Author: slaws
Date: Tue May 24 08:32:01 2011
New Revision: 1126924

URL: http://svn.apache.org/viewvc?rev=1126924&view=rev
Log:
Add a and atom view of composites and look at retrieving the composite artifact 
hierarchy

Added:
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
    tuscany/sandbox/slaws/domain-view/src/main/resources/repo/
    tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar
   (with props)
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar
   (with props)
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar
   (with props)
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/
    
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
    tuscany/sandbox/slaws/domain-view/src/main/resources/repo/index.html
Modified:
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainView.java
    
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
    tuscany/sandbox/slaws/domain-view/src/main/resources/domain.composite

Added: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactView.java
 Tue May 24 08:32:01 2011
@@ -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

Added: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeArtifactViewImpl.java
 Tue May 24 08:32:01 2011
@@ -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

Added: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomView.java
 Tue May 24 08:32:01 2011
@@ -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

Added: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeAtomViewImpl.java
 Tue May 24 08:32:01 2011
@@ -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

Modified: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java?rev=1126924&r1=1126923&r2=1126924&view=diff
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
 (original)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeView.java
 Tue May 24 08:32:01 2011
@@ -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

Modified: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java?rev=1126924&r1=1126923&r2=1126924&view=diff
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
 (original)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/CompositeViewImpl.java
 Tue May 24 08:32:01 2011
@@ -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

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=1126924&r1=1126923&r2=1126924&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
 Tue May 24 08:32:01 2011
@@ -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

Modified: 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java?rev=1126924&r1=1126923&r2=1126924&view=diff
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
 (original)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/java/org/apache/tuscany/sca/domain/DomainViewImpl.java
 Tue May 24 08:32:01 2011
@@ -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.Do
  */
 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 D
     }
     
     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;
     }

Modified: tuscany/sandbox/slaws/domain-view/src/main/resources/domain.composite
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/domain.composite?rev=1126924&r1=1126923&r2=1126924&view=diff
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/resources/domain.composite 
(original)
+++ tuscany/sandbox/slaws/domain-view/src/main/resources/domain.composite Tue 
May 24 08:32:01 2011
@@ -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>

Added: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar?rev=1126924&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-client-contribution.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar?rev=1126924&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-iface-contribution.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar?rev=1126924&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/helloworld-service-contribution.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeClient/node.xml
 Tue May 24 08:32:01 2011
@@ -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

Added: 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml?rev=1126924&view=auto
==============================================================================
--- 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
 (added)
+++ 
tuscany/sandbox/slaws/domain-view/src/main/resources/repo/domain1/nodeService/node.xml
 Tue May 24 08:32:01 2011
@@ -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

Added: tuscany/sandbox/slaws/domain-view/src/main/resources/repo/index.html
URL: 
http://svn.apache.org/viewvc/tuscany/sandbox/slaws/domain-view/src/main/resources/repo/index.html?rev=1126924&view=auto
==============================================================================
--- tuscany/sandbox/slaws/domain-view/src/main/resources/repo/index.html (added)
+++ tuscany/sandbox/slaws/domain-view/src/main/resources/repo/index.html Tue 
May 24 08:32:01 2011
@@ -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>


Reply via email to