Update to the R4.1 OSGi API. (FELIX-595)
git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@681793 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/org.osgi.core/pom.xml b/org.osgi.core/pom.xml
index 25c1c30..ec9914d 100644
--- a/org.osgi.core/pom.xml
+++ b/org.osgi.core/pom.xml
@@ -45,8 +45,8 @@
<Bundle-SymbolicName>org.osgi.core</Bundle-SymbolicName>
<Export-Package>org.osgi.framework, org.osgi.service.condpermadmin, org.osgi.service.packageadmin, org.osgi.service.permissionadmin, org.osgi.service.startlevel, org.osgi.service.url</Export-Package>
<Import-Package>org.osgi.framework,org.osgi.service.packageadmin,org.osgi.service.startlevel,org.osgi.service.url,!org.osgi.*,*</Import-Package>
- <Bundle-Version>4</Bundle-Version>
- <Bundle-Copyright>Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.</Bundle-Copyright>
+ <Bundle-Version>4.1</Bundle-Version>
+ <Bundle-Copyright>Copyright (c) OSGi Alliance (2000, 2007). All Rights Reserved.</Bundle-Copyright>
<Bundle-Category>osgi</Bundle-Category>
</instructions>
</configuration>
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/AdminPermission.java b/org.osgi.core/src/main/java/org/osgi/framework/AdminPermission.java
index 40cf9f3..396e114 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/AdminPermission.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/AdminPermission.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AdminPermission.java,v 1.29 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AdminPermission.java,v 1.34 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -23,40 +23,42 @@
import java.security.*;
/**
- * Indicates the caller's authority to perform specific privileged
- * administrative operations on or to get sensitive information about a bundle.
- * The actions for this permission are:
+ * A bundle's authority to perform specific privileged administrative operations
+ * on or to get sensitive information about a bundle. The actions for this
+ * permission are:
*
* <pre>
- * Action Methods
- * class Bundle.loadClass
- * execute Bundle.start
- * Bundle.stop
- * StartLevel.setBundleStartLevel
- * extensionLifecycle BundleContext.installBundle for extension bundles
- * Bundle.update for extension bundles
- * Bundle.uninstall for extension bundles
- * lifecycle BundleContext.installBundle
- * Bundle.update
- * Bundle.uninstall
- * listener BundleContext.addBundleListener for SynchronousBundleListener
- * BundleContext.removeBundleListener for SynchronousBundleListener
- * metadata Bundle.getHeaders
- * Bundle.getLocation
- * resolve PackageAdmin.refreshPackages
- * PackageAdmin.resolveBundles
- * resource Bundle.getResource
- * Bundle.getResources
- * Bundle.getEntry
- * Bundle.getEntryPaths
- * Bundle.findEntries
- * Bundle resource/entry URL creation
- * startlevel StartLevel.setStartLevel
- * StartLevel.setInitialBundleStartLevel
+ * Action Methods
+ * class Bundle.loadClass
+ * execute Bundle.start
+ * Bundle.stop
+ * StartLevel.setBundleStartLevel
+ * extensionLifecycle BundleContext.installBundle for extension bundles
+ * Bundle.update for extension bundles
+ * Bundle.uninstall for extension bundles
+ * lifecycle BundleContext.installBundle
+ * Bundle.update
+ * Bundle.uninstall
+ * listener BundleContext.addBundleListener for SynchronousBundleListener
+ * BundleContext.removeBundleListener for SynchronousBundleListener
+ * metadata Bundle.getHeaders
+ * Bundle.getLocation
+ * resolve PackageAdmin.refreshPackages
+ * PackageAdmin.resolveBundles
+ * resource Bundle.getResource
+ * Bundle.getResources
+ * Bundle.getEntry
+ * Bundle.getEntryPaths
+ * Bundle.findEntries
+ * Bundle resource/entry URL creation
+ * startlevel StartLevel.setStartLevel
+ * StartLevel.setInitialBundleStartLevel
+ * context Bundle.getBundleContext
+ *
* </pre>
*
* <p>
- * The special action "*" will represent all actions.
+ * The special action "*" will represent all actions.
* <p>
* The name of this permission is a filter expression. The filter gives access
* to the following parameters:
@@ -69,7 +71,8 @@
* <li>name - The symbolic name of a bundle.</li>
* </ul>
*
- * @version $Revision: 1.29 $
+ * @ThreadSafe
+ * @version $Revision: 1.34 $
*/
public final class AdminPermission extends BasicPermission {
@@ -122,6 +125,12 @@
*/
public final static String STARTLEVEL = "startlevel";
+ /**
+ * The action string <code>context</code> (Value is "context").
+ * @since 1.4
+ */
+ public final static String CONTEXT = "context";
+
/*
* NOTE: A framework implementor may also choose to replace this class in
* their distribution with a class that directly interfaces with the
@@ -135,50 +144,55 @@
* an instance of the vendor AdminPermission class will be created and this
* class will delegate method calls to the vendor AdminPermission instance.
*/
- private static final String packageProperty = "org.osgi.vendor.framework";
- private static final Constructor initStringString;
- private static final Constructor initBundleString;
- static {
- Constructor[] constructors = (Constructor[]) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
- String packageName = System
- .getProperty(packageProperty);
- if (packageName == null) {
- throw new NoClassDefFoundError(packageProperty
- + " property not set");
- }
- Class delegateClass;
- try {
- delegateClass = Class.forName(packageName
- + ".AdminPermission");
- }
- catch (ClassNotFoundException e) {
- throw new NoClassDefFoundError(e.toString());
- }
+ private static class ImplHolder implements PrivilegedAction {
+ private static final String packageProperty = "org.osgi.vendor.framework";
+ static final Constructor initStringString;
+ static final Constructor initBundleString;
+ static {
+ Constructor[] constructors = (Constructor[]) AccessController.doPrivileged(new ImplHolder());
+
+ initStringString = constructors[0];
+ initBundleString = constructors[1];
+ }
- Constructor[] result = new Constructor[2];
- try {
- result[0] = delegateClass
- .getConstructor(new Class[] {String.class,
- String.class });
- result[1] = delegateClass
- .getConstructor(new Class[] {Bundle.class,
- String.class });
- }
- catch (NoSuchMethodException e) {
- throw new NoSuchMethodError(e.toString());
- }
-
- return result;
- }
- });
-
- initStringString = constructors[0];
- initBundleString = constructors[1];
+ private ImplHolder() {
+ }
+
+ public Object run() {
+ String packageName = System
+ .getProperty(packageProperty);
+ if (packageName == null) {
+ throw new NoClassDefFoundError(packageProperty
+ + " property not set");
+ }
+
+ Class delegateClass;
+ try {
+ delegateClass = Class.forName(packageName
+ + ".AdminPermission");
+ }
+ catch (ClassNotFoundException e) {
+ throw new NoClassDefFoundError(e.toString());
+ }
+
+ Constructor[] result = new Constructor[2];
+ try {
+ result[0] = delegateClass
+ .getConstructor(new Class[] {String.class,
+ String.class });
+ result[1] = delegateClass
+ .getConstructor(new Class[] {Bundle.class,
+ String.class });
+ }
+ catch (NoSuchMethodException e) {
+ throw new NoSuchMethodError(e.toString());
+ }
+
+ return result;
+ }
}
-
+
/*
* This is the delegate permission created by the constructor.
*/
@@ -218,8 +232,8 @@
* @param actions <code>class</code>, <code>execute</code>,
* <code>extensionLifecycle</code>, <code>lifecycle</code>,
* <code>listener</code>, <code>metadata</code>,
- * <code>resolve</code>, <code>resource</code>, or
- * <code>startlevel</code>. A value of "*" or <code>null</code>
+ * <code>resolve</code>, <code>resource</code>,
+ * <code>startlevel</code> or <code>context</code>. A value of "*" or <code>null</code>
* indicates all actions
*/
public AdminPermission(String filter, String actions) {
@@ -228,7 +242,7 @@
super(filter == null ? "*" : filter);
try {
try {
- delegate = (Permission) initStringString
+ delegate = (Permission) ImplHolder.initStringString
.newInstance(new Object[] {filter, actions});
}
catch (InvocationTargetException e) {
@@ -255,14 +269,14 @@
* <code>extensionLifecycle</code>, <code>lifecycle</code>,
* <code>listener</code>, <code>metadata</code>,
* <code>resolve</code>, <code>resource</code>,
- * <code>startlevel</code>
+ * <code>startlevel</code>, <code>context</code>.
* @since 1.3
*/
public AdminPermission(Bundle bundle, String actions) {
super(createName(bundle));
try {
try {
- delegate = (Permission) initBundleString
+ delegate = (Permission) ImplHolder.initBundleString
.newInstance(new Object[] {bundle, actions});
}
catch (InvocationTargetException e) {
@@ -333,7 +347,7 @@
* following order: <code>class</code>, <code>execute</code>,
* <code>extensionLifecycle</code>, <code>lifecycle</code>,
* <code>listener</code>, <code>metadata</code>, <code>resolve</code>,
- * <code>resource</code>, <code>startlevel</code>.
+ * <code>resource</code>, <code>startlevel</code>, <code>context</code>.
*
* @return Canonical string representation of the
* <code>AdminPermission</code> actions.
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/AllServiceListener.java b/org.osgi.core/src/main/java/org/osgi/framework/AllServiceListener.java
index 08397e7..e126c5c 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/AllServiceListener.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/AllServiceListener.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AllServiceListener.java,v 1.9 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/AllServiceListener.java,v 1.10 2007/02/20 00:16:30 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2007). 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.
@@ -19,11 +19,14 @@
package org.osgi.framework;
/**
- * A <code>ServiceEvent</code> listener.
- *
- * <p>
- * <code>AllServiceListener</code> is a listener interface that may be
- * implemented by a bundle developer.
+ * A <code>ServiceEvent</code> listener that does not filter based upon
+ * package wiring. <code>AllServiceListener</code> is a listener interface
+ * that may be implemented by a bundle developer. When a
+ * <code>ServiceEvent</code> is fired, it is synchronously delivered to an
+ * <code>AllServiceListener</code>. The Framework may deliver
+ * <code>ServiceEvent</code> objects to an <code>AllServiceListener</code>
+ * out of order and may concurrently call and/or reenter an
+ * <code>AllServiceListener</code>.
* <p>
* An <code>AllServiceListener</code> object is registered with the Framework
* using the <code>BundleContext.addServiceListener</code> method.
@@ -38,21 +41,23 @@
* permissions, then additional filtering is done. <code>ServiceEvent</code>
* objects are only delivered to the listener if the bundle which defines the
* listener object's class has the appropriate <code>ServicePermission</code>
- * to get the service using at least one of the named classes the service was
- * registered under.
+ * to get the service using at least one of the named classes under which the
+ * service was registered.
*
* <p>
* Unlike normal <code>ServiceListener</code> objects,
- * <code>AllServiceListener</code> objects receive all ServiceEvent objects
- * regardless of the whether the package source of the listening bundle is equal
- * to the package source of the bundle that registered the service. This means
- * that the listener may not be able to cast the service object to any of its
- * corresponding service interfaces if the service object is retrieved.
+ * <code>AllServiceListener</code> objects receive all
+ * <code>ServiceEvent</code> objects regardless of whether the package source
+ * of the listening bundle is equal to the package source of the bundle that
+ * registered the service. This means that the listener may not be able to cast
+ * the service object to any of its corresponding service interfaces if the
+ * service object is retrieved.
*
- * @version $Revision: 1.9 $
* @see ServiceEvent
* @see ServicePermission
+ * @ThreadSafe
* @since 1.3
+ * @version $Revision: 1.10 $
*/
public interface AllServiceListener extends ServiceListener {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/Bundle.java b/org.osgi.core/src/main/java/org/osgi/framework/Bundle.java
index 5811258..b814f82 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/Bundle.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/Bundle.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Bundle.java,v 1.37 2006/06/27 13:13:30 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Bundle.java,v 1.54 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -64,11 +64,12 @@
* <code>Bundle</code> objects, and these objects are only valid within the
* Framework that created them.
*
- * @version $Revision: 1.37 $
+ * @ThreadSafe
+ * @version $Revision: 1.54 $
*/
public interface Bundle {
/**
- * This bundle is uninstalled and may not be used.
+ * The bundle is uninstalled and may not be used.
*
* <p>
* The <code>UNINSTALLED</code> state is only visible after a bundle is
@@ -78,14 +79,14 @@
* <p>
* The value of <code>UNINSTALLED</code> is 0x00000001.
*/
- public static final int UNINSTALLED = 0x00000001;
+ public static final int UNINSTALLED = 0x00000001;
/**
- * This bundle is installed but not yet resolved.
+ * The bundle is installed but not yet resolved.
*
* <p>
* A bundle is in the <code>INSTALLED</code> state when it has been
- * installed in the Framework but cannot run.
+ * installed in the Framework but is not or cannot be resolved.
* <p>
* This state is visible if the bundle's code dependencies are not resolved.
* The Framework may attempt to resolve an <code>INSTALLED</code> bundle's
@@ -94,14 +95,14 @@
* <p>
* The value of <code>INSTALLED</code> is 0x00000002.
*/
- public static final int INSTALLED = 0x00000002;
+ public static final int INSTALLED = 0x00000002;
/**
- * This bundle is resolved and is able to be started.
+ * The bundle is resolved and is able to be started.
*
* <p>
* A bundle is in the <code>RESOLVED</code> state when the Framework has
- * successfully resolved the bundle's dependencies. These dependencies
+ * successfully resolved the bundle's code dependencies. These dependencies
* include:
* <ul>
* <li>The bundle's class path from its {@link Constants#BUNDLE_CLASSPATH}
@@ -121,45 +122,98 @@
* <p>
* The value of <code>RESOLVED</code> is 0x00000004.
*/
- public static final int RESOLVED = 0x00000004;
+ public static final int RESOLVED = 0x00000004;
/**
- * This bundle is in the process of starting.
+ * The bundle is in the process of starting.
*
* <p>
- * A bundle is in the <code>STARTING</code> state when the {@link #start}
- * method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#start} is called. If this method completes without
- * exception, then the bundle has successfully started and must move to the
+ * A bundle is in the <code>STARTING</code> state when its
+ * {@link #start(int) start} method is active. A bundle must be in this
+ * state when the bundle's {@link BundleActivator#start} is called. If the
+ * <code>BundleActivator.start</code> method completes without exception,
+ * then the bundle has successfully started and must move to the
* <code>ACTIVE</code> state.
* <p>
+ * If the bundle has a
+ * {@link Constants#ACTIVATION_LAZY lazy activation policy}, then the
+ * bundle may remain in this state for some time until the activation is
+ * triggered.
+ * <p>
* The value of <code>STARTING</code> is 0x00000008.
*/
- public static final int STARTING = 0x00000008;
+ public static final int STARTING = 0x00000008;
/**
- * This bundle is in the process of stopping.
+ * The bundle is in the process of stopping.
*
* <p>
- * A bundle is in the <code>STOPPING</code> state when the {@link #stop}
- * method is active. A bundle must be in this state when the bundle's
- * {@link BundleActivator#stop} method is called. When this method completes
- * the bundle is stopped and must move to the <code>RESOLVED</code> state.
+ * A bundle is in the <code>STOPPING</code> state when its
+ * {@link #stop(int) stop} method is active. A bundle must be in this state
+ * when the bundle's {@link BundleActivator#stop} method is called. When the
+ * <code>BundleActivator.stop</code> method completes the bundle is
+ * stopped and must move to the <code>RESOLVED</code> state.
* <p>
* The value of <code>STOPPING</code> is 0x00000010.
*/
- public static final int STOPPING = 0x00000010;
+ public static final int STOPPING = 0x00000010;
/**
- * This bundle is now running.
+ * The bundle is now running.
*
* <p>
* A bundle is in the <code>ACTIVE</code> state when it has been
- * successfully started.
+ * successfully started and activated.
* <p>
* The value of <code>ACTIVE</code> is 0x00000020.
*/
- public static final int ACTIVE = 0x00000020;
+ public static final int ACTIVE = 0x00000020;
+
+ /**
+ * The bundle start operation is transient and the persistent autostart
+ * setting of the bundle is not modified.
+ *
+ * <p>
+ * This bit may be set when calling {@link #start(int)} to notify the
+ * framework that the autostart setting of the bundle must not be modified.
+ * If this bit is not set, then the autostart setting of the bundle is
+ * modified.
+ *
+ * @since 1.4
+ * @see #start(int)
+ */
+ public static final int START_TRANSIENT = 0x00000001;
+
+ /**
+ * The bundle start operation must activate the bundle according to the
+ * bundle's declared
+ * {@link Constants#BUNDLE_ACTIVATIONPOLICY activation policy}.
+ *
+ * <p>
+ * This bit may be set when calling {@link #start(int)} to notify the
+ * framework that the bundle must be activated using the bundle's declared
+ * activation policy.
+ *
+ * @since 1.4
+ * @see Constants#BUNDLE_ACTIVATIONPOLICY
+ * @see #start(int)
+ */
+ public static final int START_ACTIVATION_POLICY = 0x00000002;
+
+ /**
+ * The bundle stop is transient and the persistent autostart setting of the
+ * bundle is not modified.
+ *
+ * <p>
+ * This bit may be set when calling {@link #stop(int)} to notify the
+ * framework that the autostart setting of the bundle must not be modified.
+ * If this bit is not set, then the autostart setting of the bundle is
+ * modified.
+ *
+ * @since 1.4
+ * @see #stop(int)
+ */
+ public static final int STOP_TRANSIENT = 0x00000001;
/**
* Returns this bundle's current state.
@@ -177,48 +231,78 @@
* Starts this bundle.
*
* <p>
- * If the Framework implements the optional Start Level service and the
- * current start level is less than this bundle's start level, then the
- * Framework must persistently mark this bundle as started and delay the
- * starting of this bundle until the Framework's current start level becomes
- * equal or more than the bundle's start level.
- * <p>
- * Otherwise, the following steps are required to start a bundle:
- * <ol>
- * <li>If this bundle's state is <code>UNINSTALLED</code> then an
+ * If this bundle's state is <code>UNINSTALLED</code> then an
* <code>IllegalStateException</code> is thrown.
+ * <p>
+ * If the Framework implements the optional Start Level service and the
+ * current start level is less than this bundle's start level:
+ * <ul>
+ * <li>If the {@link #START_TRANSIENT} option is set, then a
+ * <code>BundleException</code> is thrown indicating this bundle cannot be
+ * started due to the Framework's current start level.
*
- * <li>If this bundle's state is <code>STARTING</code> or
- * <code>STOPPING</code> then this method must wait for this bundle to
- * change state before continuing. If this does not occur in a reasonable
- * time, a <code>BundleException</code> is thrown to indicate this bundle
- * was unable to be started.
+ * <li>Otherwise, the Framework must set this bundle's persistent autostart
+ * setting to <em>Started with declared activation</em> if the
+ * {@link #START_ACTIVATION_POLICY} option is set or
+ * <em>Started with eager activation</em> if not set.
+ * </ul>
+ * <p>
+ * When the Framework's current start level becomes equal to or more than
+ * this bundle's start level, this bundle will be started.
+ * <p>
+ * Otherwise, the following steps are required to start this bundle:
+ * <ol>
+ * <li>If this bundle is in the process of being activated or deactivated
+ * then this method must wait for activation or deactivation to complete
+ * before continuing. If this does not occur in a reasonable time, a
+ * <code>BundleException</code> is thrown to indicate this bundle was
+ * unable to be started.
*
* <li>If this bundle's state is <code>ACTIVE</code> then this method
* returns immediately.
*
- * <li>Persistently record that this bundle has been started. When the
- * Framework is restarted, this bundle must be automatically started.
+ * <li>If the {@link #START_TRANSIENT} option is not set then set this
+ * bundle's autostart setting to <em>Started with declared activation</em>
+ * if the {@link #START_ACTIVATION_POLICY} option is set or
+ * <em>Started with eager activation</em> if not set. When the Framework
+ * is restarted and this bundle's autostart setting is not <em>Stopped</em>,
+ * this bundle must be automatically started.
*
* <li>If this bundle's state is not <code>RESOLVED</code>, an attempt
- * is made to resolve this bundle's package dependencies. If the Framework
- * cannot resolve this bundle, a <code>BundleException</code> is thrown.
+ * is made to resolve this bundle. If the Framework cannot resolve this
+ * bundle, a <code>BundleException</code> is thrown.
*
+ * <li>If the {@link #START_ACTIVATION_POLICY} option is set and this
+ * bundle's declared activation policy is
+ * {@link Constants#ACTIVATION_LAZY lazy} then:
+ * <ul>
+ * <li>If this bundle's state is <code>STARTING</code> then this method
+ * returns immediately.
+ * <li>This bundle's state is set to <code>STARTING</code>.
+ * <li>A bundle event of type {@link BundleEvent#LAZY_ACTIVATION} is fired.
+ * <li>This method returns immediately and the remaining steps will be
+ * followed when this bundle's activation is later triggered.
+ * </ul>
+ * <i></i>
* <li>This bundle's state is set to <code>STARTING</code>.
*
- * <li>A bundle event of type {@link BundleEvent#STARTING} is fired. This event is only delivered to
- * <code>SynchronousBundleListener</code>s. It is not delivered to <code>BundleListener</code>s.
+ * <li>A bundle event of type {@link BundleEvent#STARTING} is fired.
*
* <li>The {@link BundleActivator#start} method of this bundle's
* <code>BundleActivator</code>, if one is specified, is called. If the
- * <code>BundleActivator</code> is invalid or throws an exception, this
- * bundle's state is set back to <code>RESOLVED</code>.<br>
- * Any services registered by the bundle must be unregistered. <br>
- * Any services used by the bundle must be released. <br>
- * Any listeners registered by the bundle must be removed. <br>
- * A <code>BundleException</code> is then thrown.
- *
- * <li>If this bundle's state is <code>UNINSTALLED</code>, because the
+ * <code>BundleActivator</code> is invalid or throws an exception then:
+ * <ul>
+ * <li>This bundle's state is set to <code>STOPPING</code>.
+ * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
+ * <li>Any services registered by this bundle must be unregistered.
+ * <li>Any services used by this bundle must be released.
+ * <li>Any listeners registered by this bundle must be removed.
+ * <li>This bundle's state is set to <code>RESOLVED</code>.
+ * <li>A bundle event of type {@link BundleEvent#STOPPED} is fired.
+ * <li>A <code>BundleException</code> is then thrown.
+ * </ul>
+ * <i></i>
+ * <li>If this bundle's state is <code>UNINSTALLED</code>, because this
* bundle was uninstalled while the <code>BundleActivator.start</code>
* method was running, a <code>BundleException</code> is thrown.
*
@@ -229,33 +313,60 @@
*
* <b>Preconditions </b>
* <ul>
- * <li><code>getState()</code> in {<code>INSTALLED</code>}, {
- * <code>RESOLVED</code>}.
+ * <li><code>getState()</code> in {<code>INSTALLED</code>,
+ * <code>RESOLVED</code>} or {<code>INSTALLED</code>,
+ * <code>RESOLVED</code>, <code>STARTING</code>} if this bundle has a
+ * lazy activation policy.
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li>Bundle persistent state is marked as active.
- * <li><code>getState()</code> in {<code>ACTIVE</code>}.
+ * <li>Bundle autostart setting is modified unless the
+ * {@link #START_TRANSIENT} option was set.
+ * <li><code>getState()</code> in {<code>ACTIVE</code>} unless the
+ * lazy activation policy was used.
* <li><code>BundleActivator.start()</code> has been called and did not
- * throw an exception.
+ * throw an exception unless the lazy activation policy was used.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li>Depending on when the exception occurred, bundle persistent state is
- * marked as active.
- * <li><code>getState()</code> not in {<code>STARTING</code>}, {
+ * <li>Depending on when the exception occurred, bundle autostart setting
+ * is modified unless the {@link #START_TRANSIENT} option was set.
+ * <li><code>getState()</code> not in {<code>STARTING</code>,
* <code>ACTIVE</code>}.
* </ul>
*
+ * @param options The options for starting this bundle. See
+ * {@link #START_TRANSIENT} and {@link #START_ACTIVATION_POLICY}.
+ * The Framework must ignore unrecognized options.
+ * @throws BundleException If this bundle could not be started. This could
+ * be because a code dependency could not be resolved or the
+ * specified <code>BundleActivator</code> could not be loaded or
+ * threw an exception or this bundle is a fragment.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @since 1.4
+ */
+ public void start(int options) throws BundleException;
+
+ /**
+ * Starts this bundle with no options.
+ *
+ * <p>
+ * This method calls <code>start(0)</code>.
+ *
* @throws BundleException If this bundle could not be started. This could
* be because a code dependency could not be resolved or the
* specified <code>BundleActivator</code> could not be loaded or
- * threw an exception.
+ * threw an exception or this bundle is a fragment.
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled or this bundle tries to change its own state.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,EXECUTE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @see #start(int)
*/
public void start() throws BundleException;
@@ -268,22 +379,22 @@
* <li>If this bundle's state is <code>UNINSTALLED</code> then an
* <code>IllegalStateException</code> is thrown.
*
- * <li>If this bundle's state is <code>STARTING</code> or
- * <code>STOPPING</code> then this method must wait for this bundle to
- * change state before continuing. If this does not occur in a reasonable
- * time, a <code>BundleException</code> is thrown to indicate this bundle
- * was unable to be stopped.
- *
- * <li>Persistently record that this bundle has been stopped. When the
- * Framework is restarted, this bundle must not be automatically started.
+ * <li>If this bundle is in the process of being activated or deactivated
+ * then this method must wait for activation or deactivation to complete
+ * before continuing. If this does not occur in a reasonable time, a
+ * <code>BundleException</code> is thrown to indicate this bundle was
+ * unable to be stopped.
+ * <li>If the {@link #STOP_TRANSIENT} option is not set then then set this
+ * bundle's persistent autostart setting to to <em>Stopped</em>. When the
+ * Framework is restarted and this bundle's autostart setting is
+ * <em>Stopped</em>, this bundle must not be automatically started.
*
* <li>If this bundle's state is not <code>ACTIVE</code> then this method
* returns immediately.
*
* <li>This bundle's state is set to <code>STOPPING</code>.
*
- * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired. This event is only delivered to
- * <code>SynchronousBundleListener</code>s. It is not delivered to <code>BundleListener</code>s.
+ * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
*
* <li>The {@link BundleActivator#stop} method of this bundle's
* <code>BundleActivator</code>, if one is specified, is called. If that
@@ -295,7 +406,7 @@
* <li>Any services used by this bundle must be released.
* <li>Any listeners registered by this bundle must be removed.
*
- * <li>If this bundle's state is <code>UNINSTALLED</code>, because the
+ * <li>If this bundle's state is <code>UNINSTALLED</code>, because this
* bundle was uninstalled while the <code>BundleActivator.stop</code>
* method was running, a <code>BundleException</code> must be thrown.
*
@@ -310,7 +421,8 @@
* </ul>
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li>Bundle persistent state is marked as stopped.
+ * <li>Bundle autostart setting is modified unless the
+ * {@link #STOP_TRANSIENT} option was set.
* <li><code>getState()</code> not in {<code>ACTIVE</code>,
* <code>STOPPING</code>}.
* <li><code>BundleActivator.stop</code> has been called and did not
@@ -318,16 +430,38 @@
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li>Bundle persistent state is marked as stopped.
+ * <li>Bundle autostart setting is modified unless the
+ * {@link #STOP_TRANSIENT} option was set.
* </ul>
*
+ * @param options The options for stoping this bundle. See
+ * {@link #STOP_TRANSIENT}. The Framework must ignore unrecognized
+ * options.
* @throws BundleException If this bundle's <code>BundleActivator</code>
- * could not be loaded or threw an exception.
+ * threw an exception or this bundle is a fragment.
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled or this bundle tries to change its own state.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,EXECUTE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @since 1.4
+ */
+ public void stop(int options) throws BundleException;
+
+ /**
+ * Stops this bundle with no options.
+ *
+ * <p>
+ * This method calls <code>stop(0)</code>.
+ *
+ * @throws BundleException If this bundle's <code>BundleActivator</code>
+ * threw an exception or this bundle is a fragment.
+ * @throws java.lang.IllegalStateException If this bundle has been
+ * uninstalled or this bundle tries to change its own state.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,EXECUTE]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @see #start(int)
*/
public void stop() throws BundleException;
@@ -339,10 +473,10 @@
* before the update and started after the update successfully completes.
*
* <p>
- * If the bundle being updated has exported any packages, these packages
- * must not be updated. Instead, the previous package version must remain
- * exported until the <code>PackageAdmin.refreshPackages</code> method has
- * been has been called or the Framework is relaunched.
+ * If this bundle has exported any packages, these packages must not be
+ * updated. Instead, the previous package version must remain exported until
+ * the <code>PackageAdmin.refreshPackages</code> method has been has been
+ * called or the Framework is relaunched.
*
* <p>
* The following steps are required to update a bundle:
@@ -351,15 +485,15 @@
* <code>IllegalStateException</code> is thrown.
*
* <li>If this bundle's state is <code>ACTIVE</code>,
- * <code>STARTING</code> or <code>STOPPING</code>, the bundle is
+ * <code>STARTING</code> or <code>STOPPING</code>, this bundle is
* stopped as described in the <code>Bundle.stop</code> method. If
* <code>Bundle.stop</code> throws an exception, the exception is rethrown
* terminating the update.
*
* <li>The download location of the new version of this bundle is
- * determined from either the bundle's
+ * determined from either this bundle's
* {@link Constants#BUNDLE_UPDATELOCATION} Manifest header (if available) or
- * the bundle's original location.
+ * this bundle's original location.
*
* <li>The location is interpreted in an implementation dependent manner,
* typically as a URL, and the new version of this bundle is obtained from
@@ -370,7 +504,7 @@
* this bundle must be restored and a <code>BundleException</code> must be
* thrown after completion of the remaining steps.
*
- * <li>If the bundle has declared an Bundle-RequiredExecutionEnvironment
+ * <li>If this bundle has declared an Bundle-RequiredExecutionEnvironment
* header, then the listed execution environments must be verified against
* the installed execution environments. If they do not all match, the
* original version of this bundle must be restored and a
@@ -410,9 +544,9 @@
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled or this bundle tries to change its own state.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for both
- * the current bundle and the updated bundle, and the Java Runtime
- * Environment supports permissions.
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for
+ * both the current bundle and the updated bundle, and the Java
+ * Runtime Environment supports permissions.
* @see #stop()
* @see #start()
*/
@@ -423,8 +557,8 @@
*
* <p>
* This method performs all the steps listed in <code>Bundle.update()</code>,
- * except the bundle must be read from the supplied <code>InputStream</code>,
- * rather than a <code>URL</code>.
+ * except the new version of this bundle must be read from the supplied
+ * <code>InputStream</code>, rather than a <code>URL</code>.
* <p>
* This method must always close the <code>InputStream</code> when it is
* done, even if an exception is thrown.
@@ -436,9 +570,9 @@
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled or this bundle tries to change its own state.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for both
- * the current bundle and the updated bundle, and the Java Runtime
- * Environment supports permissions.
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code> for
+ * both the current bundle and the updated bundle, and the Java
+ * Runtime Environment supports permissions.
* @see #update()
*/
public void update(InputStream in) throws BundleException;
@@ -494,21 +628,21 @@
* </ul>
*
* @throws BundleException If the uninstall failed. This can occur if
- * another thread is attempting to change the bundle's state and
+ * another thread is attempting to change this bundle's state and
* does not complete in a timely manner.
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled or this bundle tries to change its own state.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,LIFECYCLE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,LIFECYCLE]</code>, and
+ * the Java Runtime Environment supports permissions.
* @see #stop()
*/
public void uninstall() throws BundleException;
/**
* Returns this bundle's Manifest headers and values. This method returns
- * all the Manifest headers and values from the main section of the bundle's
- * Manifest file; that is, all lines prior to the first blank line.
+ * all the Manifest headers and values from the main section of this
+ * bundle's Manifest file; that is, all lines prior to the first blank line.
*
* <p>
* Manifest header names are case-insensitive. The methods of the returned
@@ -523,12 +657,12 @@
* they are present in the Manifest file:
*
* <pre>
- * Bundle-Name
- * Bundle-Vendor
- * Bundle-Version
- * Bundle-Description
- * Bundle-DocURL
- * Bundle-ContactAddress
+ * Bundle-Name
+ * Bundle-Vendor
+ * Bundle-Version
+ * Bundle-Description
+ * Bundle-DocURL
+ * Bundle-ContactAddress
* </pre>
*
* <p>
@@ -539,28 +673,27 @@
* Manifest headers and values.
*
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,METADATA]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and
+ * the Java Runtime Environment supports permissions.
*
* @see Constants#BUNDLE_LOCALIZATION
*/
public Dictionary getHeaders();
- public BundleContext getBundleContext();
-
/**
- * Returns this bundle's identifier. The bundle is assigned a unique
- * identifier by the Framework when it is installed in the OSGi environment.
+ * Returns this bundle's unique identifier. This bundle is assigned a unique
+ * identifier by the Framework when it was installed in the OSGi
+ * environment.
*
* <p>
* A bundle's unique identifier has the following attributes:
* <ul>
* <li>Is unique and persistent.
* <li>Is a <code>long</code>.
- * <li>Its value is not reused for another bundle, even after the bundle is
+ * <li>Its value is not reused for another bundle, even after a bundle is
* uninstalled.
- * <li>Does not change while the bundle remains installed.
- * <li>Does not change when the bundle is updated.
+ * <li>Does not change while a bundle remains installed.
+ * <li>Does not change when a bundle is updated.
* </ul>
*
* <p>
@@ -575,10 +708,10 @@
* Returns this bundle's location identifier.
*
* <p>
- * The bundle location identifier is the location passed to
+ * The location identifier is the location passed to
* <code>BundleContext.installBundle</code> when a bundle is installed.
- * The bundle location identifier does not change while the bundle remains
- * installed, even if the bundle is updated.
+ * The location identifier does not change while this bundle remains
+ * installed, even if this bundle is updated.
*
* <p>
* This method must continue to return this bundle's location identifier
@@ -586,8 +719,8 @@
*
* @return The string representation of this bundle's location identifier.
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,METADATA]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and
+ * the Java Runtime Environment supports permissions.
*/
public String getLocation();
@@ -677,13 +810,13 @@
/**
* Find the specified resource from this bundle.
*
- * This bundle's class loader is called to search for the specified resource.
- * If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve the bundle before attempting to get the specified resource.
- * If this bundle cannot be resolved, then only this bundle
- * must be searched for the specified resource. Imported packages cannot be
- * searched when a bundle has not been resolved. If this bundle is a
- * fragment bundle then <code>null</code> is returned.
+ * This bundle's class loader is called to search for the specified
+ * resource. If this bundle's state is <code>INSTALLED</code>, this
+ * method must attempt to resolve this bundle before attempting to get the
+ * specified resource. If this bundle cannot be resolved, then only this
+ * bundle must be searched for the specified resource. Imported packages
+ * cannot be searched when this bundle has not been resolved. If this bundle
+ * is a fragment bundle then <code>null</code> is returned.
*
* @param name The name of the resource. See
* <code>java.lang.ClassLoader.getResource</code> for a description
@@ -691,8 +824,8 @@
* @return A URL to the named resource, or <code>null</code> if the
* resource could not be found or if this bundle is a fragment
* bundle or if the caller does not have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code>, and the Java Runtime
- * Environment supports permissions.
+ * <code>AdminPermission[this,RESOURCE]</code>, and the Java
+ * Runtime Environment supports permissions.
*
* @since 1.1
* @throws java.lang.IllegalStateException If this bundle has been
@@ -711,10 +844,12 @@
* <code>Bundle.getHeaders()</code> except the manifest header values are
* localized to the specified locale.
*
- * <p>If a Manifest header value starts with "%", it must be
+ * <p>
+ * If a Manifest header value starts with "%", it must be
* localized according to the specified locale. If a locale is specified and
* cannot be found, then the header values must be returned using the
* default locale. Localizations are searched for in the following order:
+ *
* <pre>
* bn + "_" + Ls + "_" + Cs + "_" + Vs
* bn + "_" + Ls + "_" + Cs
@@ -722,12 +857,14 @@
* bn + "_" + Ld + "_" + Cd + "_" + Vd
* bn + "_" + Ld + "_" + Cd
* bn + "_" + Ld
- * bn
+ * bn
* </pre>
- * Where <code>bn</code> is the bundle localization basename, <code>Ls</code>,
- * <code>Cs</code> and <code>Vs</code> are the specified locale (language,
- * country, variant) and <code>Ld</code>, <code>Cd</code> and <code>Vd</code>
- * are the default locale (language, country, variant).
+ *
+ * Where <code>bn</code> is this bundle's localization basename,
+ * <code>Ls</code>, <code>Cs</code> and <code>Vs</code> are the
+ * specified locale (language, country, variant) and <code>Ld</code>,
+ * <code>Cd</code> and <code>Vd</code> are the default locale (language,
+ * country, variant).
*
* If <code>null</code> is specified as the locale string, the header
* values must be localized using the default locale. If the empty string
@@ -751,8 +888,8 @@
* Manifest headers and values.
*
* @throws java.lang.SecurityException If the caller does not have the
- * appropriate <code>AdminPermission[this,METADATA]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,METADATA]</code>, and
+ * the Java Runtime Environment supports permissions.
*
* @see #getHeaders()
* @see Constants#BUNDLE_LOCALIZATION
@@ -764,8 +901,8 @@
* Returns the symbolic name of this bundle as specified by its
* <code>Bundle-SymbolicName</code> manifest header. The name must be
* unique, it is recommended to use a reverse domain name naming convention
- * like that used for java packages. If the bundle does not have a specified
- * symbolic name then <code>null</code> is returned.
+ * like that used for java packages. If this bundle does not have a
+ * specified symbolic name then <code>null</code> is returned.
*
* <p>
* This method must continue to return this bundle's symbolic name while
@@ -777,21 +914,20 @@
public String getSymbolicName();
/**
- *
* Loads the specified class using this bundle's classloader.
*
* <p>
- * If the bundle is a fragment bundle then this method must throw a
+ * If this bundle is a fragment bundle then this method must throw a
* <code>ClassNotFoundException</code>.
*
* <p>
* If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve the bundle before attempting to load the class.
+ * attempt to resolve this bundle before attempting to load the class.
*
* <p>
- * If the bundle cannot be resolved, a Framework event of type
+ * If this bundle cannot be resolved, a Framework event of type
* {@link FrameworkEvent#ERROR} is fired containing a
- * <code>BundleException</code> with details of the reason the bundle
+ * <code>BundleException</code> with details of the reason this bundle
* could not be resolved. This method must then throw a
* <code>ClassNotFoundException</code>.
*
@@ -803,8 +939,8 @@
* @return The Class object for the requested class.
* @throws java.lang.ClassNotFoundException If no such class can be found or
* if this bundle is a fragment bundle or if the caller does not
- * have the appropriate <code>AdminPermission[this,CLASS]</code>, and
- * the Java Runtime Environment supports permissions.
+ * have the appropriate <code>AdminPermission[this,CLASS]</code>,
+ * and the Java Runtime Environment supports permissions.
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
@@ -814,13 +950,13 @@
/**
* Find the specified resources from this bundle.
*
- * This bundle's class loader is called to search for the specified resources.
- * If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve the bundle before attempting to get the specified resources.
- * If this bundle cannot be resolved, then only this bundle
- * must be searched for the specified resources. Imported packages cannot be
- * searched when a bundle has not been resolved. If this bundle is a
- * fragment bundle then <code>null</code> is returned.
+ * This bundle's class loader is called to search for the specified
+ * resources. If this bundle's state is <code>INSTALLED</code>, this
+ * method must attempt to resolve this bundle before attempting to get the
+ * specified resources. If this bundle cannot be resolved, then only this
+ * bundle must be searched for the specified resources. Imported packages
+ * cannot be searched when a bundle has not been resolved. If this bundle is
+ * a fragment bundle then <code>null</code> is returned.
*
* @param name The name of the resource. See
* <code>java.lang.ClassLoader.getResources</code> for a
@@ -828,8 +964,8 @@
* @return An enumeration of URLs to the named resources, or
* <code>null</code> if the resource could not be found or if this
* bundle is a fragment bundle or if the caller does not have the
- * appropriate <code>AdminPermission[this,RESOURCE]</code>, and the
- * Java Runtime Environment supports permissions.
+ * appropriate <code>AdminPermission[this,RESOURCE]</code>, and
+ * the Java Runtime Environment supports permissions.
*
* @since 1.3
* @throws java.lang.IllegalStateException If this bundle has been
@@ -840,21 +976,24 @@
/**
* Returns an Enumeration of all the paths (<code>String</code> objects)
- * to entries within the bundle whose longest sub-path matches the supplied
- * path argument. The bundle's classloader is not used to search for
- * entries. Only the contents of the bundle is searched. A specified path of
- * "/" indicates the root of the bundle.
- *
+ * to entries within this bundle whose longest sub-path matches the
+ * specified path. This bundle's classloader is not used to search for
+ * entries. Only the contents of this bundle are searched.
+ * <p>
+ * The specified path is always relative to the root of this bundle and may
+ * begin with a "/". A path value of "/" indicates the
+ * root of this bundle.
* <p>
* Returned paths indicating subdirectory paths end with a "/".
- * The returned paths are all relative to the root of the bundle.
+ * The returned paths are all relative to the root of this bundle and must
+ * not begin with "/".
*
* @param path The path name for which to return entry paths.
* @return An Enumeration of the entry paths (<code>String</code>
* objects) or <code>null</code> if no entry could be found or if
* the caller does not have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code> and the Java Runtime
- * Environment supports permissions.
+ * <code>AdminPermission[this,RESOURCE]</code> and the Java
+ * Runtime Environment supports permissions.
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
@@ -862,24 +1001,25 @@
public Enumeration getEntryPaths(String path);
/**
- * Returns a URL to the specified entry in this bundle. The bundle's
- * classloader is not used to search for the specified entry. Only the
- * contents of the bundle is searched for the specified entry. A specified
- * path of "/" indicates the root of the bundle.
+ * Returns a URL to the entry at the specified path in this bundle. This
+ * bundle's classloader is not used to search for the entry. Only the
+ * contents of this bundle are searched for the entry.
+ * <p>
+ * The specified path is always relative to the root of this bundle and may
+ * begin with "/". A path value of "/" indicates the
+ * root of this bundle.
*
- * @param name The name of the entry. See
- * <code>java.lang.ClassLoader.getResource</code> for a description
- * of the format of a resource name.
- * @return A URL to the specified entry, or <code>null</code> if no entry
- * could be found or if the caller does not have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code> and the Java Runtime
- * Environment supports permissions.
+ * @param path The path name of the entry.
+ * @return A URL to the entry, or <code>null</code> if no entry could be
+ * found or if the caller does not have the appropriate
+ * <code>AdminPermission[this,RESOURCE]</code> and the Java
+ * Runtime Environment supports permissions.
*
* @throws java.lang.IllegalStateException If this bundle has been
* uninstalled.
* @since 1.3
*/
- public URL getEntry(String name);
+ public URL getEntry(String path);
/**
* Returns the time when this bundle was last modified. A bundle is
@@ -895,12 +1035,12 @@
public long getLastModified();
/**
- * Returns entries in this bundle and its attached fragments. The bundle's
- * classloader is not used to search for entries. Only the contents of the
+ * Returns entries in this bundle and its attached fragments. This bundle's
+ * classloader is not used to search for entries. Only the contents of this
* bundle and its attached fragments are searched for the specified entries.
*
* If this bundle's state is <code>INSTALLED</code>, this method must
- * attempt to resolve the bundle before attempting to find entries.
+ * attempt to resolve this bundle before attempting to find entries.
*
* <p>
* This method is intended to be used to obtain configuration, setup,
@@ -931,9 +1071,9 @@
* return (URL) e.nextElement();
* </pre>
*
- * @param path The path name in which to look. A specified path of
- * "/" indicates the root of the bundle. Path is relative
- * to the root of the bundle and must not be null.
+ * @param path The path name in which to look. The path is always relative
+ * to the root of this bundle and may begin with "/". A
+ * path value of "/" indicates the root of this bundle.
* @param filePattern The file name pattern for selecting entries in the
* specified path. The pattern is only matched against the last
* element of the entry path and it supports substring matching, as
@@ -941,18 +1081,40 @@
* character ("*"). If null is specified, this is
* equivalent to "*" and matches all files.
* @param recurse If <code>true</code>, recurse into subdirectories.
- * Otherwise only return entries from the given directory.
+ * Otherwise only return entries from the specified path.
* @return An enumeration of URL objects for each matching entry, or
* <code>null</code> if an entry could not be found or if the
* caller does not have the appropriate
- * <code>AdminPermission[this,RESOURCE]</code>, and the Java Runtime
- * Environment supports permissions. The URLs are sorted such that
- * entries from this bundle are returned first followed by the
- * entries from attached fragments in ascending bundle id order. If
- * this bundle is a fragment, then only matching entries in this
+ * <code>AdminPermission[this,RESOURCE]</code>, and the Java
+ * Runtime Environment supports permissions. The URLs are sorted
+ * such that entries from this bundle are returned first followed by
+ * the entries from attached fragments in ascending bundle id order.
+ * If this bundle is a fragment, then only matching entries in this
* fragment are returned.
* @since 1.3
*/
public Enumeration findEntries(String path, String filePattern,
boolean recurse);
+
+ /**
+ * Returns this bundle's {@link BundleContext}. The returned
+ * <code>BundleContext</code> can be used by the caller to act on behalf
+ * of this bundle.
+ *
+ * <p>
+ * If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
+ * {@link #STOPPING} states or this bundle is a fragment bundle, then this
+ * bundle has no valid <code>BundleContext</code>. This method will
+ * return <code>null</code> if this bundle has no valid
+ * <code>BundleContext</code>.
+ *
+ * @return A <code>BundleContext</code> for this bundle or
+ * <code>null</code> if this bundle has no valid
+ * <code>BundleContext</code>.
+ * @throws java.lang.SecurityException If the caller does not have the
+ * appropriate <code>AdminPermission[this,CONTEXT]</code>, and
+ * the Java Runtime Environment supports permissions.
+ * @since 1.4
+ */
+ public BundleContext getBundleContext();
}
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/BundleActivator.java b/org.osgi.core/src/main/java/org/osgi/framework/BundleActivator.java
index b411510..a3344e6 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/BundleActivator.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/BundleActivator.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleActivator.java,v 1.11 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleActivator.java,v 1.14 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -26,7 +26,8 @@
* bundle's <code>BundleActivator</code> as required. If an instance's
* <code>BundleActivator.start</code> method executes successfully, it is
* guaranteed that the same instance's <code>BundleActivator.stop</code>
- * method will be called when the bundle is to be stopped.
+ * method will be called when the bundle is to be stopped. The Framework must
+ * not concurrently call a <code>BundleActivator</code> object.
*
* <p>
* <code>BundleActivator</code> is specified through the
@@ -35,17 +36,18 @@
* must not have a <code>BundleActivator</code>. The form of the Manifest
* header is:
*
- * <pre>
- * Bundle-Activator: <i>class-name</i>
- * </pre>
+ * <p>
+ * <code>Bundle-Activator: <i>class-name</i></code>
*
- * where <code>class-name</code> is a fully qualified Java classname.
+ * <p>
+ * where <code><i>class-name</i></code> is a fully qualified Java classname.
* <p>
* The specified <code>BundleActivator</code> class must have a public
* constructor that takes no parameters so that a <code>BundleActivator</code>
* object can be created by <code>Class.newInstance()</code>.
*
- * @version $Revision: 1.11 $
+ * @NotThreadSafe
+ * @version $Revision: 1.14 $
*/
public interface BundleActivator {
@@ -63,7 +65,6 @@
* bundle is marked as stopped and the Framework will remove this
* bundle's listeners, unregister all services registered by this
* bundle, and release all services used by this bundle.
- * @see Bundle#start
*/
public void start(BundleContext context) throws Exception;
@@ -83,7 +84,6 @@
* bundle is still marked as stopped, and the Framework will remove
* the bundle's listeners, unregister all services registered by the
* bundle, and release all services used by the bundle.
- * @see Bundle#stop
*/
public void stop(BundleContext context) throws Exception;
}
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/BundleContext.java b/org.osgi.core/src/main/java/org/osgi/framework/BundleContext.java
index 6139c82..c7d1768 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/BundleContext.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/BundleContext.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleContext.java,v 1.19 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleContext.java,v 1.22 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -69,7 +69,8 @@
* The Framework is the only entity that can create <code>BundleContext</code>
* objects and they are only valid within the Framework that created them.
*
- * @version $Revision: 1.19 $
+ * @ThreadSafe
+ * @version $Revision: 1.22 $
*/
public interface BundleContext {
@@ -150,7 +151,8 @@
*
* <li>If the bundle has declared an Bundle-RequiredExecutionEnvironment
* header, then the listed execution environments must be verified against
- * the installed execution environments. If they are not all present, a
+ * the installed execution environments. If none of the listed execution
+ * environments match an installed execution environment, a
* <code>BundleException</code> must be thrown.
*
* <li>The bundle's state is set to <code>INSTALLED</code>.
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/BundleEvent.java b/org.osgi.core/src/main/java/org/osgi/framework/BundleEvent.java
index 753d0bc..29f6fa0 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/BundleEvent.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/BundleEvent.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleEvent.java,v 1.15 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleEvent.java,v 1.19 2007/02/20 00:14:12 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -24,14 +24,17 @@
* An event from the Framework describing a bundle lifecycle change.
* <p>
* <code>BundleEvent</code> objects are delivered to
- * <code>BundleListener</code> objects when a change occurs in a bundle's
- * lifecycle. A type code is used to identify the event type for future
- * extendability.
+ * <code>SynchronousBundleListener</code>s and <code>BundleListener</code>s
+ * when a change occurs in a bundle's lifecycle. A type code is used to identify
+ * the event type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
*
- * @version $Revision: 1.15 $
+ * @Immutable
+ * @see BundleListener
+ * @see SynchronousBundleListener
+ * @version $Revision: 1.19 $
*/
public class BundleEvent extends EventObject {
@@ -39,12 +42,12 @@
/**
* Bundle that had a change occur in its lifecycle.
*/
- private Bundle bundle;
+ private final Bundle bundle;
/**
* Type of bundle lifecycle change.
*/
- private int type;
+ private final int type;
/**
* The bundle has been installed.
@@ -58,18 +61,26 @@
/**
* The bundle has been started.
* <p>
+ * The bundle's
+ * {@link BundleActivator#start(BundleContext) BundleActivator start} method
+ * has been executed if the bundle has a bundle activator class.
+ * <p>
* The value of <code>STARTED</code> is 0x00000002.
*
- * @see Bundle#start
+ * @see Bundle#start()
*/
public final static int STARTED = 0x00000002;
/**
* The bundle has been stopped.
* <p>
+ * The bundle's
+ * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
+ * has been executed if the bundle has a bundle activator class.
+ * <p>
* The value of <code>STOPPED</code> is 0x00000004.
*
- * @see Bundle#stop
+ * @see Bundle#stop()
*/
public final static int STOPPED = 0x00000004;
@@ -112,7 +123,13 @@
public final static int UNRESOLVED = 0x00000040;
/**
- * The bundle is about to start.
+ * The bundle is about to be activated.
+ * <p>
+ * The bundle's
+ * {@link BundleActivator#start(BundleContext) BundleActivator start} method
+ * is about to be called if the bundle has a bundle activator class. This
+ * event is only delivered to {@link SynchronousBundleListener}s. It is not
+ * delivered to <code>BundleListener</code>s.
* <p>
* The value of <code>STARTING</code> is 0x00000080.
*
@@ -122,7 +139,13 @@
public final static int STARTING = 0x00000080;
/**
- * The bundle is about to stop.
+ * The bundle is about to deactivated.
+ * <p>
+ * The bundle's
+ * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
+ * is about to be called if the bundle has a bundle activator class. This
+ * event is only delivered to {@link SynchronousBundleListener}s. It is not
+ * delivered to <code>BundleListener</code>s.
* <p>
* The value of <code>STOPPING</code> is 0x00000100.
*
@@ -132,6 +155,22 @@
public final static int STOPPING = 0x00000100;
/**
+ * The bundle will be lazily activated.
+ * <p>
+ * The bundle has a {@link Constants#ACTIVATION_LAZY lazy activation policy}
+ * and is waiting to be activated. It is now in the
+ * {@link Bundle#STARTING STARTING} state and has a valid
+ * <code>BundleContext</code>. This event is only delivered to
+ * {@link SynchronousBundleListener}s. It is not delivered to
+ * <code>BundleListener</code>s.
+ * <p>
+ * The value of <code>LAZY_ACTIVATION</code> is 0x00000200.
+ *
+ * @since 1.4
+ */
+ public final static int LAZY_ACTIVATION = 0x00000200;
+
+ /**
* Creates a bundle event of the specified type.
*
* @param type The event type.
@@ -159,6 +198,7 @@
* <ul>
* <li>{@link #INSTALLED}
* <li>{@link #RESOLVED}
+ * <li>{@link #LAZY_ACTIVATION}
* <li>{@link #STARTING}
* <li>{@link #STARTED}
* <li>{@link #STOPPING}
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/BundleListener.java b/org.osgi.core/src/main/java/org/osgi/framework/BundleListener.java
index 4cdcddd..e9bc6d4 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/BundleListener.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/BundleListener.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleListener.java,v 1.11 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundleListener.java,v 1.13 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -21,12 +21,12 @@
import java.util.EventListener;
/**
- * A <code>BundleEvent</code> listener. When a <code>BundleEvent</code> is
- * fired, it is asynchronously delivered to a <code>BundleListener</code>.
- *
- * <p>
- * <code>BundleListener</code> is a listener interface that may be implemented
- * by a bundle developer.
+ * A <code>BundleEvent</code> listener. <code>BundleListener</code> is a
+ * listener interface that may be implemented by a bundle developer. When a
+ * <code>BundleEvent</code> is fired, it is asynchronously delivered to a
+ * <code>BundleListener</code>. The Framework delivers
+ * <code>BundleEvent</code> objects to a <code>BundleListener</code> in
+ * order and must not concurrently call a <code>BundleListener</code>.
* <p>
* A <code>BundleListener</code> object is registered with the Framework using
* the {@link BundleContext#addBundleListener} method.
@@ -34,8 +34,9 @@
* object when a bundle has been installed, resolved, started, stopped, updated,
* unresolved, or uninstalled.
*
- * @version $Revision: 1.11 $
* @see BundleEvent
+ * @NotThreadSafe
+ * @version $Revision: 1.13 $
*/
public interface BundleListener extends EventListener {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/BundlePermission.java b/org.osgi.core/src/main/java/org/osgi/framework/BundlePermission.java
index 6b352f9..c313bf7 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/BundlePermission.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/BundlePermission.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundlePermission.java,v 1.15 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/BundlePermission.java,v 1.16 2007/02/20 00:06:02 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2007). 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.
@@ -44,6 +44,7 @@
* The <code>PROVIDE</code> action implies the <code>REQUIRE</code> action.
*
* @since 1.3
+ * @version $Revision: 1.16 $
*/
public final class BundlePermission extends BasicPermission {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/Configurable.java b/org.osgi.core/src/main/java/org/osgi/framework/Configurable.java
index f1a3502..cd40557 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/Configurable.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/Configurable.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Configurable.java,v 1.11 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Configurable.java,v 1.12 2007/02/20 00:07:22 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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,8 +27,8 @@
* configure a service may test to determine if the service object is an
* <code>instanceof Configurable</code>.
*
- * @version $Revision: 1.11 $
* @deprecated As of 1.2. Please use Configuration Admin service.
+ * @version $Revision: 1.12 $
*/
public interface Configurable {
/**
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/Constants.java b/org.osgi.core/src/main/java/org/osgi/framework/Constants.java
index 5268a90..0ee3a33 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/Constants.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/Constants.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Constants.java,v 1.25 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Constants.java,v 1.32 2007/02/20 00:07:22 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -19,15 +19,15 @@
package org.osgi.framework;
/**
- * Defines standard names for the OSGi environment property, service property,
- * and Manifest header attribute keys.
+ * Defines standard names for the OSGi environment system properties, service
+ * properties, and Manifest header attribute keys.
*
* <p>
* The values associated with these keys are of type
* <code>java.lang.String</code>, unless otherwise indicated.
*
- * @version $Revision: 1.25 $
* @since 1.1
+ * @version $Revision: 1.32 $
*/
public interface Constants {
@@ -156,7 +156,7 @@
* <p>
* The attribute value may be retrieved from the <code>Dictionary</code>
* object returned by the <code>Bundle.getHeaders</code> method.
- *
+ *
* @deprecated As of 1.2.
*/
public static final String IMPORT_SERVICE = "Import-Service";
@@ -235,14 +235,6 @@
* identifying the version of a package specified in the Export-Package or
* Import-Package manifest header.
*
- * <p>
- * The attribute value is encoded in the Export-Package or Import-Package
- * manifest header like:
- *
- * <pre>
- * Import-Package: org.osgi.framework ; specification-version="1.1"
- * </pre>
- *
* @deprecated As of 1.3. This has been replaced by
* {@link #VERSION_ATTRIBUTE}.
*/
@@ -258,7 +250,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; processor=x86 ...
+ * Bundle-NativeCode: http.so ; processor=x86 ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_PROCESSOR = "processor";
@@ -272,7 +264,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; osname=Linux ...
+ * Bundle-NativeCode: http.so ; osname=Linux ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_OSNAME = "osname";
@@ -286,7 +278,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; osversion="2.34" ...
+ * Bundle-NativeCode: http.so ; osversion="2.34" ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_OSVERSION = "osversion";
@@ -300,7 +292,7 @@
* like:
*
* <pre>
- * Bundle-NativeCode: http.so ; language=nl_be ...
+ * Bundle-NativeCode: http.so ; language=nl_be ...
* </pre>
*/
public static final String BUNDLE_NATIVECODE_LANGUAGE = "language";
@@ -428,9 +420,9 @@
/**
* Framework environment property (named
* "org.osgi.supports.framework.extension") identifying whether
- * the Framework supports framework extension bundles. If the value of this
- * property is <code>true</code>, then the Framework supports framework
- * extension bundles. The default value is <code>false</code>.
+ * the Framework supports framework extension bundles. As of version 1.4,
+ * the value of this property must be <code>true</code>. The Framework
+ * must support framework extension bundles.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
@@ -457,9 +449,9 @@
/**
* Framework environment property (named
* "org.osgi.supports.framework.fragment") identifying whether the
- * Framework supports fragment bundles. If the value of this property is
- * <code>true</code>, then the Framework supports fragment bundles. The
- * default value is <code>false</code>.
+ * Framework supports fragment bundles. As of version 1.4, the value of this
+ * property must be <code>true</code>. The Framework must support
+ * fragment bundles.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
@@ -472,9 +464,9 @@
* Framework environment property (named
* "org.osgi.supports.framework.requirebundle") identifying
* whether the Framework supports the <code>Require-Bundle</code> manifest
- * header. If the value of this property is <code>true</code>, then the
- * Framework supports the <code>Require-Bundle</code> manifest header. The
- * default value is <code>false</code>.
+ * header. As of version 1.4, the value of this property must be
+ * <code>true</code>. The Framework must support the
+ * <code>Require-Bundle</code> manifest header.
* <p>
* The value of this property may be retrieved by calling the
* <code>BundleContext.getProperty</code> method.
@@ -599,7 +591,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; singleton:=true
+ * Bundle-SymbolicName: com.acme.module.test; singleton:=true
* </pre>
*
* @since 1.3
@@ -616,7 +608,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_ALWAYS
@@ -638,7 +630,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="always"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="always"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -658,7 +650,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="resolve-time"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="resolve-time"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -677,7 +669,7 @@
* like:
*
* <pre>
- * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
+ * Bundle-SymbolicName: com.acme.module.test; fragment-attachment:="never"
* </pre>
*
* @see Constants#FRAGMENT_ATTACHMENT_DIRECTIVE
@@ -727,8 +719,8 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; bundle-version="1.1"
- * Require-Bundle: com.acme.module.test; bundle-version="[1.0,2.0)"
+ * Require-Bundle: com.acme.module.test; bundle-version="1.1"
+ * Require-Bundle: com.acme.module.test; bundle-version="[1.0,2.0)"
* </pre>
*
* <p>
@@ -761,7 +753,7 @@
* The attribute value is encoded in manifest headers like:
*
* <pre>
- * Bundle-NativeCode: libgtk.so; selection-filter="(ws=gtk)"; ...
+ * Bundle-NativeCode: libgtk.so; selection-filter="(ws=gtk)"; ...
* </pre>
*
* @since 1.3
@@ -796,7 +788,7 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; version="1.1"
+ * Import-Package: org.osgi.framework; version="1.1"
* </pre>
*
* @since 1.3
@@ -813,7 +805,7 @@
* like:
*
* <pre>
- * Import-Package: org.osgi.framework; bundle-symbolic-name="com.acme.module.test"
+ * Import-Package: org.osgi.framework; bundle-symbolic-name="com.acme.module.test"
* </pre>
*
* @since 1.3
@@ -829,8 +821,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="optional"
- * Require-Bundle: com.acme.module.test; resolution:="optional"
+ * Import-Package: org.osgi.framework; resolution:="optional"
+ * Require-Bundle: com.acme.module.test; resolution:="optional"
* </pre>
*
* @see Constants#RESOLUTION_MANDATORY
@@ -851,8 +843,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="manditory"
- * Require-Bundle: com.acme.module.test; resolution:="manditory"
+ * Import-Package: org.osgi.framework; resolution:="manditory"
+ * Require-Bundle: com.acme.module.test; resolution:="manditory"
* </pre>
*
* @see Constants#RESOLUTION_DIRECTIVE
@@ -873,8 +865,8 @@
* manifest header like:
*
* <pre>
- * Import-Package: org.osgi.framework; resolution:="optional"
- * Require-Bundle: com.acme.module.test; resolution:="optional"
+ * Import-Package: org.osgi.framework; resolution:="optional"
+ * Require-Bundle: com.acme.module.test; resolution:="optional"
* </pre>
*
* @see Constants#RESOLUTION_DIRECTIVE
@@ -891,7 +883,7 @@
* like:
*
* <pre>
- * Export-Package: org.osgi.util.tracker; uses:="org.osgi.framework"
+ * Export-Package: org.osgi.util.tracker; uses:="org.osgi.framework"
* </pre>
*
* @since 1.3
@@ -899,16 +891,25 @@
public final static String USES_DIRECTIVE = "uses";
/**
- * Manifest header directive (named "include") identifying a list
- * of classes and/or resources of the specified package which must be
- * allowed to be exported in the Export-Package manifest header.
- *
+ * Manifest header directive (named "include").
* <p>
- * The directive value is encoded in the Export-Package manifest header
- * like:
+ * This directive is used by the Import-Package manifest header to identify
+ * a list of classes of the specified package which must be allowed to be
+ * exported. The directive value is encoded in the Import-Package manifest
+ * header like:
*
* <pre>
- * Export-Package: org.osgi.framework; include:="MyStuff*"
+ * Import-Package: org.osgi.framework; include:="MyClass*"
+ * </pre>
+ *
+ * <p>
+ * This directive is also used by the Bundle-ActivationPolicy manifest
+ * header to identify the packages from which class loads will trigger lazy
+ * activation. The directive value is encoded in the Bundle-ActivationPolicy
+ * manifest header like:
+ *
+ * <pre>
+ * Bundle-ActivationPolicy: lazy; include:="org.osgi.framework"
* </pre>
*
* @since 1.3
@@ -916,16 +917,25 @@
public final static String INCLUDE_DIRECTIVE = "include";
/**
- * Manifest header directive (named "exclude") identifying a list
- * of classes and/or resources of the specified package which must not be
- * allowed to be exported in the Export-Package manifest header.
- *
+ * Manifest header directive (named "exclude").
* <p>
- * The directive value is encoded in the Export-Package manifest header
- * like:
+ * This directive is used by the Export-Package manifest header to identify
+ * a list of classes of the specified package which must not be allowed to
+ * be exported. The directive value is encoded in the Export-Package
+ * manifest header like:
*
* <pre>
- * Export-Package: org.osgi.framework; exclude:="MyStuff*"
+ * Export-Package: org.osgi.framework; exclude:="*Impl"
+ * </pre>
+ *
+ * <p>
+ * This directive is also used by the Bundle-ActivationPolicy manifest
+ * header to identify the packages from which class loads will not trigger
+ * lazy activation. The directive value is encoded in the
+ * Bundle-ActivationPolicy manifest header like:
+ *
+ * <pre>
+ * Bundle-ActivationPolicy: lazy; exclude:="org.osgi.framework"
* </pre>
*
* @since 1.3
@@ -942,7 +952,7 @@
* like:
*
* <pre>
- * Export-Package: org.osgi.framework; mandatory:="bundle-symbolic-name"
+ * Export-Package: org.osgi.framework; mandatory:="bundle-symbolic-name"
* </pre>
*
* @since 1.3
@@ -958,7 +968,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="reexport"
+ * Require-Bundle: com.acme.module.test; visibility:="reexport"
* </pre>
*
* @see Constants#VISIBILITY_PRIVATE
@@ -978,7 +988,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="private"
+ * Require-Bundle: com.acme.module.test; visibility:="private"
* </pre>
*
* @see Constants#VISIBILITY_DIRECTIVE
@@ -998,7 +1008,7 @@
* like:
*
* <pre>
- * Require-Bundle: com.acme.module.test; visibility:="reexport"
+ * Require-Bundle: com.acme.module.test; visibility:="reexport"
* </pre>
*
* @see Constants#VISIBILITY_DIRECTIVE
@@ -1006,59 +1016,94 @@
*/
public final static String VISIBILITY_REEXPORT = "reexport";
/**
- * Manifest header directive (named "extension")
- * identifying the type of the extension fragment.
+ * Manifest header directive (named "extension") identifying the
+ * type of the extension fragment.
*
* <p>
- * The directive value is encoded in the Fragment-Host manifest header
- * like:
+ * The directive value is encoded in the Fragment-Host manifest header like:
*
* <pre>
- * Fragment-Host: system.bundle; extension:="framework"
+ * Fragment-Host: system.bundle; extension:="framework"
* </pre>
*
* @see Constants#EXTENSION_FRAMEWORK
* @see Constants#EXTENSION_BOOTCLASSPATH
* @since 1.3
*/
- public final static String EXTENSION_DIRECTIVE = "extension";
+ public final static String EXTENSION_DIRECTIVE = "extension";
/**
- * Manifest header directive value (named "framework") identifying
+ * Manifest header directive value (named "framework") identifying
* the type of extension fragment. An extension fragment type of framework
- * indicates that the extension fragment is to be loaded by
- * the framework's class loader.
+ * indicates that the extension fragment is to be loaded by the framework's
+ * class loader.
*
* <p>
- * The directive value is encoded in the Fragment-Host manifest header
- * like:
+ * The directive value is encoded in the Fragment-Host manifest header like:
*
* <pre>
- * Fragment-Host: system.bundle; extension:="framework"
+ * Fragment-Host: system.bundle; extension:="framework"
* </pre>
*
* @see Constants#EXTENSION_DIRECTIVE
* @since 1.3
*/
- public final static String EXTENSION_FRAMEWORK = "framework";
+ public final static String EXTENSION_FRAMEWORK = "framework";
/**
- * Manifest header directive value (named "bootclasspath") identifying
- * the type of extension fragment. An extension fragment type of bootclasspath
- * indicates that the extension fragment is to be loaded by
+ * Manifest header directive value (named "bootclasspath")
+ * identifying the type of extension fragment. An extension fragment type of
+ * bootclasspath indicates that the extension fragment is to be loaded by
* the boot class loader.
*
* <p>
- * The directive value is encoded in the Fragment-Host manifest header
- * like:
+ * The directive value is encoded in the Fragment-Host manifest header like:
*
* <pre>
- * Fragment-Host: system.bundle; extension:="bootclasspath"
+ * Fragment-Host: system.bundle; extension:="bootclasspath"
* </pre>
*
* @see Constants#EXTENSION_DIRECTIVE
* @since 1.3
*/
- public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath";
+ public final static String EXTENSION_BOOTCLASSPATH = "bootclasspath";
+
+ /**
+ * Manifest header (named "Bundle-ActivationPolicy") identifying
+ * the bundle's activation policy.
+ * <p>
+ * The attribute value may be retrieved from the <code>Dictionary</code>
+ * object returned by the <code>Bundle.getHeaders</code> method.
+ *
+ * @since 1.4
+ * @see Constants#ACTIVATION_LAZY
+ * @see Constants#INCLUDE_DIRECTIVE
+ * @see Constants#EXCLUDE_DIRECTIVE
+ */
+ public final static String BUNDLE_ACTIVATIONPOLICY = "Bundle-ActivationPolicy";
+
+ /**
+ * Bundle activation policy (named "lazy") declaring the bundle
+ * must be activated when the first class load is made from the bundle.
+ * <p>
+ * A bundle with the lazy activation policy that is started with the
+ * {@link Bundle#START_ACTIVATION_POLICY START_ACTIVATION_POLICY} option
+ * will wait in the {@link Bundle#STARTING STARTING} state until the first
+ * class load from the bundle occurs. The bundle will then be activated
+ * before the class is returned to the requestor.
+ * <p>
+ * The activation policy value is specified as in the
+ * Bundle-ActivationPolicy manifest header like:
+ *
+ * <pre>
+ * Bundle-ActivationPolicy: lazy
+ * </pre>
+ *
+ * @see Constants#BUNDLE_ACTIVATIONPOLICY
+ * @see Bundle#start(int)
+ * @see Bundle#START_ACTIVATION_POLICY
+ * @since 1.4
+ */
+ public final static String ACTIVATION_LAZY = "lazy";
}
\ No newline at end of file
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/Filter.java b/org.osgi.core/src/main/java/org/osgi/framework/Filter.java
index 357afa0..41b7cfa 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/Filter.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/Filter.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.14 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Filter.java,v 1.16 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -32,15 +32,17 @@
* Some examples of LDAP filters are:
*
* <pre>
- * "(cn=Babs Jensen)"
- * "(!(cn=Tim Howes))"
- * "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
- * "(o=univ*of*mich*)"
+ * "(cn=Babs Jensen)"
+ * "(!(cn=Tim Howes))"
+ * "(&(" + Constants.OBJECTCLASS + "=Person)(|(sn=Jensen)(cn=Babs J*)))"
+ * "(o=univ*of*mich*)"
* </pre>
*
- * @version $Revision: 1.14 $
* @since 1.1
- * @see "Framework specification for a description of the filter string syntax."
+ * @see "Core Specification, section 5.5, for a description of the filter string
+ * syntax."
+ * @ThreadSafe
+ * @version $Revision: 1.16 $
*/
public interface Filter {
/**
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java
index 33f302a..c3da54f 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.14 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2007). 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.
@@ -24,14 +24,17 @@
* A general event from the Framework.
*
* <p>
- * <code>FrameworkEvent</code> is the event class used when notifying
- * listeners of general events occuring within the OSGI environment. A type code
- * is used to identify the event type for future extendability.
+ * <code>FrameworkEvent</code> objects are delivered to
+ * <code>FrameworkListener</code>s when a general event occurs within the
+ * OSGi environment. A type code is used to identify the event type for future
+ * extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of event types.
*
- * @version $Revision: 1.14 $
+ * @Immutable
+ * @see FrameworkListener
+ * @version $Revision: 1.15 $
*/
public class FrameworkEvent extends EventObject {
@@ -39,25 +42,25 @@
/**
* Bundle related to the event.
*/
- private Bundle bundle;
+ private final Bundle bundle;
/**
* Exception related to the event.
*/
- private Throwable throwable;
+ private final Throwable throwable;
/**
* Type of event.
*/
- private int type;
+ private final int type;
/**
* The Framework has started.
*
* <p>
- * This event is fired when the Framework has started after all
- * installed bundles that are marked to be started have been started and the
- * Framework has reached the intitial start level.
+ * This event is fired when the Framework has started after all installed
+ * bundles that are marked to be started have been started and the Framework
+ * has reached the intitial start level.
*
* <p>
* The value of <code>STARTED</code> is 0x00000001.
@@ -81,9 +84,8 @@
* A PackageAdmin.refreshPackage operation has completed.
*
* <p>
- * This event is fired when the Framework has completed the refresh
- * packages operation initiated by a call to the
- * PackageAdmin.refreshPackages method.
+ * This event is fired when the Framework has completed the refresh packages
+ * operation initiated by a call to the PackageAdmin.refreshPackages method.
*
* <p>
* The value of <code>PACKAGES_REFRESHED</code> is 0x00000004.
@@ -97,9 +99,8 @@
* A StartLevel.setStartLevel operation has completed.
*
* <p>
- * This event is fired when the Framework has completed changing the
- * active start level initiated by a call to the StartLevel.setStartLevel
- * method.
+ * This event is fired when the Framework has completed changing the active
+ * start level initiated by a call to the StartLevel.setStartLevel method.
*
* <p>
* The value of <code>STARTLEVEL_CHANGED</code> is 0x00000008.
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java
index 30bbbc9..29c934d 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkListener.java,v 1.10 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkListener.java,v 1.12 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -21,20 +21,23 @@
import java.util.EventListener;
/**
- * A <code>FrameworkEvent</code> listener. When a <code>FrameworkEvent</code> is
- * fired, it is asynchronously delivered to a <code>FrameworkListener</code>.
+ * A <code>FrameworkEvent</code> listener. <code>FrameworkListener</code> is
+ * a listener interface that may be implemented by a bundle developer. When a
+ * <code>FrameworkEvent</code> is fired, it is asynchronously delivered to a
+ * <code>FrameworkListener</code>. The Framework delivers
+ * <code>FrameworkEvent</code> objects to a <code>FrameworkListener</code>
+ * in order and must not concurrently call a <code>FrameworkListener</code>.
*
* <p>
- * <code>FrameworkListener</code> is a listener interface that may be
- * implemented by a bundle developer. A <code>FrameworkListener</code> object
- * is registered with the Framework using the
- * {@link BundleContext#addFrameworkListener} method.
+ * A <code>FrameworkListener</code> object is registered with the Framework
+ * using the {@link BundleContext#addFrameworkListener} method.
* <code>FrameworkListener</code> objects are called with a
* <code>FrameworkEvent</code> objects when the Framework starts and when
* asynchronous errors occur.
*
- * @version $Revision: 1.10 $
* @see FrameworkEvent
+ * @NotThreadSafe
+ * @version $Revision: 1.12 $
*/
public interface FrameworkListener extends EventListener {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java
index 78573a4..fdefc52 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkUtil.java,v 1.6 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/FrameworkUtil.java,v 1.10 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2007). 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.
@@ -29,8 +29,9 @@
* This class contains utility methods which access Framework functions that may
* be useful to bundles.
*
- * @version $Revision: 1.6 $
* @since 1.3
+ * @ThreadSafe
+ * @version $Revision: 1.10 $
*/
public class FrameworkUtil {
/*
@@ -45,50 +46,55 @@
* instance of the vendor FrameworkUtil class will be created and this class
* will delegate method calls to the vendor FrameworkUtil instance.
*/
- private static final String packageProperty = "org.osgi.vendor.framework";
- /*
- * This is the delegate method used by createFilter.
- */
- private final static Method createFilter;
+ private static class ImplHolder implements PrivilegedAction {
+ private static final String packageProperty = "org.osgi.vendor.framework";
+
+ /*
+ * This is the delegate method used by createFilter.
+ */
+ static final Method createFilter;
+
+ static {
+ createFilter = (Method) AccessController.doPrivileged(new ImplHolder());
+ }
+
+ private ImplHolder() {
+ }
- static {
- createFilter = (Method) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
- String packageName = System
- .getProperty(packageProperty);
- if (packageName == null) {
- throw new NoClassDefFoundError(packageProperty
- + " property not set");
- }
-
- Class delegateClass;
- try {
- delegateClass = Class.forName(packageName
- + ".FrameworkUtil");
- }
- catch (ClassNotFoundException e) {
- throw new NoClassDefFoundError(e.toString());
- }
-
- Method result;
- try {
- result = delegateClass.getMethod("createFilter",
- new Class[] {String.class});
- }
- catch (NoSuchMethodException e) {
- throw new NoSuchMethodError(e.toString());
- }
-
- if (!Modifier.isStatic(result.getModifiers())) {
- throw new NoSuchMethodError(
- "createFilter method must be static");
- }
-
- return result;
- }
- });
+ public Object run() {
+ String packageName = System
+ .getProperty(packageProperty);
+ if (packageName == null) {
+ throw new NoClassDefFoundError(packageProperty
+ + " property not set");
+ }
+
+ Class delegateClass;
+ try {
+ delegateClass = Class.forName(packageName
+ + ".FrameworkUtil");
+ }
+ catch (ClassNotFoundException e) {
+ throw new NoClassDefFoundError(e.toString());
+ }
+
+ Method result;
+ try {
+ result = delegateClass.getMethod("createFilter",
+ new Class[] {String.class});
+ }
+ catch (NoSuchMethodException e) {
+ throw new NoSuchMethodError(e.toString());
+ }
+
+ if (!Modifier.isStatic(result.getModifiers())) {
+ throw new NoSuchMethodError(
+ "createFilter method must be static");
+ }
+
+ return result;
+ }
}
@@ -118,7 +124,7 @@
throws InvalidSyntaxException {
try {
try {
- return (Filter) createFilter
+ return (Filter) ImplHolder.createFilter
.invoke(null, new Object[] {filter});
}
catch (InvocationTargetException e) {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java b/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java
index 3406679..b69c120 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/InvalidSyntaxException.java,v 1.15 2006/07/11 13:15:54 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/InvalidSyntaxException.java,v 1.16 2007/02/20 00:15:00 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -19,24 +19,27 @@
package org.osgi.framework;
/**
- * A Framework exception.
+ * A Framework exception used to indicate that a filter string has an invalid
+ * syntax.
*
* <p>
* An <code>InvalidSyntaxException</code> object indicates that a filter
- * string parameter has an invalid syntax and cannot be parsed.
+ * string parameter has an invalid syntax and cannot be parsed. See
+ * {@link Filter} for a description of the filter string syntax.
*
* <p>
- * See {@link Filter} for a description of the filter string syntax.
+ * This exception is updated to conform to the general purpose exception
+ * chaining mechanism.
*
- * @version $Revision: 1.15 $
+ * @version $Revision: 1.16 $
*/
public class InvalidSyntaxException extends Exception {
- static final long serialVersionUID = -4295194420816491875L;
+ static final long serialVersionUID = -4295194420816491875L;
/**
* The invalid filter string.
*/
- private final String filter;
+ private final String filter;
/**
* Nested exception.
*/
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java b/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java
index c415481..6f76863 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.14 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceEvent.java,v 1.15 2007/02/20 00:14:12 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -23,29 +23,31 @@
/**
* An event from the Framework describing a service lifecycle change.
* <p>
- * <code>ServiceEvent</code> objects are delivered to a
- * <code>ServiceListener</code> objects when a change occurs in this service's
- * lifecycle. A type code is used to identify the event type for future
- * extendability.
+ * <code>ServiceEvent</code> objects are delivered to
+ * <code>ServiceListener</code>s and <code>AllServiceListener</code>s when
+ * a change occurs in this service's lifecycle. A type code is used to identify
+ * the event type for future extendability.
*
* <p>
* OSGi Alliance reserves the right to extend the set of types.
*
- * @version $Revision: 1.14 $
+ * @Immutable
* @see ServiceListener
+ * @see AllServiceListener
+ * @version $Revision: 1.15 $
*/
public class ServiceEvent extends EventObject {
- static final long serialVersionUID = 8792901483909409299L;
+ static final long serialVersionUID = 8792901483909409299L;
/**
* Reference to the service that had a change occur in its lifecycle.
*/
- private ServiceReference reference;
+ private final ServiceReference reference;
/**
* Type of service lifecycle change.
*/
- private int type;
+ private final int type;
/**
* This service has been registered.
@@ -58,7 +60,7 @@
*
* @see BundleContext#registerService(String[],Object,java.util.Dictionary)
*/
- public final static int REGISTERED = 0x00000001;
+ public final static int REGISTERED = 0x00000001;
/**
* The properties of a registered service have been modified.
@@ -71,7 +73,7 @@
*
* @see ServiceRegistration#setProperties
*/
- public final static int MODIFIED = 0x00000002;
+ public final static int MODIFIED = 0x00000002;
/**
* This service is in the process of being unregistered.
@@ -92,7 +94,7 @@
* @see ServiceRegistration#unregister
* @see BundleContext#ungetService
*/
- public final static int UNREGISTERING = 0x00000004;
+ public final static int UNREGISTERING = 0x00000004;
/**
* Creates a new service event object.
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java b/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java
index a958284..1a3b3d2 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceFactory.java,v 1.9 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceFactory.java,v 1.10 2007/02/20 00:16:30 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -33,8 +33,8 @@
* <code>BundleContext.getService(ServiceReference)</code> method calls the
* <code>ServiceFactory.getService</code> method to create a service object
* specifically for the requesting bundle. The service object returned by the
- * <code>ServiceFactory</code> object is cached by the Framework until the
- * bundle releases its use of the service.
+ * <code>ServiceFactory</code> is cached by the Framework until the bundle
+ * releases its use of the service.
*
* <p>
* When the bundle's use count for the service equals zero (including the bundle
@@ -43,10 +43,12 @@
*
* <p>
* <code>ServiceFactory</code> objects are only used by the Framework and are
- * not made available to other bundles in the OSGi environment.
+ * not made available to other bundles in the OSGi environment. The Framework
+ * may concurrently call a <code>ServiceFactory</code>.
*
- * @version $Revision: 1.9 $
* @see BundleContext#getService
+ * @ThreadSafe
+ * @version $Revision: 1.10 $
*/
public interface ServiceFactory {
@@ -77,8 +79,7 @@
* all the classes named when the service was registered.
* @see BundleContext#getService
*/
- public Object getService(Bundle bundle,
- ServiceRegistration registration);
+ public Object getService(Bundle bundle, ServiceRegistration registration);
/**
* Releases a service object.
@@ -94,6 +95,6 @@
* <code>ServiceFactory.getService</code> method.
* @see BundleContext#ungetService
*/
- public void ungetService(Bundle bundle,
- ServiceRegistration registration, Object service);
+ public void ungetService(Bundle bundle, ServiceRegistration registration,
+ Object service);
}
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java b/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java
index 6365e38..8d9464e 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceListener.java,v 1.12 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceListener.java,v 1.15 2007/02/20 00:16:30 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -21,13 +21,15 @@
import java.util.EventListener;
/**
- * A <code>ServiceEvent</code> listener. When a <code>ServiceEvent</code> is
- * fired, it is synchronously delivered to a <code>BundleListener</code>.
+ * A <code>ServiceEvent</code> listener. <code>ServiceListener</code> is a
+ * listener interface that may be implemented by a bundle developer. When a
+ * <code>ServiceEvent</code> is fired, it is synchronously delivered to a
+ * <code>ServiceListener</code>. The Framework may deliver
+ * <code>ServiceEvent</code> objects to a <code>ServiceListener</code> out
+ * of order and may concurrently call and/or reenter a
+ * <code>ServiceListener</code>.
*
* <p>
- * <code>ServiceListener</code> is a listener interface that may be
- * implemented by a bundle developer.
- * <p>
* A <code>ServiceListener</code> object is registered with the Framework
* using the <code>BundleContext.addServiceListener</code> method.
* <code>ServiceListener</code> objects are called with a
@@ -41,16 +43,17 @@
* filtering is done. <code>ServiceEvent</code> objects are only delivered to
* the listener if the bundle which defines the listener object's class has the
* appropriate <code>ServicePermission</code> to get the service using at
- * least one of the named classes the service was registered under.
+ * least one of the named classes under which the service was registered.
*
* <p>
* <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
* objects is further filtered according to package sources as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
*
- * @version $Revision: 1.12 $
* @see ServiceEvent
* @see ServicePermission
+ * @ThreadSafe
+ * @version $Revision: 1.15 $
*/
public interface ServiceListener extends EventListener {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java b/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java
index d8b4efd..4f10f09 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServicePermission.java,v 1.14 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServicePermission.java,v 1.15 2007/02/20 00:06:02 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -24,7 +24,7 @@
import java.util.Hashtable;
/**
- * Indicates a bundle's authority to register or get a service.
+ * A bundle's authority to register or get a service.
* <ul>
* <li>The <code>ServicePermission.REGISTER</code> action allows a bundle to
* register a service on the specified names.
@@ -36,7 +36,7 @@
* certain services unless they have the appropriate
* <code>ServicePermission</code> to get the specific service.
*
- * @version $Revision: 1.14 $
+ * @version $Revision: 1.15 $
*/
final public class ServicePermission extends BasicPermission {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java b/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java
index c9fc7fd..a24461c 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.15 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceReference.java,v 1.20 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -42,13 +42,14 @@
* <code>ServiceReference</code> objects associated with different
* <code>ServiceRegistration</code> objects are not equal.
*
- * @version $Revision: 1.15 $
* @see BundleContext#getServiceReference
* @see BundleContext#getServiceReferences
* @see BundleContext#getService
+ * @ThreadSafe
+ * @version $Revision: 1.20 $
*/
-public interface ServiceReference {
+public interface ServiceReference extends Comparable {
/**
* Returns the property value to which the specified property key is mapped
* in the properties <code>Dictionary</code> object of the service
@@ -84,8 +85,8 @@
* This method is <i>case-preserving </i>; this means that every key in the
* returned array must have the same case as the corresponding key in the
* properties <code>Dictionary</code> that was passed to the
- * {@link BundleContext#registerService(String[],Object,java.util.Dictionary)} or
- * {@link ServiceRegistration#setProperties} methods.
+ * {@link BundleContext#registerService(String[],Object,java.util.Dictionary)}
+ * or {@link ServiceRegistration#setProperties} methods.
*
* @return An array of property keys.
*/
@@ -150,4 +151,30 @@
*/
public boolean isAssignableTo(Bundle bundle, String className);
+ /**
+ * Compares this <code>ServiceReference</code> with the specified
+ * <code>ServiceReference</code> for order.
+ *
+ * <p>
+ * If this <code>ServiceReference</code> and the specified
+ * <code>ServiceReference</code> have the same
+ * {@link Constants#SERVICE_ID service id} they are equal. This
+ * <code>ServiceReference</code> is less than the specified
+ * <code>ServiceReference</code> if it has a lower
+ * {@link Constants#SERVICE_RANKING service ranking} and greater if it has a
+ * higher service ranking. Otherwise, if this <code>ServiceReference</code>
+ * and the specified <code>ServiceReference</code> have the same
+ * {@link Constants#SERVICE_RANKING service ranking}, this
+ * <code>ServiceReference</code> is less than the specified
+ * <code>ServiceReference</code> if it has a higher
+ * {@link Constants#SERVICE_ID service id} and greater if it has a lower
+ * service id.
+ *
+ * @param reference The <code>ServiceReference</code> to be compared.
+ * @return Returns a negative integer, zero, or a positive integer if this
+ * <code>ServiceReference</code> is less than, equal to, or
+ * greater than the specified <code>ServiceReference</code>.
+ * @since 1.4
+ */
+ public int compareTo(Object reference);
}
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java b/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java
index 423baea..3239364 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.12 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/ServiceRegistration.java,v 1.14 2007/02/21 16:49:05 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2000, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2007). 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.
@@ -32,8 +32,9 @@
* The <code>ServiceRegistration</code> object may be used to update the
* properties of the service or to unregister the service.
*
- * @version $Revision: 1.12 $
* @see BundleContext#registerService(String[],Object,Dictionary)
+ * @ThreadSafe
+ * @version $Revision: 1.14 $
*/
public interface ServiceRegistration {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java b/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java
index 9a09408..e1ec5d5 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/SynchronousBundleListener.java,v 1.14 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/SynchronousBundleListener.java,v 1.15 2007/02/20 00:16:30 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2007). 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.
@@ -19,12 +19,14 @@
package org.osgi.framework;
/**
- * A synchronous <code>BundleEvent</code> listener. When a <code>BundleEvent</code> is
- * fired, it is synchronously delivered to a <code>BundleListener</code>.
- *
- * <p>
+ * A synchronous <code>BundleEvent</code> listener.
* <code>SynchronousBundleListener</code> is a listener interface that may be
- * implemented by a bundle developer.
+ * implemented by a bundle developer. When a <code>BundleEvent</code> is
+ * fired, it is synchronously delivered to a
+ * <code>SynchronousBundleListener</code>. The Framework may deliver
+ * <code>BundleEvent</code> objects to a
+ * <code>SynchronousBundleListener</code> out of order and may concurrently
+ * call and/or reenter a <code>SynchronousBundleListener</code>.
* <p>
* A <code>SynchronousBundleListener</code> object is registered with the
* Framework using the {@link BundleContext#addBundleListener} method.
@@ -39,12 +41,13 @@
* <code>SynchronousBundleListener</code> objects will be called prior to
* <code>BundleListener</code> objects.
* <p>
- * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove a
- * <code>SynchronousBundleListener</code> object.
+ * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove
+ * a <code>SynchronousBundleListener</code> object.
*
- * @version $Revision: 1.14 $
* @since 1.1
* @see BundleEvent
+ * @ThreadSafe
+ * @version $Revision: 1.15 $
*/
public interface SynchronousBundleListener extends BundleListener {
diff --git a/org.osgi.core/src/main/java/org/osgi/framework/Version.java b/org.osgi.core/src/main/java/org/osgi/framework/Version.java
index 94a44a5..55c8268 100644
--- a/org.osgi.core/src/main/java/org/osgi/framework/Version.java
+++ b/org.osgi.core/src/main/java/org/osgi/framework/Version.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Version.java,v 1.16 2006/06/16 16:31:18 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/Version.java,v 1.17 2007/02/20 00:07:22 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2007). 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.
@@ -37,8 +37,9 @@
* <p>
* <code>Version</code> objects are immutable.
*
- * @version $Revision: 1.16 $
* @since 1.3
+ * @Immutable
+ * @version $Revision: 1.17 $
*/
public class Version implements Comparable {
diff --git a/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java b/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
index bfd9e69..31cf5ff 100644
--- a/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
+++ b/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.10 2006/06/16 16:31:37 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.condpermadmin/src/org/osgi/service/condpermadmin/BundleSignerCondition.java,v 1.13 2006/10/24 17:54:27 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2005, 2006). All Rights Reserved.
*
@@ -47,7 +47,7 @@
* must be the first RDN and will match any number of RDNs (including zero
* RDNs).
*
- * @version $Revision: 1.10 $
+ * @version $Revision: 1.13 $
*/
public class BundleSignerCondition {
/*
@@ -62,48 +62,53 @@
* by the org.osgi.vendor.condpermadmin package. This class will delegate
* getCondition methods calls to the vendor BundleSignerCondition class.
*/
- private static final String packageProperty = "org.osgi.vendor.condpermadmin";
- private static final Method getCondition;
- static {
- getCondition = (Method) AccessController
- .doPrivileged(new PrivilegedAction() {
- public Object run() {
- String packageName = System
- .getProperty(packageProperty);
- if (packageName == null) {
- throw new NoClassDefFoundError(packageProperty
- + " property not set");
- }
+
+ private static class ImplHolder implements PrivilegedAction {
+ private static final String packageProperty = "org.osgi.vendor.condpermadmin";
+ static final Method getCondition;
+ static {
+ getCondition = (Method) AccessController.doPrivileged(new ImplHolder());
+ }
- Class delegateClass;
- try {
- delegateClass = Class.forName(packageName
- + ".BundleSignerCondition");
- }
- catch (ClassNotFoundException e) {
- throw new NoClassDefFoundError(e.toString());
- }
+ private ImplHolder() {
+ }
- Method result;
- try {
- result = delegateClass.getMethod("getCondition",
- new Class[] {Bundle.class,
- ConditionInfo.class });
- }
- catch (NoSuchMethodException e) {
- throw new NoSuchMethodError(e.toString());
- }
-
- if (!Modifier.isStatic(result.getModifiers())) {
- throw new NoSuchMethodError(
- "getCondition method must be static");
- }
-
- return result;
- }
- });
+ public Object run() {
+ String packageName = System
+ .getProperty(packageProperty);
+ if (packageName == null) {
+ throw new NoClassDefFoundError(packageProperty
+ + " property not set");
+ }
+
+ Class delegateClass;
+ try {
+ delegateClass = Class.forName(packageName
+ + ".BundleSignerCondition");
+ }
+ catch (ClassNotFoundException e) {
+ throw new NoClassDefFoundError(e.toString());
+ }
+
+ Method result;
+ try {
+ result = delegateClass.getMethod("getCondition",
+ new Class[] {Bundle.class,
+ ConditionInfo.class });
+ }
+ catch (NoSuchMethodException e) {
+ throw new NoSuchMethodError(e.toString());
+ }
+
+ if (!Modifier.isStatic(result.getModifiers())) {
+ throw new NoSuchMethodError(
+ "getCondition method must be static");
+ }
+
+ return result;
+ }
}
-
+
private static final String CONDITION_TYPE = "org.osgi.service.condpermadmin.BundleSignerCondition";
/**
@@ -117,7 +122,7 @@
* Bundle.
* @return A Condition which checks the signers of the specified bundle.
*/
- static public Condition getCondition(Bundle bundle, ConditionInfo info) {
+ public static Condition getCondition(Bundle bundle, ConditionInfo info) {
if (!CONDITION_TYPE.equals(info.getType()))
throw new IllegalArgumentException(
"ConditionInfo must be of type \"" + CONDITION_TYPE + "\"");
@@ -128,7 +133,7 @@
try {
try {
- return (Condition) getCondition.invoke(null, new Object[] {
+ return (Condition) ImplHolder.getCondition.invoke(null, new Object[] {
bundle, info});
}
catch (InvocationTargetException e) {
diff --git a/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java b/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java
index d4a3872..97e79e9 100644
--- a/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java
+++ b/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java
@@ -1,7 +1,7 @@
/*
- * $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/StartLevel.java,v 1.13 2006/06/16 16:31:38 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/StartLevel.java,v 1.19 2007/02/09 03:20:24 hargrave Exp $
*
- * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2007). 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.
@@ -48,10 +48,9 @@
* before it is launched.
*
* When the Framework is launched, the Framework will enter start level one and
- * all bundles which are assigned to start level one and are persistently marked
- * to be started are started as described in the <code>Bundle.start</code>
- * method. Within a start level, bundles are started in ascending order by
- * <code>Bundle.getBundleId</code>. The Framework will continue to increase
+ * all bundles which are assigned to start level one and whose autostart setting
+ * indicates the bundle should be started are started as described in the
+ * <code>Bundle.start</code> method. The Framework will continue to increase
* the start level, starting bundles at each start level, until the Framework
* has reached a beginning start level. At this point the Framework has
* completed starting bundles and will then fire a Framework event of type
@@ -59,10 +58,17 @@
* launch.
*
* <p>
+ * Within a start level, bundles may be started in an order defined by the
+ * Framework implementation. This may be something like ascending
+ * <code>Bundle.getBundleId</code> order or an order based upon dependencies
+ * between bundles. A similar but reversed order may be used when stopping
+ * bundles within a start level.
+ *
+ * <p>
* The StartLevel service can be used by management bundles to alter the active
* start level of the framework.
*
- * @version $Revision: 1.13 $
+ * @version $Revision: 1.19 $
*/
public interface StartLevel {
/**
@@ -87,16 +93,19 @@
* <p>
* If the specified start level is higher than the active start level, the
* Framework will continue to increase the start level until the Framework
- * has reached the specified start level, starting bundles at each start
- * level which are persistently marked to be started as described in the
- * <code>Bundle.start</code> method.
+ * has reached the specified start level.
*
* At each intermediate start level value on the way to and including the
- * target start level, the framework must:
+ * target start level, the Framework must:
* <ol>
* <li>Change the active start level to the intermediate start level value.
- * <li>Start bundles at the intermediate start level in ascending order by
- * <code>Bundle.getBundleId</code>.
+ * <li>Start bundles at the intermediate start level whose autostart
+ * setting indicate they must be started. They are started as described in
+ * the {@link Bundle#start(int)} method using the
+ * {@link Bundle#START_TRANSIENT} option. The
+ * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if
+ * {@link #isBundleActivationPolicyUsed(Bundle)} returns <code>true</code>
+ * for the bundle.
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
@@ -106,16 +115,14 @@
* <p>
* If the specified start level is lower than the active start level, the
* Framework will continue to decrease the start level until the Framework
- * has reached the specified start level stopping bundles at each start
- * level as described in the <code>Bundle.stop</code> method except that
- * their persistently recorded state indicates that they must be restarted
- * in the future.
+ * has reached the specified start level.
*
* At each intermediate start level value on the way to and including the
* specified start level, the framework must:
* <ol>
- * <li>Stop bundles at the intermediate start level in descending order by
- * <code>Bundle.getBundleId</code>.
+ * <li>Stop bundles at the intermediate start level as described in the
+ * {@link Bundle#stop(int)} method using the {@link Bundle#STOP_TRANSIENT}
+ * option.
* <li>Change the active start level to the intermediate start level value.
* </ol>
* When this process completes after the specified start level is reached,
@@ -128,14 +135,14 @@
* bundles are started or stopped, however, the Framework must fire a
* Framework event of type <code>FrameworkEvent.STARTLEVEL_CHANGED</code>
* to announce it has finished moving to the specified start level. This
- * event may arrive before the this method return.
+ * event may arrive before this method return.
*
* @param startlevel The requested start level for the Framework.
* @throws IllegalArgumentException If the specified start level is less
* than or equal to zero.
* @throws SecurityException If the caller does not have
- * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the Java runtime
- * environment supports permissions.
+ * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the
+ * Java runtime environment supports permissions.
*/
public void setStartLevel(int startlevel);
@@ -156,28 +163,31 @@
* The specified bundle will be assigned the specified start level. The
* start level value assigned to the bundle will be persistently recorded by
* the Framework.
- *
+ * <p>
* If the new start level for the bundle is lower than or equal to the
- * active start level of the Framework, the Framework will start the
- * specified bundle as described in the <code>Bundle.start</code> method
- * if the bundle is persistently marked to be started. The actual starting
- * of this bundle must occur asynchronously.
- *
+ * active start level of the Framework and the bundle's autostart setting
+ * indicates the bundle must be started, the Framework will start the
+ * specified bundle as described in the {@link Bundle#start(int)} method
+ * using the {@link Bundle#START_TRANSIENT} option. The
+ * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if
+ * {@link #isBundleActivationPolicyUsed(Bundle)} returns <code>true</code>
+ * for the bundle. The actual starting of this bundle must occur
+ * asynchronously.
+ * <p>
* If the new start level for the bundle is higher than the active start
* level of the Framework, the Framework will stop the specified bundle as
- * described in the <code>Bundle.stop</code> method except that the
- * persistently recorded state for the bundle indicates that the bundle must
- * be restarted in the future. The actual stopping of this bundle must occur
- * asynchronously.
+ * described in the {@link Bundle#stop(int)} method using the
+ * {@link Bundle#STOP_TRANSIENT} option. The actual stopping of this bundle
+ * must occur asynchronously.
*
* @param bundle The target bundle.
* @param startlevel The new start level for the specified Bundle.
* @throws IllegalArgumentException If the specified bundle has been
* uninstalled or if the specified start level is less than or equal
* to zero, or the specified bundle is the system bundle.
- * @throws SecurityException If the caller does not have
- * <code>AdminPermission[bundle,EXECUTE]</code> and the Java runtime
- * environment supports permissions.
+ * @throws SecurityException If the caller does not have
+ * <code>AdminPermission[bundle,EXECUTE]</code> and the Java
+ * runtime environment supports permissions.
*/
public void setBundleStartLevel(Bundle bundle, int startlevel);
@@ -214,25 +224,43 @@
* @throws IllegalArgumentException If the specified start level is less
* than or equal to zero.
* @throws SecurityException If the caller does not have
- * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the Java runtime
- * environment supports permissions.
+ * <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the
+ * Java runtime environment supports permissions.
*/
public void setInitialBundleStartLevel(int startlevel);
/**
- * Return the persistent state of the specified bundle.
- *
+ * Returns whether the specified bundle's autostart setting indicates the
+ * bundle must be started.
* <p>
- * This method returns the persistent state of a bundle. The persistent
- * state of a bundle indicates whether a bundle is persistently marked to be
- * started when it's start level is reached.
+ * The autostart setting of a bundle indicates whether the bundle is to be
+ * started when its start level is reached.
*
- * @param bundle The bundle for which to return the persistently started state.
- * @return <code>true</code> if the bundle is persistently marked to be
- * started, <code>false</code> if the bundle is not persistently
- * marked to be started.
+ * @param bundle The bundle whose autostart setting is to be examined.
+ * @return <code>true</code> if the autostart setting of the bundle
+ * indicates the bundle is to be started. <code>false</code>
+ * otherwise.
* @throws java.lang.IllegalArgumentException If the specified bundle has
* been uninstalled.
+ * @see Bundle#START_TRANSIENT
*/
public boolean isBundlePersistentlyStarted(Bundle bundle);
+
+ /**
+ * Returns whether the specified bundle's autostart setting indicates that
+ * the activation policy declared in the bundle's manifest must be used.
+ * <p>
+ * The autostart setting of a bundle indicates whether the bundle's declared
+ * activation policy is to be used when the bundle is started.
+ *
+ * @param bundle The bundle whose autostart setting is to be examined.
+ * @return <code>true</code> if the bundle’s autostart setting indicates
+ * the activation policy declared in the manifest must be used.
+ * <code>false</code> if the bundle must be eagerly activated.
+ * @throws java.lang.IllegalArgumentException If the specified bundle has
+ * been uninstalled.
+ * @since 1.1
+ * @see Bundle#START_ACTIVATION_POLICY
+ */
+ public boolean isBundleActivationPolicyUsed(Bundle bundle);
}
diff --git a/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java b/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java
index 65c8eb4..71b067e 100644
--- a/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java
+++ b/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java
@@ -1,5 +1,5 @@
/*
- * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/URLConstants.java,v 1.9 2006/07/11 00:53:59 hargrave Exp $
+ * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/URLConstants.java,v 1.10 2006/12/01 06:38:45 hargrave Exp $
*
* Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
*
@@ -24,21 +24,23 @@
* services.
*
* <p>
- * The values associated with these keys are of type <code>java.lang.String[]</code>,
+ * The values associated with these keys are of type <code>java.lang.String[]</code>
+ * or <code>java.lang.String</code>,
* unless otherwise indicated.
*
- * @version $Revision: 1.9 $
+ * @version $Revision: 1.10 $
*/
public interface URLConstants {
/**
* Service property naming the protocols serviced by a
- * URLStreamHandlerService. The property's value is an array of protocol
- * names.
+ * URLStreamHandlerService. The property's value is
+ * a protocol name or an array of protocol names.
*/
public static final String URL_HANDLER_PROTOCOL = "url.handler.protocol";
/**
* Service property naming the MIME types serviced by a
- * java.net.ContentHandler. The property's value is an array of MIME types.
+ * java.net.ContentHandler. The property's value is a
+ * MIME type or an array of MIME types.
*/
public static final String URL_CONTENT_MIMETYPE = "url.content.mimetype";
}
diff --git a/org.osgi.core/src/main/resources/about.html b/org.osgi.core/src/main/resources/about.html
index eb1ec76..7f21fe1 100644
--- a/org.osgi.core/src/main/resources/about.html
+++ b/org.osgi.core/src/main/resources/about.html
@@ -1,9 +1,9 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
-<!-- $Header: /cvshome/build/osgi/about.html,v 1.3 2006/03/14 01:21:34 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/osgi/about.html,v 1.4 2006/10/30 18:29:29 hargrave Exp $ -->
<html>
<head>
<title>About</title>
-<meta http-equiv=Content-Type content="text/html; charset=ISO-8859-1">
+<meta http-equiv=Content-Type content="text/html; charset=UTF-8">
</head>
<body lang="EN-US">
<h2>About This Content</h2>
diff --git a/org.osgi.core/src/main/resources/org/osgi/framework/package.html b/org.osgi.core/src/main/resources/org/osgi/framework/package.html
index f9d46b1..1366fb0 100644
--- a/org.osgi.core/src/main/resources/org/osgi/framework/package.html
+++ b/org.osgi.core/src/main/resources/org/osgi/framework/package.html
@@ -1,11 +1,11 @@
-<!-- $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/package.html,v 1.3 2006/07/12 21:07:03 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/org.osgi.framework/src/org/osgi/framework/package.html,v 1.4 2006/09/28 21:32:40 hargrave Exp $ -->
<BODY>
-<p>Framework Package Version 1.3.
+<p>Framework Package Version 1.4.
<p>Bundles wishing to use this package must list the package
in the Import-Package header of the bundle's manifest.
For example:
<pre>
-Import-Package: org.osgi.framework;version=1.3
+Import-Package: org.osgi.framework;version=1.4
</pre>
</BODY>
diff --git a/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo b/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo
index 0117a56..cc13f19 100644
--- a/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo
+++ b/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo
@@ -1 +1 @@
-version 1.3
+version 1.4
diff --git a/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html b/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html
index 09a9334..73df85f 100644
--- a/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html
+++ b/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html
@@ -1,11 +1,11 @@
-<!-- $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/package.html,v 1.3 2006/07/12 21:07:10 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/package.html,v 1.4 2007/02/03 20:41:48 hargrave Exp $ -->
<BODY>
-<p>Start Level Package Version 1.0.
+<p>Start Level Package Version 1.1.
<p>Bundles wishing to use this package must list the package
in the Import-Package header of the bundle's manifest.
For example:
<pre>
-Import-Package: org.osgi.service.startlevel; version=1.0
+Import-Package: org.osgi.service.startlevel; version=1.1
</pre>
</BODY>
diff --git a/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo b/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo
index 7c8de03..3987f9c 100644
--- a/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo
+++ b/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1