summaryrefslogtreecommitdiffstats
path: root/java/sca
diff options
context:
space:
mode:
authorrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-01-30 18:13:35 +0000
committerrfeng <rfeng@13f79535-47bb-0310-9956-ffa450edef68>2009-01-30 18:13:35 +0000
commit6fc3757be0aa042914c44db4d39e9296a6a9dddf (patch)
treeb3c456a5ede474382bd651ce47174552fc191c1a /java/sca
parentd9a91cf827504cb664a5f11c37f88c2bc6670bdd (diff)
Set the default configuration area using a temp folder
git-svn-id: http://svn.us.apache.org/repos/asf/tuscany@739364 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to '')
-rw-r--r--java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java21
-rw-r--r--java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java2
2 files changed, 17 insertions, 6 deletions
diff --git a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
index 945e67cb3f..03c99a86c6 100644
--- a/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
+++ b/java/sca/modules/node-launcher-equinox/src/main/java/org/apache/tuscany/sca/node/equinox/launcher/EquinoxHost.java
@@ -30,6 +30,7 @@ import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.thir
import static org.apache.tuscany.sca.node.equinox.launcher.NodeLauncherUtil.thisBundleLocation;
import java.io.File;
+import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.net.MalformedURLException;
@@ -154,20 +155,28 @@ public class EquinoxHost {
logger.fine("Equinox location: " + root);
}
- put(props, LocationManager.PROP_INSTANCE_AREA, new File(root, "workspace").toURI().toString());
+ put(props, LocationManager.PROP_INSTANCE_AREA_DEFAULT, new File(root, "workspace").toURI().toString());
put(props, LocationManager.PROP_INSTALL_AREA, new File(root, "install").toURI().toString());
- put(props, LocationManager.PROP_CONFIG_AREA, new File(root, "config").toURI().toString());
- put(props, LocationManager.PROP_USER_AREA, new File(root, "user").toURI().toString());
+ put(props, LocationManager.PROP_CONFIG_AREA_DEFAULT, new File(root, "config").toURI().toString());
+ put(props, LocationManager.PROP_USER_AREA_DEFAULT, new File(root, "user").toURI().toString());
EclipseStarter.setInitialProperties(props);
// Test if the configuration/config.ini or osgi.bundles has been set
// If yes, try to avoid discovery of bundles
if (bundleLocations == null) {
- String config = props.getProperty(LocationManager.PROP_CONFIG_AREA);
- File ini = new File(config, "config.ini");
- if (ini.isFile() || props.getProperty("osgi.bundles") != null) {
+ if (props.getProperty("osgi.bundles") != null) {
bundleLocations = Collections.emptySet();
+ } else {
+ String config = props.getProperty(LocationManager.PROP_CONFIG_AREA);
+ File ini = new File(config, "config.ini");
+ if (ini.isFile()) {
+ Properties iniProps = new Properties();
+ iniProps.load(new FileInputStream(ini));
+ if (iniProps.getProperty("osgi.bundles") != null) {
+ bundleLocations = Collections.emptySet();
+ }
+ }
}
}
diff --git a/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java b/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java
index 6186b1799a..5cc40ca77f 100644
--- a/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java
+++ b/java/sca/modules/node-launcher-equinox/src/test/java/org/apache/tuscany/sca/node/equinox/launcher/NodeLauncherTestCase.java
@@ -33,6 +33,7 @@ public class NodeLauncherTestCase {
@BeforeClass
public static void setUp() {
+ System.setProperty("osgi.configuration.area", "target/equinox/configuration");
try {
launcher = NodeLauncher.newInstance();
} catch (Exception e) {
@@ -42,6 +43,7 @@ public class NodeLauncherTestCase {
@AfterClass
public static void tearDown() {
+ System.clearProperty("osgi.configuration.area");
if (launcher != null) {
launcher.destroy();
}