summaryrefslogtreecommitdiffstats
path: root/sandbox/slaws/domain-view/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'sandbox/slaws/domain-view/src/main')
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java40
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java (renamed from sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Composite.java)7
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java73
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java (renamed from sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/Domain.java)9
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java (renamed from sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainImpl.java)36
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/domain.composite6
6 files changed, 88 insertions, 83 deletions
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java
deleted file mode 100644
index 1011a5b693..0000000000
--- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeImpl.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.tuscany.sca.domain;
-
-/**
- * Some hand crafted HTTP code to help me think about what info is missing
- * from the domain registry
- *
- */
-public class CompositeImpl implements Composite {
-
- public String get() {
- String outputHTML = "<p/>get";
- return outputHTML;
- }
-
-
- public String getComposite(String domainName) {
- String outputHTML = "<p/>get composite";
- return outputHTML;
- }
-
-} \ No newline at end of file
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/CompositeView.java
index fdc7f142c1..4ff1101cfa 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/CompositeView.java
@@ -28,11 +28,10 @@ import javax.ws.rs.core.MediaType;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
-public interface Composite {
+public interface CompositeView {
-// @GET
+ @GET
@Produces( {MediaType.TEXT_HTML})
- @Path("{domainname}/composite")
public String get();
@@ -41,7 +40,7 @@ public interface Composite {
MediaType.APPLICATION_JSON,
MediaType.APPLICATION_XML,
MediaType.TEXT_HTML})
- @Path("{domainname}/composite/{compositename}")
+ @Path("{compositename}")
public String getComposite(@PathParam("compositename") String domainName);
} \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
new file mode 100644
index 0000000000..8220672a8b
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.tuscany.sca.domain;
+
+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;
+
+/**
+ * Some hand crafted HTTP code to help me think about what info is missing
+ * from the domain registry
+ *
+ */
+public class CompositeViewImpl implements CompositeView {
+
+ public String get() {
+ String outputHTML = "<p/>get";
+ return outputHTML;
+
+// Utils.modelToXML(getDomainComposite(domainName), true, DomainViewRunner.extensionPointRegistry);
+ }
+
+
+ public String getComposite(String domainName) {
+ String outputHTML = "<p/>get composite";
+ return outputHTML;
+ }
+
+ // utilities
+
+ // copied from domain node
+ public Composite getDomainComposite(String domainName) {
+ FactoryExtensionPoint factories = DomainViewRunner.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 = DomainViewRunner.domainRegistry.getRunningCompositeURIs();
+ for (String curi : runningCompositeURIs.keySet()) {
+ for (String compositeURI : runningCompositeURIs.get(curi)) {
+ domainIncludes.add(DomainViewRunner.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/Domain.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java
index 5acaf73be3..d7514f1bf3 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/DomainView.java
@@ -28,7 +28,7 @@ import javax.ws.rs.core.MediaType;
import org.oasisopen.sca.annotation.Remotable;
@Remotable
-public interface Domain {
+public interface DomainView {
@GET
@Produces( {MediaType.TEXT_HTML})
@@ -51,12 +51,7 @@ public interface Domain {
public String getContributions(@PathParam("domainname") String domainName);
@Path("{domainname}/composite")
- @GET
- @Produces( {MediaType.APPLICATION_ATOM_XML,
- MediaType.APPLICATION_JSON,
- MediaType.APPLICATION_XML,
- MediaType.TEXT_HTML})
- public String getComposites(@PathParam("domainname") String domainName);
+ public CompositeView getComposites(@PathParam("domainname") String domainName);
@Path("{domainname}/component")
@GET
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/DomainViewImpl.java
index 5aab3d922e..1cfa4da94e 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/DomainViewImpl.java
@@ -19,7 +19,6 @@
package org.apache.tuscany.sca.domain;
-import java.io.File;
import java.util.List;
import java.util.Map;
@@ -30,7 +29,6 @@ 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;
@@ -39,7 +37,7 @@ import org.apache.tuscany.sca.runtime.DomainRegistry;
* from the domain registry
*
*/
-public class DomainImpl implements Domain {
+public class DomainViewImpl implements DomainView {
public String get() {
String outputHTML = "<p/>enter URL in the form http://host:port/sca/domain/yourdomainnamehere";
@@ -49,54 +47,34 @@ public class DomainImpl implements Domain {
public String getDomainServiceDocument(String domainName) {
String outputHTML = "<p/><a href=\"" + domainName + "/contribution\">contributions</a>" +
"<p/><a href=\"" + domainName + "/composite\">composites</a>" +
+ "<p/><a href=\"" + domainName + "/composite\">components</a>" +
"<p/><a href=\"" + domainName + "/endpoint\">endpoints</a>" +
"<p/><a href=\"" + domainName + "/node\">nodes</a>";
return outputHTML;
}
public String getContributions(String domainName) {
- DomainRegistry domainRegistry = DomainView.domainRegistry;
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
List<String> contributions = domainRegistry.getInstalledContributionURIs();
return contributions.toString();
}
- public String getComposites(String domainName){
- return Utils.modelToXML(getDomainComposite(domainName), true, DomainView.extensionPointRegistry);
+ public CompositeView getComposites(String domainName){
+ return new CompositeViewImpl();
}
public String getComponents(String domainName) {
- // TODO Auto-generated method stub
return null;
}
public String getEndpoints(String domainName) {
- DomainRegistry domainRegistry = DomainView.domainRegistry;
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
return domainRegistry.getEndpoints().toString();
}
public String getNodes(String domainName){
- DomainRegistry domainRegistry = DomainView.domainRegistry;
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
return domainRegistry.getMembers().toString();
}
-
- // utilities
-
- // 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/resources/domain.composite b/sandbox/slaws/domain-view/src/main/resources/domain.composite
index b86485d6b0..a3cdcbc3f8 100644
--- a/sandbox/slaws/domain-view/src/main/resources/domain.composite
+++ b/sandbox/slaws/domain-view/src/main/resources/domain.composite
@@ -30,9 +30,9 @@
</service>
</component>
- <component name="Domain">
- <implementation.java class="org.apache.tuscany.sca.domain.DomainImpl"/>
- <service name="Domain">
+ <component name="DomainView">
+ <implementation.java class="org.apache.tuscany.sca.domain.DomainViewImpl"/>
+ <service name="DomainView">
<tuscany:binding.rest uri="/sca/domain">
<tuscany:operationSelector.jaxrs/>
</tuscany:binding.rest>