diff options
author | Andrew Niefer | 2008-08-18 19:49:15 +0000 |
---|---|---|
committer | Andrew Niefer | 2008-08-18 19:49:15 +0000 |
commit | 93a1e7861434264ac723baa78c3e34db63d4b9d2 (patch) | |
tree | 56ccbd648630527ca6cac5df2235769225b6d0fc | |
parent | 899dea304c711b5f48448ff9a690b8fed489b25e (diff) | |
download | rt.equinox.p2-93a1e7861434264ac723baa78c3e34db63d4b9d2.tar.gz rt.equinox.p2-93a1e7861434264ac723baa78c3e34db63d4b9d2.tar.xz rt.equinox.p2-93a1e7861434264ac723baa78c3e34db63d4b9d2.zip |
bug 237662 - start levels from bundles info
3 files changed, 85 insertions, 3 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF index 977aa8803..b684be93b 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.frameworkadmin/META-INF/MANIFEST.MF @@ -8,7 +8,7 @@ Bundle-Localization: plugin Import-Package: org.eclipse.osgi.service.pluginconversion;version="1.0.0", org.osgi.framework;version="1.3.0", org.osgi.service.startlevel;version="1.0.0" -Export-Package: org.eclipse.equinox.internal.frameworkadmin.utils;x-friends:="org.eclipse.equinox.frameworkadmin.equinox", +Export-Package: org.eclipse.equinox.internal.frameworkadmin.utils;x-friends:="org.eclipse.equinox.frameworkadmin.equinox,org.eclipse.equinox.p2.metadata.generator", org.eclipse.equinox.internal.provisional.configuratormanipulator;x-internal:=true, org.eclipse.equinox.internal.provisional.frameworkadmin;x-friends:="org.eclipse.pde.p2.ui,org.eclipse.equinox.p2.touchpoint.eclipse,org.eclipse.equinox.p2.metadata.generator" Bundle-RequiredExecutionEnvironment: J2SE-1.4, diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF index 193eea6aa..dc57d2b86 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/META-INF/MANIFEST.MF @@ -11,6 +11,7 @@ Require-Bundle: org.eclipse.equinox.p2.core, Import-Package: javax.xml.parsers, org.eclipse.equinox.app;version="1.0.0", org.eclipse.equinox.internal.frameworkadmin.equinox, + org.eclipse.equinox.internal.frameworkadmin.utils, org.eclipse.equinox.internal.p2.artifact.repository, org.eclipse.equinox.internal.p2.metadata, org.eclipse.equinox.internal.p2.metadata.repository, diff --git a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/EclipseInstallGeneratorInfoProvider.java b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/EclipseInstallGeneratorInfoProvider.java index 026877b55..b59cb8c5d 100644 --- a/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/EclipseInstallGeneratorInfoProvider.java +++ b/bundles/org.eclipse.equinox.p2.metadata.generator/src/org/eclipse/equinox/internal/provisional/p2/metadata/generator/EclipseInstallGeneratorInfoProvider.java @@ -10,13 +10,13 @@ *******************************************************************************/ package org.eclipse.equinox.internal.provisional.p2.metadata.generator; -import java.io.File; -import java.io.IOException; +import java.io.*; import java.net.MalformedURLException; import java.net.URL; import java.util.*; import org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxFwConfigFileParser; import org.eclipse.equinox.internal.frameworkadmin.equinox.EquinoxManipulatorImpl; +import org.eclipse.equinox.internal.frameworkadmin.utils.Utils; import org.eclipse.equinox.internal.p2.core.helpers.ServiceHelper; import org.eclipse.equinox.internal.p2.metadata.generator.Activator; import org.eclipse.equinox.internal.p2.metadata.generator.Messages; @@ -44,6 +44,8 @@ public class EclipseInstallGeneratorInfoProvider implements IGeneratorInfo { private static final String ORG_ECLIPSE_EQUINOX_FRAMEWORKADMIN_EQUINOX = "org.eclipse.equinox.frameworkadmin.equinox"; //$NON-NLS-1$ private static final String ORG_ECLIPSE_EQUINOX_P2_RECONCILER_DROPINS = "org.eclipse.equinox.p2.reconciler.dropins"; //$NON-NLS-1$ + private static final String PARAMETER_BASEURL = "org.eclipse.equinox.simpleconfigurator.baseUrl"; //$NON-NLS-1$ + /* * TODO: Temporary for determining whether eclipse installs * in a profile should support backward compatibility @@ -242,6 +244,16 @@ public class EclipseInstallGeneratorInfoProvider implements IGeneratorInfo { String value = data.getFwIndependentProp(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL); if (value != null) { try { + //config.ini uses simpleconfigurator, read the bundles.info and replace the bundle infos + BundleInfo[] bundleInfos = readConfiguration(new URL(value)); + data.setBundles(bundleInfos); + } catch (MalformedURLException e1) { + // ignore + } catch (IOException e1) { + // ignore + } + + try { data.setFwIndependentProp(ORG_ECLIPSE_EQUINOX_SIMPLECONFIGURATOR_CONFIGURL, EquinoxManipulatorImpl.makeRelative(value, configLocation.toURL())); } catch (MalformedURLException e) { //ignore @@ -251,6 +263,75 @@ public class EclipseInstallGeneratorInfoProvider implements IGeneratorInfo { return data; } + public static BundleInfo[] readConfiguration(URL url) throws IOException { + List bundles = new ArrayList(); + try { + BufferedReader r = new BufferedReader(new InputStreamReader(url.openStream())); + String line; + try { + URL baseUrl = new URL(url, "./"); //$NON-NLS-1$ + while ((line = r.readLine()) != null) { + if (line.startsWith("#")) //$NON-NLS-1$ + continue; + line = line.trim();// symbolicName,version,location,startlevel,expectedState + if (line.length() == 0) + continue; + + // (expectedState is an integer). + if (line.startsWith(PARAMETER_BASEURL + "=")) { //$NON-NLS-1$ + String baseUrlSt = line.substring((PARAMETER_BASEURL + "=").length()); //$NON-NLS-1$ + if (!baseUrlSt.endsWith("/")) //$NON-NLS-1$ + baseUrlSt += "/"; //$NON-NLS-1$ + baseUrl = new URL(url, baseUrlSt); + continue; + } + StringTokenizer tok = new StringTokenizer(line, ",", true); //$NON-NLS-1$ + String symbolicName = tok.nextToken(); + if (symbolicName.equals(",")) //$NON-NLS-1$ + symbolicName = null; + else + tok.nextToken(); // , + + String version = tok.nextToken(); + if (version.equals(",")) //$NON-NLS-1$ + version = null; + else + tok.nextToken(); // , + + String urlSt = tok.nextToken(); + if (urlSt.equals(",")) { //$NON-NLS-1$ + if (symbolicName != null && version != null) + urlSt = symbolicName + "_" + version + ".jar"; //$NON-NLS-1$ //$NON-NLS-2$ + else + urlSt = null; + } else + tok.nextToken(); // , + try { + new URL(urlSt); + } catch (MalformedURLException e) { + urlSt = Utils.getUrlInFull(urlSt, baseUrl).toExternalForm(); + } + + int sl = Integer.parseInt(tok.nextToken().trim()); + tok.nextToken(); // , + boolean markedAsStarted = Boolean.valueOf(tok.nextToken()).booleanValue(); + + BundleInfo bInfo = new BundleInfo(symbolicName, version, urlSt, sl, markedAsStarted); + bundles.add(bInfo); + } + } finally { + try { + r.close(); + } catch (IOException ex) { + // ignore + } + } + } catch (MalformedURLException e) { + // TODO log something + } + return (BundleInfo[]) bundles.toArray(new BundleInfo[bundles.size()]); + } + public File getConfigurationLocation() { return configLocation; } |