FELIX-1660: karaf should not hardcode the 'system' location of its maven like repository, patch provided by David Jencks
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@821901 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java b/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java
index 5a1d524..736be97 100644
--- a/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java
+++ b/karaf/main/src/main/java/org/apache/felix/karaf/main/Main.java
@@ -132,6 +132,8 @@
public static final String PROPERTY_LOCK_LEVEL = "karaf.lock.level";
+ public static final String DEFAULT_REPO = "karaf.default.repository";
+
public static final String PROPERTY_LOCK_CLASS_DEFAULT = SimpleFileLock.class.getName();
Logger LOG = Logger.getLogger(this.getClass().getName());
@@ -714,17 +716,10 @@
try {
File file = new File(new File(karafBase, "etc"), CONFIG_PROPERTIES_FILE_NAME);
- configPropURL = file.toURL();
+ configPropURL = file.toURI().toURL();
file = new File(new File(karafBase, "etc"), STARTUP_PROPERTIES_FILE_NAME);
- startupPropURL = file.toURL();
-
- if (karafBase.equals(karafHome)) {
- bundleDirs.add(new File(karafHome, "system"));
- } else {
- bundleDirs.add(new File(karafBase, "system"));
- bundleDirs.add(new File(karafHome, "system"));
- }
+ startupPropURL = file.toURI().toURL();
}
catch (MalformedURLException ex) {
@@ -736,6 +731,15 @@
Properties configProps = loadPropertiesFile(configPropURL);
Properties startupProps = loadPropertiesFile(startupPropURL);
+ String defaultRepo = configProps.getProperty(DEFAULT_REPO, "system");
+
+ if (karafBase.equals(karafHome)) {
+ bundleDirs.add(new File(karafHome, defaultRepo));
+ } else {
+ bundleDirs.add(new File(karafBase, defaultRepo));
+ bundleDirs.add(new File(karafHome, defaultRepo));
+ }
+
String locations = configProps.getProperty(BUNDLE_LOCATIONS);
if (locations != null) {
diff --git a/karaf/main/src/main/resources/config.properties b/karaf/main/src/main/resources/config.properties
index 100d484..6fe20f9 100644
--- a/karaf/main/src/main/resources/config.properties
+++ b/karaf/main/src/main/resources/config.properties
@@ -43,6 +43,7 @@
osgi.shell.telnet=on
#obr.repository.url=http://bundles.osgi.org/obr/browse?_xml=1&cmd=repository
+karaf.default.repository=system
#list of directories containing bundles to be loaded by SMX
#bundle.locations=