tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r492958 - in /incubator/tuscany/java/sca/services/bindings/binding.jms/src: main/java/org/apache/tuscany/binding/jms/ test/java/org/apache/tuscany/binding/jms/ test/resources/META-INF/sca/
Date Fri, 05 Jan 2007 10:11:25 GMT
Author: antelder
Date: Fri Jan  5 02:11:23 2007
New Revision: 492958

URL: http://svn.apache.org/viewvc?view=rev&rev=492958
Log:
Switch over to latest spec draft scdl format

Added:
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java
      - copied, changed from r492102, incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961.java
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java
      - copied, changed from r492102, incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961TestCase.java
Removed:
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961.java
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961TestCase.java
Modified:
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
    incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/resources/META-INF/sca/default.scdl

Modified: incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java?view=diff&rev=492958&r1=492957&r2=492958
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
(original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingBuilder.java
Fri Jan  5 02:11:23 2007
@@ -84,7 +84,6 @@
                                      DeploymentContext deploymentContext) {
 
         String name = referenceDefinition.getName();
-        Class<?> interfaze = referenceDefinition.getServiceContract().getInterfaceClass();
         ServiceContract serviceContract;
         try {
             serviceContract = (ServiceContract) referenceDefinition.getServiceContract().clone();

Copied: incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java
(from r492102, incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java?view=diff&rev=492958&p1=incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961.java&r1=492102&p2=incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java&r2=492958
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961.java
(original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jms/src/main/java/org/apache/tuscany/binding/jms/JMSBindingLoader.java
Fri Jan  5 02:11:23 2007
@@ -18,6 +18,7 @@
 
 import static javax.xml.stream.XMLStreamConstants.END_ELEMENT;
 import static javax.xml.stream.XMLStreamConstants.START_ELEMENT;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
 
 import java.util.Arrays;
 import java.util.List;
@@ -39,15 +40,15 @@
  * Loader for handling <binding.jms> elements based on the 0.96 draft 1 spec.
  */
 @Scope("COMPOSITE")
-public class JMSBindingLoader0961 extends LoaderExtension<JMSBindingDefinition> {
+public class JMSBindingLoader extends LoaderExtension<JMSBindingDefinition> {
 
     public static final QName BINDING_JMS =
-        new QName("http://tuscany.apache.org/xmlns/binding/jms/1.0-SNAPSHOT", "binding.jms");
+        new QName(XML_NAMESPACE_1_0, "binding.jms");
 
     public static final List<String> VALID_CORRELATION_SCHEMES =
         Arrays.asList(new String[] {"requestmsgidtocorrelid", "requestcorrelidtocorrelid",
"none"});
 
-    public JMSBindingLoader0961(@Autowire LoaderRegistry registry) {
+    public JMSBindingLoader(@Autowire LoaderRegistry registry) {
         super(registry);
     }
 
@@ -86,22 +87,16 @@
             jmsBinding.setJNDIProviderURL(jndiProviderURL);
         }
 
-        String connectionFactory = reader.getAttributeValue(null, "connectionFactory");
-        if (connectionFactory != null && connectionFactory.length() > 0) {
-            jmsBinding.setConnectionFactoryName(connectionFactory);
-        }
-
-        String activationSpec = reader.getAttributeValue(null, "activationSpec");
-        if (activationSpec != null && activationSpec.length() > 0) {
-            jmsBinding.setActivationSpecName(activationSpec);
-        }
-
         while (true) {
             switch (reader.next()) {
                 case START_ELEMENT:
                     String elementName = reader.getName().getLocalPart();
                     if ("destination".equals(elementName)) {
                         parseDestination(reader, jmsBinding);
+                    } else if ("connectionFactory".equals(elementName)) {
+                        parseConnectionFactory(reader, jmsBinding);
+                    } else if ("activationSpec".equals(elementName)) {
+                        parseActivationSpec(reader, jmsBinding);
                     } else if ("response".equals(elementName)) {
                         parseResponse(reader, jmsBinding);
                     } else if ("headers".equals(elementName)) {
@@ -123,6 +118,24 @@
                     }
                     throw new RuntimeException("Incomplete binding.jms definition");
             }
+        }
+    }
+
+    protected void parseActivationSpec(XMLStreamReader reader, JMSBindingDefinition jmsBinding)
{
+        String name = reader.getAttributeValue(null, "name");
+        if (name != null && name.length() > 0) {
+            jmsBinding.setActivationSpecName(name);
+        } else {
+            throw new RuntimeException("missing ActivationSpec name");
+        }
+    }
+
+    protected void parseConnectionFactory(XMLStreamReader reader, JMSBindingDefinition jmsBinding)
{
+        String name = reader.getAttributeValue(null, "name");
+        if (name != null && name.length() > 0) {
+            jmsBinding.setConnectionFactoryName(name);
+        } else {
+            throw new RuntimeException("missing connectionFactory name");
         }
     }
 

Copied: incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java
(from r492102, incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961TestCase.java)
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java?view=diff&rev=492958&p1=incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961TestCase.java&r1=492102&p2=incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java&r2=492958
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoader0961TestCase.java
(original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/java/org/apache/tuscany/binding/jms/JMSBindingLoaderTestCase.java
Fri Jan  5 02:11:23 2007
@@ -9,10 +9,11 @@
 import junit.framework.TestCase;
 
 import org.apache.tuscany.spi.loader.LoaderException;
+import static org.osoa.sca.Version.XML_NAMESPACE_1_0;
 
-public class JMSBindingLoader0961TestCase extends TestCase {
+public class JMSBindingLoaderTestCase extends TestCase {
 
-    private JMSBindingLoader0961 loader;
+    private JMSBindingLoader loader;
 
     public void testMinimal() throws LoaderException, XMLStreamException {
         String xml = "<binding.jms></binding.jms>";
@@ -63,13 +64,13 @@
     }
 
     public void testConnectionFactory() throws LoaderException, XMLStreamException {
-        XMLStreamReader reader = createReader("<binding.jms connectionFactory=\"myfactory\"></binding.jms>");
+        XMLStreamReader reader = createReader("<binding.jms> <connectionFactory
name=\"myfactory\"/> </binding.jms>");
         JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
         assertEquals("myfactory", jmsBinding.getConnectionFactoryName());
     }
 
     public void testActivationSpec() throws LoaderException, XMLStreamException {
-        XMLStreamReader reader = createReader("<binding.jms activationSpec=\"myas\"></binding.jms>");
+        XMLStreamReader reader = createReader("<binding.jms> <activationSpec name=\"myas\"/></binding.jms>");
         JMSBindingDefinition jmsBinding = loader.load(null, null, reader, null);
         assertEquals("myas", jmsBinding.getActivationSpecName());
     }
@@ -77,7 +78,7 @@
     private XMLStreamReader createReader(String xml) throws XMLStreamException {
         XMLInputFactory factory = XMLInputFactory.newInstance();
 
-        String xxx = "<xxx xmlns=\"http://tuscany.apache.org/xmlns/binding/jms/1.0-SNAPSHOT\">"
+ xml + "</xxx>";
+        String xxx = "<xxx xmlns=\"" + XML_NAMESPACE_1_0 + "\">" + xml + "</xxx>";
         XMLStreamReader reader = factory.createXMLStreamReader(new StringReader(xxx));
         reader.nextTag();
         reader.nextTag();
@@ -85,6 +86,6 @@
     }
 
     protected void setUp() throws Exception {
-        this.loader = new JMSBindingLoader0961(null);
+        this.loader = new JMSBindingLoader(null);
     }
 }

Modified: incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/resources/META-INF/sca/default.scdl
URL: http://svn.apache.org/viewvc/incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/resources/META-INF/sca/default.scdl?view=diff&rev=492958&r1=492957&r2=492958
==============================================================================
--- incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/resources/META-INF/sca/default.scdl
(original)
+++ incubator/tuscany/java/sca/services/bindings/binding.jms/src/test/resources/META-INF/sca/default.scdl
Fri Jan  5 02:11:23 2007
@@ -19,11 +19,9 @@
 
     <service name="GreetingJMSService">
         <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
-        <binding.jms xmlns="http://tuscany.apache.org/xmlns/binding/jms/1.0-SNAPSHOT"
>
-        	<connection.jms destinationName="greetingServiceQueue"
-        	                connectionFactoryName="ConnectionFactory"
-        	                initialContextFactoryName="org.activemq.jndi.ActiveMQInitialContextFactory"
-        	                providerURL="tcp://localhost:61616" />   
+        <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory"
JNDIProviderURL="tcp://localhost:61616" >
+           <destination name="greetingServiceQueue" />
+           <connectionFactory name="ConnectionFactory" />
         </binding.jms>
         <reference>GretingServiceComponent</reference>
     </service>
@@ -39,22 +37,18 @@
     
     <reference name="GreetingJMSReference">
         <interface.java class="org.apache.tuscany.binding.jms.GreetingService"/>
-        <binding.jms xmlns="http://tuscany.apache.org/xmlns/binding/jms/1.0-SNAPSHOT"
>
-        	<connection.jms destinationName="dynamicQueues/greetingServiceQueue"
-        	                connectionFactoryName="ConnectionFactory"
-        	                initialContextFactoryName="org.activemq.jndi.ActiveMQInitialContextFactory"
-        	                providerURL="tcp://localhost:61616" />        	             
   
+        <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory"
JNDIProviderURL="tcp://localhost:61616" >
+           <destination name="dynamicQueues/greetingServiceQueue" />
+           <connectionFactory name="ConnectionFactory" />
         </binding.jms>
     </reference>
     
     <service name="HelloworldJMSService">
         <interface.wsdl interface="http://helloworld#wsdl.interface(HelloWorld)" 
             wsdli:wsdlLocation="http://helloworld wsdl/helloworld.wsdl" />
-        <binding.jms xmlns="http://tuscany.apache.org/xmlns/binding/jms/1.0-SNAPSHOT"
>
-        	<connection.jms destinationName="HelloworldServiceQueue"
-        	                connectionFactoryName="ConnectionFactory"
-        	                initialContextFactoryName="org.activemq.jndi.ActiveMQInitialContextFactory"
-        	                providerURL="tcp://localhost:61616" />   
+        <binding.jms initialContextFactory="org.activemq.jndi.ActiveMQInitialContextFactory"
JNDIProviderURL="tcp://localhost:61616" >
+           <destination name="HelloworldServiceQueue" />
+           <connectionFactory name="ConnectionFactory" />
         </binding.jms>
         <reference>HelloworldComponent</reference>
     </service>



---------------------------------------------------------------------
To unsubscribe, e-mail: tuscany-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: tuscany-commits-help@ws.apache.org


Mime
View raw message