tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rf...@apache.org
Subject svn commit: r1209634 - in /tuscany/sca-java-2.x/trunk/modules: assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/ binding-ws-runtime-jaxws/META-INF/ common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/ common-java/src/t...
Date Fri, 02 Dec 2011 18:55:39 GMT
Author: rfeng
Date: Fri Dec  2 18:55:36 2011
New Revision: 1209634

URL: http://svn.apache.org/viewvc?rev=1209634&view=rev
Log:
Add ablity to specify endpoint descriptions in node.xml for local domain registry

Modified:
    tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
    tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelper.java
    tuscany/sca-java-2.x/trunk/modules/common-java/src/test/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelperTestCase.java
    tuscany/sca-java-2.x/trunk/modules/contribution/META-INF/MANIFEST.MF
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
    tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
    tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
    tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
    tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
    tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml

Modified: tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/assembly-xml/src/main/java/org/apache/tuscany/sca/assembly/xml/EndpointProcessor.java
Fri Dec  2 18:55:36 2011
@@ -19,9 +19,6 @@
 
 package org.apache.tuscany.sca.assembly.xml;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLStreamConstants;
 import javax.xml.stream.XMLStreamException;
@@ -82,12 +79,16 @@ public class EndpointProcessor extends B
         if (reader.getEventType() == XMLStreamConstants.START_DOCUMENT) {
             reader.nextTag();
         }
