You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by ri...@apache.org on 2008/08/01 21:31:34 UTC
svn commit: r681793 [2/2] - in /felix/trunk/org.osgi.core: ./
src/main/java/org/osgi/framework/
src/main/java/org/osgi/service/condpermadmin/
src/main/java/org/osgi/service/startlevel/
src/main/java/org/osgi/service/url/ src/main/resources/ src/main/re...
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Constants.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Constants.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Constants.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Constants.java Fri Aug 1 12:31:32 2008
@@ -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>
+ * 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>
+ * Import-Package: org.osgi.framework; include:="MyClass*"
+ * </pre>
*
* <p>
- * The directive value is encoded in the Export-Package manifest header
- * like:
+ * 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>
- * Export-Package: org.osgi.framework; include:="MyStuff*"
+ * 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>
+ * 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:="*Impl"
+ * </pre>
*
* <p>
- * The directive value is encoded in the Export-Package manifest header
- * like:
+ * 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>
- * Export-Package: org.osgi.framework; exclude:="MyStuff*"
+ * 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
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Filter.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Filter.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Filter.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Filter.java Fri Aug 1 12:31:32 2008
@@ -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 {
/**
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkEvent.java Fri Aug 1 12:31:32 2008
@@ -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.
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkListener.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/FrameworkUtil.java Fri Aug 1 12:31:32 2008
@@ -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) {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/InvalidSyntaxException.java Fri Aug 1 12:31:32 2008
@@ -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.
*/
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceEvent.java Fri Aug 1 12:31:32 2008
@@ -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.
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceFactory.java Fri Aug 1 12:31:32 2008
@@ -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);
}
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceListener.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServicePermission.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceReference.java Fri Aug 1 12:31:32 2008
@@ -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);
}
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/ServiceRegistration.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/SynchronousBundleListener.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Version.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Version.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/framework/Version.java Fri Aug 1 12:31:32 2008
@@ -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 {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/condpermadmin/BundleSignerCondition.java Fri Aug 1 12:31:32 2008
@@ -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");
- }
-
- 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 class ImplHolder implements PrivilegedAction {
+ private static final String packageProperty = "org.osgi.vendor.condpermadmin";
+ static final Method getCondition;
+ static {
+ getCondition = (Method) AccessController.doPrivileged(new ImplHolder());
+ }
+
+ 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
+ + ".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) {
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java Fri Aug 1 12:31:32 2008
@@ -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);
}
Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java Fri Aug 1 12:31:32 2008
@@ -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";
}
Modified: felix/trunk/org.osgi.core/src/main/resources/about.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/resources/about.html?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/resources/about.html (original)
+++ felix/trunk/org.osgi.core/src/main/resources/about.html Fri Aug 1 12:31:32 2008
@@ -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>
Modified: felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/package.html?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/package.html (original)
+++ felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/package.html Fri Aug 1 12:31:32 2008
@@ -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>
Modified: felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo (original)
+++ felix/trunk/org.osgi.core/src/main/resources/org/osgi/framework/packageinfo Fri Aug 1 12:31:32 2008
@@ -1 +1 @@
-version 1.3
+version 1.4
Modified: felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html (original)
+++ felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/package.html Fri Aug 1 12:31:32 2008
@@ -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>
Modified: felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo?rev=681793&r1=681792&r2=681793&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo (original)
+++ felix/trunk/org.osgi.core/src/main/resources/org/osgi/service/startlevel/packageinfo Fri Aug 1 12:31:32 2008
@@ -1 +1 @@
-version 1.0
+version 1.1