From 2fd232ad1680d2164bfb445b87299742f8af347d Mon Sep 17 00:00:00 2001 From: antelder Date: Sat, 18 Jun 2011 07:46:51 +0000 Subject: Change setting a contributions dependencies explicitly from using the domain.properties file to use a .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 --- .../java/org/apache/tuscany/sca/TuscanyRuntime.java | 14 +++++++++++--- .../test-domains/dependencies/domain.properties | 2 -- .../test-domains/dependencies/import1.dependencies | 19 +++++++++++++++++++ .../test-domains/dependencies/import2.dependencies | 19 +++++++++++++++++++ .../resources/test-domains/dependencies/readme.txt | 2 +- 5 files changed, 50 insertions(+), 6 deletions(-) delete mode 100644 sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/domain.properties create mode 100644 sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import1.dependencies create mode 100644 sca-java-2.x/trunk/modules/domain-node/src/test/resources/test-domains/dependencies/import2.dependencies (limited to 'sca-java-2.x/trunk') 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 dependencyURIs = new ArrayList(); - 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. -- cgit v1.2.3