Author: slaws
Date: Fri May  8 12:27:46 2009
New Revision: 772957

URL: http://svn.apache.org/viewvc?rev=772957&view=rev
Log:
TUSCANY-2900 - Add code to generate JMS binding and service/port to generated 
wsdl. Add itest to explore the different ways of configuring generated WSDL. 

Added:
    tuscany/branches/sca-java-1.x/itest/wsdlgen/   (with props)
    tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml   (with props)
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java 
  (with props)
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
   (with props)
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
   (with props)
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
   (with props)
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml  
 (with props)
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
   (with props)
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
   (with props)
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/
    tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/
    
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
   (with props)
Modified:
    tuscany/branches/sca-java-1.x/itest/pom.xml
    
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
    
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
    
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java

Modified: tuscany/branches/sca-java-1.x/itest/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/pom.xml?rev=772957&r1=772956&r2=772957&view=diff
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/pom.xml (original)
+++ tuscany/branches/sca-java-1.x/itest/pom.xml Fri May  8 12:27:46 2009
@@ -134,6 +134,7 @@
                 <module>validation</module>
                 <module>wires</module>
                 <module>wsdl</module>
+                <module>wsdlgen</module>
                 <module>wsdlless</module>
                 <module>wsdl2java</module>
                 <module>wsdl-multiple</module>

Propchange: tuscany/branches/sca-java-1.x/itest/wsdlgen/
------------------------------------------------------------------------------
--- svn:ignore (added)
+++ svn:ignore Fri May  8 12:27:46 2009
@@ -0,0 +1,4 @@
+.classpath
+.project
+.settings
+target

Added: tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml?rev=772957&view=auto
==============================================================================
--- tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml (added)
+++ tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml Fri May  8 12:27:46 2009
@@ -0,0 +1,92 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>1.6-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+    <artifactId>itest-wsdlgen</artifactId>
+    <name>Apache Tuscany SCA iTest runtime WSDL generation</name>
+
+    <repositories>
+       <repository>
+          <id>apache.incubator</id>
+          <url>http://people.apache.org/repo/m2-incubating-repository</url>
+       </repository>
+    </repositories>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-jetty</artifactId>
+            <version>1.6-SNAPSHOT</version>
+            <scope>compile</scope>            
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-host-embedded</artifactId>
+            <version>1.6-SNAPSHOT</version>
+            <scope>compile</scope>            
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.activemq</groupId>
+            <artifactId>activemq-core</artifactId>
+            <version>5.2.0</version>
+            <scope>compile</scope>            
+        </dependency>
+        <dependency>
+            <groupId>backport-util-concurrent</groupId>
+            <artifactId>backport-util-concurrent</artifactId>
+            <version>3.1</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-implementation-java-runtime</artifactId>
+            <version>1.6-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-binding-ws-axis2</artifactId>
+            <version>1.6-SNAPSHOT</version>
+            <scope>runtime</scope>
+        </dependency>    
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.5</version>
+            <scope>test</scope>
+        </dependency>
+       
+    </dependencies>
+    
+    <build>
+       <finalName>${artifactId}</finalName>
+    </build>
+
+</project>

