You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2011/05/16 23:49:05 UTC
svn commit: r1103918 [9/12] - in /felix/trunk/framework: ./
src/main/java/org/apache/felix/framework/
src/main/java/org/apache/felix/framework/cache/
src/main/java/org/apache/felix/framework/capabilityset/
src/main/java/org/apache/felix/framework/resol...
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundleContext.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2009). 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.
@@ -18,7 +18,6 @@ package org.osgi.framework;
import java.io.File;
import java.io.InputStream;
-import java.util.Collection;
import java.util.Dictionary;
/**
@@ -27,107 +26,100 @@ import java.util.Dictionary;
* Framework.
*
* <p>
- * {@code BundleContext} methods allow a bundle to:
+ * <code>BundleContext</code> methods allow a bundle to:
* <ul>
* <li>Subscribe to events published by the Framework.
* <li>Register service objects with the Framework service registry.
- * <li>Retrieve {@code ServiceReferences} from the Framework service registry.
+ * <li>Retrieve <code>ServiceReferences</code> from the Framework service
+ * registry.
* <li>Get and release service objects for a referenced service.
* <li>Install new bundles in the Framework.
* <li>Get the list of bundles installed in the Framework.
* <li>Get the {@link Bundle} object for a bundle.
- * <li>Create {@code File} objects for files in a persistent storage area
- * provided for the bundle by the Framework.
+ * <li>Create <code>File</code> objects for files in a persistent storage
+ * area provided for the bundle by the Framework.
* </ul>
*
* <p>
- * A {@code BundleContext} object will be created for a bundle when the bundle
- * is started. The {@code Bundle} object associated with a {@code BundleContext}
- * object is called the <em>context bundle</em>.
- *
- * <p>
- * The {@code BundleContext} object will be passed to the
- * {@link BundleActivator#start} method during activation of the context bundle.
- * The same {@code BundleContext} object will be passed to the
- * {@link BundleActivator#stop} method when the context bundle is stopped. A
- * {@code BundleContext} object is generally for the private use of its
+ * A <code>BundleContext</code> object will be created and provided to the
+ * bundle associated with this context when it is started using the
+ * {@link BundleActivator#start} method. The same <code>BundleContext</code>
+ * object will be passed to the bundle associated with this context when it is
+ * stopped using the {@link BundleActivator#stop} method. A
+ * <code>BundleContext</code> object is generally for the private use of its
* associated bundle and is not meant to be shared with other bundles in the
* OSGi environment.
*
* <p>
- * The {@code BundleContext} object is only valid during the execution of its
- * context bundle; that is, during the period from when the context bundle is in
- * the {@code STARTING}, {@code STOPPING}, and {@code ACTIVE} bundle states. If
- * the {@code BundleContext} object is used subsequently, an
- * {@code IllegalStateException} must be thrown. The {@code BundleContext}
- * object must never be reused after its context bundle is stopped.
+ * The <code>Bundle</code> object associated with a <code>BundleContext</code>
+ * object is called the <em>context bundle</em>.
*
* <p>
- * Two {@code BundleContext} objects are equal if they both refer to the same
- * execution context of a bundle. The Framework is the only entity that can
- * create {@code BundleContext} objects and they are only valid within the
- * Framework that created them.
+ * The <code>BundleContext</code> object is only valid during the execution of
+ * its context bundle; that is, during the period from when the context bundle
+ * is in the <code>STARTING</code>, <code>STOPPING</code>, and
+ * <code>ACTIVE</code> bundle states. If the <code>BundleContext</code>
+ * object is used subsequently, an <code>IllegalStateException</code> must be
+ * thrown. The <code>BundleContext</code> object must never be reused after
+ * its context bundle is stopped.
*
* <p>
- * A {@link Bundle} can be {@link Bundle#adapt(Class) adapted} to its
- * {@code BundleContext}. In order for this to succeed, the caller must have the
- * appropriate {@code AdminPermission[bundle,CONTEXT]} if the Java Runtime
- * Environment supports permissions.
+ * The Framework is the only entity that can create <code>BundleContext</code>
+ * objects and they are only valid within the Framework that created them.
*
* @ThreadSafe
- * @noimplement
- * @version $Id: 6d4b5967b9fe706b1dfbdd42b3d759028ed9826d $
+ * @version $Revision: 6781 $
*/
-public interface BundleContext extends BundleReference {
-
+public interface BundleContext {
/**
* Returns the value of the specified property. If the key is not found in
* the Framework properties, the system properties are then searched. The
- * method returns {@code null} if the property is not found.
+ * method returns <code>null</code> if the property is not found.
*
* <p>
* All bundles must have permission to read properties whose names start
* with "org.osgi.".
*
* @param key The name of the requested property.
- * @return The value of the requested property, or {@code null} if the
+ * @return The value of the requested property, or <code>null</code> if the
* property is undefined.
* @throws SecurityException If the caller does not have the appropriate
- * {@code PropertyPermission} to read the property, and the Java
- * Runtime Environment supports permissions.
+ * <code>PropertyPermission</code> to read the property, and the
+ * Java Runtime Environment supports permissions.
*/
- String getProperty(String key);
+ public String getProperty(String key);
/**
- * Returns the {@code Bundle} object associated with this
- * {@code BundleContext}. This bundle is called the context bundle.
+ * Returns the <code>Bundle</code> object associated with this
+ * <code>BundleContext</code>. This bundle is called the context bundle.
*
- * @return The {@code Bundle} object associated with this
- * {@code BundleContext}.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @return The <code>Bundle</code> object associated with this
+ * <code>BundleContext</code>.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- Bundle getBundle();
+ public Bundle getBundle();
/**
- * Installs a bundle from the specified {@code InputStream} object.
+ * Installs a bundle from the specified <code>InputStream</code> object.
*
* <p>
- * If the specified {@code InputStream} is {@code null}, the Framework must
- * create the {@code InputStream} from which to read the bundle by
- * interpreting, in an implementation dependent manner, the specified
- * {@code location}.
+ * If the specified <code>InputStream</code> is <code>null</code>, the
+ * Framework must create the <code>InputStream</code> from which to read the
+ * bundle by interpreting, in an implementation dependent manner, the
+ * specified <code>location</code>.
*
* <p>
- * The specified {@code location} identifier will be used as the identity of
- * the bundle. Every installed bundle is uniquely identified by its location
- * identifier which is typically in the form of a URL.
+ * The specified <code>location</code> identifier will be used as the
+ * identity of the bundle. Every installed bundle is uniquely identified by
+ * its location identifier which is typically in the form of a URL.
*
* <p>
* The following steps are required to install a bundle:
* <ol>
* <li>If a bundle containing the same location identifier is already
- * installed, the {@code Bundle} object for that bundle is returned.
+ * installed, the <code>Bundle</code> object for that bundle is returned.
*
* <li>The bundle's content is read from the input stream. If this fails, a
* {@link BundleException} is thrown.
@@ -135,80 +127,71 @@ public interface BundleContext extends B
* <li>The bundle's associated resources are allocated. The associated
* resources minimally consist of a unique identifier and a persistent
* storage area if the platform has file system support. If this step fails,
- * a {@code BundleException} is thrown.
+ * a <code>BundleException</code> is thrown.
*
- * <li>The bundle's state is set to {@code INSTALLED}.
+ * <li>The bundle's state is set to <code>INSTALLED</code>.
*
* <li>A bundle event of type {@link BundleEvent#INSTALLED} is fired.
*
- * <li>The {@code Bundle} object for the newly or previously installed
+ * <li>The <code>Bundle</code> object for the newly or previously installed
* bundle is returned.
* </ol>
*
* <b>Postconditions, no exceptions thrown </b>
* <ul>
- * <li>{@code getState()} in { {@code INSTALLED}, {@code RESOLVED}
- * }.
+ * <li><code>getState()</code> in { <code>INSTALLED</code>,
+ * <code>RESOLVED</code> }.
* <li>Bundle has a unique ID.
* </ul>
* <b>Postconditions, when an exception is thrown </b>
* <ul>
- * <li>Bundle is not installed. If there was an existing bundle for the
- * specified location, then that bundle must still be in the state it was
- * prior to calling this method.</li>
+ * <li>Bundle is not installed and no trace of the bundle exists.
* </ul>
*
* @param location The location identifier of the bundle to install.
- * @param input The {@code InputStream} object from which this bundle will
- * be read or {@code null} to indicate the Framework must create the
- * input stream from the specified location identifier. The input
- * stream must always be closed when this method completes, even if
- * an exception is thrown.
- * @return The {@code Bundle} object of the installed bundle.
- * @throws BundleException If the installation failed. BundleException types
- * thrown by this method include: {@link BundleException#READ_ERROR}
- * , {@link BundleException#DUPLICATE_BUNDLE_ERROR},
- * {@link BundleException#MANIFEST_ERROR}, and
- * {@link BundleException#REJECTED_BY_HOOK}.
+ * @param input The <code>InputStream</code> object from which this bundle
+ * will be read or <code>null</code> to indicate the Framework must
+ * create the input stream from the specified location identifier.
+ * The input stream must always be closed when this method completes,
+ * even if an exception is thrown.
+ * @return The <code>Bundle</code> object of the installed bundle.
+ * @throws BundleException If the input stream cannot be read or the
+ * installation failed.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[installed bundle,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
+ * Java Runtime Environment supports permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- Bundle installBundle(String location, InputStream input)
+ public Bundle installBundle(String location, InputStream input)
throws BundleException;
/**
- * Installs a bundle from the specified {@code location} identifier.
+ * Installs a bundle from the specified <code>location</code> identifier.
*
* <p>
* This method performs the same function as calling
* {@link #installBundle(String,InputStream)} with the specified
- * {@code location} identifier and a {@code null} InputStream.
+ * <code>location</code> identifier and a <code>null</code> InputStream.
*
* @param location The location identifier of the bundle to install.
- * @return The {@code Bundle} object of the installed bundle.
- * @throws BundleException If the installation failed. BundleException types
- * thrown by this method include: {@link BundleException#READ_ERROR}
- * , {@link BundleException#DUPLICATE_BUNDLE_ERROR},
- * {@link BundleException#MANIFEST_ERROR}, and
- * {@link BundleException#REJECTED_BY_HOOK}.
+ * @return The <code>Bundle</code> object of the installed bundle.
+ * @throws BundleException If the installation failed.
* @throws SecurityException If the caller does not have the appropriate
- * {@code AdminPermission[installed bundle,LIFECYCLE]}, and the Java
- * Runtime Environment supports permissions.
+ * <code>AdminPermission[installed bundle,LIFECYCLE]</code>, and the
+ * Java Runtime Environment supports permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #installBundle(String, InputStream)
*/
- Bundle installBundle(String location) throws BundleException;
+ public Bundle installBundle(String location) throws BundleException;
/**
* Returns the bundle with the specified identifier.
*
* @param id The identifier of the bundle to retrieve.
- * @return A {@code Bundle} object or {@code null} if the identifier does
- * not match any installed bundle.
+ * @return A <code>Bundle</code> object or <code>null</code> if the
+ * identifier does not match any installed bundle.
*/
- Bundle getBundle(long id);
+ public Bundle getBundle(long id);
/**
* Returns a list of all installed bundles.
@@ -218,164 +201,179 @@ public interface BundleContext extends B
* Framework is a very dynamic environment, bundles can be installed or
* uninstalled at anytime.
*
- * @return An array of {@code Bundle} objects, one object per installed
- * bundle.
+ * @return An array of <code>Bundle</code> objects, one object per
+ * installed bundle.
*/
- Bundle[] getBundles();
+ public Bundle[] getBundles();
/**
- * Adds the specified {@code ServiceListener} object with the specified
- * {@code filter} to the context bundle's list of listeners. See
- * {@link Filter} for a description of the filter syntax.
- * {@code ServiceListener} objects are notified when a service has a
+ * Adds the specified <code>ServiceListener</code> object with the
+ * specified <code>filter</code> to the context bundle's list of
+ * listeners. See {@link Filter} for a description of the filter syntax.
+ * <code>ServiceListener</code> objects are notified when a service has a
* lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * {@code l} such that {@code (l==listener)}, then this method replaces that
- * listener's filter (which may be {@code null}) with the specified one
- * (which may be {@code null}).
+ * <code>l</code> such that <code>(l==listener)</code>, then this
+ * method replaces that listener's filter (which may be <code>null</code>)
+ * with the specified one (which may be <code>null</code>).
*
* <p>
* The listener is called if the filter criteria is met. To filter based
* upon the class of the service, the filter should reference the
- * {@link Constants#OBJECTCLASS} property. If {@code filter} is {@code null}
- * , all services are considered to match the filter.
+ * {@link Constants#OBJECTCLASS} property. If <code>filter</code> is
+ * <code>null</code>, all services are considered to match the filter.
*
* <p>
- * When using a {@code filter}, it is possible that the {@code ServiceEvent}
- * s for the complete lifecycle of a service will not be delivered to the
- * listener. For example, if the {@code filter} only matches when the
- * property {@code x} has the value {@code 1}, the listener will not be
- * called if the service is registered with the property {@code x} not set
- * to the value {@code 1}. Subsequently, when the service is modified
- * setting property {@code x} to the value {@code 1}, the filter will match
- * and the listener will be called with a {@code ServiceEvent} of type
- * {@code MODIFIED}. Thus, the listener will not be called with a
- * {@code ServiceEvent} of type {@code REGISTERED}.
+ * When using a <code>filter</code>, it is possible that the
+ * <code>ServiceEvent</code>s for the complete lifecycle of a service
+ * will not be delivered to the listener. For example, if the
+ * <code>filter</code> only matches when the property <code>x</code> has
+ * the value <code>1</code>, the listener will not be called if the
+ * service is registered with the property <code>x</code> not set to the
+ * value <code>1</code>. Subsequently, when the service is modified
+ * setting property <code>x</code> to the value <code>1</code>, the
+ * filter will match and the listener will be called with a
+ * <code>ServiceEvent</code> of type <code>MODIFIED</code>. Thus, the
+ * listener will not be called with a <code>ServiceEvent</code> of type
+ * <code>REGISTERED</code>.
*
* <p>
* If the Java Runtime Environment supports permissions, the
- * {@code ServiceListener} object will be notified of a service event only
- * if the bundle that is registering it has the {@code ServicePermission} to
- * get the service using at least one of the named classes the service was
- * registered under.
+ * <code>ServiceListener</code> object will be notified of a service event
+ * only if the bundle that is registering it has the
+ * <code>ServicePermission</code> to get the service using at least one of
+ * the named classes the service was registered under.
*
- * @param listener The {@code ServiceListener} object to be added.
+ * @param listener The <code>ServiceListener</code> object to be added.
* @param filter The filter criteria.
- * @throws InvalidSyntaxException If {@code filter} contains an invalid
- * filter string that cannot be parsed.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an
+ * invalid filter string that cannot be parsed.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @see ServiceEvent
* @see ServiceListener
* @see ServicePermission
*/
- void addServiceListener(ServiceListener listener, String filter)
+ public void addServiceListener(ServiceListener listener, String filter)
throws InvalidSyntaxException;
/**
- * Adds the specified {@code ServiceListener} object to the context bundle's
- * list of listeners.
+ * Adds the specified <code>ServiceListener</code> object to the context
+ * bundle's list of listeners.
*
* <p>
* This method is the same as calling
- * {@code BundleContext.addServiceListener(ServiceListener listener,
- * String filter)} with {@code filter} set to {@code null}.
- *
- * @param listener The {@code ServiceListener} object to be added.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * <code>BundleContext.addServiceListener(ServiceListener listener,
+ * String filter)</code>
+ * with <code>filter</code> set to <code>null</code>.
+ *
+ * @param listener The <code>ServiceListener</code> object to be added.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @see #addServiceListener(ServiceListener, String)
*/
- void addServiceListener(ServiceListener listener);
+ public void addServiceListener(ServiceListener listener);
/**
- * Removes the specified {@code ServiceListener} object from the context
- * bundle's list of listeners.
+ * Removes the specified <code>ServiceListener</code> object from the
+ * context bundle's list of listeners.
*
* <p>
- * If {@code listener} is not contained in this context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in this context bundle's list
+ * of listeners, this method does nothing.
*
- * @param listener The {@code ServiceListener} to be removed.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @param listener The <code>ServiceListener</code> to be removed.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- void removeServiceListener(ServiceListener listener);
+ public void removeServiceListener(ServiceListener listener);
/**
- * Adds the specified {@code BundleListener} object to the context bundle's
- * list of listeners if not already present. BundleListener objects are
- * notified when a bundle has a lifecycle state change.
+ * Adds the specified <code>BundleListener</code> object to the context
+ * bundle's list of listeners if not already present. BundleListener objects
+ * are notified when a bundle has a lifecycle state change.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * {@code l} such that {@code (l==listener)}, this method does nothing.
+ * <code>l</code> such that <code>(l==listener)</code>, this method
+ * does nothing.
*
- * @param listener The {@code BundleListener} to be added.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @param listener The <code>BundleListener</code> to be added.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @throws SecurityException If listener is a
- * {@code SynchronousBundleListener} and the caller does not have
- * the appropriate {@code AdminPermission[context bundle,LISTENER]},
- * and the Java Runtime Environment supports permissions.
+ * <code>SynchronousBundleListener</code> and the caller does not
+ * have the appropriate
+ * <code>AdminPermission[context bundle,LISTENER]</code>, and the
+ * Java Runtime Environment supports permissions.
* @see BundleEvent
* @see BundleListener
*/
- void addBundleListener(BundleListener listener);
+ public void addBundleListener(BundleListener listener);
/**
- * Removes the specified {@code BundleListener} object from the context
- * bundle's list of listeners.
+ * Removes the specified <code>BundleListener</code> object from the
+ * context bundle's list of listeners.
*
* <p>
- * If {@code listener} is not contained in the context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in the context bundle's list
+ * of listeners, this method does nothing.
*
- * @param listener The {@code BundleListener} object to be removed.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @param listener The <code>BundleListener</code> object to be removed.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @throws SecurityException If listener is a
- * {@code SynchronousBundleListener} and the caller does not have
- * the appropriate {@code AdminPermission[context bundle,LISTENER]},
- * and the Java Runtime Environment supports permissions.
+ * <code>SynchronousBundleListener</code> and the caller does not
+ * have the appropriate
+ * <code>AdminPermission[context bundle,LISTENER]</code>, and the
+ * Java Runtime Environment supports permissions.
*/
- void removeBundleListener(BundleListener listener);
+ public void removeBundleListener(BundleListener listener);
/**
- * Adds the specified {@code FrameworkListener} object to the context
+ * Adds the specified <code>FrameworkListener</code> object to the context
* bundle's list of listeners if not already present. FrameworkListeners are
* notified of general Framework events.
*
* <p>
* If the context bundle's list of listeners already contains a listener
- * {@code l} such that {@code (l==listener)}, this method does nothing.
+ * <code>l</code> such that <code>(l==listener)</code>, this method
+ * does nothing.
*
- * @param listener The {@code FrameworkListener} object to be added.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @param listener The <code>FrameworkListener</code> object to be added.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @see FrameworkEvent
* @see FrameworkListener
*/
- void addFrameworkListener(FrameworkListener listener);
+ public void addFrameworkListener(FrameworkListener listener);
/**
- * Removes the specified {@code FrameworkListener} object from the context
- * bundle's list of listeners.
+ * Removes the specified <code>FrameworkListener</code> object from the
+ * context bundle's list of listeners.
*
* <p>
- * If {@code listener} is not contained in the context bundle's list of
- * listeners, this method does nothing.
+ * If <code>listener</code> is not contained in the context bundle's list
+ * of listeners, this method does nothing.
*
- * @param listener The {@code FrameworkListener} object to be removed.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @param listener The <code>FrameworkListener</code> object to be
+ * removed.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
*/
- void removeFrameworkListener(FrameworkListener listener);
+ public void removeFrameworkListener(FrameworkListener listener);
/**
* Registers the specified service object with the specified properties
* under the specified class names into the Framework. A
- * {@code ServiceRegistration} object is returned. The
- * {@code ServiceRegistration} object is for the private use of the bundle
- * registering the service and should not be shared with other bundles. The
- * registering bundle is defined to be the context bundle. Other bundles can
- * locate the service by using either the {@link #getServiceReferences} or
- * {@link #getServiceReference} method.
+ * <code>ServiceRegistration</code> object is returned. The
+ * <code>ServiceRegistration</code> object is for the private use of the
+ * bundle registering the service and should not be shared with other
+ * bundles. The registering bundle is defined to be the context bundle.
+ * Other bundles can locate the service by using either the
+ * {@link #getServiceReferences} or {@link #getServiceReference} method.
*
* <p>
* A bundle can register a service object that implements the
@@ -385,81 +383,59 @@ public interface BundleContext extends B
* <p>
* The following steps are required to register a service:
* <ol>
- * <li>If {@code service} is not a {@code ServiceFactory}, an
- * {@code IllegalArgumentException} is thrown if {@code service} is not an
- * {@code instanceof} all the specified class names.
+ * <li>If <code>service</code> is not a <code>ServiceFactory</code>, an
+ * <code>IllegalArgumentException</code> is thrown if <code>service</code>
+ * is not an <code>instanceof</code> all the specified class names.
* <li>The Framework adds the following service properties to the service
- * properties from the specified {@code Dictionary} (which may be
- * {@code null}): <br/>
+ * properties from the specified <code>Dictionary</code> (which may be
+ * <code>null</code>): <br/>
* A property named {@link Constants#SERVICE_ID} identifying the
* registration number of the service <br/>
* A property named {@link Constants#OBJECTCLASS} containing all the
* specified classes. <br/>
- * Properties with these names in the specified {@code Dictionary} will be
- * ignored.
+ * Properties with these names in the specified <code>Dictionary</code> will
+ * be ignored.
* <li>The service is added to the Framework service registry and may now be
* used by other bundles.
* <li>A service event of type {@link ServiceEvent#REGISTERED} is fired.
- * <li>A {@code ServiceRegistration} object for this registration is
+ * <li>A <code>ServiceRegistration</code> object for this registration is
* returned.
* </ol>
*
* @param clazzes The class names under which the service can be located.
* The class names in this array will be stored in the service's
* properties under the key {@link Constants#OBJECTCLASS}.
- * @param service The service object or a {@code ServiceFactory} object.
+ * @param service The service object or a <code>ServiceFactory</code>
+ * object.
* @param properties The properties for this service. The keys in the
- * properties object must all be {@code String} objects. See
+ * properties object must all be <code>String</code> objects. See
* {@link Constants} for a list of standard service property keys.
* Changes should not be made to this object after calling this
* method. To update the service's properties the
* {@link ServiceRegistration#setProperties} method must be called.
- * The set of properties may be {@code null} if the service has no
- * properties.
- * @return A {@code ServiceRegistration} object for use by the bundle
+ * The set of properties may be <code>null</code> if the service has
+ * no properties.
+ * @return A <code>ServiceRegistration</code> object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
* @throws IllegalArgumentException If one of the following is true:
* <ul>
- * <li>{@code service} is {@code null}. <li>{@code service} is not a
- * {@code ServiceFactory} object and is not an instance of all the
- * named classes in {@code clazzes}. <li> {@code properties}
- * contains case variants of the same key name.
+ * <li><code>service</code> is <code>null</code>. <li><code>service
+ * </code> is not a <code>ServiceFactory</code> object and is not an
+ * instance of all the named classes in <code>clazzes</code>. <li>
+ * <code>properties</code> contains case variants of the same key
+ * name.
* </ul>
* @throws SecurityException If the caller does not have the
- * {@code ServicePermission} to register the service for all the
- * named classes and the Java Runtime Environment supports
+ * <code>ServicePermission</code> to register the service for all
+ * the named classes and the Java Runtime Environment supports
* permissions.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see ServiceRegistration
* @see ServiceFactory
*/
- ServiceRegistration< ? > registerService(String[] clazzes, Object service,
- Dictionary<String, ? > properties);
-
- /**
- * Registers the specified service object with the specified properties
- * under the specified class name with the Framework.
- *
- * <p>
- * This method is otherwise identical to
- * {@link #registerService(String[], Object, Dictionary)} and is provided as
- * a convenience when {@code service} will only be registered under a single
- * class name. Note that even in this case the value of the service's
- * {@link Constants#OBJECTCLASS} property will be an array of string, rather
- * than just a single string.
- *
- * @param clazz The class name under which the service can be located.
- * @param service The service object or a {@code ServiceFactory} object.
- * @param properties The properties for this service.
- * @return A {@code ServiceRegistration} object for use by the bundle
- * registering the service to update the service's properties or to
- * unregister the service.
- * @throws IllegalStateException If this BundleContext is no longer valid.
- * @see #registerService(String[], Object, Dictionary)
- */
- ServiceRegistration< ? > registerService(String clazz, Object service,
- Dictionary<String, ? > properties);
+ public ServiceRegistration registerService(String[] clazzes,
+ Object service, Dictionary properties);
/**
* Registers the specified service object with the specified properties
@@ -468,29 +444,28 @@ public interface BundleContext extends B
* <p>
* This method is otherwise identical to
* {@link #registerService(String[], Object, Dictionary)} and is provided as
- * a convenience when {@code service} will only be registered under a single
- * class name. Note that even in this case the value of the service's
+ * a convenience when <code>service</code> will only be registered under a
+ * single class name. Note that even in this case the value of the service's
* {@link Constants#OBJECTCLASS} property will be an array of string, rather
* than just a single string.
*
- * @param <S> Type of Service.
* @param clazz The class name under which the service can be located.
- * @param service The service object or a {@code ServiceFactory} object.
+ * @param service The service object or a <code>ServiceFactory</code>
+ * object.
* @param properties The properties for this service.
- * @return A {@code ServiceRegistration} object for use by the bundle
+ * @return A <code>ServiceRegistration</code> object for use by the bundle
* registering the service to update the service's properties or to
* unregister the service.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see #registerService(String[], Object, Dictionary)
- * @since 1.6
*/
- <S> ServiceRegistration<S> registerService(Class<S> clazz, S service,
- Dictionary<String, ? > properties);
+ public ServiceRegistration registerService(String clazz, Object service,
+ Dictionary properties);
/**
- * Returns an array of {@code ServiceReference} objects. The returned array
- * of {@code ServiceReference} objects contains services that were
- * registered under the specified class, match the specified filter
+ * Returns an array of <code>ServiceReference</code> objects. The returned
+ * array of <code>ServiceReference</code> objects contains services that
+ * were registered under the specified class, match the specified filter
* expression, and the packages for the class names under which the services
* were registered match the context bundle's packages as defined in
* {@link ServiceReference#isAssignableTo(Bundle, String)}.
@@ -501,51 +476,53 @@ public interface BundleContext extends B
* unregistered at any time.
*
* <p>
- * The specified {@code filter} expression is used to select the registered
- * services whose service properties contain keys and values which satisfy
- * the filter expression. See {@link Filter} for a description of the filter
- * syntax. If the specified {@code filter} is {@code null}, all registered
- * services are considered to match the filter. If the specified
- * {@code filter} expression cannot be parsed, an
- * {@link InvalidSyntaxException} will be thrown with a human readable
+ * The specified <code>filter</code> expression is used to select the
+ * registered services whose service properties contain keys and values
+ * which satisfy the filter expression. See {@link Filter} for a description
+ * of the filter syntax. If the specified <code>filter</code> is
+ * <code>null</code>, all registered services are considered to match the
+ * filter. If the specified <code>filter</code> expression cannot be parsed,
+ * an {@link InvalidSyntaxException} will be thrown with a human readable
* message where the filter became unparsable.
*
* <p>
- * The result is an array of {@code ServiceReference} objects for all
+ * The result is an array of <code>ServiceReference</code> objects for all
* services that meet all of the following conditions:
* <ul>
- * <li>If the specified class name, {@code clazz}, is not {@code null}, the
- * service must have been registered with the specified class name. The
- * complete list of class names with which a service was registered is
- * available from the service's {@link Constants#OBJECTCLASS objectClass}
- * property.
- * <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
+ * <li>If the specified class name, <code>clazz</code>, is not
+ * <code>null</code>, the service must have been registered with the
+ * specified class name. The complete list of class names with which a
+ * service was registered is available from the service's
+ * {@link Constants#OBJECTCLASS objectClass} property.
+ * <li>If the specified <code>filter</code> is not <code>null</code>, the
+ * filter expression must match the service.
* <li>If the Java Runtime Environment supports permissions, the caller must
- * have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
+ * have <code>ServicePermission</code> with the <code>GET</code> action for
+ * at least one of the class names under which the service was registered.
* <li>For each class name with which the service was registered, calling
* {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
- * bundle and the class name on the service's {@code ServiceReference}
- * object must return {@code true}
+ * bundle and the class name on the service's <code>ServiceReference</code>
+ * object must return <code>true</code>
* </ul>
*
* @param clazz The class name with which the service was registered or
- * {@code null} for all services.
- * @param filter The filter expression or {@code null} for all services.
- * @return An array of {@code ServiceReference} objects or {@code null} if
- * no services are registered which satisfy the search.
- * @throws InvalidSyntaxException If the specified {@code filter} contains
- * an invalid filter expression that cannot be parsed.
+ * <code>null</code> for all services.
+ * @param filter The filter expression or <code>null</code> for all
+ * services.
+ * @return An array of <code>ServiceReference</code> objects or
+ * <code>null</code> if no services are registered which satisfy the
+ * search.
+ * @throws InvalidSyntaxException If the specified <code>filter</code>
+ * contains an invalid filter expression that cannot be parsed.
* @throws IllegalStateException If this BundleContext is no longer valid.
*/
- ServiceReference< ? >[] getServiceReferences(String clazz, String filter)
+ public ServiceReference[] getServiceReferences(String clazz, String filter)
throws InvalidSyntaxException;
/**
- * Returns an array of {@code ServiceReference} objects. The returned array
- * of {@code ServiceReference} objects contains services that were
- * registered under the specified class and match the specified filter
+ * Returns an array of <code>ServiceReference</code> objects. The returned
+ * array of <code>ServiceReference</code> objects contains services that
+ * were registered under the specified class and match the specified filter
* expression.
*
* <p>
@@ -554,91 +531,61 @@ public interface BundleContext extends B
* unregistered at any time.
*
* <p>
- * The specified {@code filter} expression is used to select the registered
- * services whose service properties contain keys and values which satisfy
- * the filter expression. See {@link Filter} for a description of the filter
- * syntax. If the specified {@code filter} is {@code null}, all registered
- * services are considered to match the filter. If the specified
- * {@code filter} expression cannot be parsed, an
- * {@link InvalidSyntaxException} will be thrown with a human readable
+ * The specified <code>filter</code> expression is used to select the
+ * registered services whose service properties contain keys and values
+ * which satisfy the filter expression. See {@link Filter} for a description
+ * of the filter syntax. If the specified <code>filter</code> is
+ * <code>null</code>, all registered services are considered to match the
+ * filter. If the specified <code>filter</code> expression cannot be parsed,
+ * an {@link InvalidSyntaxException} will be thrown with a human readable
* message where the filter became unparsable.
*
* <p>
- * The result is an array of {@code ServiceReference} objects for all
+ * The result is an array of <code>ServiceReference</code> objects for all
* services that meet all of the following conditions:
* <ul>
- * <li>If the specified class name, {@code clazz}, is not {@code null}, the
- * service must have been registered with the specified class name. The
- * complete list of class names with which a service was registered is
- * available from the service's {@link Constants#OBJECTCLASS objectClass}
- * property.
- * <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
+ * <li>If the specified class name, <code>clazz</code>, is not
+ * <code>null</code>, the service must have been registered with the
+ * specified class name. The complete list of class names with which a
+ * service was registered is available from the service's
+ * {@link Constants#OBJECTCLASS objectClass} property.
+ * <li>If the specified <code>filter</code> is not <code>null</code>, the
+ * filter expression must match the service.
* <li>If the Java Runtime Environment supports permissions, the caller must
- * have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
+ * have <code>ServicePermission</code> with the <code>GET</code> action for
+ * at least one of the class names under which the service was registered.
* </ul>
*
* @param clazz The class name with which the service was registered or
- * {@code null} for all services.
- * @param filter The filter expression or {@code null} for all services.
- * @return An array of {@code ServiceReference} objects or {@code null} if
- * no services are registered which satisfy the search.
- * @throws InvalidSyntaxException If the specified {@code filter} contains
- * an invalid filter expression that cannot be parsed.
+ * <code>null</code> for all services.
+ * @param filter The filter expression or <code>null</code> for all
+ * services.
+ * @return An array of <code>ServiceReference</code> objects or
+ * <code>null</code> if no services are registered which satisfy the
+ * search.
+ * @throws InvalidSyntaxException If the specified <code>filter</code>
+ * contains an invalid filter expression that cannot be parsed.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @since 1.3
*/
- ServiceReference< ? >[] getAllServiceReferences(String clazz, String filter)
- throws InvalidSyntaxException;
-
- /**
- * Returns a {@code ServiceReference} object for a service that implements
- * and was registered under the specified class.
- *
- * <p>
- * The returned {@code ServiceReference} object is valid at the time of the
- * call to this method. However as the Framework is a very dynamic
- * environment, services can be modified or unregistered at any time.
- *
- * <p>
- * This method is the same as calling
- * {@link #getServiceReferences(String, String)} with a {@code null} filter
- * expression and then finding the reference with the highest priority. It
- * is provided as a convenience for when the caller is interested in any
- * service that implements the specified class.
- * <p>
- * If multiple such services exist, the service with the highest priority is
- * selected. This priority is defined as the service reference with the
- * highest ranking (as specified in its {@link Constants#SERVICE_RANKING}
- * property) is returned.
- * <p>
- * If there is a tie in ranking, the service with the lowest service ID (as
- * specified in its {@link Constants#SERVICE_ID} property); that is, the
- * service that was registered first is returned.
- *
- * @param clazz The class name with which the service was registered.
- * @return A {@code ServiceReference} object, or {@code null} if no services
- * are registered which implement the named class.
- * @throws IllegalStateException If this BundleContext is no longer valid.
- * @see #getServiceReferences(String, String)
- */
- ServiceReference< ? > getServiceReference(String clazz);
+ public ServiceReference[] getAllServiceReferences(String clazz,
+ String filter) throws InvalidSyntaxException;
/**
- * Returns a {@code ServiceReference} object for a service that implements
- * and was registered under the specified class.
+ * Returns a <code>ServiceReference</code> object for a service that
+ * implements and was registered under the specified class.
*
* <p>
- * The returned {@code ServiceReference} object is valid at the time of the
- * call to this method. However as the Framework is a very dynamic
+ * The returned <code>ServiceReference</code> object is valid at the time of
+ * the call to this method. However as the Framework is a very dynamic
* environment, services can be modified or unregistered at any time.
*
* <p>
* This method is the same as calling
- * {@link #getServiceReferences(Class, String)} with a {@code null} filter
- * expression. It is provided as a convenience for when the caller is
- * interested in any service that implements the specified class.
+ * {@link BundleContext#getServiceReferences(String, String)} with a
+ * <code>null</code> filter expression. It is provided as a convenience for
+ * when the caller is interested in any service that implements the
+ * specified class.
* <p>
* If multiple such services exist, the service with the highest ranking (as
* specified in its {@link Constants#SERVICE_RANKING} property) is returned.
@@ -647,76 +594,17 @@ public interface BundleContext extends B
* specified in its {@link Constants#SERVICE_ID} property); that is, the
* service that was registered first is returned.
*
- * @param <S> Type of Service.
* @param clazz The class name with which the service was registered.
- * @return A {@code ServiceReference} object, or {@code null} if no services
- * are registered which implement the named class.
+ * @return A <code>ServiceReference</code> object, or <code>null</code> if
+ * no services are registered which implement the named class.
* @throws IllegalStateException If this BundleContext is no longer valid.
- * @see #getServiceReferences(Class, String)
- * @since 1.6
- */
- <S> ServiceReference<S> getServiceReference(Class<S> clazz);
-
- /**
- * Returns a collection of {@code ServiceReference} objects. The returned
- * collection of {@code ServiceReference} objects contains services that
- * were registered under the specified class, match the specified filter
- * expression, and the packages for the class names under which the services
- * were registered match the context bundle's packages as defined in
- * {@link ServiceReference#isAssignableTo(Bundle, String)}.
- *
- * <p>
- * The collection is valid at the time of the call to this method. However
- * since the Framework is a very dynamic environment, services can be
- * modified or unregistered at any time.
- *
- * <p>
- * The specified {@code filter} expression is used to select the registered
- * services whose service properties contain keys and values which satisfy
- * the filter expression. See {@link Filter} for a description of the filter
- * syntax. If the specified {@code filter} is {@code null}, all registered
- * services are considered to match the filter. If the specified
- * {@code filter} expression cannot be parsed, an
- * {@link InvalidSyntaxException} will be thrown with a human readable
- * message where the filter became unparsable.
- *
- * <p>
- * The result is a collection of {@code ServiceReference} objects for all
- * services that meet all of the following conditions:
- * <ul>
- * <li>If the specified class name, {@code clazz}, is not {@code null}, the
- * service must have been registered with the specified class name. The
- * complete list of class names with which a service was registered is
- * available from the service's {@link Constants#OBJECTCLASS objectClass}
- * property.
- * <li>If the specified {@code filter} is not {@code null}, the filter
- * expression must match the service.
- * <li>If the Java Runtime Environment supports permissions, the caller must
- * have {@code ServicePermission} with the {@code GET} action for at least
- * one of the class names under which the service was registered.
- * <li>For each class name with which the service was registered, calling
- * {@link ServiceReference#isAssignableTo(Bundle, String)} with the context
- * bundle and the class name on the service's {@code ServiceReference}
- * object must return {@code true}
- * </ul>
- *
- * @param <S> Type of Service
- * @param clazz The class name with which the service was registered. Must
- * not be {@code null}.
- * @param filter The filter expression or {@code null} for all services.
- * @return A collection of {@code ServiceReference} objects. May be empty if
- * no services are registered which satisfy the search.
- * @throws InvalidSyntaxException If the specified {@code filter} contains
- * an invalid filter expression that cannot be parsed.
- * @throws IllegalStateException If this BundleContext is no longer valid.
- * @since 1.6
+ * @see #getServiceReferences(String, String)
*/
- <S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
- String filter) throws InvalidSyntaxException;
+ public ServiceReference getServiceReference(String clazz);
/**
* Returns the service object referenced by the specified
- * {@code ServiceReference} object.
+ * <code>ServiceReference</code> object.
* <p>
* A bundle's use of a service is tracked by the bundle's use count of that
* service. Each time a service's service object is returned by
@@ -729,59 +617,60 @@ public interface BundleContext extends B
* no longer use that service.
*
* <p>
- * This method will always return {@code null} when the service associated
- * with this {@code reference} has been unregistered.
+ * This method will always return <code>null</code> when the service
+ * associated with this <code>reference</code> has been unregistered.
*
* <p>
* The following steps are required to get the service object:
* <ol>
- * <li>If the service has been unregistered, {@code null} is returned.
- * <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with an object implementing the
- * {@code ServiceFactory} interface, the
- * {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
- * called to create a service object for the context bundle. If the service
- * object returned by the {@code ServiceFactory} object is {@code null}, not
- * an {@code instanceof} all the classes named when the service was
- * registered or the {@code ServiceFactory} object throws an exception or
- * will be recursively called for the context bundle, {@code null} is
- * returned and a Framework event of type {@link FrameworkEvent#ERROR}
- * containing a {@link ServiceException} describing the error is fired. <br>
- * This service object is cached by the Framework. While the context
- * bundle's use count for the service is greater than zero, subsequent calls
- * to get the services's service object for the context bundle will return
- * the cached service object.
+ * <li>If the service has been unregistered, <code>null</code> is returned.
* <li>The context bundle's use count for this service is incremented by
* one.
+ * <li>If the context bundle's use count for the service is currently one
+ * and the service was registered with an object implementing the
+ * <code>ServiceFactory</code> interface, the
+ * {@link ServiceFactory#getService(Bundle, ServiceRegistration)} method is
+ * called to create a service object for the context bundle. This service
+ * object is cached by the Framework. While the context bundle's use count
+ * for the service is greater than zero, subsequent calls to get the
+ * services's service object for the context bundle will return the cached
+ * service object. <br>
+ * If the service object returned by the <code>ServiceFactory</code> object
+ * is not an <code>instanceof</code> all the classes named when the service
+ * was registered or the <code>ServiceFactory</code> object throws an
+ * exception, <code>null</code> is returned and a Framework event of type
+ * {@link FrameworkEvent#ERROR} containing a {@link ServiceException}
+ * describing the error is fired.
* <li>The service object for the service is returned.
* </ol>
*
- * @param <S> Type of Service.
* @param reference A reference to the service.
* @return A service object for the service associated with
- * {@code reference} or {@code null} if the service is not
+ * <code>reference</code> or <code>null</code> if the service is not
* registered, the service object returned by a
- * {@code ServiceFactory} does not implement the classes under which
- * it was registered or the {@code ServiceFactory} threw an
- * exception.
+ * <code>ServiceFactory</code> does not implement the classes under
+ * which it was registered or the <code>ServiceFactory</code> threw
+ * an exception.
* @throws SecurityException If the caller does not have the
- * {@code ServicePermission} to get the service using at least one
- * of the named classes the service was registered under and the
+ * <code>ServicePermission</code> to get the service using at least
+ * one of the named classes the service was registered under and the
* Java Runtime Environment supports permissions.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @throws IllegalArgumentException If the specified
- * {@code ServiceReference} was not created by the same framework
- * instance as this {@code BundleContext}.
+ * <code>ServiceReference</code> was not created by the same
+ * framework instance as this <code>BundleContext</code>.
* @see #ungetService(ServiceReference)
* @see ServiceFactory
*/
- <S> S getService(ServiceReference<S> reference);
+ public Object getService(ServiceReference reference);
/**
* Releases the service object referenced by the specified
- * {@code ServiceReference} object. If the context bundle's use count for
- * the service is zero, this method returns {@code false}. Otherwise, the
- * context bundle's use count for the service is decremented by one.
+ * <code>ServiceReference</code> object. If the context bundle's use count
+ * for the service is zero, this method returns <code>false</code>.
+ * Otherwise, the context bundle's use count for the service is decremented
+ * by one.
*
* <p>
* The service's service object should no longer be used and all references
@@ -792,81 +681,76 @@ public interface BundleContext extends B
* The following steps are required to unget the service object:
* <ol>
* <li>If the context bundle's use count for the service is zero or the
- * service has been unregistered, {@code false} is returned.
+ * service has been unregistered, <code>false</code> is returned.
* <li>The context bundle's use count for this service is decremented by
* one.
* <li>If the context bundle's use count for the service is currently zero
- * and the service was registered with a {@code ServiceFactory} object, the
+ * and the service was registered with a <code>ServiceFactory</code> object,
+ * the
* {@link ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)}
* method is called to release the service object for the context bundle.
- * <li>{@code true} is returned.
+ * <li><code>true</code> is returned.
* </ol>
*
* @param reference A reference to the service to be released.
- * @return {@code false} if the context bundle's use count for the service
- * is zero or if the service has been unregistered; {@code true}
- * otherwise.
- * @throws IllegalStateException If this BundleContext is no longer valid.
+ * @return <code>false</code> if the context bundle's use count for the
+ * service is zero or if the service has been unregistered;
+ * <code>true</code> otherwise.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
* @throws IllegalArgumentException If the specified
- * {@code ServiceReference} was not created by the same framework
- * instance as this {@code BundleContext}.
+ * <code>ServiceReference</code> was not created by the same
+ * framework instance as this <code>BundleContext</code>.
* @see #getService
* @see ServiceFactory
*/
- boolean ungetService(ServiceReference< ? > reference);
+ public boolean ungetService(ServiceReference reference);
/**
- * Creates a {@code File} object for a file in the persistent storage area
- * provided for the bundle by the Framework. This method will return
- * {@code null} if the platform does not have file system support.
+ * Creates a <code>File</code> object for a file in the persistent storage
+ * area provided for the bundle by the Framework. This method will return
+ * <code>null</code> if the platform does not have file system support.
*
* <p>
- * A {@code File} object for the base directory of the persistent storage
- * area provided for the context bundle by the Framework can be obtained by
- * calling this method with an empty string as {@code filename}.
+ * A <code>File</code> object for the base directory of the persistent
+ * storage area provided for the context bundle by the Framework can be
+ * obtained by calling this method with an empty string as
+ * <code>filename</code>.
*
* <p>
* If the Java Runtime Environment supports permissions, the Framework will
- * ensure that the bundle has the {@code java.io.FilePermission} with
- * actions {@code read},{@code write},{@code delete} for all files
- * (recursively) in the persistent storage area provided for the context
- * bundle.
+ * ensure that the bundle has the <code>java.io.FilePermission</code> with
+ * actions <code>read</code>,<code>write</code>,<code>delete</code>
+ * for all files (recursively) in the persistent storage area provided for
+ * the context bundle.
*
* @param filename A relative name to the file to be accessed.
- * @return A {@code File} object that represents the requested file or
- * {@code null} if the platform does not have file system support.
- * @throws IllegalStateException If this BundleContext is no longer valid.
- */
- File getDataFile(String filename);
+ * @return A <code>File</code> object that represents the requested file
+ * or <code>null</code> if the platform does not have file system
+ * support.
+ * @throws IllegalStateException If this BundleContext is no
+ * longer valid.
+ */
+ public File getDataFile(String filename);
/**
- * Creates a {@code Filter} object. This {@code Filter} object may be used
- * to match a {@code ServiceReference} object or a {@code Dictionary}
- * object.
+ * Creates a <code>Filter</code> object. This <code>Filter</code> object may
+ * be used to match a <code>ServiceReference</code> object or a
+ * <code>Dictionary</code> object.
*
* <p>
* If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
* thrown with a human readable message where the filter became unparsable.
*
* @param filter The filter string.
- * @return A {@code Filter} object encapsulating the filter string.
- * @throws InvalidSyntaxException If {@code filter} contains an invalid
+ * @return A <code>Filter</code> object encapsulating the filter string.
+ * @throws InvalidSyntaxException If <code>filter</code> contains an invalid
* filter string that cannot be parsed.
- * @throws NullPointerException If {@code filter} is null.
+ * @throws NullPointerException If <code>filter</code> is null.
* @throws IllegalStateException If this BundleContext is no longer valid.
* @see "Framework specification for a description of the filter string syntax."
* @see FrameworkUtil#createFilter(String)
* @since 1.1
*/
- Filter createFilter(String filter) throws InvalidSyntaxException;
-
- /**
- * Returns the bundle with the specified location.
- *
- * @param location The location of the bundle to retrieve.
- * @return A {@code Bundle} object or {@code null} if the location does not
- * match any installed bundle.
- * @since 1.6
- */
- Bundle getBundle(String location);
+ public Filter createFilter(String filter) throws InvalidSyntaxException;
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundleEvent.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2009). 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,8 +21,8 @@ import java.util.EventObject;
/**
* An event from the Framework describing a bundle lifecycle change.
* <p>
- * {@code BundleEvent} objects are delivered to
- * {@code SynchronousBundleListener}s and {@code BundleListener}s
+ * <code>BundleEvent</code> objects are delivered to
+ * <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.
*
@@ -32,7 +32,7 @@ import java.util.EventObject;
* @Immutable
* @see BundleListener
* @see SynchronousBundleListener
- * @version $Id: ed3c40cd707bed45681cadce114a6cc5db27a844 $
+ * @version $Revision: 6542 $
*/
public class BundleEvent extends EventObject {
@@ -113,7 +113,7 @@ public class BundleEvent extends EventOb
* {@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}s.
+ * delivered to <code>BundleListener</code>s.
*
* @see Bundle#start()
* @since 1.3
@@ -127,7 +127,7 @@ public class BundleEvent extends EventOb
* {@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}s.
+ * delivered to <code>BundleListener</code>s.
*
* @see Bundle#stop()
* @since 1.3
@@ -140,55 +140,25 @@ public class BundleEvent extends EventOb
* 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}. This event is only delivered to
+ * <code>BundleContext</code>. This event is only delivered to
* {@link SynchronousBundleListener}s. It is not delivered to
- * {@code BundleListener}s.
+ * <code>BundleListener</code>s.
*
* @since 1.4
*/
public final static int LAZY_ACTIVATION = 0x00000200;
/**
- * Bundle that was the origin of the event. For install event type, this is
- * the bundle whose context was used to install the bundle. Otherwise it is
- * the bundle itself.
- *
- * @since 1.6
- */
- private final Bundle origin;
-
- /**
* Creates a bundle event of the specified type.
*
* @param type The event type.
* @param bundle The bundle which had a lifecycle change.
- * @param origin The bundle which is the origin of the event. For the event
- * type {@link #INSTALLED}, this is the bundle whose context was used
- * to install the bundle. Otherwise it is the bundle itself.
- * @since 1.6
*/
- public BundleEvent(int type, Bundle bundle, Bundle origin) {
- super(bundle);
- if (origin == null) {
- throw new IllegalArgumentException("null origin");
- }
- this.bundle = bundle;
- this.type = type;
- this.origin = origin;
- }
- /**
- * Creates a bundle event of the specified type.
- *
- * @param type The event type.
- * @param bundle The bundle which had a lifecycle change. This bundle is
- * used as the origin of the event.
- */
public BundleEvent(int type, Bundle bundle) {
super(bundle);
this.bundle = bundle;
this.type = type;
- this.origin = bundle;
}
/**
@@ -218,21 +188,8 @@ public class BundleEvent extends EventOb
*
* @return The type of lifecycle event.
*/
+
public int getType() {
return type;
}
-
- /**
- * Returns the bundle that was the origin of the event.
- *
- * <p>
- * For the event type {@link #INSTALLED}, this is the bundle whose context
- * was used to install the bundle. Otherwise it is the bundle itself.
- *
- * @return The bundle that was the origin of the event.
- * @since 1.6
- */
- public Bundle getOrigin() {
- return origin;
- }
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundleException.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -21,9 +21,9 @@ package org.osgi.framework;
* occurred.
*
* <p>
- * A {@code BundleException} object is created by the Framework to denote
+ * A <code>BundleException</code> object is created by the Framework to denote
* an exception condition in the lifecycle of a bundle.
- * {@code BundleException}s should not be created by bundle developers.
+ * <code>BundleException</code>s should not be created by bundle developers.
* A type code is used to identify the exception type for future extendability.
*
* <p>
@@ -32,7 +32,7 @@ package org.osgi.framework;
* <p>
* This exception conforms to the general purpose exception chaining mechanism.
*
- * @version $Id: 9e117ec9667b040f7752e342aa07d6c7d5bf0275 $
+ * @version $Revision: 6083 $
*/
public class BundleException extends Exception {
@@ -45,14 +45,13 @@ public class BundleException extends Exc
private final int type;
/**
- * No exception type is specified.
+ * No exception type is unspecified.
*
* @since 1.5
*/
public static final int UNSPECIFIED = 0;
/**
- * The operation was unsupported. This type can be used anywhere a
- * BundleException can be thrown.
+ * The operation was unsupported.
*
* @since 1.5
*/
@@ -103,12 +102,8 @@ public class BundleException extends Exc
public static final int NATIVECODE_ERROR = 8;
/**
- * The install or update operation failed because another already installed
- * bundle has the same symbolic name and version. This exception type will
- * only occur if the framework is configured to only allow a single bundle
- * to be installed for a given symbolic name and version.
- *
- * @see Constants#FRAMEWORK_BSNVERSION
+ * The install or update operation failed because another
+ * already installed bundle has the same symbolic name and version.
* @since 1.5
*/
public static final int DUPLICATE_BUNDLE_ERROR = 9;
@@ -122,22 +117,7 @@ public class BundleException extends Exc
public static final int START_TRANSIENT_ERROR = 10;
/**
- * The framework received an error while reading the input stream for a
- * bundle.
- *
- * @since 1.6
- */
- public static final int READ_ERROR = 11;
-
- /**
- * A framework hook rejected the operation.
- *
- * @since 1.6
- */
- public static final int REJECTED_BY_HOOK = 12;
-
- /**
- * Creates a {@code BundleException} with the specified message and
+ * Creates a <code>BundleException</code> with the specified message and
* exception cause.
*
* @param msg The associated message.
@@ -148,7 +128,7 @@ public class BundleException extends Exc
}
/**
- * Creates a {@code BundleException} with the specified message.
+ * Creates a <code>BundleException</code> with the specified message.
*
* @param msg The message.
*/
@@ -157,7 +137,7 @@ public class BundleException extends Exc
}
/**
- * Creates a {@code BundleException} with the specified message, type
+ * Creates a <code>BundleException</code> with the specified message, type
* and exception cause.
*
* @param msg The associated message.
@@ -171,7 +151,7 @@ public class BundleException extends Exc
}
/**
- * Creates a {@code BundleException} with the specified message and
+ * Creates a <code>BundleException</code> with the specified message and
* type.
*
* @param msg The message.
@@ -184,29 +164,29 @@ public class BundleException extends Exc
}
/**
- * Returns the cause of this exception or {@code null} if no cause was
+ * Returns the cause of this exception or <code>null</code> if no cause was
* specified when this exception was created.
*
* <p>
* This method predates the general purpose exception chaining mechanism.
- * The {@code getCause()} method is now the preferred means of
+ * The <code>getCause()</code> method is now the preferred means of
* obtaining this information.
*
- * @return The result of calling {@code getCause()}.
+ * @return The result of calling <code>getCause()</code>.
*/
public Throwable getNestedException() {
return getCause();
}
/**
- * Returns the cause of this exception or {@code null} if no cause was
+ * Returns the cause of this exception or <code>null</code> if no cause was
* set.
*
- * @return The cause of this exception or {@code null} if no cause was
+ * @return The cause of this exception or <code>null</code> if no cause was
* set.
* @since 1.3
*/
- public Throwable getCause() {
+ public Throwable getCause() {
return super.getCause();
}
@@ -226,7 +206,7 @@ public class BundleException extends Exc
}
/**
- * Returns the type for this exception or {@code UNSPECIFIED} if the
+ * Returns the type for this exception or <code>UNSPECIFIED</code> if the
* type was unspecified or unknown.
*
* @return The type of this exception.
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundleListener.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,29 +19,29 @@ package org.osgi.framework;
import java.util.EventListener;
/**
- * A {@code BundleEvent} listener. {@code BundleListener} is a
+ * A <code>BundleEvent</code> listener. <code>BundleListener</code> is a
* listener interface that may be implemented by a bundle developer. When a
- * {@code BundleEvent} is fired, it is asynchronously delivered to a
- * {@code BundleListener}. The Framework delivers
- * {@code BundleEvent} objects to a {@code BundleListener} in
- * order and must not concurrently call a {@code BundleListener}.
+ * <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} object is registered with the Framework using
+ * A <code>BundleListener</code> object is registered with the Framework using
* the {@link BundleContext#addBundleListener} method.
- * {@code BundleListener}s are called with a {@code BundleEvent}
+ * <code>BundleListener</code>s are called with a <code>BundleEvent</code>
* object when a bundle has been installed, resolved, started, stopped, updated,
* unresolved, or uninstalled.
*
* @see BundleEvent
* @NotThreadSafe
- * @version $Id: 77cdaebd3ac97c6798fc3043957abd1bd6d01ccb $
+ * @version $Revision: 5673 $
*/
public interface BundleListener extends EventListener {
/**
* Receives notification that a bundle has had a lifecycle change.
*
- * @param event The {@code BundleEvent}.
+ * @param event The <code>BundleEvent</code>.
*/
public void bundleChanged(BundleEvent event);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/BundlePermission.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2009). 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,12 +23,10 @@ import java.io.ObjectStreamField;
import java.security.BasicPermission;
import java.security.Permission;
import java.security.PermissionCollection;
-import java.util.ArrayList;
import java.util.Collections;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.Hashtable;
-import java.util.List;
import java.util.Map;
/**
@@ -52,13 +50,13 @@ import java.util.Map;
* </pre>
*
* <p>
- * {@code BundlePermission} has four actions: {@code provide},
- * {@code require},{@code host}, and {@code fragment}. The
- * {@code provide} action implies the {@code require} action.
+ * <code>BundlePermission</code> has four actions: <code>provide</code>,
+ * <code>require</code>,<code>host</code>, and <code>fragment</code>. The
+ * <code>provide</code> action implies the <code>require</code> action.
*
* @since 1.3
* @ThreadSafe
- * @version $Id: d30c9c987cc13007ed19d3a9fdd11b00739591c0 $
+ * @version $Revision: 6860 $
*/
public final class BundlePermission extends BasicPermission {
@@ -66,24 +64,24 @@ public final class BundlePermission exte
private static final long serialVersionUID = 3257846601685873716L;
/**
- * The action string {@code provide}. The {@code provide} action
- * implies the {@code require} action.
+ * The action string <code>provide</code>. The <code>provide</code> action
+ * implies the <code>require</code> action.
*/
public final static String PROVIDE = "provide";
/**
- * The action string {@code require}. The {@code require} action
- * is implied by the {@code provide} action.
+ * The action string <code>require</code>. The <code>require</code> action
+ * is implied by the <code>provide</code> action.
*/
public final static String REQUIRE = "require";
/**
- * The action string {@code host}.
+ * The action string <code>host</code>.
*/
public final static String HOST = "host";
/**
- * The action string {@code fragment}.
+ * The action string <code>fragment</code>.
*/
public final static String FRAGMENT = "fragment";
@@ -115,14 +113,14 @@ public final class BundlePermission exte
* Bundle Permissions are granted over all possible versions of a bundle.
*
* A bundle that needs to provide a bundle must have the appropriate
- * {@code BundlePermission} for the symbolic name; a bundle that
- * requires a bundle must have the appropriate {@code BundlePermssion}
+ * <code>BundlePermission</code> for the symbolic name; a bundle that
+ * requires a bundle must have the appropriate <code>BundlePermssion</code>
* for that symbolic name; a bundle that specifies a fragment host must have
- * the appropriate {@code BundlePermission} for that symbolic name.
+ * the appropriate <code>BundlePermission</code> for that symbolic name.
*
* @param symbolicName The bundle symbolic name.
- * @param actions {@code provide},{@code require},
- * {@code host},{@code fragment} (canonical order).
+ * @param actions <code>provide</code>,<code>require</code>,
+ * <code>host</code>,<code>fragment</code> (canonical order).
*/
public BundlePermission(String symbolicName, String actions) {
this(symbolicName, parseActions(actions));
@@ -280,9 +278,9 @@ public final class BundlePermission exte
*
* <p>
* This method checks that the symbolic name of the target is implied by the
- * symbolic name of this object. The list of {@code BundlePermission}
+ * symbolic name of this object. The list of <code>BundlePermission</code>
* actions must either match or allow for the list of the target object to
- * imply the target {@code BundlePermission} action.
+ * imply the target <code>BundlePermission</code> action.
* <p>
* The permission to provide a bundle implies the permission to require the
* named symbolic name.
@@ -295,8 +293,8 @@ public final class BundlePermission exte
* </pre>
*
* @param p The requested permission.
- * @return {@code true} if the specified {@code BundlePermission}
- * action is implied by this object; {@code false} otherwise.
+ * @return <code>true</code> if the specified <code>BundlePermission</code>
+ * action is implied by this object; <code>false</code> otherwise.
*/
public boolean implies(Permission p) {
if (!(p instanceof BundlePermission)) {
@@ -312,15 +310,15 @@ public final class BundlePermission exte
/**
* Returns the canonical string representation of the
- * {@code BundlePermission} actions.
+ * <code>BundlePermission</code> actions.
*
* <p>
- * Always returns present {@code BundlePermission} actions in the
- * following order: {@code provide}, {@code require},
- * {@code host}, {@code fragment}.
+ * Always returns present <code>BundlePermission</code> actions in the
+ * following order: <code>provide</code>, <code>require</code>,
+ * <code>host</code>, <code>fragment</code>.
*
- * @return Canonical string representation of the {@code BundlePermission
- * } actions.
+ * @return Canonical string representation of the <code>BundlePermission
+ * </code> actions.
*/
public String getActions() {
String result = actions;
@@ -359,28 +357,28 @@ public final class BundlePermission exte
}
/**
- * Returns a new {@code PermissionCollection} object suitable for
- * storing {@code BundlePermission} objects.
+ * Returns a new <code>PermissionCollection</code> object suitable for
+ * storing <code>BundlePermission</code> objects.
*
- * @return A new {@code PermissionCollection} object.
+ * @return A new <code>PermissionCollection</code> object.
*/
public PermissionCollection newPermissionCollection() {
return new BundlePermissionCollection();
}
/**
- * Determines the equality of two {@code BundlePermission} objects.
+ * Determines the equality of two <code>BundlePermission</code> objects.
*
* This method checks that specified bundle has the same bundle symbolic
- * name and {@code BundlePermission} actions as this
- * {@code BundlePermission} object.
+ * name and <code>BundlePermission</code> actions as this
+ * <code>BundlePermission</code> object.
*
* @param obj The object to test for equality with this
- * {@code BundlePermission} object.
- * @return {@code true} if {@code obj} is a
- * {@code BundlePermission}, and has the same bundle symbolic
- * name and actions as this {@code BundlePermission} object;
- * {@code false} otherwise.
+ * <code>BundlePermission</code> object.
+ * @return <code>true</code> if <code>obj</code> is a
+ * <code>BundlePermission</code>, and has the same bundle symbolic
+ * name and actions as this <code>BundlePermission</code> object;
+ * <code>false</code> otherwise.
*/
public boolean equals(Object obj) {
if (obj == this) {
@@ -410,7 +408,7 @@ public final class BundlePermission exte
/**
* WriteObject is called to save the state of the
- * {@code BundlePermission} object to a stream. The actions are
+ * <code>BundlePermission</code> object to a stream. The actions are
* serialized, and the superclass takes care of the name.
*/
private synchronized void writeObject(java.io.ObjectOutputStream s)
@@ -435,7 +433,7 @@ public final class BundlePermission exte
}
/**
- * Stores a set of {@code BundlePermission} permissions.
+ * Stores a set of <code>BundlePermission</code> permissions.
*
* @see java.security.Permission
* @see java.security.Permissions
@@ -450,7 +448,7 @@ final class BundlePermissionCollection e
*
* @GuardedBy this
*/
- private transient Map<String, BundlePermission> permissions;
+ private transient Map permissions;
/**
* Boolean saying if "*" is in the collection.
@@ -465,17 +463,17 @@ final class BundlePermissionCollection e
*
*/
public BundlePermissionCollection() {
- permissions = new HashMap<String, BundlePermission>();
+ permissions = new HashMap();
all_allowed = false;
}
/**
* Add a permission to this permission collection.
*
- * @param permission The {@code BundlePermission} object to add.
+ * @param permission The <code>BundlePermission</code> object to add.
* @throws IllegalArgumentException If the permission is not a
- * {@code BundlePermission} instance.
- * @throws SecurityException If this {@code BundlePermissionCollection}
+ * <code>BundlePermission</code> instance.
+ * @throws SecurityException If this <code>BundlePermissionCollection</code>
* object has been marked read-only.
*/
public void add(final Permission permission) {
@@ -490,8 +488,8 @@ final class BundlePermissionCollection e
final BundlePermission bp = (BundlePermission) permission;
final String name = bp.getName();
synchronized (this) {
- Map<String, BundlePermission> pc = permissions;
- BundlePermission existing = pc.get(name);
+ Map pc = permissions;
+ BundlePermission existing = (BundlePermission) pc.get(name);
if (existing != null) {
final int oldMask = existing.getActionsMask();
final int newMask = bp.getActionsMask();
@@ -514,12 +512,12 @@ final class BundlePermissionCollection e
/**
* Determines if the specified permissions implies the permissions expressed
- * in {@code permission}.
+ * in <code>permission</code>.
*
* @param permission The Permission object to compare with this
- * {@code BundlePermission} object.
- * @return {@code true} if {@code permission} is a proper subset
- * of a permission in the set; {@code false} otherwise.
+ * <code>BundlePermission</code> object.
+ * @return <code>true</code> if <code>permission</code> is a proper subset
+ * of a permission in the set; <code>false</code> otherwise.
*/
public boolean implies(final Permission permission) {
if (!(permission instanceof BundlePermission)) {
@@ -532,10 +530,10 @@ final class BundlePermissionCollection e
BundlePermission bp;
synchronized (this) {
- Map<String, BundlePermission> pc = permissions;
+ Map pc = permissions;
/* short circuit if the "*" Permission was added */
if (all_allowed) {
- bp = pc.get("*");
+ bp = (BundlePermission) pc.get("*");
if (bp != null) {
effective |= bp.getActionsMask();
if ((effective & desired) == desired) {
@@ -543,7 +541,7 @@ final class BundlePermissionCollection e
}
}
}
- bp = pc.get(requestedName);
+ bp = (BundlePermission) pc.get(requestedName);
// strategy:
// Check for full match first. Then work our way up the
// name looking for matches on a.b.*
@@ -559,7 +557,7 @@ final class BundlePermissionCollection e
int offset = requestedName.length() - 1;
while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
requestedName = requestedName.substring(0, last + 1) + "*";
- bp = pc.get(requestedName);
+ bp = (BundlePermission) pc.get(requestedName);
if (bp != null) {
effective |= bp.getActionsMask();
if ((effective & desired) == desired) {
@@ -575,14 +573,13 @@ final class BundlePermissionCollection e
}
/**
- * Returns an enumeration of all {@code BundlePermission} objects in
+ * Returns an enumeration of all <code>BundlePermission</code> objects in
* the container.
*
- * @return Enumeration of all {@code BundlePermission} objects.
+ * @return Enumeration of all <code>BundlePermission</code> objects.
*/
- public synchronized Enumeration<Permission> elements() {
- List<Permission> all = new ArrayList<Permission>(permissions.values());
- return Collections.enumeration(all);
+ public synchronized Enumeration elements() {
+ return Collections.enumeration(permissions.values());
}
/* serialization logic */
@@ -592,8 +589,7 @@ final class BundlePermissionCollection e
private synchronized void writeObject(ObjectOutputStream out)
throws IOException {
- Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(
- permissions);
+ Hashtable hashtable = new Hashtable(permissions);
ObjectOutputStream.PutField pfields = out.putFields();
pfields.put("permissions", hashtable);
pfields.put("all_allowed", all_allowed);
@@ -603,9 +599,8 @@ final class BundlePermissionCollection e
private synchronized void readObject(java.io.ObjectInputStream in)
throws IOException, ClassNotFoundException {
ObjectInputStream.GetField gfields = in.readFields();
- Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields
- .get("permissions", null);
- permissions = new HashMap<String, BundlePermission>(hashtable);
+ Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
+ permissions = new HashMap(hashtable);
all_allowed = gfields.get("all_allowed", false);
}
}