Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/EquinoxUtils.java
- +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/EquinoxUtils.java
- @@ -8,6 +8,7 @@
- ******************************************************************************/
- package org.eclipse.equinox.internal.simpleconfigurator.utils;
- +import java.io.File;
- import java.net.*;
- import org.eclipse.equinox.internal.simpleconfigurator.console.ConfiguratorCommandProvider;
- import org.eclipse.osgi.framework.console.CommandProvider;
- @@ -24,10 +25,20 @@ public class EquinoxUtils {
- URL baseURL = configLocation.getURL();
- if (configLocation.getParentLocation() != null && configLocation.getURL() != null) {
- - if (baseURL == null)
- + if (baseURL == null) {
- return new URL[] {configLocation.getParentLocation().getURL()};
- - else
- - return new URL[] {baseURL, configLocation.getParentLocation().getURL()};
- + } else {
- + File scatteredBundlesInfos = getScatteredBundleInfos();
- + if (scatteredBundlesInfos == null) {
- + return new URL[] {baseURL, configLocation.getParentLocation().getURL()};
- + } else {
- + try {
- + return new URL[] {baseURL, configLocation.getParentLocation().getURL(), scatteredBundlesInfos.toURL()};
- + } catch (MalformedURLException e) {
- + return new URL[] {baseURL, configLocation.getParentLocation().getURL()};
- + }
- + }
- + }
- }
- if (baseURL != null)
- return new URL[] {baseURL};
- @@ -35,6 +46,17 @@ public class EquinoxUtils {
- return null;
- }
- + private static File getScatteredBundleInfos() {
- + String scatteredBundlesInfoLocation = System.getProperty("org.eclipse.p2.bundlesinfofolder");
- + if (scatteredBundlesInfoLocation == null)
- + return null;
- + File f = new File(scatteredBundlesInfoLocation);
- + //various *.info folders will be located in that directory
- + if (f.exists() && f.isDirectory())
- + return f;
- + return null;
- + }
- +
- public static Location getConfigLocation(BundleContext context) {
- Filter filter = null;
- try {
- diff --git a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java b/bundles/org.eclipse
- index aa0235a..69981f7 100644
- --- a/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java
- +++ b/bundles/org.eclipse.equinox.simpleconfigurator/src/org/eclipse/equinox/internal/simpleconfigurator/utils/SimpleConfiguratorUtils.java
- @@ -27,6 +27,24 @@ public class SimpleConfiguratorUtils {
- private static final String ENCODED_COMMA = "%2C";
- public static List readConfiguration(URL url, URI base) throws IOException {
- + File f = new File(url.getFile());
- + if (f.isFile()) {
- + return readConfigurationFromFile(url, base);
- + } else {
- + ArrayList result = new ArrayList();
- + File[] listFiles = f.listFiles();
- + for (File file : listFiles) {
- + if (file.getName().endsWith(".info")) {
- + System.out.println("Reading configuration from file " + file.getName());
- + List list = readConfiguration(file.toURL(), base);
- + result.addAll(list);
- + }
- + }
- + return result;
- + }
- + }
- +
- + private static List readConfigurationFromFile(URL url, URI base) throws IOException {
- InputStream stream = null;
- try {
- stream = url.openStream();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement