diff options
author | Thomas Watson | 2005-03-10 23:05:26 +0000 |
---|---|---|
committer | Thomas Watson | 2005-03-10 23:05:26 +0000 |
commit | 79d784823a003d59071afc89bd5bbacf67b66af8 (patch) | |
tree | 8b0eb3eaab013f69e06e99309066245579c7aba9 /bundles/org.eclipse.osgi | |
parent | 1f47e02a18b3f46e486a9f410175db02131db254 (diff) | |
download | rt.equinox.framework-79d784823a003d59071afc89bd5bbacf67b66af8.tar.gz rt.equinox.framework-79d784823a003d59071afc89bd5bbacf67b66af8.tar.xz rt.equinox.framework-79d784823a003d59071afc89bd5bbacf67b66af8.zip |
Add support to export java specification profile packages from the system bundle.
Diffstat (limited to 'bundles/org.eclipse.osgi')
16 files changed, 502 insertions, 102 deletions
diff --git a/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile b/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile new file mode 100644 index 000000000..c77a5027f --- /dev/null +++ b/bundles/org.eclipse.osgi/CDC-1.0_Foundation-1.0.profile @@ -0,0 +1,12 @@ +############################################################################### +# Copyright (c) 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.microedition.io diff --git a/bundles/org.eclipse.osgi/J2SE-1.3.profile b/bundles/org.eclipse.osgi/J2SE-1.3.profile new file mode 100644 index 000000000..de9ed2795 --- /dev/null +++ b/bundles/org.eclipse.osgi/J2SE-1.3.profile @@ -0,0 +1,51 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi diff --git a/bundles/org.eclipse.osgi/J2SE-1.4.profile b/bundles/org.eclipse.osgi/J2SE-1.4.profile new file mode 100644 index 000000000..500b35900 --- /dev/null +++ b/bundles/org.eclipse.osgi/J2SE-1.4.profile @@ -0,0 +1,102 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stream,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.portable,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers diff --git a/bundles/org.eclipse.osgi/J2SE-1.5.profile b/bundles/org.eclipse.osgi/J2SE-1.5.profile new file mode 100644 index 000000000..e6b066b7e --- /dev/null +++ b/bundles/org.eclipse.osgi/J2SE-1.5.profile @@ -0,0 +1,127 @@ +############################################################################### +# Copyright (c) 2003, 2005 IBM Corporation and others. +# All rights reserved. This program and the accompanying materials +# are made available under the terms of the Eclipse Public License v1.0 +# which accompanies this distribution, and is available at +# http://www.eclipse.org/legal/epl-v10.html +# +# Contributors: +# IBM Corporation - initial API and implementation +############################################################################### +org.osgi.framework.system.packages = \ + javax.accessibility,\ + javax.activity,\ + javax.crypto,\ + javax.crypto.interfaces,\ + javax.crypto.spec,\ + javax.imageio,\ + javax.imageio.event,\ + javax.imageio.metadata,\ + javax.imageio.plugins.bmp,\ + javax.imageio.plugins.jpeg,\ + javax.imageio.spi,\ + javax.imageio.stream,\ + javax.management,\ + javax.management.loading,\ + javax.management.modelmbean,\ + javax.management.monitor,\ + javax.management.openmbean,\ + javax.management.relation,\ + javax.management.remote,\ + javax.management.remote.rmi,\ + javax.management.timer,\ + javax.naming,\ + javax.naming.directory,\ + javax.naming.event,\ + javax.naming.ldap,\ + javax.naming.spi,\ + javax.net,\ + javax.net.ssl,\ + javax.print,\ + javax.print.attribute,\ + javax.print.attribute.standard,\ + javax.print.event,\ + javax.rmi,\ + javax.rmi.CORBA,\ + javax.rmi.ssl,\ + javax.security.auth,\ + javax.security.auth.callback,\ + javax.security.auth.kerberos,\ + javax.security.auth.login,\ + javax.security.auth.spi,\ + javax.security.auth.x500,\ + javax.security.cert,\ + javax.security.sasl,\ + javax.sound.midi,\ + javax.sound.midi.spi,\ + javax.sound.sampled,\ + javax.sound.sampled.spi,\ + javax.sql,\ + javax.sql.rowset,\ + javax.sql.rowset.serial,\ + javax.sql.rowset.spi,\ + javax.swing,\ + javax.swing.border,\ + javax.swing.colorchooser,\ + javax.swing.event,\ + javax.swing.filechooser,\ + javax.swing.plaf,\ + javax.swing.plaf.basic,\ + javax.swing.plaf.metal,\ + javax.swing.plaf.multi,\ + javax.swing.plaf.synth,\ + javax.swing.table,\ + javax.swing.text,\ + javax.swing.text.html,\ + javax.swing.text.html.parser,\ + javax.swing.text.rtf,\ + javax.swing.tree,\ + javax.swing.undo,\ + javax.transaction,\ + javax.transaction.xa,\ + javax.xml,\ + javax.xml.datatype,\ + javax.xml.namespace,\ + javax.xml.parsers,\ + javax.xml.transform,\ + javax.xml.transform.dom,\ + javax.xml.transform.sax,\ + javax.xml.transform.stream,\ + javax.xml.validation,\ + javax.xml.xpath,\ + org.ietf.jgss,\ + org.omg.CORBA,\ + org.omg.CORBA_2_3,\ + org.omg.CORBA_2_3.portable,\ + org.omg.CORBA.DynAnyPackage,\ + org.omg.CORBA.ORBPackage,\ + org.omg.CORBA.portable,\ + org.omg.CORBA.TypeCodePackage,\ + org.omg.CosNaming,\ + org.omg.CosNaming.NamingContextExtPackage,\ + org.omg.CosNaming.NamingContextPackage,\ + org.omg.Dynamic,\ + org.omg.DynamicAny,\ + org.omg.DynamicAny.DynAnyFactoryPackage,\ + org.omg.DynamicAny.DynAnyPackage,\ + org.omg.IOP,\ + org.omg.IOP.CodecFactoryPackage,\ + org.omg.IOP.CodecPackage,\ + org.omg.Messaging,\ + org.omg.PortableInterceptor,\ + org.omg.PortableInterceptor.ORBInitInfoPackage,\ + org.omg.PortableServer,\ + org.omg.PortableServer.CurrentPackage,\ + org.omg.PortableServer.POAManagerPackage,\ + org.omg.PortableServer.POAPackage,\ + org.omg.PortableServer.portable,\ + org.omg.PortableServer.ServantLocatorPackage,\ + org.omg.SendingContext,\ + org.omg.stub.java.rmi,\ + org.w3c.dom,\ + org.w3c.dom.bootstrap,\ + org.w3c.dom.events,\ + org.w3c.dom.ls,\ + org.xml.sax,\ + org.xml.sax.ext,\ + org.xml.sax.helpers diff --git a/bundles/org.eclipse.osgi/build.properties b/bundles/org.eclipse.osgi/build.properties index 5f435c926..4966c04aa 100644 --- a/bundles/org.eclipse.osgi/build.properties +++ b/bundles/org.eclipse.osgi/build.properties @@ -15,7 +15,8 @@ bin.includes = .options,\ about.html,\ eclipse.properties,\ META-INF/,\ - systembundle.properties + systembundle.properties,\ + *.profile src.includes=about.html ############################################################################### # The following configuration splits the framework code into the most diff --git a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java index ce2f07d05..42e8e33c9 100644 --- a/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java +++ b/bundles/org.eclipse.osgi/core/adaptor/org/eclipse/osgi/service/resolver/State.java @@ -153,7 +153,6 @@ public interface State { */ public void resolveConstraint(VersionConstraint constraint, BaseDescription supplier); - /** * Sets whether or not the given bundle is selected in this state. * <p> @@ -325,6 +324,7 @@ public interface State { * osgi.os - the platform operating system<br> * osgi.arch - the platform architecture<br> * osgi.ws - the platform windowing system<br> + * org.osgi.framework.system.packages - the packages exported by the system bundle <br> * <p> * The values used for the supported properties can be <tt>String</tt> type * to specify a single value for the property or they can by <tt>String[]</tt> @@ -332,7 +332,7 @@ public interface State { * @param platformProperties the platform properties of the state * @return false if the platformProperties specified do not change any of the * supported properties already set. If any of the supported property values - * are changed as a result of calling this method then true is returnd + * are changed as a result of calling this method then true is returned. */ public boolean setPlatformProperties(Dictionary platformProperties); } diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java index cea3331d4..b0a7d99bf 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Constants.java @@ -101,17 +101,17 @@ public class Constants implements org.osgi.framework.Constants { public static final String OSGI_CHECKSERVICECLASSSOURCE = "osgi.checkServiceClassSource"; //$NON-NLS-1$ public static final String OSGI_RESTRICTSERVICECLASSES = "osgi.restrictServiceClasses"; //$NON-NLS-1$ - /** Properties set by the framework */ - /** OSGI system package property */ - public static final String OSGI_SYSTEMPACKAGES = "osgi.framework.systempackages"; //$NON-NLS-1$ public static final String OSGI_FRAMEWORK_SYSTEM_PACKAGES = "org.osgi.framework.system.packages"; //$NON-NLS-1$ - + /** OSGi java profile; used to give a URL to a java profile */ + public static final String OSGI_JAVA_PROFILE = "osgi.java.profile"; //$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() { return INTERNAL_SYSTEM_BUNDLE; } + static void setInternalSymbolicName(String name) { INTERNAL_SYSTEM_BUNDLE = name; } @@ -139,7 +139,6 @@ public class Constants implements org.osgi.framework.Constants { // TODO should remove this!! public final static String PROVIDE_PACKAGE = "Provide-Package"; - /** * Manifest header attribute (named "reprovide") * for Require-Bundle @@ -199,5 +198,4 @@ public class Constants implements org.osgi.framework.Constants { // TODO should remove this!! public final static String REQUIRE_PACKAGES_ATTRIBUTE = "require-packages"; - } diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java index fdbd03fcb..60efa72e2 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java @@ -11,6 +11,7 @@ package org.eclipse.osgi.framework.internal.core; import java.io.*; +import java.net.*; import java.net.URL; import java.net.URLConnection; import java.security.*; @@ -54,7 +55,8 @@ public class Framework implements EventDispatcher, EventPublisher { protected ServiceRegistry serviceRegistry; //TODO This is duplicated from the adaptor, do we really gain ? /** next free service id. */ protected long serviceid; - + /** the VM profile (execution environment */ + private String vmProfile; /* * The following EventListeners objects keep track of event listeners * by BundleContext. Each element is a EventListeners that is the list @@ -206,6 +208,7 @@ public class Framework implements EventDispatcher, EventPublisher { e.printStackTrace(); throw new RuntimeException(NLS.bind(Msg.OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION, e.getMessage())); } + setSystemExports(); } /** @@ -285,22 +288,100 @@ public class Framework implements EventDispatcher, EventPublisher { } } } - value = properties.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ""); //$NON-NLS-1$ + setExecutionEnvironment(); + } + + private void setExecutionEnvironment() { + String value = properties.getProperty(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ""); //$NON-NLS-1$ String j2meConfig = properties.getProperty(Constants.J2ME_MICROEDITION_CONFIGURATION); String j2meProfile = properties.getProperty(Constants.J2ME_MICROEDITION_PROFILES); StringBuffer ee = new StringBuffer(value); if (j2meConfig != null && j2meConfig.length() > 0 && j2meProfile != null && j2meProfile.length() > 0) { + // save the vmProfile based off of the config and profile + vmProfile = j2meConfig + '_' + j2meProfile; int ic = value.indexOf(j2meConfig); + // append the profile only if it is not already present if (!(ic >= 0) || !(ic + j2meConfig.length() < value.length() && value.charAt(ic + j2meConfig.length()) == '/') || !(value.startsWith(j2meProfile, ic + j2meConfig.length() + 1))) { if (ee.length() > 0) { - ee.append(","); //$NON-NLS-1$ + ee.append(','); } ee.append(j2meConfig).append('/').append(j2meProfile); } + + } else if (value.length() > 0) { + // just use the first EE defined as our profile + StringTokenizer st = new StringTokenizer(value, ","); //$NON-NLS-1$ + vmProfile = st.nextToken().replace('/', '_'); + } else { + String javaSpecVersion = properties.getProperty("java.specification.version"); //$NON-NLS-1$ + // set the profile and EE based off of the java.specification.version + // TODO We assume J2SE here. need to support other profiles J2ME/J2EE ... + if (javaSpecVersion != null) { + StringTokenizer st = new StringTokenizer(javaSpecVersion, " _-"); //$NON-NLS-1$ + javaSpecVersion = st.nextToken(); + vmProfile = "J2SE-" + javaSpecVersion; //$NON-NLS-1$ + int index = value.indexOf(vmProfile); + if (index < 0) { + if (ee.length() > 0) + ee.append(','); + ee.append(vmProfile); + } + } } properties.put(Constants.FRAMEWORK_EXECUTIONENVIRONMENT, ee.toString()); } + private void setSystemExports() { + String systemExports = properties.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); + if (systemExports != null) + return; + InputStream in = findVMProfile(); + if (in == null) + return; + Properties vmPackages = new Properties(); + try { + vmPackages.load(new BufferedInputStream(in)); + } catch (IOException e) { + // do nothing + } finally { + try { + in.close(); + } catch (IOException ee) { + // do nothing + } + } + systemExports = vmPackages.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); + if (systemExports != null) + properties.put(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES, systemExports); + } + + private InputStream findVMProfile() { + URL url = null; + // check for the java profile property for a url + String propJavaProfile = System.getProperty(Constants.OSGI_JAVA_PROFILE); + if (propJavaProfile != null) + try { + // we assume a URL + url = new URL(propJavaProfile); + } catch (MalformedURLException e1) { + // TODO consider logging ... + } + if (url == null && vmProfile != null) { + // look for a profile in the system bundle based on the vm profile + String javaProfile = vmProfile + ".profile"; //$NON-NLS-1$ + url = systemBundle.getEntry(javaProfile); + if (url == null) + url = getClass().getResource(javaProfile); + } + if (url != null) + try { + return url.openStream(); + } catch (IOException e) { + // TODO consider logging ... + } + return null; + } + /** * This method return the state of the framework. * @@ -1263,9 +1344,13 @@ public class Framework implements EventDispatcher, EventPublisher { System.setSecurityManager(sm); return; } catch (ClassNotFoundException e) { + // do nothing } catch (ClassCastException e) { + // do nothing } catch (InstantiationException e) { + // do nothing } catch (IllegalAccessException e) { + // do nothing } throw new NoClassDefFoundError(securityManager); } diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java index 9423fd611..e78cb7d73 100644 --- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java +++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/PackageAdminImpl.java @@ -518,13 +518,25 @@ public class PackageAdminImpl implements PackageAdmin { } protected void setResolvedBundles(SystemBundle systemBundle) { + checkSystemBundle(systemBundle); + // Now set the actual state of the bundles from the persisted state. + State state = framework.adaptor.getState(); + BundleDescription[] descriptions = state.getBundles(); + for (int i = 0; i < descriptions.length; i++) { + long bundleId = descriptions[i].getBundleId(); + if (bundleId == 0) + continue; + setResolved(descriptions[i]); + } + } + + private void checkSystemBundle(SystemBundle systemBundle) { try { - // first check that the system bundle has not changed since - // last saved state. - BundleDescription newSystemBundle = framework.adaptor.getState().getFactory().createBundleDescription(systemBundle.getHeaders(""), systemBundle.getLocation(), 0); //$NON-NLS-1$ + // first check that the system bundle has not changed since last saved state. + State state = framework.adaptor.getState(); + BundleDescription newSystemBundle = state.getFactory().createBundleDescription(systemBundle.getHeaders(""), systemBundle.getLocation(), 0); //$NON-NLS-1$ if (newSystemBundle == null) throw new BundleException(Msg.OSGI_SYSTEMBUNDLE_DESCRIPTION_ERROR); //$NON-NLS-1$ - State state = framework.adaptor.getState(); BundleDescription oldSystemBundle = state.getBundle(0); if (oldSystemBundle != null) { boolean different = false; @@ -534,8 +546,8 @@ public class PackageAdminImpl implements PackageAdmin { // is up to date in the state. ExportPackageDescription[] oldPackages = oldSystemBundle.getExportPackages(); ExportPackageDescription[] newPackages = newSystemBundle.getExportPackages(); - if (oldPackages.length == newPackages.length) { - for (int i = 0; i < oldPackages.length; i++) { + if (oldPackages.length >= newPackages.length) { + for (int i = 0; i < newPackages.length; i++) { if (oldPackages[i].getName().equals(newPackages[i].getName())) { Object oldVersion = oldPackages[i].getVersion(); Object newVersion = newPackages[i].getVersion(); @@ -588,15 +600,5 @@ public class PackageAdminImpl implements PackageAdmin { e.printStackTrace(); throw new RuntimeException(NLS.bind(Msg.OSGI_SYSTEMBUNDLE_CREATE_EXCEPTION, e.getMessage())); //$NON-NLS-1$ } - - // Now set the actual state of the bundles from the persisted state. - State state = framework.adaptor.getState(); - BundleDescription[] descriptions = state.getBundles(); - for (int i = 0; i < descriptions.length; i++) { - long bundleId = descriptions[i].getBundleId(); - if (bundleId == 0) - continue; - setResolved(descriptions[i]); - } } } diff --git a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java index 2cc91b8f2..dcff49952 100644 --- a/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java +++ b/bundles/org.eclipse.osgi/defaultAdaptor/src/org/eclipse/osgi/framework/adaptor/core/SystemBundleData.java @@ -76,15 +76,6 @@ public class SystemBundleData extends AbstractBundleData { if (in == null) throw new BundleException(AdaptorMsg.SYSTEMBUNDLE_MISSING_MANIFEST); Headers systemManifest = Headers.parseManifest(in); - // check the OSGi system package property - // first check the OSGi R4 spec'ed property - String systemExportProp = System.getProperty(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES); - if (systemExportProp != null) - appendManifestValue(systemManifest, Constants.EXPORT_PACKAGE, systemExportProp); - // now check the original pre OSGi R4 property - systemExportProp = System.getProperty(Constants.OSGI_SYSTEMPACKAGES); - if (systemExportProp != null) - appendManifestValue(systemManifest, Constants.EXPORT_PACKAGE, systemExportProp); // now get any extra packages and services that the adaptor wants // to export and merge this into the system bundle's manifest String exportPackages = adaptor.getExportPackages(); diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java index 73c820e0c..20a3eb23f 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/BundleDescriptionImpl.java @@ -12,27 +12,25 @@ package org.eclipse.osgi.internal.resolver; import java.io.IOException; import java.util.*; -import java.util.Iterator; - import org.eclipse.osgi.framework.internal.core.Constants; import org.eclipse.osgi.framework.internal.core.KeyedElement; import org.eclipse.osgi.service.resolver.*; public class BundleDescriptionImpl extends BaseDescriptionImpl implements BundleDescription, KeyedElement { - static final int RESOLVED = 0x01; - static final int SINGLETON = 0x02; - static final int REMOVAL_PENDING = 0x04; - static final int FULLY_LOADED = 0x08; - static final int LAZY_LOADED = 0x10; - static final int HAS_DYNAMICIMPORT = 0x20; - static final int ATTACH_FRAGMENTS = 0x40; - static final int DYNAMIC_FRAGMENTS = 0x80; + static final int RESOLVED = 0x01; + static final int SINGLETON = 0x02; + static final int REMOVAL_PENDING = 0x04; + static final int FULLY_LOADED = 0x08; + static final int LAZY_LOADED = 0x10; + static final int HAS_DYNAMICIMPORT = 0x20; + static final int ATTACH_FRAGMENTS = 0x40; + static final int DYNAMIC_FRAGMENTS = 0x80; // set to fully loaded and allow dynamic fragments by default private int stateBits = FULLY_LOADED | ATTACH_FRAGMENTS | DYNAMIC_FRAGMENTS; private long bundleId = -1; - private HostSpecification host; //null if the bundle is not a fragment + private HostSpecification host; //null if the bundle is not a fragment private StateImpl containingState; private Object userObject; @@ -84,9 +82,26 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle public ExportPackageDescription[] getExportPackages() { fullyLoad(); - if (lazyData.exportPackages == null) - return new ExportPackageDescription[0]; - return lazyData.exportPackages; + ExportPackageDescription[] result = lazyData.exportPackages; + if (Constants.getInternalSymbolicName().equals(getSymbolicName())) + result = mergeSystemExports(result); + if (result == null) + return new ExportPackageDescription[0]; + return result; + } + + private ExportPackageDescription[] mergeSystemExports(ExportPackageDescription[] existingExports) { + if (containingState == null) + return existingExports; + ExportPackageDescription[] systemExports = containingState.getSystemExports(); + if (systemExports == null || systemExports.length == 0) + return existingExports; + for (int i = 0; i < systemExports.length; i++) + ((ExportPackageDescriptionImpl) systemExports[i]).setExporter(this); + ExportPackageDescription[] allExports = new ExportPackageDescription[existingExports.length + systemExports.length]; + System.arraycopy(existingExports, 0, allExports, 0, existingExports.length); + System.arraycopy(systemExports, 0, allExports, existingExports.length, systemExports.length); + return allExports; } public boolean isResolved() { @@ -171,7 +186,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle lazyData.exportPackages = exportPackages; if (exportPackages != null) { for (int i = 0; i < exportPackages.length; i++) { - ((ExportPackageDescriptionImpl)exportPackages[i]).setExporter(this); + ((ExportPackageDescriptionImpl) exportPackages[i]).setExporter(this); } } } @@ -182,8 +197,8 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle 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); + ((ImportPackageSpecificationImpl) importPackages[i]).setBundleSymbolicName(Constants.getInternalSymbolicName()); + ((ImportPackageSpecificationImpl) importPackages[i]).setBundle(this); if ((importPackages[i].getResolution() & ImportPackageSpecification.RESOLUTION_DYNAMIC) != 0) stateBits |= HAS_DYNAMICIMPORT; } @@ -196,7 +211,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle 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]).setName(Constants.getInternalSymbolicName()); ((VersionConstraintImpl) requiredBundles[i]).setBundle(this); } } @@ -219,8 +234,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle stateBits |= LAZY_LOADED; else stateBits &= ~LAZY_LOADED; - } - else { + } else { stateBits &= ~LAZY_LOADED; } } @@ -229,7 +243,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle this.host = host; if (host != null) { if (Constants.OSGI_SYSTEM_BUNDLE.equals(host.getName())) - ((VersionConstraintImpl)host).setName(Constants.getInternalSymbolicName()); + ((VersionConstraintImpl) host).setName(Constants.getInternalSymbolicName()); ((VersionConstraintImpl) host).setBundle(this); } } @@ -247,7 +261,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle lazyData.selectedExports = selectedExports; if (selectedExports != null) { for (int i = 0; i < selectedExports.length; i++) { - ((ExportPackageDescriptionImpl)selectedExports[i]).setExporter(this); + ((ExportPackageDescriptionImpl) selectedExports[i]).setExporter(this); } } } @@ -284,19 +298,19 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle } /* TODO Determine if we need more than just Object ID type of hashcode. - public int hashCode() { - if (getSymbolicName() == null) - return (int) (bundleId % Integer.MAX_VALUE); - return (int) ((bundleId * (getSymbolicName().hashCode())) % Integer.MAX_VALUE); - } - */ + public int hashCode() { + if (getSymbolicName() == null) + return (int) (bundleId % Integer.MAX_VALUE); + return (int) ((bundleId * (getSymbolicName().hashCode())) % Integer.MAX_VALUE); + } + */ protected synchronized void removeDependencies() { if (dependencies == null) return; Iterator iter = dependencies.iterator(); while (iter.hasNext()) { - ((BundleDescriptionImpl)iter.next()).removeDependent(this); + ((BundleDescriptionImpl) iter.next()).removeDependent(this); } dependencies = null; } @@ -314,7 +328,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle dependencies = new ArrayList(10); BundleDescriptionImpl bundle; if (dependency instanceof ExportPackageDescription) - bundle = (BundleDescriptionImpl) ((ExportPackageDescription)dependency).getExporter(); + bundle = (BundleDescriptionImpl) ((ExportPackageDescription) dependency).getExporter(); else bundle = (BundleDescriptionImpl) dependency; if (!dependencies.contains(bundle)) { @@ -333,7 +347,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle ArrayList required = new ArrayList(dependencies.size()); for (Iterator iter = dependencies.iterator(); iter.hasNext();) { Object dep = iter.next(); - if (dep != this && dep instanceof BundleDescription && ((BundleDescription)dep).getHost() == null) + if (dep != this && dep instanceof BundleDescription && ((BundleDescription) dep).getHost() == null) required.add(dep); } return required; @@ -367,11 +381,10 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle } void setFullyLoaded(boolean fullyLoaded) { - if (fullyLoaded){ + if (fullyLoaded) { stateBits |= FULLY_LOADED; lazyTimeStamp = System.currentTimeMillis(); - } - else { + } else { stateBits &= ~FULLY_LOADED; } } @@ -434,7 +447,7 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle if (tempData == null || tempData.selectedExports == null) return; for (int i = 0; i < tempData.selectedExports.length; i++) - containingState.getReader().objectTable.remove(new Integer(((ExportPackageDescriptionImpl)tempData.selectedExports[i]).getTableIndex())); + containingState.getReader().objectTable.remove(new Integer(((ExportPackageDescriptionImpl) tempData.selectedExports[i]).getTableIndex())); } private void checkLazyData() { @@ -442,7 +455,6 @@ public class BundleDescriptionImpl extends BaseDescriptionImpl implements Bundle lazyData = new LazyData(); } - //TODO Consider usage of softReferences private final class LazyData { String location; String platformFilter; diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java index 084f37df5..f9c6fde08 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateBuilder.java @@ -63,7 +63,7 @@ class StateBuilder { ManifestElement[] reexports = ManifestElement.parseHeader(Constants.REEXPORT_PACKAGE, (String) manifest.get(Constants.REEXPORT_PACKAGE)); ManifestElement[] provides = ManifestElement.parseHeader(Constants.PROVIDE_PACKAGE, (String) manifest.get(Constants.PROVIDE_PACKAGE)); // TODO this is null for now until the framwork is updated to handle the new re-export semantics ArrayList providedExports = new ArrayList(provides == null ? 0 : provides.length); - result.setExportPackages(createExportPackages(result, exports, reexports, provides, providedExports, manifestVersion)); + result.setExportPackages(createExportPackages(exports, reexports, provides, providedExports, manifestVersion)); ManifestElement[] imports = ManifestElement.parseHeader(Constants.IMPORT_PACKAGE, (String) manifest.get(Constants.IMPORT_PACKAGE)); ManifestElement[] dynamicImports = ManifestElement.parseHeader(Constants.DYNAMICIMPORT_PACKAGE, (String) manifest.get(Constants.DYNAMICIMPORT_PACKAGE)); result.setImportPackages(createImportPackages(result.getExportPackages(), providedExports, imports, dynamicImports, manifestVersion)); @@ -166,7 +166,7 @@ class StateBuilder { return result; } - private static ExportPackageDescription[] createExportPackages(BundleDescriptionImpl bundle, ManifestElement[] exported, ManifestElement[] reexported, ManifestElement[] provides, ArrayList providedExports, int manifestVersion) throws BundleException { + static ExportPackageDescription[] createExportPackages(ManifestElement[] exported, ManifestElement[] reexported, ManifestElement[] provides, ArrayList providedExports, int manifestVersion) throws BundleException { int numExports = (exported == null ? 0 : exported.length) + (reexported == null ? 0 : reexported.length) + (provides == null ? 0 : provides.length); if (numExports == 0) return null; diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java index 50f914889..6a16adde2 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateImpl.java @@ -14,13 +14,16 @@ import java.util.*; import org.eclipse.osgi.framework.debug.Debug; import org.eclipse.osgi.framework.debug.DebugOptions; +import org.eclipse.osgi.framework.internal.core.*; import org.eclipse.osgi.framework.internal.core.KeyedElement; import org.eclipse.osgi.framework.internal.core.KeyedHashSet; import org.eclipse.osgi.service.resolver.*; +import org.eclipse.osgi.util.ManifestElement; +import org.osgi.framework.BundleException; import org.osgi.framework.Version; public abstract class StateImpl implements State { - public static final String[] PROPS = {"osgi.os", "osgi.ws", "osgi.nl", "osgi.arch"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + public static final String[] PROPS = {"osgi.os", "osgi.ws", "osgi.nl", "osgi.arch", Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ transient private Resolver resolver; transient private StateDeltaImpl changes; @@ -35,6 +38,7 @@ public abstract class StateImpl implements State { // only used for lazy loading of BundleDescriptions private StateReader reader; private Dictionary platformProperties = new Hashtable(4); // Dictionary here because of Filter API + private ExportPackageDescription[] systemExports = new ExportPackageDescription[0]; private static long cumulativeTime; @@ -66,11 +70,10 @@ public abstract class StateImpl implements State { if (resolver != null) { boolean pending = existing.getDependents().length > 0; resolver.bundleUpdated(newDescription, existing, pending); - if (pending){ + if (pending) { getDelta().recordBundleRemovalPending(existing); removalPendings.add(existing); - } - else { + } else { // an existing bundle has been updated with no dependents it can safely be unresolved now synchronized (this) { try { @@ -104,15 +107,13 @@ public abstract class StateImpl implements State { if (pending) { getDelta().recordBundleRemovalPending((BundleDescriptionImpl) toRemove); removalPendings.add(toRemove); - } - else { + } else { // a bundle has been removed with no dependents it can safely be unresolved now synchronized (this) { try { resolving = true; resolveBundle(toRemove, false, null, null, null, null); - } - finally { + } finally { resolving = false; } } @@ -162,7 +163,7 @@ public abstract class StateImpl implements State { public BundleDescription getBundle(String name, Version version) { for (Iterator i = bundleDescriptions.iterator(); i.hasNext();) { BundleDescription current = (BundleDescription) i.next(); - if (name.equals(current.getSymbolicName()) && current.getVersion().equals(version)) + if (name.equals(current.getSymbolicName()) && (version == null || current.getVersion().equals(version))) return current; } return null; @@ -177,7 +178,7 @@ public abstract class StateImpl implements State { } public void resolveConstraint(VersionConstraint constraint, BaseDescription supplier) { - ((VersionConstraintImpl)constraint).setSupplier(supplier); + ((VersionConstraintImpl) constraint).setSupplier(supplier); } public void resolveBundle(BundleDescription bundle, boolean status, BundleDescription[] hosts, ExportPackageDescription[] selectedExports, BundleDescription[] resolvedRequires, ExportPackageDescription[] resolvedImports) { @@ -193,8 +194,7 @@ public abstract class StateImpl implements State { if (status) { resolveConstraints(modifiable, hosts, selectedExports, resolvedRequires, resolvedImports); resolvedBundles.add(modifiable); - } - else { + } else { // ensures no links are left unresolveConstraints(modifiable); // remove the bundle from the resolved pool @@ -215,14 +215,14 @@ public abstract class StateImpl implements State { if (hosts != null) { hostSpec.setHosts(hosts); for (int i = 0; i < hosts.length; i++) - ((BundleDescriptionImpl)hosts[i]).addDependency(bundle); + ((BundleDescriptionImpl) hosts[i]).addDependency(bundle); } } bundle.setSelectedExports(selectedExports); bundle.setResolvedRequires(resolvedRequires); bundle.setResolvedImports(resolvedImports); - + bundle.addDependencies(hosts); bundle.addDependencies(resolvedRequires); bundle.addDependencies(resolvedImports); @@ -233,7 +233,6 @@ public abstract class StateImpl implements State { if (host != null) host.setHosts(null); - bundle.setSelectedExports(null); bundle.setResolvedImports(null); bundle.setResolvedRequires(null); @@ -383,11 +382,11 @@ public abstract class StateImpl implements State { for (Iterator iter = bundleDescriptions.iterator(); iter.hasNext();) { BundleDescription bundle = (BundleDescription) iter.next(); HostSpecification hostSpec = bundle.getHost(); - + if (hostSpec != null) { BundleDescription[] hosts = hostSpec.getHosts(); if (hosts != null) - for(int i = 0; i < hosts.length; i++) + for (int i = 0; i < hosts.length; i++) if (hosts[i] == host) { fragments.add(bundle); break; @@ -408,6 +407,7 @@ public abstract class StateImpl implements State { void setFactory(StateObjectFactory factory) { this.factory = factory; } + public BundleDescription getBundleByLocation(String location) { for (Iterator i = bundleDescriptions.iterator(); i.hasNext();) { BundleDescription current = (BundleDescription) i.next(); @@ -465,7 +465,7 @@ public abstract class StateImpl implements State { private boolean setProps(Dictionary origProps, Dictionary newProps) { boolean changed = false; - for(int i = 0; i < PROPS.length; i++) { + for (int i = 0; i < PROPS.length; i++) { Object origProp = origProps.get(PROPS[i]); Object newProp = newProps.get(PROPS[i]); if (checkProp(origProp, newProp)) { @@ -474,6 +474,8 @@ public abstract class StateImpl implements State { origProps.remove(PROPS[i]); else origProps.put(PROPS[i], newProp); + if (PROPS[i].equals(Constants.OSGI_FRAMEWORK_SYSTEM_PACKAGES)) + setSystemExports((String) newProp); } } return changed; @@ -492,16 +494,18 @@ public abstract class StateImpl implements State { if (result == null) return null; // need to add the result to the list of resolved imports - ((BundleDescriptionImpl)importingBundle).addDynamicResolvedImport(result); + ((BundleDescriptionImpl) importingBundle).addDynamicResolvedImport(result); return result; } void setReader(StateReader reader) { this.reader = reader; } + StateReader getReader() { return reader; } + void fullyLoad() { if (fullyLoaded == true) return; @@ -510,14 +514,26 @@ public abstract class StateImpl implements State { fullyLoaded = true; } - void unloadLazyData(long expireTime) { long currentTime = System.currentTimeMillis(); BundleDescription[] bundles = getBundles(); // make sure no other thread is trying to unload or load synchronized (reader) { for (int i = 0; i < bundles.length; i++) - ((BundleDescriptionImpl)bundles[i]).unload(currentTime, expireTime); + ((BundleDescriptionImpl) bundles[i]).unload(currentTime, expireTime); } } + + void setSystemExports(String exportSpec) { + try { + ManifestElement[] elements = ManifestElement.parseHeader(Constants.EXPORT_PACKAGE, exportSpec); + systemExports = StateBuilder.createExportPackages(elements, null, null, null, 2); + } catch (BundleException e) { + // TODO consider throwing this... + } + } + + ExportPackageDescription[] getSystemExports() { + return systemExports; + } } diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java index 6aa1e6191..38d049797 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateManager.java @@ -100,9 +100,9 @@ public class StateManager implements PlatformAdmin, Runnable { private void initializeSystemState() { systemState.setResolver(getResolver(System.getSecurityManager() != null)); + lastTimeStamp = systemState.getTimeStamp(); if (systemState.setPlatformProperties(System.getProperties())) systemState.resolve(false); // cause a full resolve; some platform properties have changed - lastTimeStamp = systemState.getTimeStamp(); } public synchronized StateImpl createSystemState() { @@ -146,7 +146,7 @@ public class StateManager implements PlatformAdmin, Runnable { if (!(state instanceof UserState)) throw new IllegalArgumentException("Wrong state implementation"); //$NON-NLS-1$ if (state.getTimeStamp() != systemState.getTimeStamp()) - throw new BundleException(StateMsg.COMMIT_INVALID_TIMESTAMP); + throw new BundleException(StateMsg.COMMIT_INVALID_TIMESTAMP); StateDelta delta = state.compare(systemState); BundleDelta[] changes = delta.getChanges(); for (int i = 0; i < changes.length; i++) diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java index e1accbabf..84ec65094 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateReader.java @@ -83,7 +83,7 @@ class StateReader { int numProps = in.readInt(); for (int i = 0; i < numProps; i++) { Object value = readPlatformProp(in); - if (value != null) + if (value != null && i < StateImpl.PROPS.length) props.put(StateImpl.PROPS[i], value); } state.setPlatformProperties(props); @@ -131,7 +131,7 @@ class StateReader { int numProps = in.readInt(); for (int i = 0; i < numProps; i++) { Object value = readPlatformProp(in); - if (value != null) + if (value != null && i < StateImpl.PROPS.length) props.put(StateImpl.PROPS[i], value); } state.setPlatformProperties(props); diff --git a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java index b5ae64c37..4af9f94fc 100644 --- a/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java +++ b/bundles/org.eclipse.osgi/resolver/src/org/eclipse/osgi/internal/resolver/StateWriter.java @@ -80,6 +80,9 @@ class StateWriter { DataOutputStream outLazy = null; DataOutputStream outState = null; try { + // first clear the System exports because we don't want to persist them in the system + // bundles bundle description data + state.setSystemExports(null); BundleDescription[] bundles = state.getBundles(); StateHelperImpl.getInstance().sortBundles(bundles); // need to prime the object table with all bundles @@ -180,7 +183,7 @@ class StateWriter { private void writeBundleDescriptionLazyData(BundleDescription bundle, DataOutputStream out) throws IOException { int dataStart = out.size(); // save the offset of lazy data start int index = getFromObjectTable(bundle); - ((BundleDescriptionImpl)bundle).setLazyDataOffset(out.size()); + ((BundleDescriptionImpl) bundle).setLazyDataOffset(out.size()); out.writeInt(index); writeStringOrNull(bundle.getLocation(), out); @@ -229,7 +232,7 @@ class StateWriter { } // save the size of the lazy data - ((BundleDescriptionImpl)bundle).setLazyDataSize(out.size() - dataStart); + ((BundleDescriptionImpl) bundle).setLazyDataSize(out.size() - dataStart); } private void writeBundleSpec(BundleSpecificationImpl bundle, DataOutputStream out) throws IOException { |