summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-14 09:42:48 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-14 09:42:48 +0000
commit5d8998148b1de990559f6617f09b518d3ab324fe (patch)
treed7d15460b5dec003768efb598c4251ffa09627d8 /sca-java-2.x/trunk
parentc23d51cb0fc9c129bbd912bf9d475ef9430e16b2 (diff)
Update to support a contribution exploded (unzipped) into a file system directory
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1135438 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java7
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java12
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt4
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jarbin0 -> 4808 bytes
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF14
-rw-r--r--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.properties5
-rw-r--r--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.xml58
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml24
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite29
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.classbin0 -> 251 bytes
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.classbin0 -> 819 bytes
11 files changed, 151 insertions, 2 deletions
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
index 5d84933374..4795fbe780 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java
@@ -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")) {
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
index 5bf1f53690..f3ba1ff405 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/java/org/apache/tuscany/sca/impl/DirectoryDomainTestCase.java
@@ -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));
+ }
}
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
new file mode 100644
index 0000000000..ea7af2b3f7
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/readme.txt
@@ -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
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar
new file mode 100644
index 0000000000..1ea85c8e63
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld.jar
Binary files differ
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
new file mode 100644
index 0000000000..c5d7d06f98
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/MANIFEST.MF
@@ -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
+
diff --git a/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 b/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
new file mode 100644
index 0000000000..ff83691757
--- /dev/null
+++ b/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
@@ -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
diff --git a/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 b/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
new file mode 100644
index 0000000000..e480d4f534
--- /dev/null
+++ b/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
@@ -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>
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
new file mode 100644
index 0000000000..e81e94d9a1
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/META-INF/sca-contribution.xml
@@ -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>
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
new file mode 100644
index 0000000000..324395c246
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/helloworld.composite
@@ -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>
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class
new file mode 100644
index 0000000000..19c82db88e
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/Helloworld.class
Binary files differ
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class
new file mode 100644
index 0000000000..575b3370c4
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/exploded/sample-helloworld/sample/HelloworldImpl.class
Binary files differ