Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 88635 Details for
Bug 195281
Target platform should be able to specify different system.bundle
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
[patch]
equinox framework patch
195281.txt (text/plain), 36.41 KB, created by
Thomas Watson
on 2008-02-01 16:55:16 EST
(
hide
)
Description:
equinox framework patch
Filename:
MIME Type:
Creator:
Thomas Watson
Created:
2008-02-01 16:55:16 EST
Size:
36.41 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.osgi >Index: core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java,v >retrieving revision 1.22 >diff -u -r1.22 BundleRepository.java >--- core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java 10 Jan 2007 19:19:48 -0000 1.22 >+++ core/framework/org/eclipse/osgi/framework/internal/core/BundleRepository.java 1 Feb 2008 21:51:55 -0000 >@@ -59,7 +59,7 @@ > } > > public AbstractBundle[] getBundles(String symbolicName) { >- if (Constants.OSGI_SYSTEM_BUNDLE.equals(symbolicName)) >+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) > symbolicName = Constants.getInternalSymbolicName(); > return (AbstractBundle[]) bundlesBySymbolicName.get(symbolicName); > } >Index: core/framework/org/eclipse/osgi/framework/internal/core/Constants.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java,v >retrieving revision 1.33 >diff -u -r1.33 Constants.java >--- core/framework/org/eclipse/osgi/framework/internal/core/Constants.java 4 Feb 2007 00:21:45 -0000 1.33 >+++ core/framework/org/eclipse/osgi/framework/internal/core/Constants.java 1 Feb 2008 21:51:55 -0000 >@@ -98,7 +98,6 @@ > /** OSGI system package property */ > public static final String OSGI_FRAMEWORK_SYSTEM_PACKAGES = "org.osgi.framework.system.packages"; //$NON-NLS-1$ > public static final String OSGI_BOOTDELEGATION = "org.osgi.framework.bootdelegation"; //$NON-NLS-1$ >- public static final String OSGI_SYSTEM_BUNDLE = "system.bundle"; //$NON-NLS-1$ > private static String INTERNAL_SYSTEM_BUNDLE = "org.eclipse.osgi"; //$NON-NLS-1$ > > public static String getInternalSymbolicName() { >@@ -130,6 +129,8 @@ > public static final String STRICT_MODE = "strict"; //$NON-NLS-1$ > public static final String DEVELOPMENT_MODE = "development"; //$NON-NLS-1$ > >+ public static final String STATE_SYSTEM_BUNDLE = "osgi.system.bundle"; //$NON-NLS-1$ >+ > public static final String OSGI_FRAMEWORKBEGINNINGSTARTLEVEL = "osgi.framework.beginningstartlevel"; //$NON-NLS-1$ > > /** Properties defaults */ >@@ -232,12 +233,12 @@ > */ > public final static String REQUIRE_PACKAGES_ATTRIBUTE = "require-packages"; //$NON-NLS-1$ > >- /** >- * The key used to designate the buddy loader associated with a given bundle. >- */ >- public final static String BUDDY_LOADER = "Eclipse-BuddyPolicy"; //$NON-NLS-1$ >+ /** >+ * The key used to designate the buddy loader associated with a given bundle. >+ */ >+ public final static String BUDDY_LOADER = "Eclipse-BuddyPolicy"; //$NON-NLS-1$ > >- public final static String REGISTERED_POLICY = "Eclipse-RegisterBuddy"; //$NON-NLS-1$ >+ public final static String REGISTERED_POLICY = "Eclipse-RegisterBuddy"; //$NON-NLS-1$ > > /** > * Manifest header (named "Reexport-Package") identifying the >@@ -250,7 +251,7 @@ > * > * @deprecated > */ >- public final static String REEXPORT_PACKAGE = "Reexport-Package"; //$NON-NLS-1$ >+ public final static String REEXPORT_PACKAGE = "Reexport-Package"; //$NON-NLS-1$ > > static public final String INTERNAL_HANDLER_PKGS = "equinox.interal.handler.pkgs"; //$NON-NLS-1$ > >Index: resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java,v >retrieving revision 1.9 >diff -u -r1.9 VersionConstraintImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java 21 Feb 2005 23:09:54 -0000 1.9 >+++ resolver/src/org/eclipse/osgi/internal/resolver/VersionConstraintImpl.java 1 Feb 2008 21:51:56 -0000 >@@ -10,6 +10,7 @@ > *******************************************************************************/ > package org.eclipse.osgi.internal.resolver; > >+import org.eclipse.osgi.framework.internal.core.Constants; > import org.eclipse.osgi.service.resolver.*; > > public abstract class VersionConstraintImpl implements VersionConstraint { >@@ -19,6 +20,8 @@ > private BaseDescription supplier; > > public String getName() { >+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(name)) >+ return ((StateImpl) bundle.getContainingState()).getSystemBundle(); > return name; > } > >@@ -43,6 +46,7 @@ > public boolean isSatisfiedBy(BaseDescription supplier) { > return false; > } >+ > protected void setName(String name) { > this.name = name; > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java,v >retrieving revision 1.48 >diff -u -r1.48 StateBuilder.java >--- resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 10 Sep 2007 13:26:11 -0000 1.48 >+++ resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java 1 Feb 2008 21:51:56 -0000 >@@ -586,6 +586,7 @@ > if (elements.length == 0 || elements[0].getDirective(Constants.EXTENSION_DIRECTIVE) == null) > return; > String hostName = elements[0].getValue(); >+ // XXX: The extension bundle check is done against system.bundle and org.eclipse.osgi > if (!hostName.equals(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) && !hostName.equals(Constants.getInternalSymbolicName())) > throw new BundleException(NLS.bind(StateMsg.HEADER_EXTENSION_ERROR, hostName)); > } >Index: resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java,v >retrieving revision 1.15 >diff -u -r1.15 ImportPackageSpecificationImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java 10 May 2006 16:17:28 -0000 1.15 >+++ resolver/src/org/eclipse/osgi/internal/resolver/ImportPackageSpecificationImpl.java 1 Feb 2008 21:51:56 -0000 >@@ -46,6 +46,8 @@ > } > > public String getBundleSymbolicName() { >+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) >+ return ((StateImpl) getBundle().getContainingState()).getSystemBundle(); > return symbolicName; > } > >@@ -82,10 +84,10 @@ > return false; > } > } >- >- if (symbolicName != null) { >+ String exporterSymbolicName = getBundleSymbolicName(); >+ if (exporterSymbolicName != null) { > BundleDescription exporter = pkgDes.getExporter(); >- if (!symbolicName.equals(exporter.getSymbolicName())) >+ if (!exporterSymbolicName.equals(exporter.getSymbolicName())) > return false; > if (getBundleVersionRange() != null && !getBundleVersionRange().isIncluded(exporter.getVersion())) > return false; >@@ -116,7 +118,7 @@ > if (mandatory != null) { > for (int i = 0; i < mandatory.length; i++) { > if (Constants.BUNDLE_SYMBOLICNAME_ATTRIBUTE.equals(mandatory[i])) { >- if (symbolicName == null) >+ if (exporterSymbolicName == null) > return false; > } else if (Constants.BUNDLE_VERSION_ATTRIBUTE.equals(mandatory[i])) { > if (bundleVersionRange == null) >@@ -133,10 +135,10 @@ > } > } > // finally check the ee index >- if (((BundleDescriptionImpl)getBundle()).getEquinoxEE() < 0) >+ if (((BundleDescriptionImpl) getBundle()).getEquinoxEE() < 0) > return true; > int eeIndex = ((Integer) pkgDes.getDirective(ExportPackageDescriptionImpl.EQUINOX_EE)).intValue(); >- return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl)getBundle()).getEquinoxEE(); >+ return eeIndex < 0 || eeIndex == ((BundleDescriptionImpl) getBundle()).getEquinoxEE(); > } > > protected void setBundleSymbolicName(String symbolicName) { >Index: resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java,v >retrieving revision 1.68 >diff -u -r1.68 StateImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java 29 Jan 2008 18:13:12 -0000 1.68 >+++ resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java 1 Feb 2008 21:51:56 -0000 >@@ -27,7 +27,7 @@ > private static final String OSGI_WS = "osgi.ws"; //$NON-NLS-1$ > private static final String OSGI_NL = "osgi.nl"; //$NON-NLS-1$ > private static final String OSGI_ARCH = "osgi.arch"; //$NON-NLS-1$ >- public static final String[] PROPS = {OSGI_OS, OSGI_WS, OSGI_NL, OSGI_ARCH, Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, Constants.OSGI_RESOLVER_MODE, Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional", "osgi.genericAliases", Constants.FRAMEWORK_OS_NAME, Constants.FRAMEWORK_OS_VERSION, Constants.FRAMEWORK_PROCESSOR, Constants.FRAMEWORK_LANGUAGE}; //$NON-NLS-1$ //$NON-NLS-2$ >+ public static final String[] PROPS = {OSGI_OS, OSGI_WS, OSGI_NL, OSGI_ARCH, Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, Constants.OSGI_RESOLVER_MODE, Constants.FRAMEWORK_EXECUTIONENVIRONMENT, "osgi.resolveOptional", "osgi.genericAliases", Constants.FRAMEWORK_OS_NAME, Constants.FRAMEWORK_OS_VERSION, Constants.FRAMEWORK_PROCESSOR, Constants.FRAMEWORK_LANGUAGE, Constants.STATE_SYSTEM_BUNDLE}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ > private static final DisabledInfo[] EMPTY_DISABLEDINFOS = new DisabledInfo[0]; > transient private Resolver resolver; > transient private StateDeltaImpl changes; >@@ -80,7 +80,7 @@ > } > resolved = false; > getDelta().recordBundleAdded((BundleDescriptionImpl) description); >- if (Constants.getInternalSymbolicName().equals(description.getSymbolicName())) >+ if (getSystemBundle().equals(description.getSymbolicName())) > resetSystemExports(); > if (resolver != null) > resolver.bundleAdded(description); >@@ -111,7 +111,7 @@ > return false; > resolved = false; > getDelta().recordBundleUpdated((BundleDescriptionImpl) newDescription); >- if (Constants.getInternalSymbolicName().equals(newDescription.getSymbolicName())) >+ if (getSystemBundle().equals(newDescription.getSymbolicName())) > resetSystemExports(); > if (resolver != null) { > boolean pending = existing.getDependents().length > 0; >@@ -187,8 +187,8 @@ > } > > public BundleDescription[] getBundles(String symbolicName) { >- if (Constants.OSGI_SYSTEM_BUNDLE.equals(symbolicName)) >- symbolicName = Constants.getInternalSymbolicName(); >+ if (Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(symbolicName)) >+ symbolicName = getSystemBundle(); > final List bundles = new ArrayList(); > for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) { > BundleDescription bundle = (BundleDescription) iter.next(); >@@ -620,8 +620,10 @@ > String[] keys = getPlatformPropertyKeys(); > for (int i = 0; i < newPlatformProperties.length && !result; i++) { > result |= changedProps(this.platformProperties[i], newPlatformProperties[i], keys); >- if (resetSystemExports) >+ if (resetSystemExports) { > performResetSystemExports |= checkProp(this.platformProperties[i].get(Constants.FRAMEWORK_SYSTEMPACKAGES), newPlatformProperties[i].get(Constants.FRAMEWORK_SYSTEMPACKAGES)); >+ performResetSystemExports |= checkProp(this.platformProperties[i].get(Constants.SYSTEM_BUNDLE_SYMBOLICNAME), newPlatformProperties[i].get(Constants.SYSTEM_BUNDLE_SYMBOLICNAME)); >+ } > } > } > // always do a complete replacement of the properties in case new bundles are added that uses new filter props >@@ -632,7 +634,7 @@ > } > > private void resetSystemExports() { >- BundleDescription[] systemBundles = getBundles(Constants.getInternalSymbolicName()); >+ BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME); > if (systemBundles.length > 0) { > BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[0]; > ExportPackageDescription[] exports = systemBundle.getExportPackages(); >@@ -698,6 +700,13 @@ > return false; > } > >+ public String getSystemBundle() { >+ String symbolicName = null; >+ if (platformProperties != null && platformProperties.length > 0) >+ symbolicName = (String) platformProperties[0].get(Constants.STATE_SYSTEM_BUNDLE); //$NON-NLS-1$ >+ return symbolicName != null ? symbolicName : Constants.getInternalSymbolicName(); >+ } >+ > public BundleDescription[] getRemovalPendings() { > return (BundleDescription[]) removalPendings.toArray(new BundleDescription[removalPendings.size()]); > } >@@ -763,7 +772,7 @@ > > public ExportPackageDescription[] getSystemPackages() { > ArrayList result = new ArrayList(); >- BundleDescription[] systemBundles = getBundles(Constants.getInternalSymbolicName()); >+ BundleDescription[] systemBundles = getBundles(Constants.SYSTEM_BUNDLE_SYMBOLICNAME); > if (systemBundles.length > 0) { > BundleDescriptionImpl systemBundle = (BundleDescriptionImpl) systemBundles[0]; > ExportPackageDescription[] exports = systemBundle.getExportPackages(); >Index: resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java,v >retrieving revision 1.42 >diff -u -r1.42 BundleDescriptionImpl.java >--- resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 30 Jan 2008 20:41:05 -0000 1.42 >+++ resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java 1 Feb 2008 21:51:56 -0000 >@@ -220,8 +220,6 @@ > lazyData.importPackages = importPackages; > if (importPackages != null) { > for (int i = 0; i < importPackages.length; i++) { >- if (Constants.OSGI_SYSTEM_BUNDLE.equals(importPackages[i].getBundleSymbolicName())) >- ((ImportPackageSpecificationImpl) importPackages[i]).setBundleSymbolicName(Constants.getInternalSymbolicName()); > ((ImportPackageSpecificationImpl) importPackages[i]).setBundle(this); > if (ImportPackageSpecification.RESOLUTION_DYNAMIC.equals(importPackages[i].getDirective(Constants.RESOLUTION_DIRECTIVE))) > stateBits |= HAS_DYNAMICIMPORT; >@@ -234,8 +232,6 @@ > lazyData.requiredBundles = requiredBundles; > if (requiredBundles != null) > for (int i = 0; i < requiredBundles.length; i++) { >- if (Constants.OSGI_SYSTEM_BUNDLE.equals(requiredBundles[i].getName())) >- ((VersionConstraintImpl) requiredBundles[i]).setName(Constants.getInternalSymbolicName()); > ((VersionConstraintImpl) requiredBundles[i]).setBundle(this); > } > } >@@ -295,8 +291,6 @@ > protected void setHost(HostSpecification host) { > this.host = host; > if (host != null) { >- if (Constants.OSGI_SYSTEM_BUNDLE.equals(host.getName())) >- ((VersionConstraintImpl) host).setName(Constants.getInternalSymbolicName()); > ((VersionConstraintImpl) host).setBundle(this); > } > } >Index: defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorageHook.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorageHook.java,v >retrieving revision 1.14 >diff -u -r1.14 BaseStorageHook.java >--- defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorageHook.java 13 Sep 2007 20:12:03 -0000 1.14 >+++ defaultAdaptor/src/org/eclipse/osgi/internal/baseadaptor/BaseStorageHook.java 1 Feb 2008 21:51:55 -0000 >@@ -101,7 +101,7 @@ > if (host != null) { > bundleType |= BundleData.TYPE_FRAGMENT; > ManifestElement[] hostElement = ManifestElement.parseHeader(Constants.FRAGMENT_HOST, host); >- if (Constants.getInternalSymbolicName().equals(hostElement[0].getValue()) || Constants.OSGI_SYSTEM_BUNDLE.equals(hostElement[0].getValue())) { >+ if (Constants.getInternalSymbolicName().equals(hostElement[0].getValue()) || Constants.SYSTEM_BUNDLE_SYMBOLICNAME.equals(hostElement[0].getValue())) { > String extensionType = hostElement[0].getDirective("extension"); //$NON-NLS-1$ > if (extensionType == null || extensionType.equals("framework")) //$NON-NLS-1$ > bundleType |= BundleData.TYPE_FRAMEWORK_EXTENSION; >Index: resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java,v >retrieving revision 1.77 >diff -u -r1.77 ResolverImpl.java >--- resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 1 Feb 2008 18:46:13 -0000 1.77 >+++ resolver/src/org/eclipse/osgi/internal/module/ResolverImpl.java 1 Feb 2008 21:51:55 -0000 >@@ -12,6 +12,7 @@ > import org.eclipse.osgi.framework.adaptor.FrameworkAdaptor; > import org.eclipse.osgi.framework.debug.Debug; > import org.eclipse.osgi.framework.debug.FrameworkDebugOptions; >+import org.eclipse.osgi.framework.internal.core.Constants; > import org.eclipse.osgi.framework.internal.core.FrameworkProperties; > import org.eclipse.osgi.internal.module.GroupingChecker.PackageRoots; > import org.eclipse.osgi.internal.resolver.BundleDescriptionImpl; >@@ -361,6 +362,7 @@ > > if (!initialized) > initialize(); >+ // set developmentMode each resolution > developmentMode = platformProperties.length == 0 ? false : org.eclipse.osgi.framework.internal.core.Constants.DEVELOPMENT_MODE.equals(platformProperties[0].get(org.eclipse.osgi.framework.internal.core.Constants.OSGI_RESOLVER_MODE)); > reRefresh = addDevConstraints(reRefresh); > // Unresolve all the supplied bundles and their dependents >@@ -800,7 +802,7 @@ > Integer ee = (Integer) ((ResolverExport) suppliers[suppliersIndex]).getExportPackageDescription().getDirective(ExportPackageDescriptionImpl.EQUINOX_EE); > if (ee.intValue() >= 0) > continue; >- if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(FrameworkAdaptor.FRAMEWORK_SYMBOLICNAME) == null) >+ if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(getSystemBundle()) == null) > if (((ResolverExport) suppliers[suppliersIndex]).getExporter().getRequire(Constants.SYSTEM_BUNDLE_SYMBOLICNAME) == null) { > multipleImportSupplierList.add(imports[j]); > break; >@@ -849,6 +851,14 @@ > return (ResolverConstraint[][]) results.toArray(new ResolverConstraint[results.size()][]); > } > >+ String getSystemBundle() { >+ Dictionary[] platformProperties = state.getPlatformProperties(); >+ String systemBundle = (String) (platformProperties.length == 0 ? null : platformProperties[0].get(Constants.STATE_SYSTEM_BUNDLE)); >+ if (systemBundle == null) >+ systemBundle = Constants.getInternalSymbolicName(); >+ return systemBundle; >+ } >+ > private void addMergedSuppliers(ArrayList mergedSuppliers, HashMap constraints) { > for (Iterator iConstraints = constraints.values().iterator(); iConstraints.hasNext();) { > ArrayList mergedConstraintLists = (ArrayList) iConstraints.next(); >Index: resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java,v >retrieving revision 1.8 >diff -u -r1.8 VersionHashMap.java >--- resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java 15 Nov 2006 18:10:58 -0000 1.8 >+++ resolver/src/org/eclipse/osgi/internal/module/VersionHashMap.java 1 Feb 2008 21:51:55 -0000 >@@ -11,10 +11,8 @@ > package org.eclipse.osgi.internal.module; > > import java.util.*; >-import org.eclipse.osgi.framework.internal.core.Constants; > > public class VersionHashMap extends MappedList implements Comparator { >- private final String systemBundle = Constants.getInternalSymbolicName(); > private ResolverImpl resolver; > > public VersionHashMap(ResolverImpl resolver) { >@@ -103,6 +101,7 @@ > // if the selection policy is set then use that > if (resolver.getSelectionPolicy() != null) > return resolver.getSelectionPolicy().compare(vs1.getBaseDescription(), vs2.getBaseDescription()); >+ String systemBundle = resolver.getSystemBundle(); > if (systemBundle.equals(vs1.getBundle().getSymbolicName()) && !systemBundle.equals(vs2.getBundle().getSymbolicName())) > return -1; > else if (!systemBundle.equals(vs1.getBundle().getSymbolicName()) && systemBundle.equals(vs2.getBundle().getSymbolicName())) >#P org.eclipse.osgi.tests >Index: src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java,v >retrieving revision 1.26 >diff -u -r1.26 StateResolverTest.java >--- src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java 30 Jan 2008 20:49:10 -0000 1.26 >+++ src/org/eclipse/osgi/tests/services/resolver/StateResolverTest.java 1 Feb 2008 21:51:57 -0000 >@@ -2550,7 +2550,7 @@ > assertEquals("1.4", b1ResolvedImports[2].getExporter(), a1_100); > } > >- public void testPlatformProperties() throws BundleException { >+ public void testPlatformProperties01() throws BundleException { > State state = buildEmptyState(); > int bundleID = 0; > // test the selection algorithm of the resolver to pick the bundles which >@@ -2625,6 +2625,297 @@ > assertTrue("2.1", b_updated.getResolvedImports()[0].getExporter() == systemB); > } > >+ public void testPlatformProperties02() throws BundleException { >+ // same as 01 except use alias system.bundle to another name "test.system.bundle" >+ State state = buildEmptyState(); >+ int bundleID = 0; >+ // test the selection algorithm of the resolver to pick the bundles which >+ // resolve the largest set of bundles; with fragments using Import-Package >+ Hashtable manifest = new Hashtable(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "test.system.bundle"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, "test.system.bundle", bundleID++); >+ >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.b, pkg.system.b"); >+ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.4"); >+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, "A", bundleID++); >+ >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.EXPORT_PACKAGE, "pkg.b"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.b"); >+ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); >+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, "B", bundleID++); >+ >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "system.b"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.EXPORT_PACKAGE, "pkg.system.b"); >+ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); >+ BundleDescription systemB = state.getFactory().createBundleDescription(state, manifest, "system.b", bundleID++); >+ >+ Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; >+ props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.c"); >+ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); >+ props[0].put("osgi.system.bundle", "test.system.bundle"); // set the system.bundle to another system bundle (other than org.eclipse.osgi) >+ props[1].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b, pkg.system.c"); >+ props[1].put("org.osgi.framework.executionenvironment", "J2SE-1.4"); >+ >+ state.setPlatformProperties(props); >+ state.addBundle(systemBundle); >+ state.addBundle(a); >+ state.addBundle(b); >+ state.addBundle(systemB); >+ state.resolve(); >+ >+ assertTrue("1.0", systemBundle.isResolved()); >+ assertTrue("1.1", a.isResolved()); >+ assertTrue("1.2", b.isResolved()); >+ assertTrue("1.3", systemB.isResolved()); >+ >+ assertTrue("2.0", a.getResolvedImports()[1].getExporter() == systemBundle); >+ assertTrue("2.1", b.getResolvedImports()[0].getExporter() == systemB); >+ >+ // now test the uses clause for pkg.b such that bundle 'A' will be forced to used >+ // pkg.system from bundle 'system.b' >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.EXPORT_PACKAGE, "pkg.b; uses:=\"pkg.system.b\""); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.b"); >+ manifest.put(Constants.BUNDLE_REQUIREDEXECUTIONENVIRONMENT, "J2SE-1.2"); >+ BundleDescription b_updated = state.getFactory().createBundleDescription(state, manifest, "B", b.getBundleId()); >+ state.updateBundle(b_updated); >+ state.resolve(new BundleDescription[] {b_updated}); >+ >+ assertTrue("3.0", systemBundle.isResolved()); >+ assertTrue("3.1", a.isResolved()); >+ assertTrue("3.2", b_updated.isResolved()); >+ assertTrue("3.3", systemB.isResolved()); >+ >+ assertTrue("2.0", a.getResolvedImports()[1].getExporter() == systemB); >+ assertTrue("2.1", b_updated.getResolvedImports()[0].getExporter() == systemB); >+ } >+ >+ public void testPlatformProperties03() throws BundleException { >+ // test that require-bundle, fragment-host, and import-package of system.bundle can be aliased properly >+ State state = buildEmptyState(); >+ int bundleID = 0; >+ String configuredSystemBundle = "org.eclipse.osgi"; >+ // test the selection algorithm of the resolver to pick the bundles which >+ // resolve the largest set of bundles; with fragments using Import-Package >+ Hashtable manifest = new Hashtable(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); >+ manifest.put(Constants.EXPORT_PACKAGE, "system.bundle.exported.pkg"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle, bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.REQUIRE_BUNDLE, "system.bundle"); >+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, "A", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.REQUIRE_BUNDLE, configuredSystemBundle); >+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, "B", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"system.bundle\""); >+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, "C", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); >+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, "D", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.a; bundle-symbolic-name=\"system.bundle\""); >+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, "E", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.a; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); >+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, "F", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.FRAGMENT_HOST, "system.bundle"); >+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, "G", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.FRAGMENT_HOST, configuredSystemBundle); >+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, "H", bundleID++); >+ >+ Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; >+ props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b"); >+ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); >+ >+ state.setPlatformProperties(props); >+ state.addBundle(systemBundle); >+ state.addBundle(a); >+ state.addBundle(b); >+ state.addBundle(c); >+ state.addBundle(d); >+ state.addBundle(e); >+ state.addBundle(f); >+ state.addBundle(g); >+ state.addBundle(h); >+ state.resolve(); >+ >+ assertTrue("1.0", systemBundle.isResolved()); >+ assertTrue("1.1", a.isResolved()); >+ assertTrue("1.2", b.isResolved()); >+ assertTrue("1.3", c.isResolved()); >+ assertTrue("1.4", d.isResolved()); >+ assertTrue("1.5", e.isResolved()); >+ assertTrue("1.6", f.isResolved()); >+ assertTrue("1.7", g.isResolved()); >+ assertTrue("1.8", h.isResolved()); >+ >+ assertTrue("2.0", a.getResolvedRequires()[0] == systemBundle); >+ assertTrue("2.1", b.getResolvedRequires()[0] == systemBundle); >+ assertTrue("2.2", c.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.3", d.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.4", e.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.5", f.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.6", g.getHost().getHosts()[0] == systemBundle); >+ assertTrue("2.7", h.getHost().getHosts()[0] == systemBundle); >+ } >+ >+ public void testPlatformProperties04() throws BundleException { >+ // same as 03 except use a different system.bundle alias other than org.eclipse.osgi >+ // test that require-bundle, fragment-host, and import-package of system.bundle can be aliased properly >+ State state = buildEmptyState(); >+ int bundleID = 0; >+ String configuredSystemBundle = "test.system.bundle"; >+ // test the selection algorithm of the resolver to pick the bundles which >+ // resolve the largest set of bundles; with fragments using Import-Package >+ Hashtable manifest = new Hashtable(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, configuredSystemBundle); >+ manifest.put(Constants.EXPORT_PACKAGE, "system.bundle.exported.pkg"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ BundleDescription systemBundle = state.getFactory().createBundleDescription(state, manifest, configuredSystemBundle, bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "A"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.REQUIRE_BUNDLE, "system.bundle"); >+ BundleDescription a = state.getFactory().createBundleDescription(state, manifest, "A", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "B"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.REQUIRE_BUNDLE, configuredSystemBundle); >+ BundleDescription b = state.getFactory().createBundleDescription(state, manifest, "B", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "C"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"system.bundle\""); >+ BundleDescription c = state.getFactory().createBundleDescription(state, manifest, "C", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "D"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "system.bundle.exported.pkg; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); >+ BundleDescription d = state.getFactory().createBundleDescription(state, manifest, "D", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "E"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.a; bundle-symbolic-name=\"system.bundle\""); >+ BundleDescription e = state.getFactory().createBundleDescription(state, manifest, "E", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "F"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.IMPORT_PACKAGE, "pkg.system.a; bundle-symbolic-name=\"" + configuredSystemBundle + "\""); >+ BundleDescription f = state.getFactory().createBundleDescription(state, manifest, "F", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "G"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.FRAGMENT_HOST, "system.bundle"); >+ BundleDescription g = state.getFactory().createBundleDescription(state, manifest, "G", bundleID++); >+ >+ manifest.clear(); >+ manifest.put(Constants.BUNDLE_MANIFESTVERSION, "2"); >+ manifest.put(Constants.BUNDLE_SYMBOLICNAME, "H"); >+ manifest.put(Constants.BUNDLE_VERSION, "1.0"); >+ manifest.put(Constants.FRAGMENT_HOST, configuredSystemBundle); >+ BundleDescription h = state.getFactory().createBundleDescription(state, manifest, "H", bundleID++); >+ >+ Dictionary[] props = new Dictionary[] {new Hashtable(), new Hashtable()}; >+ props[0].put("org.osgi.framework.system.packages", "pkg.system.a, pkg.system.b"); >+ props[0].put("org.osgi.framework.executionenvironment", "J2SE-1.2"); >+ props[0].put("osgi.system.bundle", configuredSystemBundle); // set the system.bundle to another system bundle (other than org.eclipse.osgi) >+ >+ state.setPlatformProperties(props); >+ state.addBundle(systemBundle); >+ state.addBundle(a); >+ state.addBundle(b); >+ state.addBundle(c); >+ state.addBundle(d); >+ state.addBundle(e); >+ state.addBundle(f); >+ state.addBundle(g); >+ state.addBundle(h); >+ state.resolve(); >+ >+ assertTrue("1.0", systemBundle.isResolved()); >+ assertTrue("1.1", a.isResolved()); >+ assertTrue("1.2", b.isResolved()); >+ assertTrue("1.3", c.isResolved()); >+ assertTrue("1.4", d.isResolved()); >+ assertTrue("1.5", e.isResolved()); >+ assertTrue("1.6", f.isResolved()); >+ assertTrue("1.7", g.isResolved()); >+ assertTrue("1.8", h.isResolved()); >+ >+ assertTrue("2.0", a.getResolvedRequires()[0] == systemBundle); >+ assertTrue("2.1", b.getResolvedRequires()[0] == systemBundle); >+ assertTrue("2.2", c.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.3", d.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.4", e.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.5", f.getResolvedImports()[0].getExporter() == systemBundle); >+ assertTrue("2.6", g.getHost().getHosts()[0] == systemBundle); >+ assertTrue("2.7", h.getHost().getHosts()[0] == systemBundle); >+ } >+ > public void testPlatformPropertiesBug188075() throws BundleException, IOException { > State state = buildEmptyState(); > int bundleID = 0;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 195281
:
85263
|
85264
|
88074
|
88075
|
88229
|
88230
|
88231
|
88623
| 88635 |
89505