summaryrefslogtreecommitdiffstats
path: root/sandbox/slaws
diff options
context:
space:
mode:
authorslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-05-24 08:32:01 +0000
committerslaws <slaws@13f79535-47bb-0310-9956-ffa450edef68>2011-05-24 08:32:01 +0000
commit7608b05fc67449fca1fbefaddc202598b8b4639c (patch)
tree07018aad538e1e6799cc7b6e81503abbf980972e /sandbox/slaws
parent59eaca5c239d0dee919fd521d315d67cfa135613 (diff)
Add a and atom view of composites and look at retrieving the composite artifact hierarchy
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1126924 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sandbox/slaws')
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java37
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java64
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java38
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java72
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java15
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java66
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java10
-rw-r--r--sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java14
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/domain.composite14
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jarbin0 -> 9625 bytes
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jarbin0 -> 8212 bytes
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jarbin0 -> 9432 bytes
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml38
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml38
-rw-r--r--sandbox/slaws/domain-view/src/main/resources/repo/index.html250
15 files changed, 598 insertions, 58 deletions
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
new file mode 100644
index 0000000000..de88ce9845
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
@@ -0,0 +1,37 @@
+/*
+ * 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 javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface CompositeArtifactView {
+
+ @GET
+ @Produces( {MediaType.TEXT_HTML})
+ public String get(@Context UriInfo uriInfo);
+
+} \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
new file mode 100644
index 0000000000..35fdf92f6f
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
@@ -0,0 +1,64 @@
+/*
+ * 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.Iterator;
+import java.util.List;
+
+import javax.ws.rs.core.PathSegment;
+import javax.ws.rs.core.UriInfo;
+
+/**
+ * Some hand crafted HTTP code to help me think about what info is missing
+ * from the domain registry
+ */
+public class CompositeArtifactViewImpl implements CompositeArtifactView {
+
+ private String domainName;
+
+ public CompositeArtifactViewImpl(String domainName){
+ this.domainName = domainName;
+ }
+
+ public String get(UriInfo uriInfo){
+ Iterator<PathSegment> pathSegmentsIter = uriInfo.getPathSegments().iterator();
+
+ // get past the sca/domain/domainname/composite/compositename segments
+ pathSegmentsIter.next();
+ pathSegmentsIter.next();
+ pathSegmentsIter.next();
+ pathSegmentsIter.next();
+ pathSegmentsIter.next();
+
+ // now expecting componentname/componentname/componentname/service or reference/binding
+ while (pathSegmentsIter.hasNext()){
+ pathSegmentsIter.next();
+ }
+
+ // get list of pairs of artifact type and name
+ return "Yippeeeee! Show the composite artifact at " + uriInfo.getPath();
+ }
+
+ class Artifact {
+ public String type;
+ public String name;
+ }
+
+} \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
new file mode 100644
index 0000000000..8d9cada6bd
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
@@ -0,0 +1,38 @@
+/*
+ * 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 javax.ws.rs.GET;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.oasisopen.sca.annotation.Remotable;
+
+@Remotable
+public interface CompositeAtomView {
+
+ @GET
+ @Produces( {MediaType.APPLICATION_ATOM_XML} )
+ public AtomFeed getFeed(@Context UriInfo uriInfo);
+
+} \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
new file mode 100644
index 0000000000..d858f82013
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
@@ -0,0 +1,72 @@
+/*
+ * 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.Date;
+
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.tuscany.sca.assembly.Composite;
+import org.apache.tuscany.sca.assembly.xml.Utils;
+import org.apache.tuscany.sca.runtime.DomainRegistry;
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomText;
+
+/**
+ * Some hand crafted HTTP code to help me think about what info is missing
+ * from the domain registry
+ */
+public class CompositeAtomViewImpl implements CompositeAtomView {
+
+ private String domainName;
+
+ public CompositeAtomViewImpl(String domainName){
+ this.domainName = domainName;
+ }
+
+ public AtomFeed getFeed(UriInfo uriInfo) {
+ AtomFeed feed = new AtomFeed();
+ feed.setId(domainName + " composites");
+ feed.setTitle(new AtomText("Composites installed in domain: " + domainName));
+ feed.setUpdated(new Date());
+ AtomLink feedLink = new AtomLink();
+ feedLink.setHref(uriInfo.getPath());
+ feed.getLinks().add(feedLink);
+
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
+ Composite composite = domainRegistry.getDomainComposite();
+ for (Composite tmpComposite : composite.getIncludes()){
+
+ AtomEntry entry = new AtomEntry();
+ entry.setId(tmpComposite.getName().toString());
+ entry.setTitle(new AtomText(tmpComposite.getName().toString()));
+ entry.setUpdated(new Date());
+ entry.setPublished(new Date());
+ entry.setSummary(new AtomText(Utils.modelToXML(tmpComposite, true, DomainViewRunner.extensionPointRegistry)));
+
+ feed.getEntries().add(entry);
+ }
+
+ return feed;
+ }
+
+} \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
index 4ff1101cfa..a60ec61bc3 100644
--- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
@@ -23,7 +23,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
import org.oasisopen.sca.annotation.Remotable;
@@ -32,15 +34,14 @@ public interface CompositeView {
@GET
@Produces( {MediaType.TEXT_HTML})
- public String get();
-
+ public String getComposites();
@GET
- @Produces( {MediaType.APPLICATION_ATOM_XML,
- MediaType.APPLICATION_JSON,
- MediaType.APPLICATION_XML,
- MediaType.TEXT_HTML})
+ @Produces( {MediaType.TEXT_HTML})
@Path("{compositename}")
- public String getComposite(@PathParam("compositename") String domainName);
+ public String getComposite(@PathParam("compositename") String compositeName, @Context UriInfo uriInfo);
+
+ @Path("{compositename}/{compositeartifact}")
+ public CompositeArtifactView getCompositeArtifact();
} \ 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
index 8220672a8b..3f33d7335a 100644
--- 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
@@ -19,55 +19,53 @@
package org.apache.tuscany.sca.domain;
-import java.util.List;
-import java.util.Map;
+import java.util.Date;
-import javax.xml.namespace.QName;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.UriInfo;
-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.runtime.DomainRegistry;
+import org.apache.wink.common.model.atom.AtomEntry;
+import org.apache.wink.common.model.atom.AtomFeed;
+import org.apache.wink.common.model.atom.AtomLink;
+import org.apache.wink.common.model.atom.AtomText;
/**
* 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);
- }
+ private String domainName;
-
- public String getComposite(String domainName) {
- String outputHTML = "<p/>get composite";
- return outputHTML;
- }
+ public CompositeViewImpl(String domainName){
+ this.domainName = domainName;
+ }
- // utilities
+ public String getComposites() {
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
+ Composite composite = domainRegistry.getDomainComposite();
+ return composite.getIncludes().toString();
+ }
- // 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));
+ public String getComposite(String compositeName, UriInfo uriInfo) {
+ DomainRegistry domainRegistry = DomainViewRunner.domainRegistry;
+ Composite composite = domainRegistry.getDomainComposite();
+ for (Composite tmpComposite : composite.getIncludes()){
+ if (tmpComposite.getName().getLocalPart().equals(compositeName)){
+ return "<p/><textarea rows=\"40\" cols=\"80\">" +
+ Utils.modelToXML(tmpComposite, true, DomainViewRunner.extensionPointRegistry) +
+ "</textarea>";
}
}
- return domainComposite;
- }
+
+ return "<p/>composite not found";
+ }
+ public CompositeArtifactView getCompositeArtifact(){
+ return new CompositeArtifactViewImpl(domainName);
+ }
+
} \ 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 d7514f1bf3..7f4981e574 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
@@ -23,7 +23,9 @@ import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.UriInfo;
import org.oasisopen.sca.annotation.Remotable;
@@ -32,7 +34,7 @@ public interface DomainView {
@GET
@Produces( {MediaType.TEXT_HTML})
- public String get();
+ public String get(@Context UriInfo uriInfo);
@Path("{domainname}")
@GET
@@ -51,7 +53,11 @@ public interface DomainView {
public String getContributions(@PathParam("domainname") String domainName);
@Path("{domainname}/composite")
- public CompositeView getComposites(@PathParam("domainname") String domainName);
+ public CompositeView getComposites(@PathParam("domainname") String domainName);
+
+ @Path("{domainname}/composite.atom")
+ public CompositeAtomView getCompositesAtom(@PathParam("domainname") String domainName);
+
@Path("{domainname}/component")
@GET
diff --git a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
index 1cfa4da94e..f297b00b77 100644
--- a/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
+++ b/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
@@ -22,6 +22,9 @@ package org.apache.tuscany.sca.domain;
import java.util.List;
import java.util.Map;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.UriInfo;
import javax.xml.namespace.QName;
import org.apache.tuscany.sca.assembly.AssemblyFactory;
@@ -39,7 +42,10 @@ import org.apache.tuscany.sca.runtime.DomainRegistry;
*/
public class DomainViewImpl implements DomainView {
- public String get() {
+ @Context
+ HttpHeaders requestHeaders;
+
+ public String get(UriInfo uriInfo) {
String outputHTML = "<p/>enter URL in the form http://host:port/sca/domain/yourdomainnamehere";
return outputHTML;
}
@@ -60,9 +66,13 @@ public class DomainViewImpl implements DomainView {
}
public CompositeView getComposites(String domainName){
- return new CompositeViewImpl();
+ return new CompositeViewImpl(domainName);
}
+ public CompositeAtomView getCompositesAtom(String domainName){
+ return new CompositeAtomViewImpl(domainName);
+ }
+
public String getComponents(String domainName) {
return null;
}
diff --git a/sandbox/slaws/domain-view/src/main/resources/domain.composite b/sandbox/slaws/domain-view/src/main/resources/domain.composite
index a3cdcbc3f8..be9aaa4a0c 100644
--- a/sandbox/slaws/domain-view/src/main/resources/domain.composite
+++ b/sandbox/slaws/domain-view/src/main/resources/domain.composite
@@ -28,7 +28,7 @@
<service name="Widget">
<tuscany:binding.rest uri="/sca" />
</service>
- </component>
+ </component>
<component name="DomainView">
<implementation.java class="org.apache.tuscany.sca.domain.DomainViewImpl"/>
@@ -39,16 +39,4 @@
</service>
</component>
-<!--
- don't know how to map multiple components to a variable root
- <component name="Composite">
- <implementation.java class="org.apache.tuscany.sca.domain.CompositeImpl"/>
- <service name="Composite">
- <tuscany:binding.rest uri="/sca/domain">
- <tuscany:operationSelector.jaxrs/>
- </tuscany:binding.rest>
- </service>
- </component>
--->
-
</composite>
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar
new file mode 100644
index 0000000000..c98214fc83
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar
Binary files differ
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar
new file mode 100644
index 0000000000..455de9c58a
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar
Binary files differ
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar
new file mode 100644
index 0000000000..28e3e680e9
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar
Binary files differ
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
new file mode 100644
index 0000000000..f6756ad187
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ uri="http://sample/domain1/nodeClient"
+ domain="uri:domain1">
+
+ <!-- Configure the base URIs for a given binding -->
+ <!-- Each base URI is for a protocol supported by the binding -->
+ <binding name="sca:binding.sca" baseURIs="http://localhost:8081/sca https://localhost:8081/sca"/>
+ <binding name="sca:binding.ws" baseURIs="http://localhost:8082/ws https://localhost:8082/ws"/>
+
+ <!-- Configure a list of contributions -->
+ <contribution uri="iface" location="../helloworld-iface-contribution.jar"/>
+ <contribution uri="client" location="../helloworld-client-contribution.jar">
+ <!-- doesn't pick up the deployable composite properly without this?-->
+ <deploymentComposite location="helloworld-client.composite"/>
+ </contribution>
+
+</node> \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
new file mode 100644
index 0000000000..38274a1a62
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ * 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.
+-->
+<node xmlns:sca="http://docs.oasis-open.org/ns/opencsa/sca/200912"
+ xmlns="http://tuscany.apache.org/xmlns/sca/1.1"
+ xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1"
+ uri="http://sample/domain1/nodeService"
+ domain="uri:domain1">
+
+ <!-- Configure the base URIs for a given binding -->
+ <!-- Each base URI is for a protocol supported by the binding -->
+ <binding name="sca:binding.sca" baseURIs="http://localhost:8081/sca https://localhost:8081/sca"/>
+ <binding name="sca:binding.ws" baseURIs="http://localhost:8082/ws https://localhost:8082/ws"/>
+
+ <!-- Configure a list of contributions -->
+ <contribution uri="iface" location="../helloworld-iface-contribution.jar"/>
+ <contribution uri="service" location="../helloworld-service-contribution.jar">
+ <!-- doesn't pick up the deployable composite properly without this?-->
+ <deploymentComposite location="helloworld-service.composite"/>
+ </contribution>
+
+</node> \ No newline at end of file
diff --git a/sandbox/slaws/domain-view/src/main/resources/repo/index.html b/sandbox/slaws/domain-view/src/main/resources/repo/index.html
new file mode 100644
index 0000000000..7862cd5f82
--- /dev/null
+++ b/sandbox/slaws/domain-view/src/main/resources/repo/index.html
@@ -0,0 +1,250 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Tuscany SCA Domain Components</title>
+
+<script type="text/javascript" src="/dojo/dojo.js"></script>
+
+<style type="text/css">
+body,html {
+ font-family: helvetica, arial, sans-serif;
+ font-size: 90%;
+}
+
+.componentIcon {
+ margin-left: 16px;
+ width: 16px;
+ height: 16px;
+ background: url('component.gif') no-repeat;
+}
+
+.serviceIcon {
+ margin-left: 16px;
+ width: 16px;
+ height: 16px;
+ background: url('service.gif') no-repeat;
+}
+
+.referenceIcon {
+ margin-left: 16px;
+ width: 16px;
+ height: 16px;
+ background: url('reference.gif') no-repeat;
+}
+</style>
+
+</head>
+
+<body>
+ <div id="header" style="border-bottom: solid 1px silver; overflow: hidden;">
+ <img src="http://tuscany.apache.org/images/TuscanyLogo.jpg" style="float:right;"/>
+ <h1>Tuscany SCA Domain</h1>
+ </div> <!-- end header div -->
+
+ <div id="container" style="border:1px solid silver">
+ <div id="navigation" style="position:absolute; float:left; width:30%; height:80%; padding:10px; border:1px solid silver">
+ <div id="treeDomain" /> </div>
+ </div> <!-- end navigation div -->
+
+ <div id="images" style="position:absolute; float:left; width:60%; height:80%; left:35%; padding:10px; border:1px solid silver">
+
+ <table style="margin-left:auto; margin-right:auto;" border="0" cellspacing="0" cellpadding="1">
+ <tr>
+ <td><a href="javascript:updatePage(-1)">prev</a></td>
+ <td><a href="javascript:updatePage(1)">next</a></td>
+ </tr>
+ <tr>
+ <td colspan="4">
+ <table id="tableImageThumb" style="margin-left:auto; margin-right:auto;" border="0" cellspacing="0" cellpadding="1"></table>
+
+ </td>
+ </tr>
+ </table>
+ </div> <!-- end images div -->
+
+ </div> <!-- end container div -->
+
+</body>
+
+<script type="text/javascript">
+ dojo.require("dojo.data.ItemFileWriteStore");
+ dojo.require("dijit.Tree");
+ dojo.require("dojox.xml.parser");
+ dojo.require("tuscany.RestService");
+ //dojo.require("tuscany.Composite");
+
+ var restClient;
+
+ var store;
+ var treeModel;
+ var treeControl;
+
+ var composite;
+
+
+ function prepare() {
+ store = new dojo.data.ItemFileWriteStore({
+ data: {
+ identifier: 'id',
+ label: 'label',
+ type: 'type',
+ items: [ ]
+ }
+ });
+ treeModel = new dijit.tree.ForestStoreModel({
+ store: store
+ });
+
+ treeControl = new dijit.Tree({
+ model: treeModel,
+ showRoot: false,
+ getIconClass: function(/*dojo.data.Item*/ item, /*Boolean*/ opened) {
+ console.log("##" + item.type);
+ if(item.type != undefined) {
+ if(item.type == 'component') {
+ return "componentIcon";
+ } else if(item.type == 'service' || item.type == 'service-binding') {
+ return "serviceIcon";
+ } else if(item.type == 'reference' || item.type == 'reference-binding') {
+ return "referenceIcon";
+ }
+ }
+ return "serviceIcon";
+ },
+ onClick: showArtifactDocumentation,
+ _createTreeNode: function(/*Object*/ args) {
+ var tnode = new dijit._TreeNode(args);
+ tnode.labelNode.innerHTML = args.label;
+ return tnode;
+ }
+ },"treeDomain");
+
+ restClient = new tuscany.RestService("/domain","text/plain");
+
+ showDomainArtifacts();
+ }
+
+
+ function composite_getResponse(xmlResponse, exception) {
+ if(exception){
+ alert(exception.message);
+ return;
+ }
+
+ var componentNode = xmlResponse.getElementsByTagName ("component");
+ //loop trough all components
+ for (c = 0; c < componentNode.length; c++) {
+ var componentAttributes = componentNode[c].attributes;
+ var componentItem = store.newItem({id:componentAttributes['uri'].value, label:componentAttributes['name'].value, type:'component'});
+
+ //loop trough all services
+ var serviceNode = componentNode[c].getElementsByTagName ("service");
+ for(s = 0; s < serviceNode.length; s++) {
+ var serviceAttributes = serviceNode[s].attributes;
+ var serviceId = componentAttributes['uri'].value + "/" + serviceAttributes['name'].value;
+
+ var parentInfo={
+ parent: componentItem,
+ attribute: "children"
+ };
+
+ var serviceItem = store.newItem({id:serviceId, label:serviceAttributes['name'].value, type:'service'}, parentInfo);
+
+ //loop trough children to find bindings
+ for(b=0; b < serviceNode[s].childNodes.length; b ++) {
+ var childNode = serviceNode[s].childNodes[b];
+ if(childNode.nodeName.indexOf('binding') == 0) {
+ var bindingId = serviceId + "/" + childNode.nodeName;
+
+ var parentInfo={
+ parent: serviceItem,
+ attribute: "children"
+ };
+
+ var bindingItem = store.newItem({id:bindingId, label:childNode.nodeName, type:'service-binding'}, parentInfo);
+ }
+ }
+ }
+
+
+ //loop trough all references
+ var referenceNode = componentNode[c].getElementsByTagName ("reference");
+ for(r = 0; r < referenceNode.length; r++) {
+ var referenceAttributes = referenceNode[r].attributes;
+ var referenceId = componentAttributes['uri'].value + "/" + referenceAttributes['name'].value;
+
+ var parentInfo={
+ parent: componentItem,
+ attribute: "children"
+ };
+
+ var referenceItem = store.newItem({id:serviceId, label:referenceAttributes['name'].value, type:'reference'}, parentInfo);
+
+ //loop trough children to find bindings
+ for(b=0; b < referenceNode[s].childNodes.length; b ++) {
+ var childNode = referenceNode[s].childNodes[b];
+ if(childNode.nodeName.indexOf('binding') == 0) {
+ var bindingId = serviceId + "/" + childNode.nodeName;
+
+ var parentInfo={
+ parent: serviceItem,
+ attribute: "children"
+ };
+
+ var bindingItem = store.newItem({id:bindingId, label:childNode.nodeName, type:'reference-binding'}, parentInfo);
+ }
+ }
+
+
+ }
+
+ }
+
+ //var composite = new tuscany.Composite(xmlResponse);
+
+
+ /*
+ var itemTags = xmlResponse.getElementsByTagName ("component");
+ for (i = 0; i < itemTags.length; i++) {
+ var attributes = itemTags[i].attributes;
+ alert(attributes[0].name);
+ var recordNode = itemTags[i].getElementsByTagName ("name")[0];
+ if (recordNode.textContent != undefined) {
+ alert(recordNode.textContent);
+ }
+ else {
+ alert(recordNode.text);
+ }
+ }
+ */
+
+ compositeXML = dojox.xml.parser.innerXML(xmlResponse);
+
+
+ //alert(compositeXML);
+
+ }
+
+ function showDomainArtifacts() {
+ restClient.get("default").addCallback(composite_getResponse);
+ }
+
+ function showArtifactDocumentation(/*dojo.data.Item*/ item) {
+ alert('showing documentation for' + item.id);
+ }
+
+ function guidGenerator() {
+ var S4 = function() {
+ return (((1+Math.random())*0x10000)|0).toString(16).substring(1);
+ };
+ return (S4()+S4()+"-"+S4()+"-"+S4()+"-"+S4()+"-"+S4()+S4()+S4());
+ }
+
+
+ dojo.addOnLoad(prepare);
+</script>
+
+</body>
+
+</html>