diff options
author | Simon Kaegi | 2009-03-28 19:06:27 +0000 |
---|---|---|
committer | Simon Kaegi | 2009-03-28 19:06:27 +0000 |
commit | c486e771c93b3a811d318066f049dd92a659b849 (patch) | |
tree | fd04b58428916cb3348b4e8bd7e77552a636ba78 /bundles/org.eclipse.equinox.frameworkadmin.equinox | |
parent | 2e4a3600befa09abe88bb2744133cef4f8c92fc2 (diff) | |
download | rt.equinox.p2-c486e771c93b3a811d318066f049dd92a659b849.tar.gz rt.equinox.p2-c486e771c93b3a811d318066f049dd92a659b849.tar.xz rt.equinox.p2-c486e771c93b3a811d318066f049dd92a659b849.zip |
Bug 241477 [eclipse] better support for framework extensions via eclipse touchpoint
Diffstat (limited to 'bundles/org.eclipse.equinox.frameworkadmin.equinox')
3 files changed, 55 insertions, 19 deletions
diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java index b4579c5f3..f9b99cb5f 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxBundlesState.java @@ -388,10 +388,10 @@ public class EquinoxBundlesState implements BundlesState { } catch (FrameworkAdminRuntimeException e1) { Log.log(LogService.LOG_ERROR, "", e1); //$NON-NLS-1$ } - return createBundleInfo(toConvert, markedAsStarted, sl, location); + return createBundleInfo(toConvert, markedAsStarted, sl, location, null); } - private BundleInfo createBundleInfo(BundleDescription toConvert, boolean markedAsStarted, int sl, URI location) { + private BundleInfo createBundleInfo(BundleDescription toConvert, boolean markedAsStarted, int sl, URI location, String fragmentHost) { BundleInfo result = new BundleInfo(); result.setSymbolicName(toConvert.getSymbolicName()); result.setVersion(toConvert.getVersion().toString()); @@ -400,6 +400,7 @@ public class EquinoxBundlesState implements BundlesState { result.setMarkedAsStarted(markedAsStarted); result.setStartLevel(sl); result.setBundleId(toConvert.getBundleId()); + result.setFragmentHost(fragmentHost); return result; } @@ -429,12 +430,14 @@ public class EquinoxBundlesState implements BundlesState { e.printStackTrace(); throw new IllegalStateException("BundleDescription conversion problem" + e.getMessage()); //$NON-NLS-1$ //TODO path_fun } + String fragmentHost = null; BundleInfo original = (BundleInfo) bundleInfoMap.get(location); if (original != null) { markedAsStarted = original.isMarkedAsStarted(); sl = getStartLevel(original.getStartLevel()); + fragmentHost = original.getFragmentHost(); } - result[i] = createBundleInfo(bundles[i], markedAsStarted, sl, location); + result[i] = createBundleInfo(bundles[i], markedAsStarted, sl, location, fragmentHost); } return result; } diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java index bc68cc5d0..2f0cc301c 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxConstants.java @@ -45,6 +45,7 @@ public class EquinoxConstants { public static final String PROP_INITIAL_STARTLEVEL = "osgi.startLevel"; //$NON-NLS-1$ //The start level when the fwl start public static final String PROP_INSTALL = "osgi.install"; //$NON-NLS-1$ public static final String PROP_ECLIPSE_COMMANDS = "eclipse.commands"; //$NON-NLS-1$ + public static final String PROP_FW_EXTENSIONS = "osgi.framework.extensions"; //$NON-NLS-1$ public static final String PROP_OSGI_FW = "osgi.framework"; //$NON-NLS-1$ public static final String PROP_OSGI_SYSPATH = "osgi.syspath"; //$NON-NLS-1$ public static final String PROP_LAUNCHER_PATH = "osgi.launcherPath"; //$NON-NLS-1$ diff --git a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java index a5e4d294e..78b1c39a1 100644 --- a/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java +++ b/bundles/org.eclipse.equinox.frameworkadmin.equinox/src/org/eclipse/equinox/internal/frameworkadmin/equinox/EquinoxFwConfigFileParser.java @@ -19,6 +19,7 @@ import org.eclipse.equinox.internal.frameworkadmin.utils.Utils; import org.eclipse.equinox.internal.provisional.frameworkadmin.*; import org.eclipse.osgi.util.NLS; import org.osgi.framework.BundleContext; +import org.osgi.framework.Constants; import org.osgi.service.log.LogService; public class EquinoxFwConfigFileParser { @@ -83,14 +84,22 @@ public class EquinoxFwConfigFileParser { return BundleInfo.NO_LEVEL; } - private void readBundlesList(Manipulator manipulator, URI osgiInstallArea, String value) throws NumberFormatException { - BundleInfo[] bundles = parseBundleList(manipulator, value); - if (bundles == null) - return; - + private void readBundlesList(Manipulator manipulator, URI osgiInstallArea, Properties props) throws NumberFormatException { ConfigData configData = manipulator.getConfigData(); - for (int i = 0; i < bundles.length; i++) { - configData.addBundle(bundles[i]); + + BundleInfo[] fwExtensions = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_FW_EXTENSIONS)); + if (fwExtensions != null) { + for (int i = 0; i < fwExtensions.length; i++) { + fwExtensions[i].setFragmentHost(Constants.SYSTEM_BUNDLE_SYMBOLICNAME); + configData.addBundle(fwExtensions[i]); + } + } + + BundleInfo[] bundles = parseBundleList(manipulator, props.getProperty(EquinoxConstants.PROP_BUNDLES)); + if (bundles != null) { + for (int i = 0; i < bundles.length; i++) { + configData.addBundle(bundles[i]); + } } } @@ -139,21 +148,39 @@ public class EquinoxFwConfigFileParser { } private void writeBundlesList(File fwJar, Properties props, URI base, BundleInfo[] bundles) { - //framework jar does not get stored on the bundle list, figure out who that is. - StringBuffer osgiBundlesList = new StringBuffer(); + StringBuffer osgiFrameworkExtensionsList = new StringBuffer(); for (int j = 0; j < bundles.length; j++) { + BundleInfo bundle = bundles[j]; + + //framework jar does not get stored on the bundle list, figure out who that is. if (fwJar != null) { - if (URIUtil.sameURI(fwJar.toURI(), bundles[j].getLocation())) + if (URIUtil.sameURI(fwJar.toURI(), bundle.getLocation())) continue; - } else if (EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundles[j].getSymbolicName())) + } else if (EquinoxConstants.FW_SYMBOLIC_NAME.equals(bundle.getSymbolicName())) continue; - URI location = fwJar != null ? URIUtil.makeRelative(bundles[j].getLocation(), fwJar.getParentFile().toURI()) : bundles[j].getLocation(); - osgiBundlesList.append(toOSGiBundleListForm(bundles[j], location)); - if (j < bundles.length - 1) //If it is not the last entry add a comma to separate the entries + URI location = fwJar != null ? URIUtil.makeRelative(bundle.getLocation(), fwJar.getParentFile().toURI()) : bundle.getLocation(); + + String fragmentHost = bundle.getFragmentHost(); + boolean isFrameworkExtension = fragmentHost != null && (fragmentHost.startsWith(EquinoxConstants.FW_SYMBOLIC_NAME) || fragmentHost.startsWith(Constants.SYSTEM_BUNDLE_SYMBOLICNAME)); + + if (isFrameworkExtension) { + bundle.setStartLevel(BundleInfo.NO_LEVEL); + bundle.setMarkedAsStarted(false); + osgiFrameworkExtensionsList.append(toOSGiBundleListForm(bundle, location)); + osgiFrameworkExtensionsList.append(','); + } else { + osgiBundlesList.append(toOSGiBundleListForm(bundle, location)); osgiBundlesList.append(','); + } } + if (osgiFrameworkExtensionsList.length() > 0) + osgiFrameworkExtensionsList.deleteCharAt(osgiFrameworkExtensionsList.length() - 1); + props.setProperty(EquinoxConstants.PROP_FW_EXTENSIONS, osgiFrameworkExtensionsList.toString()); + + if (osgiBundlesList.length() > 0) + osgiBundlesList.deleteCharAt(osgiBundlesList.length() - 1); props.setProperty(EquinoxConstants.PROP_BUNDLES, osgiBundlesList.toString()); } @@ -195,7 +222,7 @@ public class EquinoxFwConfigFileParser { readLauncherPath(props, rootURI); readp2DataArea(props, configArea); readSimpleConfiguratorURL(props, configArea); - readBundlesList(manipulator, ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), props, launcherData).toURI(), props.getProperty(EquinoxConstants.PROP_BUNDLES)); + readBundlesList(manipulator, ParserUtils.getOSGiInstallArea(Arrays.asList(launcherData.getProgramArgs()), props, launcherData).toURI(), props); readInitialStartLeve(configData, props); readDefaultStartLevel(configData, props); // if (key.equals(EquinoxConstants.PROP_LAUNCHER_NAME)) @@ -204,7 +231,7 @@ public class EquinoxFwConfigFileParser { // if (key.equals(EquinoxConstants.PROP_LAUNCHER_PATH)) // if (launcherData.getLauncher() == null) // launcherPath = value; - String[] KNOWN_PROPERTIES = {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL}; + String[] KNOWN_PROPERTIES = {EquinoxConstants.PROP_BUNDLES, EquinoxConstants.PROP_FW_EXTENSIONS, EquinoxConstants.PROP_INITIAL_STARTLEVEL, EquinoxConstants.PROP_BUNDLES_STARTLEVEL}; top: for (Enumeration enumeration = props.keys(); enumeration.hasMoreElements();) { String key = (String) enumeration.nextElement(); for (int i = 0; i < KNOWN_PROPERTIES.length; i++) { @@ -497,6 +524,11 @@ public class EquinoxFwConfigFileParser { configProps.remove(key); continue; } + + if (key.equals(EquinoxConstants.PROP_FW_EXTENSIONS) && equalBundleLists(manipulator, value, sharedValue)) { + configProps.remove(key); + continue; + } } } |