tuscany-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sl...@apache.org
Subject svn commit: r1124703 - in /tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain: Composite.java Domain.java DomainImpl.java DomainView.java
Date Thu, 19 May 2011 12:10:28 GMT
Author: slaws
Date: Thu May 19 12:10:28 2011
New Revision: 1124703

URL: http://svn.apache.org/viewvc?rev=1124703&view=rev
Log:
Catch up with Ant's changes

Modified:
    tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java
    tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java
    tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java
    tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java

Modified: tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java?rev=1124703&r1=1124702&r2=1124703&view=diff
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java
(original)
+++ tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java
Thu May 19 12:10:28 2011
@@ -30,7 +30,7 @@ import org.oasisopen.sca.annotation.Remo
 @Remotable
 public interface Composite {
     
-    @GET
+//    @GET
     @Produces( {MediaType.TEXT_HTML})
     @Path("{domainname}/composite")
     public String get();

Modified: tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java?rev=1124703&r1=1124702&r2=1124703&view=diff
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java
(original)
+++ tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java
Thu May 19 12:10:28 2011
@@ -66,7 +66,7 @@ public interface Domain {
                 MediaType.TEXT_HTML})
     public String getComponents(@PathParam("domainname") String domainName);
     
-    @Path("{domainname}/endpoints")
+    @Path("{domainname}/endpoint")
     @GET
     @Produces( {MediaType.APPLICATION_ATOM_XML, 
                 MediaType.APPLICATION_JSON,

Modified: tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java?rev=1124703&r1=1124702&r2=1124703&view=diff
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java
(original)
+++ tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java
Thu May 19 12:10:28 2011
@@ -21,8 +21,17 @@ package org.apache.tuscany.sca.domain;
 
 import java.io.File;
 import java.util.List;
+import java.util.Map;
 
+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.xml.Utils;
+import org.apache.tuscany.sca.core.FactoryExtensionPoint;
 import org.apache.tuscany.sca.impl.NodeImpl;
+import org.apache.tuscany.sca.runtime.DomainRegistry;
 
 
 /**
@@ -46,14 +55,13 @@ public class DomainImpl implements Domai
     } 
     
     public String getContributions(String domainName) {
-        NodeImpl node = (NodeImpl)DomainView.domainAccessPointNode;
-        List<String> contributions = node.getInstalledContributionURIs();
+        DomainRegistry domainRegistry = DomainView.domainRegistry;
+        List<String> contributions = domainRegistry.getInstalledContributionURIs();
         return contributions.toString();
     }
     
     public String getComposites(String domainName){
-        NodeImpl node = (NodeImpl)DomainView.domainAccessPointNode;
-        return node.getDomainLevelCompositeAsString();
+        return Utils.modelToXML(getDomainComposite(domainName), true, DomainView.extensionPointRegistry);
     } 
     
     public String getComponents(String domainName) {
@@ -62,29 +70,33 @@ public class DomainImpl implements Domai
     }
     
     public String getEndpoints(String domainName) {
-        NodeImpl node = (NodeImpl)DomainView.domainAccessPointNode;
-        return node.getEndpointRegistry().getEndpoints().toString();
+        DomainRegistry domainRegistry = DomainView.domainRegistry;
+        return domainRegistry.getEndpoints().toString();
     }
     
     public String getNodes(String domainName){
-        // use the domain on the file system in lieu of info in the registry
-        File domainDir = new File("target/test-classes/" + domainName);
-        String nodes = "";
-        
-        for (File subDir : domainDir.listFiles()){
-            if (subDir.isDirectory()){
-                nodes += subDir.getName() + "\n";
-            }
-        }
-        return nodes;
+        DomainRegistry domainRegistry = DomainView.domainRegistry;
+        return domainRegistry.getMembers().toString();
     }     
     
     // utilities
     
-    public String prettyPrintXMLString(String inXML){
-        return inXML.replaceAll("<", "&lt;").replaceAll(">", "&gt;");
-        
-        // etc. need to read and write a structured version
+    // copied from domain node
+    public Composite getDomainComposite(String domainName) {
+        FactoryExtensionPoint factories = DomainView.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 = DomainView.domainRegistry.getRunningCompositeURIs();
+        for (String curi : runningCompositeURIs.keySet()) {
+            for (String compositeURI : runningCompositeURIs.get(curi)) {
+                domainIncludes.add(DomainView.domainRegistry.getRunningComposite(curi, compositeURI));
+            }
+        }
+        return domainComposite;
     }
 
 }
\ No newline at end of file

Modified: tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java
URL: http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java?rev=1124703&r1=1124702&r2=1124703&view=diff
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java
(original)
+++ tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java
Thu May 19 12:10:28 2011
@@ -21,6 +21,9 @@ package org.apache.tuscany.sca.domain;
 
 import org.apache.tuscany.sca.Node;
 import org.apache.tuscany.sca.TuscanyRuntime;
+import org.apache.tuscany.sca.core.ExtensionPointRegistry;
+import org.apache.tuscany.sca.impl.NodeImpl;
+import org.apache.tuscany.sca.runtime.DomainRegistry;
 
 /**
  * Main class for Tuscany. Just looking at what it means to read config from a directory
structure. 
@@ -28,20 +31,26 @@ import org.apache.tuscany.sca.TuscanyRun
  */
 public class DomainView {
     
-    public static Node domainAccessPointNode = null;
+    public static DomainRegistry domainRegistry = null;
+    public static ExtensionPointRegistry extensionPointRegistry = null;
+    
+    private static Node domainAccessPointNode = null;
     private static Node domainViewNode = null;
 
     public static void main(String[] args) throws Exception {
         String domainName = args[0];
                
         TuscanyRuntime tuscanyRuntime = TuscanyRuntime.newInstance();
+        extensionPointRegistry = tuscanyRuntime.getExtensionPointRegistry();
         
         // a node to access the specified domain
         domainAccessPointNode = tuscanyRuntime.createNode("uri:" + domainName);
+        domainRegistry = ((NodeImpl)domainAccessPointNode).getEndpointRegistry();
         
         // a node to run the domain view app. Just starts in the local domain "domainview"
         domainViewNode = tuscanyRuntime.createNode("domainview");
-        domainViewNode.installContribution("target/classes");
+        domainViewNode.installContribution("domainViewContrib", "target/classes", null, null);
+        domainViewNode.startComposite("domainViewContrib", "domain.composite");
         
         System.out.print("Press a key to stop");
         try{



Mime
View raw message