summaryrefslogtreecommitdiffstats
path: root/sca-java-2.x/trunk/modules/domain-node
diff options
context:
space:
mode:
authorantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-18 07:46:51 +0000
committerantelder <antelder@13f79535-47bb-0310-9956-ffa450edef68>2011-06-18 07:46:51 +0000
commit2fd232ad1680d2164bfb445b87299742f8af347d (patch)
tree87a022465a11c7500676a168df4d0f3558c2a5bf /sca-java-2.x/trunk/modules/domain-node
parent7a1fb15ee8302de48aa989085d2211593ba22406 (diff)
Change setting a contributions dependencies explicitly from using the domain.properties file to use a <contributionName>.dependencies file to be more consistent with how the other files are used
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@1137135 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'sca-java-2.x/trunk/modules/domain-node')
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/main/java/org/apache/tuscany/sca/TuscanyRuntime.java14
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/domain.properties2
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import1.dependencies19
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import2.dependencies19
-rw-r--r--sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/readme.txt2
5 files changed, 50 insertions, 6 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 c4bf0d4b26..ad466c19bd 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
@@ -19,6 +19,7 @@
package org.apache.tuscany.sca;
+import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileReader;
@@ -212,9 +213,16 @@ public class TuscanyRuntime {
}
List<String> dependencyURIs = new ArrayList<String>();
- String dependencyURIprop = domainProps.getProperty("dependencies." + fn);
- if (dependencyURIprop != null && dependencyURIprop.length() > 0) {
- dependencyURIs = Arrays.asList(dependencyURIprop.split(","));
+ File dependencyFile = new File(directory, fn + ".dependencies");
+ if (dependencyFile.exists()) {
+ BufferedReader br = new BufferedReader(new FileReader(dependencyFile));
+ String s;
+ while ((s = br.readLine()) != null) {
+ if (!s.startsWith("#") && s.trim().length() > 0) {
+ dependencyURIs.addAll(Arrays.asList(s.trim().split("[ ,]+")));
+ }
+ }
+ br.close();
}
String curi = node.installContribution(null, f.getPath(), metaData, dependencyURIs);
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/domain.properties b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/domain.properties
deleted file mode 100644
index 5d8b0823d4..0000000000
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/domain.properties
+++ /dev/null
@@ -1,2 +0,0 @@
-dependencies.import1=export1
-dependencies.import2=export2
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import1.dependencies b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import1.dependencies
new file mode 100644
index 0000000000..b7c54895d0
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import1.dependencies
@@ -0,0 +1,19 @@
+# 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.
+
+ export1
+
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import2.dependencies b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import2.dependencies
new file mode 100644
index 0000000000..dd3052994c
--- /dev/null
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import2.dependencies
@@ -0,0 +1,19 @@
+# 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.
+
+export2
+
diff --git a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/readme.txt b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/readme.txt
index cb67b5402e..fc645c0682 100644
--- a/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/readme.txt
+++ b/sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/readme.txt
@@ -7,7 +7,7 @@ and "Hello 2" in export2.jar.
Contributions import1.jar and import2.jar both import the package sample and use the
sample.HelloworldImpl class in the component implementation.
-The domain.propertes includes properties to explicitly set the dependency URIs used by
+The *.dependencies files explicitly set the dependency URIs used by
Contributions import1.jar and import2.jar, without the explicit property the imports would just t
use the first contribution found that exports the sample package.