Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java123
-rw-r--r--bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java38
-rw-r--r--bundles/org.eclipse.osgi/.settings/.api_filters115
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxSystemBundle.java41
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/Framework.java2
-rw-r--r--bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java19
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java87
-rw-r--r--bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/SystemBundle.java133
-rw-r--r--bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/FrameworkProperties.java8
9 files changed, 392 insertions, 174 deletions
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
index 4297fd85e..8cbb21a95 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/bundles/SystemBundleTests.java
@@ -19,7 +19,6 @@ import org.eclipse.osgi.launch.Equinox;
import org.eclipse.osgi.service.datalocation.Location;
import org.eclipse.osgi.tests.OSGiTestsActivator;
import org.osgi.framework.*;
-import org.osgi.framework.launch.SystemBundle;
public class SystemBundleTests extends AbstractBundleTests {
public static Test suite() {
@@ -30,10 +29,10 @@ public class SystemBundleTests extends AbstractBundleTests {
// simple test to create an embedded framework
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle01"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
try {
+ equinox.init();
equinox.start();
} catch (BundleException e) {
fail("Failed to start the framework", e); //$NON-NLS-1$
@@ -71,10 +70,11 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle02"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+
try {
+ equinox.init();
equinox.start();
} catch (BundleException e) {
fail("Failed to start the framework", e); //$NON-NLS-1$
@@ -115,9 +115,13 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/stop/ test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle03"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
BundleContext systemContext = equinox.getBundleContext();
@@ -143,9 +147,13 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle04"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
BundleContext systemContext = equinox.getBundleContext();
@@ -188,9 +196,13 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/install/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle05_1"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
BundleContext systemContext = equinox.getBundleContext();
@@ -234,9 +246,13 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/install/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle05_2"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
BundleContext systemContext = equinox.getBundleContext();
@@ -310,17 +326,25 @@ public class SystemBundleTests extends AbstractBundleTests {
// create multiple instances test
File config1 = OSGiTestsActivator.getContext().getDataFile("testSystemBundle06_1"); //$NON-NLS-1$
Properties configuration1 = new Properties();
- configuration1.put(SystemBundle.STORAGE, config1.getAbsolutePath());
- Equinox equinox1 = new Equinox();
- equinox1.init(configuration1);
+ configuration1.put(Constants.FRAMEWORK_STORAGE, config1.getAbsolutePath());
+ Equinox equinox1 = new Equinox(configuration1);
+ try {
+ equinox1.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox1.getState()); //$NON-NLS-1$
File config2 = OSGiTestsActivator.getContext().getDataFile("testSystemBundle06_2"); //$NON-NLS-1$
Properties configuration2 = new Properties();
- configuration2.put(SystemBundle.STORAGE, config2.getAbsolutePath());
- Equinox equinox2 = new Equinox();
- equinox2.init(configuration2);
+ configuration2.put(Constants.FRAMEWORK_STORAGE, config2.getAbsolutePath());
+ Equinox equinox2 = new Equinox(configuration2);
+ try {
+ equinox2.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox2.getState()); //$NON-NLS-1$
@@ -359,7 +383,7 @@ public class SystemBundleTests extends AbstractBundleTests {
}
assertEquals("Wrong state for SystemBundle", Bundle.RESOLVED, equinox1.getState()); //$NON-NLS-1$
- // put the framework 1 back to the RESOLVED state
+ // put the framework 2 back to the RESOLVED state
try {
equinox2.stop();
} catch (BundleException e) {
@@ -377,18 +401,17 @@ public class SystemBundleTests extends AbstractBundleTests {
// test init twice
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle07_01"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
-
- config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle07_02"); //$NON-NLS-1$
- configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
+ }
try {
- equinox.init(configuration);
- fail("Failed to throw illegal state exception on double init"); //$NON-NLS-1$
- } catch (IllegalStateException e) {
- // expected
+ equinox.init();
+ } catch (Exception e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
}
try {
@@ -401,10 +424,9 @@ public class SystemBundleTests extends AbstractBundleTests {
assertNotNull("SystemBundle context is null", systemContext); //$NON-NLS-1$
try {
- equinox.init(configuration);
- fail("Failed to throw illegal state exception on double init"); //$NON-NLS-1$
- } catch (IllegalStateException e) {
- // expected
+ equinox.init();
+ } catch (Exception e) {
+ fail("Unexpected exception in init()", e); //$NON-NLS-1$
}
ServiceReference[] refs = null;
@@ -436,10 +458,10 @@ public class SystemBundleTests extends AbstractBundleTests {
// create/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle08_1"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
try {
+ equinox.init();
equinox.start();
} catch (BundleException e) {
fail("Failed to start the framework", e); //$NON-NLS-1$
@@ -459,10 +481,10 @@ public class SystemBundleTests extends AbstractBundleTests {
config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle08_2"); //$NON-NLS-1$
configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- equinox.init(configuration);
-
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ equinox = new Equinox(configuration);
try {
+ equinox.init();
equinox.start();
} catch (BundleException e) {
fail("Failed to start the framework", e); //$NON-NLS-1$
@@ -498,9 +520,8 @@ public class SystemBundleTests extends AbstractBundleTests {
// test FrameworkUtil.createFilter
File config = OSGiTestsActivator.getContext().getDataFile("testSystemBundle09"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ Equinox equinox = new Equinox(configuration);
try {
equinox.start();
} catch (BundleException e) {
@@ -517,7 +538,7 @@ public class SystemBundleTests extends AbstractBundleTests {
try {
testFilterA.start();
} catch (BundleException e) {
- fail("Unexpected exception starting test bundle", e);
+ fail("Unexpected exception starting test bundle", e); //$NON-NLS-1$
}
try {
equinox.stop();
diff --git a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java
index d14df47b1..cbcbd9efe 100644
--- a/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java
+++ b/bundles/org.eclipse.osgi.tests/src/org/eclipse/osgi/tests/securityadmin/SecurityManagerTests.java
@@ -20,7 +20,6 @@ import org.eclipse.osgi.launch.Equinox;
import org.eclipse.osgi.tests.OSGiTestsActivator;
import org.eclipse.osgi.tests.bundles.AbstractBundleTests;
import org.osgi.framework.*;
-import org.osgi.framework.launch.SystemBundle;
import org.osgi.service.condpermadmin.*;
import org.osgi.service.permissionadmin.PermissionInfo;
@@ -93,10 +92,14 @@ public class SecurityManagerTests extends AbstractBundleTests {
public void testEnableSecurityManager01() {
File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager01"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- configuration.put(Framework.PROP_EQUINOX_SECURITY, Framework.SECURITY_OSGI);
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ configuration.put(Constants.FRAMEWORK_SECURITY, Framework.SECURITY_OSGI);
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception on init()", e); //$NON-NLS-1$
+ }
assertNotNull("SecurityManager is null", System.getSecurityManager()); //$NON-NLS-1$
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
@@ -125,10 +128,15 @@ public class SecurityManagerTests extends AbstractBundleTests {
// create/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testEnableSecurityManager02"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- configuration.put(Framework.PROP_EQUINOX_SECURITY, Framework.SECURITY_OSGI);
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ configuration.put(Constants.FRAMEWORK_SECURITY, Framework.SECURITY_OSGI);
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception on init()", e); //$NON-NLS-1$
+ }
+
assertNotNull("SecurityManager is null", System.getSecurityManager()); //$NON-NLS-1$
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
@@ -172,10 +180,14 @@ public class SecurityManagerTests extends AbstractBundleTests {
// create/start/stop/start/stop test
File config = OSGiTestsActivator.getContext().getDataFile("testLocalization01"); //$NON-NLS-1$
Properties configuration = new Properties();
- configuration.put(SystemBundle.STORAGE, config.getAbsolutePath());
- configuration.put(Framework.PROP_EQUINOX_SECURITY, Framework.SECURITY_OSGI);
- Equinox equinox = new Equinox();
- equinox.init(configuration);
+ configuration.put(Constants.FRAMEWORK_STORAGE, config.getAbsolutePath());
+ configuration.put(Constants.FRAMEWORK_SECURITY, Framework.SECURITY_OSGI);
+ Equinox equinox = new Equinox(configuration);
+ try {
+ equinox.init();
+ } catch (BundleException e) {
+ fail("Unexpected exception on init()", e); //$NON-NLS-1$
+ }
assertNotNull("SecurityManager is null", System.getSecurityManager()); //$NON-NLS-1$
// should be in the STARTING state
assertEquals("Wrong state for SystemBundle", Bundle.STARTING, equinox.getState()); //$NON-NLS-1$
diff --git a/bundles/org.eclipse.osgi/.settings/.api_filters b/bundles/org.eclipse.osgi/.settings/.api_filters
index d1bb3df36..cf9ccba78 100644
--- a/bundles/org.eclipse.osgi/.settings/.api_filters
+++ b/bundles/org.eclipse.osgi/.settings/.api_filters
@@ -57,13 +57,6 @@
</message_arguments>
</filter>
</resource>
-<resource path="osgi/src/org/osgi/framework/hooks/service/ListenerHook.java" type="org.osgi.framework.hooks.service.ListenerHook">
-<filter id="1110441988">
-<message_arguments>
-<message_argument value="org.osgi.framework.hooks.service.ListenerHook"/>
-</message_arguments>
-</filter>
-</resource>
<resource path="osgi/src/org/osgi/service/condpermadmin/ConditionalPermissionAdmin.java" type="org.osgi.service.condpermadmin.ConditionalPermissionAdmin">
<filter id="1209008130">
<message_arguments>
@@ -72,17 +65,17 @@
<message_argument value="createConditionalPermissionInfoBase(String, ConditionInfo[], PermissionInfo[], String)"/>
</message_arguments>
</filter>
-<filter id="1209008130">
+<filter id="403804204">
<message_arguments>
-<message_argument value="1.1"/>
-<message_argument value="3.4"/>
<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"/>
+<message_argument value="createConditionalPermissionInfoBase(String, ConditionInfo[], PermissionInfo[], String)"/>
</message_arguments>
</filter>
-<filter id="403804204">
+<filter id="1209008130">
<message_arguments>
+<message_argument value="1.1"/>
+<message_argument value="3.4"/>
<message_argument value="org.osgi.service.condpermadmin.ConditionalPermissionAdmin"/>
-<message_argument value="createConditionalPermissionInfoBase(String, ConditionInfo[], PermissionInfo[], String)"/>
</message_arguments>
</filter>
<filter id="1209008130">
@@ -99,7 +92,67 @@
</message_arguments>
</filter>
</resource>
+<resource path="osgi/src/org/osgi/framework/hooks/service/ListenerHook.java" type="org.osgi.framework.hooks.service.ListenerHook">
+<filter id="1110441988">
+<message_arguments>
+<message_argument value="org.osgi.framework.hooks.service.ListenerHook"/>
+</message_arguments>
+</filter>
+</resource>
<resource path="osgi/src/org/osgi/framework/Constants.java" type="org.osgi.framework.Constants">
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_LIBRARY_EXTENSIONS"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_ROOT_CERTIFICATES"/>
+</message_arguments>
+</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_ROOT_CERTIFICATES"/>
+</message_arguments>
+</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_EXECPERMISSION"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_SECURITY"/>
+</message_arguments>
+</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_LIBRARY_EXTENSIONS"/>
+</message_arguments>
+</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_STORAGE"/>
+</message_arguments>
+</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_WINDOWSYSTEM"/>
+</message_arguments>
+</filter>
<filter id="1209008130">
<message_arguments>
<message_argument value="1.5"/>
@@ -107,12 +160,50 @@
<message_argument value="SERVICE_TYPE"/>
</message_arguments>
</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_BEGINNING_STARTLEVEL"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_EXECPERMISSION"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_STORAGE"/>
+</message_arguments>
+</filter>
<filter id="403767336">
<message_arguments>
<message_argument value="org.osgi.framework.Constants"/>
<message_argument value="SERVICE_TYPE"/>
</message_arguments>
</filter>
+<filter id="1209008130">
+<message_arguments>
+<message_argument value="1.5"/>
+<message_argument value="3.5"/>
+<message_argument value="FRAMEWORK_SECURITY"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_WINDOWSYSTEM"/>
+</message_arguments>
+</filter>
+<filter id="403767336">
+<message_arguments>
+<message_argument value="org.osgi.framework.Constants"/>
+<message_argument value="FRAMEWORK_BEGINNING_STARTLEVEL"/>
+</message_arguments>
+</filter>
</resource>
<resource path="osgi/src/org/osgi/util/tracker/BundleTracker.java" type="org.osgi.util.tracker.BundleTracker">
<filter id="1108344834">
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxSystemBundle.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxSystemBundle.java
index bfd0c23ab..b179c1663 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxSystemBundle.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/framework/internal/core/EquinoxSystemBundle.java
@@ -26,12 +26,17 @@ public class EquinoxSystemBundle implements SystemBundle {
private static String FULLPATH = " [fullpath]"; //$NON-NLS-1$
private volatile Framework framework;
private volatile Bundle systemBundle;
+ private final Map configuration;
- public void init(Properties configuration) {
- internalInit(configuration);
+ public EquinoxSystemBundle(Map configuration) {
+ this.configuration = configuration;
}
- private Framework internalInit(Properties configuration) {
+ public void init() {
+ internalInit();
+ }
+
+ private Framework internalInit() {
Framework current = framework;
if (current != null) {
// this is not really necessary because the Equinox class will
@@ -57,40 +62,40 @@ public class EquinoxSystemBundle implements SystemBundle {
return current;
}
- private void setEquinoxProperties(Properties configuration) {
+ private void setEquinoxProperties(Map configuration) {
// always need to use an active thread
FrameworkProperties.setProperty(Framework.PROP_FRAMEWORK_THREAD, Framework.THREAD_NORMAL);
// first check props we are required to provide reasonable defaults for
- String windowSystem = configuration == null ? null : configuration.getProperty(SystemBundle.WINDOWSYSTEM);
+ Object windowSystem = configuration == null ? null : configuration.get(Constants.FRAMEWORK_WINDOWSYSTEM);
if (windowSystem == null) {
windowSystem = FrameworkProperties.getProperty(EclipseStarter.PROP_WS);
if (windowSystem != null)
- FrameworkProperties.setProperty(SystemBundle.WINDOWSYSTEM, windowSystem);
+ FrameworkProperties.setProperty(Constants.FRAMEWORK_WINDOWSYSTEM, (String) windowSystem);
}
// rest of props can be ignored if the configuration is null
if (configuration == null)
return;
// check each osgi defined property and set the appropriate equinox one
- String security = configuration.getProperty(SystemBundle.SECURITY);
+ Object security = configuration.get(Constants.FRAMEWORK_SECURITY);
if (security != null) {
- if (Boolean.valueOf(security).booleanValue())
+ if (Framework.SECURITY_OSGI.equals(security))
FrameworkProperties.setProperty(Framework.PROP_EQUINOX_SECURITY, Framework.SECURITY_OSGI);
- else
- FrameworkProperties.setProperty(Framework.PROP_EQUINOX_SECURITY, security);
+ else if (security instanceof String)
+ FrameworkProperties.setProperty(Framework.PROP_EQUINOX_SECURITY, (String) security);
}
- String storage = configuration.getProperty(SystemBundle.STORAGE);
- if (storage != null) {
- FrameworkProperties.setProperty(LocationManager.PROP_CONFIG_AREA, storage);
- FrameworkProperties.setProperty(LocationManager.PROP_CONFIG_AREA_DEFAULT, storage);
+ Object storage = configuration.get(Constants.FRAMEWORK_STORAGE);
+ if (storage != null && storage instanceof String) {
+ FrameworkProperties.setProperty(LocationManager.PROP_CONFIG_AREA, (String) storage);
+ FrameworkProperties.setProperty(LocationManager.PROP_CONFIG_AREA_DEFAULT, (String) storage);
}
- String execPermission = configuration.getProperty(SystemBundle.EXECPERMISSION);
- if (execPermission != null) {
+ Object execPermissionObj = configuration.get(Constants.FRAMEWORK_EXECPERMISSION);
+ if (execPermissionObj != null && execPermissionObj instanceof String) {
+ String execPermission = (String) execPermissionObj;
if (!execPermission.endsWith(FULLPATH))
execPermission = execPermission + FULLPATH;
FrameworkProperties.setProperty("osgi.filepermissions.command", execPermission); //$NON-NLS-1$
}
-
}
public void waitForStop(long timeout) throws InterruptedException {
@@ -222,7 +227,7 @@ public class EquinoxSystemBundle implements SystemBundle {
if (getState() == Bundle.ACTIVE)
return;
if (getState() != Bundle.STARTING)
- current = internalInit(null);
+ current = internalInit();
current.startLevelManager.doSetStartLevel(1);
}
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 779dac5a8..d401374f4 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
@@ -573,6 +573,8 @@ public class Framework implements EventDispatcher, EventPublisher, Runnable {
*
*/
public synchronized void close() {
+ if (adaptor == null)
+ return;
if (active) {
shutdown();
}
diff --git a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
index 0ba29fc00..b9dfd9691 100644
--- a/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
+++ b/bundles/org.eclipse.osgi/core/framework/org/eclipse/osgi/launch/Equinox.java
@@ -12,6 +12,8 @@ package org.eclipse.osgi.launch;
import java.io.IOException;
import java.io.InputStream;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.net.URLClassLoader;
import java.util.*;
@@ -29,21 +31,28 @@ public class Equinox implements SystemBundle {
/**@GuardedBy this*/
private SystemBundle impl;
private final boolean useSeparateCL;
+ private final Map configuration;
- public Equinox() {
+ public Equinox(Map configuration) {
useSeparateCL = FrameworkProperties.inUse();
+ this.configuration = configuration;
}
private SystemBundle createImpl() {
try {
Class implClazz = getImplClass();
- return (SystemBundle) implClazz.newInstance();
+ Constructor constructor = implClazz.getConstructor(new Class[] {Map.class});
+ return (SystemBundle) constructor.newInstance(new Object[] {configuration});
} catch (ClassNotFoundException e) {
throw new NoClassDefFoundError(implName);
} catch (IllegalAccessException e) {
throw new RuntimeException(e.getMessage());
+ } catch (NoSuchMethodException e) {
+ throw new NoSuchMethodError(e.getMessage());
} catch (InstantiationException e) {
throw new RuntimeException(e.getMessage());
+ } catch (InvocationTargetException e) {
+ throw new RuntimeException(e.getMessage());
}
}
@@ -62,9 +71,9 @@ public class Equinox implements SystemBundle {
return impl;
}
- public void init(Properties configuration) {
+ public void init() throws BundleException {
if ((getState() & (Bundle.ACTIVE | Bundle.STARTING | Bundle.STOPPING)) != 0)
- throw new IllegalStateException("Framework is active!!");
+ return; // no op
synchronized (this) {
if (impl != null && impl.getState() != Bundle.INSTALLED) {
try {
@@ -78,7 +87,7 @@ public class Equinox implements SystemBundle {
impl = null;
}
}
- getImpl().init(configuration);
+ getImpl().init();
}
public void waitForStop(long timeout) throws InterruptedException {
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
index b6d7bf29f..262f80608 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/Constants.java
@@ -1,7 +1,7 @@
/*
- * $Date: 2008-08-04 12:32:08 -0400 (Mon, 04 Aug 2008) $
+ * $Date: 2008-09-10 20:26:25 -0400 (Wed, 10 Sep 2008) $
*
- * Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@ package org.osgi.framework;
* <code>java.lang.String</code>, unless otherwise indicated.
*
* @since 1.1
- * @version $Revision: 5248 $
+ * @version $Revision: 5591 $
*/
public interface Constants {
@@ -1125,4 +1125,85 @@ public interface Constants {
*/
public final static String ACTIVATION_LAZY = "lazy";
+ /**
+ * Specifies the the type of security manager the framework must use. If not
+ * specified then the framework will not set the VM security manager. The
+ * following types are defined:
+ * <ul>
+ * <li> osgi - Enables a security manager that supports all security aspects
+ * of the OSGi R4 specification (including postponed conditions).</li>
+ * </ul>
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_SECURITY = "org.osgi.framework.security";
+
+ /**
+ * A valid file path in the file system to a directory that exists. The
+ * framework is free to use this directory as it sees fit. This area can not
+ * be shared with anything else. If this property is not set, the framework
+ * should use a persistent storage area in the current directory with a
+ * framework implementation specific name.
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_STORAGE = "org.osgi.framework.storage";
+
+ /**
+ * A comma separated list of additional library file extensions that must be
+ * searched for when a bundle's class loader is searching for native
+ * libraries. If not set then only the library name returned by
+ * <code>System.mapLibraryName(String)</code> will be used to search. This
+ * is needed for certain operating systems which allow more than one
+ * extension for a library. For example AIX allows library extensions of
+ * <code>.a</code> and <code>.so</code>, but System.mapLibraryName(String)
+ * will only return names with the <code>.a</code> extension.
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_LIBRARY_EXTENSIONS = "org.osgi.framework.library.extensions";
+
+ /**
+ * Specifies an optional OS specific command to set file permissions on
+ * extracted native code. On some operating systems it is required that
+ * native libraries be set to executable. This optional property allows you
+ * to specify the command. For example, on a UNIX style OS you could have
+ * the following value:
+ *
+ * <pre>
+ * org.osgi.framework.command.execpermission = &quot;chmod +rx [fullpath]&quot;
+ * </pre>
+ *
+ * The [fullpath] is used to substitute the actual file path by the
+ * framework.
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_EXECPERMISSION = "org.osgi.framework.command.execpermission";
+
+ /**
+ * Points to a directory with certificates. ###??? Keystore? Certificate
+ * format?
+ *
+ * TODO Need to complete this description
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_ROOT_CERTIFICATES = "org.osgi.framework.root.certificates";
+
+ /**
+ * Specifies the current windowing system. The framework should provide a
+ * reasonable default if this is not set.
+ *
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_WINDOWSYSTEM = "org.osgi.framework.windowsystem";
+
+ /**
+ * Specifies the beginning start level of the framework.
+ *
+ * @see "Core Specification, section 8.2.3."
+ * @since 1.5
+ */
+ public final static String FRAMEWORK_BEGINNING_STARTLEVEL = "org.osgi.framework.startlevel";
} \ No newline at end of file
diff --git a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/SystemBundle.java b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/SystemBundle.java
index 8ace12328..a0c06edbf 100644
--- a/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/SystemBundle.java
+++ b/bundles/org.eclipse.osgi/osgi/src/org/osgi/framework/launch/SystemBundle.java
@@ -1,5 +1,5 @@
/*
- * $Date: 2008-07-31 14:34:04 -0400 (Thu, 31 Jul 2008) $
+ * $Date: 2008-09-10 20:26:25 -0400 (Wed, 10 Sep 2008) $
*
* Copyright (c) OSGi Alliance (2008). All Rights Reserved.
*
@@ -17,88 +17,85 @@
*/
package org.osgi.framework.launch;
-import java.util.Properties;
-
import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
/**
- * This interface should be implemented by framework implementations when their
- * main object is created. It allows a configurator to set the properties and
- * launch the framework.
+ * The System Bundle for a Framework instance.
+ *
+ * The <i>main</i> class of a framework implementation must implement this
+ * interface. The instantiator of the framework implementation class then has a
+ * System Bundle object and can then use the methods of this interface to manage
+ * and control the created framework instance.
*
- * TODO The javadoc in this class need a good scrub before release.
+ * <p>
+ * The <i>main</i> class of a framework implementation must provide a public
+ * constructor that takes a single argument of type <code>Map</code>. This
+ * configuration argument provides this System Bundle with framework properties
+ * to configure the framework instance. The framework instance must also examine
+ * the system properties for framework properties which are not set in the
+ * configuration argument. If framework properties are not provided by the
+ * configuration argument or the system properties, this System Bundle must use
+ * some reasonable default configuration appropriate for the current VM. For
+ * example, the system packages for the current execution environment should be
+ * properly exported. The configuration argument may be <code>null</code>.
+ *
+ * <p>
+ * A newly constructed System Bundle must be in the {@link Bundle#INSTALLED
+ * INSTALLED} state.
*
* @ThreadSafe
- * @version $Revision: 5214 $
+ * @version $Revision: 5591 $
*/
public interface SystemBundle extends Bundle {
/**
- * The name of a Security Manager class with public empty constructor. A
- * valid value is also true, this means that the framework should
- * instantiate its own security manager. If not set, security could be
- * defined by a parent framework or there is no security. This can be
- * detected by looking if there is a security manager set
- */
- String SECURITY = "org.osgi.framework.security";
-
- /**
- * A valid file path in the file system to a directory that exists. The
- * framework is free to use this directory as it sees fit. This area can not
- * be shared with anything else. If this property is not set, the framework
- * should use a file area from the parent bundle. If it is not embedded, it
- * must use a reasonable platform default.
- */
- String STORAGE = "org.osgi.framework.storage";
-
- /**
- * A list of paths (separated by path separator) that point to additional
- * directories to search for platform specific libraries
- */
- String LIBRARIES = "org.osgi.framework.libraries";
- /**
- * The command to give a file executable permission. This is necessary in
- * some environments for running shared libraries.
- */
- String EXECPERMISSION = "org.osgi.framework.command.execpermission";
-
- /**
- * Points to a directory with certificates. ###??? Keystore? Certificate
- * format?
- */
- String ROOT_CERTIFICATES = "org.osgi.framework.root.certificates";
-
- /**
- * Set by the configurator but the framework should provide a reasonable
- * default.
- */
- String WINDOWSYSTEM = "org.osgi.framework.windowsystem";
-
- /**
- * Configure this framework with the given properties. These properties can
- * contain framework specific properties or of the general kind defined in
- * the specification or in this interface.
+ * Initialize this System Bundle. After calling this method, this System
+ * Bundle must be in the {@link Bundle#STARTING STARTING} state and must
+ * have a valid Bundle Context.
+ *
+ * <p>
+ * During intialization, this System Bundle must also register
+ * {@link org.osgi.service.concurrent.ThreadFactory ThreadFactory} and
+ * {@link org.osgi.service.concurrent.AsyncExecutor AsyncExecutor} services.
+ * Implementations of these services may be passed to this System Bundle in
+ * the configuration argument using the service names as keys. If
+ * implementations of these services are not passed in the configuration
+ * argument, then this System Bundle must create and use a default
+ * implementation of each service.
+ *
+ * <p>
+ * This System Bundle will not actually be started until <code>start</code>
+ * is called. If this System Bundle is not initialized called prior to
+ * calling <code>start</code>, then the <code>start</code> method must
+ * initialize this System Bundle prior to starting.
*
- * @param configuration
- * The properties. This properties can be backed by another
- * properties, it can there not be assumed that it contains all
- * keys. Use it only through the getProperty methods. This
- * parameter may be null.
+ * <p>
+ * This method does nothing if called when this System Bundle is in the
+ * {@link Bundle#STARTING STARTING}, {@link Bundle#ACTIVE ACTIVE} or
+ * {@link Bundle#STOPPING STOPPING} states.
*
+ * @throws BundleException If this System Bundle could not be initialized.
*/
- void init(Properties configuration);
+ void init() throws BundleException;
/**
- * Wait until the framework is completely finished.
- *
- * This method will return if the framework is stopped and has cleaned up
- * all the framework resources.
- *
- * @param timeout
- * Maximum number of milliseconds to wait until the framework is
- * finished. Specifying a zero will wait indefinitely.
- * @throws InterruptedException When the wait was interrupted
+ * Wait until this System Bundle has completely stopped. The
+ * <code>stop</code> and <code>update</code> methods on a System Bundle
+ * performs an asynchronous stop of the System Bundle. This method can be
+ * used to wait until the asynchronous stop of this System Bundle has
+ * completed. This method will only wait if called when this System Bundle
+ * is in the {@link Bundle#STARTING STARTING}, {@link Bundle#ACTIVE ACTIVE},
+ * or {@link Bundle#STOPPING STOPPING} states. Otherwise it will return
+ * immediately.
*
+ * @param timeout Maximum number of milliseconds to wait until this System
+ * Bundle has completely stopped. A value of zero will wait
+ * indefinitely.
+ * @throws InterruptedException If another thread interrupted the current
+ * thread before or while the current thread was waiting for this
+ * System Bundle to completely stop. The <i>interrupted status</i>
+ * of the current thread is cleared when this exception is thrown.
+ * @throws IllegalArgumentException If the value of timeout is negative.
*/
-
void waitForStop(long timeout) throws InterruptedException;
}
diff --git a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/FrameworkProperties.java b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/FrameworkProperties.java
index 8455f820f..7aa798e9e 100644
--- a/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/FrameworkProperties.java
+++ b/bundles/org.eclipse.osgi/supplement/src/org/eclipse/osgi/framework/internal/core/FrameworkProperties.java
@@ -85,7 +85,7 @@ public class FrameworkProperties {
return properties;
}
- public static synchronized void setProperties(Properties input) {
+ public static synchronized void setProperties(Map input) {
if (input == null) {
// just use internal props; note that this will reuse a previous set of properties if they were set
internalGetProperties("false"); //$NON-NLS-1$
@@ -93,9 +93,9 @@ public class FrameworkProperties {
}
properties = null;
Properties toSet = internalGetProperties("false"); //$NON-NLS-1$
- for (Enumeration keys = input.keys(); keys.hasMoreElements();) {
- String key = (String) keys.nextElement();
- Object value = input.getProperty(key);
+ for (Iterator keys = input.keySet().iterator(); keys.hasNext();) {
+ String key = (String) keys.next();
+ Object value = input.get(key);
if (value != null) {
toSet.setProperty(key, (String) value);
continue;

Back to the top