+        if (reader.getEventType() == XMLStreamConstants.START_ELEMENT && ENDPOINT_QNAME.equals(reader.getName()))
{
+            // Skip the "endpoint" element wrapper
+            reader.nextTag();
+        }
         Object model = extensionProcessor.read(reader, context);
         if (model instanceof Composite) {
             Composite composite = (Composite)model;
             Component component = composite.getComponents().get(0);
             ComponentService service = component.getServices().get(0);
-            Binding binding = service.getBindings().get(0);
+            Binding binding = service.getBindings().isEmpty() ? null : service.getBindings().get(0);
             endpoint.setComponent(component);
             endpoint.setService(service);
             endpoint.setBinding(binding);

Modified: tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/binding-ws-runtime-jaxws/META-INF/MANIFEST.MF Fri Dec
 2 18:55:36 2011
@@ -29,6 +29,7 @@ Import-Package: javax.security.auth.call
  org.apache.tuscany.sca.contribution.processor;version="2.0.0",
  org.apache.tuscany.sca.core;version="2.0.0",
  org.apache.tuscany.sca.core.assembly;version="2.0.0",
+ org.apache.tuscany.sca.core.invocation;version="2.0.0",
  org.apache.tuscany.sca.databinding;version="2.0.0",
  org.apache.tuscany.sca.definitions;version="2.0.0",
  org.apache.tuscany.sca.host.http;version="2.0.0",

Modified: tuscany/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelper.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelper.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelper.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/common-java/src/main/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelper.java
Fri Dec  2 18:55:36 2011
@@ -504,16 +504,18 @@ public final class JavaIntrospectionHelp
      * Returns the set of interfaces implemented by the given class and its
      * ancestors or a blank set if none
      */
-    public Set<Class<?>> getAllInterfaces(Class<?> clazz) {
-        Set<Class<?>> implemented = new HashSet<Class<?>>();
+    public List<Class<?>> getAllInterfaces(Class<?> clazz) {
+        List<Class<?>> implemented = new ArrayList<Class<?>>();
         getAllInterfaces(clazz, implemented);
         return implemented;
     }
 
-    private static void getAllInterfaces(Class<?> clazz, Set<Class<?>>
implemented) {
+    private static void getAllInterfaces(Class<?> clazz, List<Class<?>>
implemented) {
         Class<?>[] interfaces = clazz.getInterfaces();
         for (Class<?> interfaze : interfaces) {
-            implemented.add(interfaze);
+            if (!implemented.contains(interfaze)) {
+                implemented.add(interfaze);
+            }
         }
         Class<?> superClass = clazz.getSuperclass();
         // Object has no superclass so check for null

Modified: tuscany/sca-java-2.x/trunk/modules/common-java/src/test/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelperTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/common-java/src/test/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelperTestCase.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/common-java/src/test/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelperTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/common-java/src/test/java/org/apache/tuscany/sca/common/java/reflection/JavaIntrospectionHelperTestCase.java
Fri Dec  2 18:55:36 2011
@@ -21,6 +21,7 @@ package org.apache.tuscany.sca.common.ja
 
 import java.lang.reflect.Field;
 import java.lang.reflect.Method;
+import java.util.List;
 import java.util.Set;
 
 import org.apache.tuscany.sca.core.DefaultExtensionPointRegistry;
@@ -56,7 +57,7 @@ public class JavaIntrospectionHelperTest
 
     @Test
     public void testGetAllInterfaces() {
-        Set<Class<?>> interfaces = helper.getAllInterfaces(SubTestImpl.class);
+        List<Class<?>> interfaces = helper.getAllInterfaces(SubTestImpl.class);
         System.out.println(interfaces);
     }
 

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/META-INF/MANIFEST.MF?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/META-INF/MANIFEST.MF (original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/META-INF/MANIFEST.MF Fri Dec  2 18:55:36
2011
@@ -38,6 +38,7 @@ Import-Package: javax.xml.namespace,
  org.apache.tuscany.sca.assembly.impl;version="2.0.0",
  org.apache.tuscany.sca.assembly.xsd;version="2.0.0";resolution:=optional,
  org.apache.tuscany.sca.common.java.io;version="2.0.0",
+ org.apache.tuscany.sca.common.java.reflection;version="2.0.0",
  org.apache.tuscany.sca.common.xml;version="2.0.0",
  org.apache.tuscany.sca.common.xml.stax;version="2.0.0",
  org.apache.tuscany.sca.contribution;version="2.0.0",

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultArtifactProcessorExtensionPoint.java
Fri Dec  2 18:55:36 2011
@@ -19,8 +19,12 @@
 package org.apache.tuscany.sca.contribution.processor;
 
 import java.util.HashMap;
+import java.util.List;
 import java.util.Map;
 
+import org.apache.tuscany.sca.common.java.reflection.JavaIntrospectionHelper;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+
 /**
  * The default implementation of an artifact processor extension point.
  *
@@ -30,10 +34,15 @@ abstract class DefaultArtifactProcessorE
     protected final Map<Object, P> processorsByArtifactType = new HashMap<Object,
P>();
     protected final Map<Class<?>, P> processorsByModelType = new HashMap<Class<?>,
P>();
 
+    protected ExtensionPointRegistry registry;
+    private JavaIntrospectionHelper introspectionHelper;
+
     /**
      * Constructs a new loader registry.
      */
-    DefaultArtifactProcessorExtensionPoint() {
+    DefaultArtifactProcessorExtensionPoint(ExtensionPointRegistry registry) {
+        this.registry = registry;
+        this.introspectionHelper = JavaIntrospectionHelper.getInstance(registry);
     }
 
     /**
@@ -53,14 +62,18 @@ abstract class DefaultArtifactProcessorE
      * @return The processor associated with the given model type
      */
     public <T> P getProcessor(Class<T> modelType) {
-        Class<?>[] classes = modelType.getInterfaces();
+        P processor = processorsByModelType.get(modelType);
+        if (processor != null) {
+            return processor;
+        }
+        List<Class<?>> classes = introspectionHelper.getAllInterfaces(modelType);
         for (Class<?> c : classes) {
-            P processor = processorsByModelType.get(c);
+            processor = processorsByModelType.get(c);
             if (processor != null) {
                 return processor;
             }
         }
-        return processorsByModelType.get(modelType);
+        return null;
     }
 
 }

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXArtifactProcessorExtensionPoint.java
Fri Dec  2 18:55:36 2011
@@ -47,7 +47,6 @@ import org.apache.tuscany.sca.monitor.Pr
 public class DefaultStAXArtifactProcessorExtensionPoint extends
     DefaultArtifactProcessorExtensionPoint<StAXArtifactProcessor<?>> implements
StAXArtifactProcessorExtensionPoint {
 
-    private ExtensionPointRegistry registry;
     private FactoryExtensionPoint modelFactories;
     private boolean loaded;
     private StAXArtifactProcessor<Object> extensibleStAXProcessor;
@@ -57,7 +56,7 @@ public class DefaultStAXArtifactProcesso
      * Constructs a new extension point.
      */
     public DefaultStAXArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints)
{
-        this.registry = extensionPoints;
+        super(extensionPoints);
         this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
         XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
         XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultStAXAttributeProcessorExtensionPoint.java
Fri Dec  2 18:55:36 2011
@@ -49,7 +49,6 @@ import org.apache.tuscany.sca.monitor.Pr
 public class DefaultStAXAttributeProcessorExtensionPoint extends
     DefaultArtifactProcessorExtensionPoint<StAXAttributeProcessor<?>> implements
StAXAttributeProcessorExtensionPoint {
 
-    private ExtensionPointRegistry registry;
     private FactoryExtensionPoint modelFactories;
     private StAXAttributeProcessor<Object> extensibleStAXAttributeProcessor;
     private boolean loaded;
@@ -59,7 +58,7 @@ public class DefaultStAXAttributeProcess
      * Constructs a new extension point.
      */
     public DefaultStAXAttributeProcessorExtensionPoint(ExtensionPointRegistry extensionPoints)
{
-        this.registry = extensionPoints;
+        super(extensionPoints);
         this.modelFactories = extensionPoints.getExtensionPoint(FactoryExtensionPoint.class);
         XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
         XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);

Modified: tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/contribution/src/main/java/org/apache/tuscany/sca/contribution/processor/DefaultURLArtifactProcessorExtensionPoint.java
Fri Dec  2 18:55:36 2011
@@ -45,7 +45,6 @@ import org.apache.tuscany.sca.extensibil
 public class DefaultURLArtifactProcessorExtensionPoint extends
     DefaultArtifactProcessorExtensionPoint<URLArtifactProcessor<?>> implements
URLArtifactProcessorExtensionPoint {
 
-    private ExtensionPointRegistry registry;
     private StAXArtifactProcessor<?> staxProcessor;
     private boolean loaded;
 
@@ -53,7 +52,7 @@ public class DefaultURLArtifactProcessor
      * Constructs a new extension point.
      */
     public DefaultURLArtifactProcessorExtensionPoint(ExtensionPointRegistry extensionPoints)
{
-        this.registry = extensionPoints;
+        super(extensionPoints);
         FactoryExtensionPoint modelFactories = this.registry.getExtensionPoint(FactoryExtensionPoint.class);
         XMLInputFactory inputFactory = modelFactories.getFactory(XMLInputFactory.class);
         XMLOutputFactory outputFactory = modelFactories.getFactory(XMLOutputFactory.class);

Modified: tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/implementation-spring/src/main/java/org/apache/tuscany/sca/implementation/spring/introspect/SpringXMLComponentTypeLoader.java
Fri Dec  2 18:55:36 2011
@@ -630,7 +630,7 @@ public class SpringXMLComponentTypeLoade
         }
 
         Class<?> beanClass = resolveClass(resolver, bean.getClassName(), context);
-        Set<Class<?>> ifaces = javaIntrospectionHelper.getAllInterfaces(beanClass);
+        List<Class<?>> ifaces = javaIntrospectionHelper.getAllInterfaces(beanClass);
         for (Class<?> interfaze : ifaces) {
             if (interfaze.isAnnotationPresent(Remotable.class)) {
                 return interfaze;

Modified: tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/NodeConfiguration.java
Fri Dec  2 18:55:36 2011
@@ -28,6 +28,8 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.assembly.Endpoint;
+
 /**
  * The configuration for a Node which represents the deployment of an SCA composite application
  * @tuscany.spi.extension.asclient
@@ -105,6 +107,12 @@ public interface NodeConfiguration {
     NodeConfiguration addBinding(QName bindingType, String...baseURIs);
     NodeConfiguration addBinding(QName bindingType, URI...baseURIs);
     
+    /**
+     * Get a list of endpoint descriptions for external services.
+     * @return
+     */
+    List<Endpoint> getEndpointDescriptions();
+    
     List<Object> getExtensions();
 
 

Modified: tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/node-api/src/main/java/org/apache/tuscany/sca/node/configuration/impl/NodeConfigurationImpl.java
Fri Dec  2 18:55:36 2011
@@ -30,6 +30,7 @@ import java.util.Map;
 
 import javax.xml.namespace.QName;
 
+import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.node.configuration.BindingConfiguration;
 import org.apache.tuscany.sca.node.configuration.ContributionConfiguration;
 import org.apache.tuscany.sca.node.configuration.NodeConfiguration;
@@ -44,6 +45,7 @@ public class NodeConfigurationImpl imple
     private List<ContributionConfiguration> contributions = new ArrayList<ContributionConfiguration>();
     private List<BindingConfiguration> bindings = new ArrayList<BindingConfiguration>();
     private List<Object> extensions = new ArrayList<Object>();
+    private List<Endpoint> endpoints = new ArrayList<Endpoint>();
     
     private transient Map<String, Object> attributes = new HashMap<String, Object>();
 
@@ -194,4 +196,9 @@ public class NodeConfigurationImpl imple
         return this;
     }
 
+    @Override
+    public List<Endpoint> getEndpointDescriptions() {
+        return endpoints;
+    }
+
 }

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/configuration/xml/NodeConfigurationProcessor.java
Fri Dec  2 18:55:36 2011
@@ -31,6 +31,7 @@ import javax.xml.stream.XMLStreamExcepti
 import javax.xml.stream.XMLStreamReader;
 import javax.xml.stream.XMLStreamWriter;
 
+import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.common.xml.stax.StAXHelper;
 import org.apache.tuscany.sca.contribution.processor.BaseStAXArtifactProcessor;
 import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
@@ -157,7 +158,12 @@ public class NodeConfigurationProcessor 
                         helper.save(reader, writer);
                         composite.setContent(sw.toString());
                     } else {
-                        node.getExtensions().add(processor.read(reader, context));
+                        Object ext = processor.read(reader, context);
+                        if (ext instanceof Endpoint) {
+                            node.getEndpointDescriptions().add((Endpoint)ext);
+                        } else {
+                            node.getExtensions().add(ext);
+                        }
                     }
                     break;
 
@@ -238,6 +244,11 @@ public class NodeConfigurationProcessor 
             writeEnd(writer);
         }
         
+        // FIXME: The composite processor assumes that composite is root element
+//        for (Endpoint o : node.getEndpointDescriptions()) {
+//            processor.write(o, writer, context);
+//        }
+        
         for(Object o: node.getExtensions()) {
             processor.write(o, writer, context);
         }

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl/src/main/java/org/apache/tuscany/sca/node/impl/NodeImpl.java
Fri Dec  2 18:55:36 2011
@@ -136,7 +136,12 @@ public class NodeImpl implements Node, N
             // Pass down the context attributes
             compositeContext.getAttributes().putAll(configuration.getAttributes());
             
-
+            // Add endpoint descriptions from the node configuration if the domain registry
is local
+            if (!domainRegistry.isDistributed()) {
+                for (Endpoint e : configuration.getEndpointDescriptions()) {
+                    domainRegistry.addEndpoint(e);
+                }
+            }
             // Activate the composite
             compositeActivator.activate(compositeContext, domainComposite);
 
@@ -234,6 +239,14 @@ public class NodeImpl implements Node, N
                 compositeActivator.deactivate(domainComposite);
 
             } // end if
+            
+            // Remove the external endpoint descriptions from node.xml
+            DomainRegistry domainRegistry = compositeContext.getEndpointRegistry();
+            if (!domainRegistry.isDistributed()) {
+                for (Endpoint e : configuration.getEndpointDescriptions()) {
+                    domainRegistry.removeEndpoint(e);
+                }
+            }
 
             nodeFactory.removeNode(configuration);
 /*

Modified: tuscany/sca-java-2.x/trunk/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml?rev=1209634&r1=1209633&r2=1209634&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
(original)
+++ tuscany/sca-java-2.x/trunk/modules/node-impl/src/test/resources/org/apache/tuscany/sca/node/configuration/node1.xml
Fri Dec  2 18:55:36 2011
@@ -55,4 +55,13 @@
     </contribution>
     <option name="debug" value="true"/>
     <option name="validation">true</option>
+    <endpoint>
+        <sca:composite name="endpoint">
+            <sca:component name="Component1"> <!-- first component -->
+                <sca:service name="Service1">
+                    <tuscany:binding.rest uri="http://localhost:8080/services/myResource"
/>
+                </sca:service>
+            </sca:component>
+        </sca:composite>
+    </endpoint>
 </node>
\ No newline at end of file



Mime
View raw message