Propchange: tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: tuscany/branches/sca-java-1.x/itest/wsdlgen/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java 
(added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java 
Fri May  8 12:27:46 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package helloworld;
+
+public class ABean {
+    
+    protected String field1;
+    protected String field2;
+
+    public String getField1() {
+        return field1;
+    }
+    
+    public void setField1(String field1) {
+        this.field1 = field1;
+    }
+    
+    public String getField2() {
+        return field2;
+    }
+    
+    public void setField2(String field2) {
+        this.field2 = field2;
+    }
+}
+

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/ABean.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
 Fri May  8 12:27:46 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package helloworld;
+
+import java.util.Vector;
+
+import org.osoa.sca.annotations.Service;
+
+/**
+ * This class implements the HelloWorld service.
+ */
+...@service(HelloWorldService.class)
+public class HelloWorldImpl implements HelloWorldService {
+
+    public String getGreetings(String name) {
+        return "Hello " + name;
+    }
+    
+    public String getGreetingsBean(ABean bean){
+        return "Hello " + bean.getField1() + " " + bean.getField2();
+    }
+
+    public String getGreetingsBeanArray(ABean[] bean){
+        return "Hello " + bean[0].getField1() + " " + bean[0].getField2();
+    }
+   
+    /*
+    public String getGreetingsBeanVector(Vector<ABean> bean){
+        return "Hello " + bean.get(0).getField1() + " " + 
bean.get(0).getField2();
+    }
+    */
+}

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
 Fri May  8 12:27:46 2009
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
+package helloworld;
+
+import java.util.Vector;
+
+import org.osoa.sca.annotations.Remotable;
+
+/**
+ * This is the business interface of the HelloWorld greetings service.
+ */
+...@remotable
+public interface HelloWorldService {
+
+    public String getGreetings(String name);
+    public String getGreetingsBean(ABean bean);
+    public String getGreetingsBeanArray(ABean[] bean);
+    //public String getGreetingsBeanVector(Vector<ABean> bean);
+}
+

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/HelloWorldService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
 Fri May  8 12:27:46 2009
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+ */
[email protected](namespace="http://test";)
+package helloworld;

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/java/helloworld/package-info.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml 
(added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml 
Fri May  8 12:27:46 2009
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="ASCII"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<sca:definitions xmlns="http://www.osoa.org/xmlns/sca/1.0";
+                       targetNamespace="http://www.osoa.org/xmlns/sca/1.0";
+                       xmlns:sca="http://www.osoa.org/xmlns/sca/1.0";
+                       xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.0";>
+
+ <sca:intent name="transport"  
+                        constrains="sca:binding.ws">
+                        <sca:description>
+                        The general intent that a transport is available over 
which SOAP messages flow 
+                        </sca:description>
+ </sca:intent>
+
+ <sca:intent name="transport.jms">
+                        <sca:description>
+                        A JMS transport is required
+                        </sca:description>
+ </sca:intent>
+ 
+ <sca:intent name="transport.http">
+             <sca:description>
+             An HTTP transport is required
+             </sca:description>
+ </sca:intent>
+ 
+ <!-- 
+   how does the following relate to confidentiality intents 
+   does confidentiality become a profile intent?
+ -->
+ <sca:intent name="transport.https">
+             <sca:description>
+             An HTTPS transport is required
+             </sca:description>
+ </sca:intent>
+
+ <sca:policySet name="wsJMSTransportPolicy"
+       provides="transport.jms"
+       appliesTo="sca:binding.ws">
+       <tuscany:wsConfigParam>
+        <parameter name="TuscanyQueueConnectionFactory">
+            <parameter 
name="java.naming.factory.initial">org.apache.activemq.jndi.ActiveMQInitialContextFactory</parameter>
+            <parameter 
name="java.naming.provider.url">tcp://localhost:61982</parameter>
+            <parameter 
name="transport.jms.ConnectionFactoryJNDIName">QueueConnectionFactory</parameter>
+        </parameter>
+       </tuscany:wsConfigParam>
+ </sca:policySet>
+ 
+ </sca:definitions>
\ No newline at end of file

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/definitions.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
 Fri May  8 12:27:46 2009
@@ -0,0 +1,71 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    * Licensed to the Apache Software Foundation (ASF) under one
+    * or more contributor license agreements.  See the NOTICE file
+    * distributed with this work for additional information
+    * regarding copyright ownership.  The ASF licenses this file
+    * to you under the Apache License, Version 2.0 (the
+    * "License"); you may not use this file except in compliance
+    * with the License.  You may obtain a copy of the License at
+    * 
+    *   http://www.apache.org/licenses/LICENSE-2.0
+    * 
+    * Unless required by applicable law or agreed to in writing,
+    * software distributed under the License is distributed on an
+    * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    * KIND, either express or implied.  See the License for the
+    * specific language governing permissions and limitations
+    * under the License.    
+-->
+<composite xmlns="http://www.osoa.org/xmlns/sca/1.0";
+        xmlns:sca="http://www.osoa.org/xmlns/sca/1.0";
+       targetNamespace="http://helloworld";
+       xmlns:hw="http://helloworld";
+    name="helloworldws">
+
+    <component name="HelloWorldServiceComponent1">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+           <service name="HelloWorldService">
+            <binding.ws 
uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:51293"/>
+        </service>
+    </component>
+    
+    <component name="HelloWorldServiceComponent2">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+        <service name="HelloWorldService">
+            <interface.wsdl 
interface="http://helloworld/#wsdl.interface(HelloWorldService)" />
+            <binding.ws 
uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:51293"/>
+        </service>
+    </component>
+    
+    <component name="HelloWorldServiceComponent3">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+        <service name="HelloWorldService">
+            <binding.ws 
uri="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:51293"
+                        
wsdlElement="http://helloworld/#wsdl.binding(HelloWorldJmsBinding)"/>
+        </service>
+    </component>
+   
+    <component name="HelloWorldServiceComponent4">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+        <service name="HelloWorldService">            
+            <binding.ws 
wsdlElement="http://helloworld/#wsdl.port(HelloWorldService/HelloWorldJmsPort)"/>
+        </service>
+    </component>
+    
+    <component name="HelloWorldServiceComponent5">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+        <service name="HelloWorldService">            
+            <binding.ws 
wsdlElement="http://helloworld/#wsdl.service(HelloWorldService)"/>
+        </service>
+    </component>  
+    
+    
+    <component name="HelloWorldServiceComponent10">
+        <implementation.java class="helloworld.HelloWorldImpl" />
+        <service name="HelloWorldService">
+            <binding.ws/>
+        </service>
+    </component>    
+
+</composite>

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/helloworld.composite
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
 Fri May  8 12:27:46 2009
@@ -0,0 +1,105 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ * 
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.    
+-->
+<wsdl:definitions targetNamespace="http://helloworld/"; 
+                  xmlns:tns="http://helloworld/"; 
+                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"; 
+                  xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/"; 
+                  xmlns:xsd="http://www.w3.org/2001/XMLSchema";
+                     name="helloworld">
+
+    <wsdl:types>
+        <schema elementFormDefault="qualified" 
targetNamespace="http://helloworld/"; xmlns="http://www.w3.org/2001/XMLSchema";>
+
+            <element name="getGreetings">
+                <complexType>
+                    <sequence>
+                        <element name="name" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+
+            <element name="getGreetingsResponse">
+                <complexType>
+                    <sequence>
+                        <element name="getGreetingsReturn" type="xsd:string"/>
+                    </sequence>
+                </complexType>
+            </element>
+            
+        </schema>
+    </wsdl:types>
+
+    <wsdl:message name="getGreetingsRequest">
+        <wsdl:part element="tns:getGreetings" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:message name="getGreetingsResponse">
+        <wsdl:part element="tns:getGreetingsResponse" name="parameters"/>
+    </wsdl:message>
+
+    <wsdl:portType name="HelloWorldService">
+        <wsdl:operation name="getGreetings">
+            <wsdl:input message="tns:getGreetingsRequest" 
name="getGreetingsRequest"/>
+            <wsdl:output message="tns:getGreetingsResponse" 
name="getGreetingsResponse"/>
+        </wsdl:operation>
+    </wsdl:portType>
+
+    <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorldService">
+        <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/http"/>
+        <wsdl:operation name="getGreetings">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getGreetingsResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:binding name="HelloWorldJmsBinding" type="tns:HelloWorldService">
+        <wsdlsoap:binding style="document" 
transport="http://schemas.xmlsoap.org/soap/jms"/>
+        <wsdl:operation name="getGreetings">
+            <wsdlsoap:operation soapAction=""/>
+            <wsdl:input name="getGreetingsRequest">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:input>
+            <wsdl:output name="getGreetingsResponse">
+                <wsdlsoap:body use="literal"/>
+            </wsdl:output>
+        </wsdl:operation>
+    </wsdl:binding>
+
+    <wsdl:service name="HelloWorldService">
+        <wsdl:port binding="tns:HelloWorldSoapBinding" 
name="HelloWorldSoapPort">
+            <wsdlsoap:address 
location="http://localhost:8085/HelloWorldServiceComponent"/>
+        </wsdl:port>
+        
+        <wsdl:port binding="tns:HelloWorldJmsBinding" name="HelloWorldJmsPort">
+            <wsdlsoap:address 
location="jms:/queue.sample?transport.jms.ConnectionFactoryJNDIName=QueueConnectionFactory&amp;java.naming.factory.initial=org.apache.activemq.jndi.ActiveMQInitialContextFactory&amp;java.naming.provider.url=tcp://localhost:51293"/>
+            <!-- jms:address destinationStyle="queue"   
+                         initialContextFactory="com.ibm.NamingFactory"?
+                         jndiProviderURL="iiop://something:900/wherever"?
+                         jndiConnectionFactoryName="orange"
+                         jndiDestinationName="fred"/-->
+        </wsdl:port>        
+    </wsdl:service>
+
+</wsdl:definitions>

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/main/resources/wsdl/helloworld.wsdl
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java?rev=772957&view=auto
==============================================================================
--- 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
 (added)
+++ 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
 Fri May  8 12:27:46 2009
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package helloworld;
+
+import static junit.framework.Assert.assertEquals;
+import static junit.framework.Assert.assertNotNull;
+
+import java.io.IOException;
+
+import org.apache.activemq.broker.BrokerService;
+import org.apache.tuscany.sca.host.embedded.SCADomain;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ * Tests that the helloworld server is available
+ */
+public class JmsTransportTestCase{
+
+    private SCADomain scaDomain;
+    private BrokerService jmsBroker;
+
+    @Before
+       public void startServer() throws Exception {
+            startBroker();
+            scaDomain = SCADomain.newInstance("helloworld.composite");
+       }
+
+    protected void startBroker() throws Exception {
+        jmsBroker = new BrokerService(); 
+        jmsBroker.setPersistent(false);
+        jmsBroker.setUseJmx(false);
+        jmsBroker.addConnector("tcp://localhost:51293");
+        jmsBroker.start();
+    }
+    
+    //@Ignore
+    @Test
+    public void testComponent1() throws IOException {
+        HelloWorldService helloWorldService = 
scaDomain.getService(HelloWorldService.class, 
"HelloWorldServiceComponent1/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }
+    
+    @Ignore
+    @Test
+    public void testComponent2() throws IOException {
+        HelloWorldService helloWorldService = 
scaDomain.getService(HelloWorldService.class, 
"HelloWorldServiceComponent2/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }  
+    
+    @Ignore
+    @Test
+    public void testComponent3() throws IOException {
+        HelloWorldService helloWorldService = 
scaDomain.getService(HelloWorldService.class, 
"HelloWorldServiceComponent3/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }    
+    
+    @Ignore
+    @Test
+    public void testComponent4() throws IOException {
+        HelloWorldService helloWorldService = 
scaDomain.getService(HelloWorldService.class, 
"HelloWorldServiceComponent4/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }    
+    
+    @Ignore
+    @Test
+    public void testComponent5() throws IOException {
+        HelloWorldService helloWorldService = 
scaDomain.getService(HelloWorldService.class, 
"HelloWorldServiceComponent5/HelloWorldService");
+        assertNotNull(helloWorldService);
+        
+        assertEquals("Hello Smith", helloWorldService.getGreetings("Smith"));
+    }
+       
+    @Ignore
+    @Test
+    public void testWaitForInput() {
+        System.out.println("Press a key to end");
+        try {
+            System.in.read();
+        } catch (Exception ex) {
+        }
+        System.out.println("Shutting down");
+    }      
+
+       @After
+       public void stopServer() throws Exception {
+            if (scaDomain != null) {
+                scaDomain.close();
+            }
+            if (jmsBroker != null) {
+                jmsBroker.stop();
+            }
+       }
+
+}

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: 
tuscany/branches/sca-java-1.x/itest/wsdlgen/src/test/java/helloworld/JmsTransportTestCase.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java?rev=772957&r1=772956&r2=772957&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/Interface2WSDLGenerator.java
 Fri May  8 12:27:46 2009
@@ -109,7 +109,7 @@
         super();
         this.requiresSOAP12 = requiresSOAP12; 
         this.resolver = resolver; 
-        definitionGenerator = new WSDLDefinitionGenerator(requiresSOAP12);
+        definitionGenerator = new WSDLDefinitionGenerator(requiresSOAP12, 
false);
         this.dataBindings = dataBindings;
         this.xsdFactory = xsdFactory;
         this.monitor = monitor;

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java?rev=772957&r1=772956&r2=772957&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLDefinitionGenerator.java
 Fri May  8 12:27:46 2009
@@ -76,15 +76,17 @@
     private static final String PORT_SUFFIX = "Port";
 
     private boolean requiresSOAP12;
+    private boolean requiresJMS;
     private QName soapAddress;
     private QName soapBinding;
     private QName soapBody;
     private QName soapFault;
     private QName soapOperation;
 
-    public WSDLDefinitionGenerator(boolean requiresSOAP12) {
+    public WSDLDefinitionGenerator(boolean requiresSOAP12, boolean 
requiresJMS) {
         super();
         this.requiresSOAP12 = requiresSOAP12;
+        this.requiresJMS = requiresJMS;
         soapAddress = requiresSOAP12 ? SOAP12_ADDRESS : SOAP_ADDRESS;
         soapBinding = requiresSOAP12 ? SOAP12_BINDING : SOAP_BINDING;
         soapBody = requiresSOAP12 ? SOAP12_BODY : SOAP_BODY;
@@ -114,10 +116,18 @@
                 
definition.getExtensionRegistry().createExtension(Binding.class, soapBinding);
             if (requiresSOAP12) {
                 ((SOAP12Binding)bindingExtension).setStyle("document");
-                
((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http";);
+                if (requiresJMS){
+                    
((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms";);
+                } else {
+                    
((SOAP12Binding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http";);
+                }
             } else {
                 ((SOAPBinding)bindingExtension).setStyle("document");
-                
((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http";);
+                if (requiresJMS){
+                    
((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/jms";);
+                } else {
+                    
((SOAPBinding)bindingExtension).setTransportURI("http://schemas.xmlsoap.org/soap/http";);
+                }
             }
             binding.addExtensibilityElement(bindingExtension);
             return binding;
@@ -126,6 +136,7 @@
         }
     }
 
+
     protected void configureBinding(Definition definition, Binding binding, 
PortType portType) throws WSDLException {
         QName portTypeName = portType.getQName();
         if (portTypeName != null) {

Modified: 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
URL: 
http://svn.apache.org/viewvc/tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java?rev=772957&r1=772956&r2=772957&view=diff
==============================================================================
--- 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
 (original)
+++ 
tuscany/branches/sca-java-1.x/modules/binding-ws-wsdlgen/src/main/java/org/apache/tuscany/sca/binding/ws/wsdlgen/WSDLServiceGenerator.java
 Fri May  8 12:27:46 2009
@@ -147,7 +147,10 @@
             return null;
         }
         Definition def = wsdlDefinition.getDefinition();
-        if (wsdlDefinition.getBinding() == null) {
+        
+        boolean wsdlProvidedByUser = (wsdlDefinition.getBinding() == null);
+        
+        if (wsdlProvidedByUser) {
             // The WSDL document was provided by the user.  Generate a new
             // WSDL document with imports from the user-provided document.
             WSDLFactory factory = null;
@@ -253,7 +256,7 @@
 
         // add a service and ports to the generated definition  
         WSDLDefinitionGenerator helper =
-                new 
WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding));
+                new 
WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),false);
         WSDLInterface wi = 
(WSDLInterface)wsBinding.getBindingInterfaceContract().getInterface();
         PortType portType = wi.getPortType();
         Service service = helper.createService(def, portType);
@@ -298,6 +301,32 @@
             }
             wsBinding.setService(service);
         }
+        
+        // TUSCANY-2900 - add jms binding and service port if required
+        // TODO - remove service/ports from any imported WSDL
+        //      - find away to allow users to retrieve WSDL with JMS bindings
+        //        as a jms binding on it's own provides not target for ?wsdl
+        if ((!wsdlProvidedByUser) && 
+            (wsBinding.getURI() != null) &&
+            (wsBinding.getURI().startsWith("jms"))){
+            
+            // need to work out how to check if user has already specified a 
binding
+            
+            // create jms binding
+            helper = new 
WSDLDefinitionGenerator(BindingWSDLGenerator.requiresSOAP12(wsBinding),true);
+            Binding binding = helper.createBinding(def, portType);
+            helper.createBindingOperations(def, binding, portType);
+            binding.setUndefined(false);
+            def.addBinding(binding);
+            
+            // create a jms port
+            String endpointURI = computeActualURI(wsBinding, null);
+            Port port = helper.createPort(def, binding, service, endpointURI);
+            wsBinding.setService(service);
+            wsBinding.setPort(port);
+            
+            //printWSDL = true;
+        }
 
         // for debugging
         if (printWSDL) {


Reply via email to