tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From antel...@apache.org
Subject svn commit: r1124724 - in /tuscany/sca-java-2.x/trunk/modules: core-spi/src/main/java/org/apache/tuscany/sca/runtime/ domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/ domain-node/src/main/java/org/apache/tuscany/sca/impl/ domai...
Date Thu, 19 May 2011 12:59:51 GMT
Author: antelder
Date: Thu May 19 12:59:50 2011
New Revision: 1124724

URL: http://svn.apache.org/viewvc?rev=1124724&view=rev
Log:
Move the code for getDomainComposite from NodeImpl to the domain registry

Modified:
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
    tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java?rev=1124724&r1=1124723&r2=1124724&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/BaseDomainRegistry.java
Thu May 19 12:59:50 2011
@@ -26,9 +26,15 @@ import java.util.Map;
 import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.logging.Logger;
 
+import javax.xml.namespace.QName;
+
+import org.apache.tuscany.sca.assembly.AssemblyFactory;
+import org.apache.tuscany.sca.assembly.Base;
+import org.apache.tuscany.sca.assembly.Composite;
 import org.apache.tuscany.sca.assembly.Endpoint;
 import org.apache.tuscany.sca.assembly.EndpointReference;
 import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.core.LifeCycleListener;
 
 /**
@@ -164,4 +170,21 @@ public abstract class BaseDomainRegistry
     public void removeContributionListener(ContributionListener listener) {
         contributionlisteners.remove(listener);
     }
+
+    public Composite getDomainComposite() {
+        FactoryExtensionPoint factories = registry.getExtensionPoint(FactoryExtensionPoint.class);
+        AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
+        Composite domainComposite = assemblyFactory.createComposite();
+        domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, getDomainURI()));
+        domainComposite.setAutowire(false);
+        domainComposite.setLocal(false);
+        List<Composite> domainIncludes = domainComposite.getIncludes();
+        Map<String, List<String>> runningCompositeURIs = getRunningCompositeURIs();
+        for (String curi : runningCompositeURIs.keySet()) {
+            for (String compositeURI : runningCompositeURIs.get(curi)) {
+                domainIncludes.add(getRunningComposite(curi, compositeURI));
+            }
+        }
+        return domainComposite;
+    }
 }

Modified: tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java?rev=1124724&r1=1124723&r2=1124724&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/core-spi/src/main/java/org/apache/tuscany/sca/runtime/DomainRegistry.java
Thu May 19 12:59:50 2011
@@ -99,4 +99,5 @@ public interface DomainRegistry {
     String getRunningMember(String contributionURI, String compositeURI);
     
     String remoteCommand(String memberName, Callable<String> command);
+    public Composite getDomainComposite();
 }

Modified: tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java?rev=1124724&r1=1124723&r2=1124724&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-hazelcast/src/main/java/org/apache/tuscany/sca/registry/hazelcast/HazelcastDomainRegistry.java
Thu May 19 12:59:50 2011
@@ -594,6 +594,7 @@ public class HazelcastDomainRegistry ext
         Map<String, String> cs = runningComposites.get(contributionURI);
         if (cs != null) {
             String compositeXML = cs.get(compositeURI);
+            // TODO: cache the Composite locally so that it doesn't get deserialized multiple
times
             return readComposite(compositeXML);
         }
         return null;

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java?rev=1124724&r1=1124723&r2=1124724&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/impl/NodeImpl.java
Thu May 19 12:59:50 2011
@@ -265,20 +265,7 @@ public class NodeImpl implements Node {
     }
 
     public Composite getDomainComposite() {
-        FactoryExtensionPoint factories = extensionPointRegistry.getExtensionPoint(FactoryExtensionPoint.class);
-        AssemblyFactory assemblyFactory = factories.getFactory(AssemblyFactory.class);
-        Composite domainComposite = assemblyFactory.createComposite();
-        domainComposite.setName(new QName(Base.SCA11_TUSCANY_NS, domainName));
-        domainComposite.setAutowire(false);
-        domainComposite.setLocal(false);
-        List<Composite> domainIncludes = domainComposite.getIncludes();
-        Map<String, List<String>> runningCompositeURIs = domainRegistry.getRunningCompositeURIs();
-        for (String curi : runningCompositeURIs.keySet()) {
-            for (String compositeURI : runningCompositeURIs.get(curi)) {
-                domainIncludes.add(domainRegistry.getRunningComposite(curi, compositeURI));
-            }
-        }
-        return domainComposite;
+        return domainRegistry.getDomainComposite();
     }
 
     public <T> T getService(Class<T> interfaze, String serviceURI) throws NoSuchServiceException
{
@@ -374,10 +361,13 @@ public class NodeImpl implements Node {
         return dcURIs;
     }
 
-    // TODO: this is used by the shell to endpoint detail, should it be on the Node interface?
+    // TODO: these are used by the shell, should they be on the Node interface?
     public DomainRegistry getEndpointRegistry() {
         return domainRegistry;
     }
+    public ExtensionPointRegistry getExtensionPointRegistry() {
+        return extensionPointRegistry;
+    }
     
     public void stop() {
         for (DeployedComposite dc : startedComposites.values()) {

Modified: tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
URL: http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java?rev=1124724&r1=1124723&r2=1124724&view=diff
==============================================================================
--- tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
(original)
+++ tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/runtime/DomainCompositeTestCase.java
Thu May 19 12:59:50 2011
@@ -23,7 +23,9 @@ import junit.framework.Assert;
 import org.apache.tuscany.sca.Node;
 import org.apache.tuscany.sca.TuscanyRuntime;
 import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Utils;
 import org.apache.tuscany.sca.contribution.processor.ContributionReadException;
+import org.apache.tuscany.sca.impl.NodeImpl;
 import org.apache.tuscany.sca.monitor.ValidationException;
 import org.junit.Test;
 import org.oasisopen.sca.NoSuchDomainException;
@@ -57,7 +59,7 @@ public class DomainCompositeTestCase {
         Assert.assertEquals("helloworld", c.getName().getLocalPart());
         
 //        String s = node.getDomainLevelCompositeAsString();
-//        System.out.println(s);
+        System.out.println(Utils.modelToXML(node.getDomainComposite(), true, ((NodeImpl)node).getExtensionPointRegistry()));
 //        Assert.assertTrue(s.contains(":helloworld\""));
 
         node.stopComposite("helloworld", "helloworld.composite");



Mime
View raw message