diff options
Diffstat (limited to 'sandbox')
4 files changed, 45 insertions, 24 deletions
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java index 8163f160aa..fdc7f142c1 100644 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java @@ -30,7 +30,7 @@ import org.oasisopen.sca.annotation.Remotable; @Remotable
public interface Composite {
- @GET
+// @GET
@Produces( {MediaType.TEXT_HTML})
@Path("{domainname}/composite")
public String get();
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java index 773e649202..5acaf73be3 100644 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java @@ -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,
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java index 41ca341763..5aab3d922e 100644 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java @@ -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 Domain { }
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 Domain { }
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("<", "<").replaceAll(">", ">");
-
- // 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 diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java index e8d9aa416a..1732a536f4 100644 --- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java +++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java @@ -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.TuscanyRuntime; */
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{
|