Author: antelder
Date: Tue Jun 14 09:42:48 2011
New Revision: 1135438

URL: http://svn.apache.org/viewvc?rev=1135438&view=rev
Log:
Update to support a contribution exploded (unzipped) into a file system 
directory

Added:
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar
   (with props)
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.properties
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.xml
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class
   (with props)
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class
   (with props)
Modified:
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
    
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java

Modified: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java?rev=1135438&r1=1135437&r2=1135438&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
 Tue Jun 14 09:42:48 2011
@@ -194,12 +194,15 @@ public class TuscanyRuntime {
 
         DomainRegistry domainRegistry = 
domainRegistryFactory.getEndpointRegistry(domainURI, domainName);
         Node node = new NodeImpl(deployer, compositeActivator, domainRegistry, 
extensionPointRegistry, null);
- 
-        
+
         List<String> installed = new ArrayList<String>();
         for (File f : directory.listFiles()) {
             if (f.getName().endsWith(".jar") || f.getName().endsWith(".zip") 
|| (f.isDirectory() && !f.getName().startsWith("."))) {
                 String fn = f.getName().lastIndexOf('.') == -1 ? f.getName() : 
f.getName().substring(0, f.getName().lastIndexOf('.'));
+                // ignore the contribution if it has an associated exploded 
folder version
+                if (!f.isDirectory() && new File(f.getParent(), 
fn).isDirectory()) {
+                    continue;
+                }
                 String metaData = null;
                 for (File f2 : directory.listFiles()) {
                     if (f2.getName().startsWith(fn) && 
f2.getName().endsWith(".xml")) {

Modified: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java?rev=1135438&r1=1135437&r2=1135438&view=diff
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
 (original)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
 Tue Jun 14 09:42:48 2011
@@ -92,4 +92,16 @@ public class DirectoryDomainTestCase {
         Assert.assertEquals(1, startedComposites.size());
         Assert.assertEquals("helloworld.composite", 
startedComposites.get("sample-helloworld").get(0));
     }
+
+    @Test
+    public void testExploded() throws ContributionReadException, 
ActivationException, ValidationException, XMLStreamException, IOException {
+        Node node = TuscanyRuntime.newInstance().createNode(new 
File("src/test/resources/test-domains/exploded"));
+        Assert.assertEquals("exploded", node.getDomainName());
+        List<String> cs = node.getInstalledContributionURIs();
+        Assert.assertEquals(1, cs.size());
+        Assert.assertEquals("sample-helloworld", cs.get(0));
+        Map<String, List<String>> startedComposites = 
node.getStartedCompositeURIs();
+        Assert.assertEquals(1, startedComposites.size());
+        Assert.assertEquals("helloworld.composite", 
startedComposites.get("sample-helloworld").get(0));
+    }
 }

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,4 @@
+A domain directory showing a contribution jar exploded into a contribution 
directory.
+In this case the contribution jar is ignored and the contribution directory is 
used.
+Thats the same approach used for things like Tomcat with exploded webapps and 
it 
+enables more easily supporting dynamic updates to individual files in a 
contribution. 
\ No newline at end of file

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar?rev=1135438&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,14 @@
+Manifest-Version: 1.0
+Archiver-Version: Plexus Archiver
+Created-By: Apache Maven
+Built-By: ant
+Build-Jdk: 1.6.0_18
+Extension-Name: sample-helloworld
+Implementation-Title: Apache Tuscany SCA Sample Helloworld
+Implementation-Vendor: The Apache Software Foundation
+Implementation-Vendor-Id: org.apache
+Implementation-Version: 2.0-SNAPSHOT
+Specification-Title: Apache Tuscany SCA Sample Helloworld
+Specification-Vendor: The Apache Software Foundation
+Specification-Version: 2.0-SNAPSHOT
+

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.properties
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.properties?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.properties
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.properties
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,5 @@
+#Generated by Maven
+#Wed May 19 10:03:09 BST 2010
+version=2.0-SNAPSHOT
+groupId=org.apache.tuscany.sca
+artifactId=sample-helloworld

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.xml?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.xml
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/maven/org.apache.tuscany.sca/sample-helloworld/pom.xml
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,58 @@
+<?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.    
+-->
+<project>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.tuscany.sca</groupId>
+        <artifactId>tuscany-sca</artifactId>
+        <version>2.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <packaging>jar</packaging>
+    <artifactId>sample-helloworld</artifactId>
+    <name>Apache Tuscany SCA Sample Helloworld</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.tuscany.sca</groupId>
+            <artifactId>tuscany-sca-api</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <version>4.8.1</version>
+            <scope>test</scope>
+        </dependency>
+    </dependencies>
+
+    <build>
+       <finalName>${artifactId}</finalName>
+       <plugins>
+         <plugin>
+             <groupId>org.apache.tuscany.maven.plugins</groupId>
+             <artifactId>maven-tuscany-plugin</artifactId>
+             <version>2.0-SNAPSHOT</version>
+         </plugin>
+       </plugins>
+    </build>
+</project>

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,24 @@
+<?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.    
+-->
+<contribution xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912";
+              xmlns:sample="http://sample";>
+   <deployable composite="sample:helloworld"/>
+   <export.java package="sample" />
+</contribution>

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite?rev=1135438&view=auto
==============================================================================
--- 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
 (added)
+++ 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
 Tue Jun 14 09:42:48 2011
@@ -0,0 +1,29 @@
+<?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.    
+-->
+<composite xmlns="http://docs.oasis-open.org/ns/opencsa/sca/200912";
+           xmlns:tuscany="http://tuscany.apache.org/xmlns/sca/1.1";
+           targetNamespace="http://sample";
+           name="helloworld">
+
+    <component name="HelloworldComponent">
+        <implementation.java class="sample.HelloworldImpl"/>
+    </component>
+
+</composite>

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class?rev=1135438&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class
URL: 
http://svn.apache.org/viewvc/tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class?rev=1135438&view=auto
==============================================================================
Binary file - no diff available.

Propchange: 
tuscany/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream


Reply via email to