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 2011/05/18 16:52:18 UTC
svn commit: r1124290 [2/3] - in /felix/trunk/framework/src/main:
java/org/apache/felix/framework/ java/org/osgi/framework/
java/org/osgi/framework/hooks/bundle/ java/org/osgi/framework/hooks/resolver/
java/org/osgi/framework/hooks/service/ java/org/osg...
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java?rev=1124290&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WeavingHook.java Wed May 18 14:52:16 2011
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) OSGi Alliance (2010). 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.hooks.weaving;
+
+/**
+ * OSGi Framework Weaving Hook Service.
+ *
+ * <p>
+ * Bundles registering this service will be called during framework class
+ * loading operations. Weaving hook services are called when a class is being
+ * loaded by the framework and have an opportunity to transform the class file
+ * bytes that represents the class being loaded. Weaving hooks may also ask the
+ * framework to wire in additional dynamic imports to the bundle.
+ *
+ * <p>
+ * When a class is being loaded, the framework will create a {@link WovenClass}
+ * object for the class and pass it to each registered weaving hook service for
+ * possible modification. The first weaving hook called will see the original
+ * class file bytes. Subsequently called weaving hooks will see the class file
+ * bytes as modified by previously called weaving hooks.
+ *
+ * @ThreadSafe
+ * @version $Id: d1985029024baba2db1c56aab1e06ee953fd6365 $
+ */
+
+public interface WeavingHook {
+ /**
+ * Weaving hook method.
+ *
+ * This method can modify the specified woven class object to weave the
+ * class being defined.
+ *
+ * <p>
+ * If this method throws any exception, the framework must log the exception
+ * and fail the class load in progress. This weaving hook service must be
+ * blacklisted by the framework and must not be called again. The
+ * blacklisting of this weaving hook service must expire when this weaving
+ * hook service is unregistered. However, this method can throw a
+ * {@link WeavingException} to deliberately fail the class load in progress
+ * without being blacklisted by the framework.
+ *
+ * @param wovenClass The {@link WovenClass} object that represents the data
+ * that will be used to define the class.
+ * @throws WeavingException If this weaving hook wants to deliberately fail
+ * the class load in progress without being blacklisted by the
+ * framework
+ */
+ public void weave(WovenClass wovenClass);
+}
Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java?rev=1124290&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java Wed May 18 14:52:16 2011
@@ -0,0 +1,157 @@
+/*
+ * Copyright (c) OSGi Alliance (2010, 2011). 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.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.hooks.weaving;
+
+import java.security.ProtectionDomain;
+import java.util.List;
+
+import org.osgi.framework.wiring.BundleWiring;
+
+/**
+ * A class being woven.
+ *
+ * This object represents a class being woven and is passed to each
+ * {@link WeavingHook} for possible modification. It allows access to the most
+ * recently transformed class file bytes and to any additional packages that
+ * should be added to the bundle as dynamic imports.
+ *
+ * <p>
+ * After weaving is {@link #isWeavingComplete() complete}, this object becomes
+ * effectively immutable.
+ *
+ * @NotThreadSafe
+ * @noimplement
+ * @version $Id: c689a4c27dc39af1bf5f51338f1a8eaca1dddc1a $
+ */
+public interface WovenClass {
+
+ /**
+ * Returns the class file bytes to be used to define the
+ * {@link WovenClass#getClassName() named} class.
+ *
+ * <p>
+ * While weaving is not {@link #isWeavingComplete() complete}, this method
+ * returns a reference to the class files byte array contained in this
+ * object. After weaving is {@link #isWeavingComplete() complete}, this
+ * object becomes effectively immutable and a copy of the class file byte
+ * array is returned.
+ *
+ * @return The bytes to be used to define the
+ * {@link WovenClass#getClassName() named} class.
+ * @throws SecurityException If the caller does not have
+ * {@code AdminPermission[bundle,WEAVE]} and the Java runtime
+ * environment supports permissions.
+ */
+ public byte[] getBytes();
+
+ /**
+ * Set the class file bytes to be used to define the
+ * {@link WovenClass#getClassName() named} class. This method must not be
+ * called outside invocations of the {@link WeavingHook#weave(WovenClass)
+ * weave} method by the framework.
+ *
+ * <p>
+ * While weaving is not {@link #isWeavingComplete() complete}, this method
+ * replaces the reference to the array contained in this object with the
+ * specified array. After weaving is {@link #isWeavingComplete() complete},
+ * this object becomes effectively immutable and this method will throw an
+ * {@link IllegalStateException}.
+ *
+ * @param newBytes The new classfile that will be used to define the
+ * {@link WovenClass#getClassName() named} class. The specified array
+ * is retained by this object and the caller must not modify the
+ * specified array.
+ * @throws NullPointerException If newBytes is {@code null}.
+ * @throws IllegalStateException If weaving is {@link #isWeavingComplete()
+ * complete}.
+ * @throws SecurityException If the caller does not have
+ * {@code AdminPermission[bundle,WEAVE]} and the Java runtime
+ * environment supports permissions.
+ */
+ public void setBytes(byte[] newBytes);
+
+ /**
+ * Returns the list of dynamic import package descriptions to add to the
+ * {@link #getBundleWiring() bundle wiring} for this woven class. Changes
+ * made to the returned list will be visible to later {@link WeavingHook
+ * weaving hooks} called with this object. The returned list must not be
+ * modified outside invocations of the {@link WeavingHook#weave(WovenClass)
+ * weave} method by the framework.
+ *
+ * <p>
+ * After weaving is {@link #isWeavingComplete() complete}, this object
+ * becomes effectively immutable and the returned list will be unmodifiable.
+ *
+ * <p>
+ * If the Java runtime environment supports permissions, the caller must
+ * have {@code AdminPermission[bundle,WEAVE]} to modify the returned list.
+ *
+ * @return A list containing zero or more dynamic import package
+ * descriptions to add to the bundle wiring for this woven class.
+ * This list must throw {@code IllegalArgumentException} if a
+ * malformed dynamic import package description is added.
+ * @see "Core Specification, Dynamic Import Package, for the syntax of a dynamic import package description."
+ */
+ public List<String> getDynamicImports();
+
+ /**
+ * Returns whether weaving is complete in this woven class. Weaving is
+ * complete after the last {@link WeavingHook weaving hook} is called and
+ * the class is defined.
+ *
+ * <p>
+ * After weaving is complete, this object becomes effectively immutable.
+ *
+ * @return {@code true} weaving is complete, {@code false} otherwise.
+ */
+ public boolean isWeavingComplete();
+
+ /**
+ * Returns the fully qualified name of the class being woven.
+ *
+ * @return The fully qualified name of the class being woven.
+ */
+ public String getClassName();
+
+ /**
+ * Returns the protection domain to which the woven class will be assigned
+ * when it is defined.
+ *
+ * @return The protection domain to which the woven class will be assigned
+ * when it is defined, or {@code null} if no protection domain will
+ * be assigned.
+ */
+ public ProtectionDomain getProtectionDomain();
+
+ /**
+ * Returns the class associated with this woven class. When loading a class
+ * for the first time this method will return {@code null} until weaving is
+ * {@link #isWeavingComplete() complete}. Once weaving is complete, this
+ * method will return the class object.
+ *
+ * @return The class associated with this woven class, or {@code null} if
+ * weaving is not complete or the class definition failed.
+ */
+ public Class< ? > getDefinedClass();
+
+ /**
+ * Returns the bundle wiring whose class loader will define the woven class.
+ *
+ * @return The bundle wiring whose class loader will define the woven class.
+ */
+ public BundleWiring getBundleWiring();
+}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2008, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2010). 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.
@@ -17,6 +17,8 @@
package org.osgi.framework.launch;
import java.io.InputStream;
+import java.net.URL;
+import java.util.Enumeration;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleException;
@@ -32,7 +34,8 @@ import org.osgi.framework.FrameworkEvent
* instance.
*
* @ThreadSafe
- * @version $Revision: 6542 $
+ * @noimplement
+ * @version $Id: 2be857d06f3605a04f701b59f11e127c0f8940dc $
*/
public interface Framework extends Bundle {
@@ -40,14 +43,17 @@ public interface Framework extends Bundl
* Initialize this Framework. After calling this method, this Framework
* must:
* <ul>
+ * <li>Have generated a new {@link Constants#FRAMEWORK_UUID framework UUID}.
+ * </li>
* <li>Be in the {@link #STARTING} state.</li>
* <li>Have a valid Bundle Context.</li>
* <li>Be at start level 0.</li>
* <li>Have event handling enabled.</li>
* <li>Have reified Bundle objects for all installed bundles.</li>
* <li>Have registered any framework services. For example,
- * <code>PackageAdmin</code>, <code>ConditionalPermissionAdmin</code>,
- * <code>StartLevel</code>.</li>
+ * {@code ConditionalPermissionAdmin}.</li>
+ * <li>Be {@link #adapt(Class) adaptable} to the OSGi defined types to which
+ * a system bundle can be adapted.</li>
* </ul>
*
* <p>
@@ -61,8 +67,8 @@ public interface Framework extends Bundl
* @throws BundleException If this Framework could not be initialized.
* @throws SecurityException If the Java Runtime Environment supports
* permissions and the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code> or if there is a
- * security manager already installed and the
+ * {@code AdminPermission[this,EXECUTE]} or if there is a security
+ * manager already installed and the
* {@link Constants#FRAMEWORK_SECURITY} configuration property is
* set.
*
@@ -70,8 +76,8 @@ public interface Framework extends Bundl
void init() throws BundleException;
/**
- * Wait until this Framework has completely stopped. The <code>stop</code>
- * and <code>update</code> methods on a Framework performs an asynchronous
+ * Wait until this Framework has completely stopped. The {@code stop}
+ * and {@code update} methods on a Framework performs an asynchronous
* stop of the Framework. This method can be used to wait until the
* asynchronous stop of this Framework has completed. This method will only
* wait if called when this Framework is in the {@link #STARTING},
@@ -84,7 +90,7 @@ public interface Framework extends Bundl
* Framework has completely stopped. A value of zero will wait
* indefinitely.
* @return A Framework Event indicating the reason this method returned. The
- * following <code>FrameworkEvent</code> types may be returned by
+ * following {@code FrameworkEvent} types may be returned by
* this method.
* <ul>
* <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
@@ -98,7 +104,7 @@ public interface Framework extends Bundl
* STOPPED_BOOTCLASSPATH_MODIFIED} - This Framework has been stopped
* and a bootclasspath extension bundle has been installed or
* updated. The VM must be restarted in order for the changed boot
- * class path to take affect. </li>
+ * class path to take effect. </li>
*
* <li>{@link FrameworkEvent#ERROR ERROR} - The Framework
* encountered an error while shutting down or an error has occurred
@@ -127,12 +133,10 @@ public interface Framework extends Bundl
* <li>All installed bundles must be started in accordance with each
* bundle's persistent <i>autostart setting</i>. This means some bundles
* will not be started, some will be started with <i>eager activation</i>
- * and some will be started with their <i>declared activation</i> policy. If
- * this Framework implements the optional <i>Start Level Service
- * Specification</i>, then the start level of this Framework is moved to the
- * start level specified by the
- * {@link Constants#FRAMEWORK_BEGINNING_STARTLEVEL beginning start level}
- * framework property, as described in the <i>Start Level Service
+ * and some will be started with their <i>declared activation</i> policy.
+ * The start level of this Framework is moved to the start level specified
+ * by the {@link Constants#FRAMEWORK_BEGINNING_STARTLEVEL beginning start
+ * level} framework property, as described in the <i>Start Level
* Specification</i>. If this framework property is not specified, then the
* start level of this Framework is moved to start level one (1). Any
* exceptions that occur during bundle starting must be wrapped in a
@@ -144,9 +148,9 @@ public interface Framework extends Bundl
*
* @throws BundleException If this Framework could not be started.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
- * @see "Start Level Service Specification"
+ * @see "Start Level Specification"
*/
void start() throws BundleException;
@@ -160,7 +164,7 @@ public interface Framework extends Bundl
* @param options Ignored. There are no start options for the Framework.
* @throws BundleException If this Framework could not be started.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #start()
*/
@@ -175,12 +179,11 @@ public interface Framework extends Bundl
* <ol>
* <li>This Framework's state is set to {@link #STOPPING}.</li>
* <li>All installed bundles must be stopped without changing each bundle's
- * persistent <i>autostart setting</i>. If this Framework implements the
- * optional <i>Start Level Service Specification</i>, then the start level
- * of this Framework is moved to start level zero (0), as described in the
- * <i>Start Level Service Specification</i>. Any exceptions that occur
- * during bundle stopping must be wrapped in a {@link BundleException} and
- * then published as a framework event of type {@link FrameworkEvent#ERROR}</li>
+ * persistent <i>autostart setting</i>. The start level of this Framework is
+ * moved to start level zero (0), as described in the <i>Start Level
+ * Specification</i>. Any exceptions that occur during bundle stopping must
+ * be wrapped in a {@link BundleException} and then published as a framework
+ * event of type {@link FrameworkEvent#ERROR}</li>
* <li>Unregister all services registered by this Framework.</li>
* <li>Event handling is disabled.</li>
* <li>This Framework's state is set to {@link #RESOLVED}.</li>
@@ -196,9 +199,9 @@ public interface Framework extends Bundl
* @throws BundleException If stopping this Framework could not be
* initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
- * @see "Start Level Service Specification"
+ * @see "Start Level Specification"
*/
void stop() throws BundleException;
@@ -213,7 +216,7 @@ public interface Framework extends Bundl
* @throws BundleException If stopping this Framework could not be
* initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+ * {@code AdminPermission[this,EXECUTE]}, and the Java Runtime
* Environment supports permissions.
* @see #stop()
*/
@@ -227,7 +230,7 @@ public interface Framework extends Bundl
*
* @throws BundleException This Framework cannot be uninstalled.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void uninstall() throws BundleException;
@@ -248,7 +251,7 @@ public interface Framework extends Bundl
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void update() throws BundleException;
@@ -265,7 +268,7 @@ public interface Framework extends Bundl
* @throws BundleException If stopping and restarting this Framework could
* not be initiated.
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+ * {@code AdminPermission[this,LIFECYCLE]}, and the Java
* Runtime Environment supports permissions.
*/
void update(InputStream in) throws BundleException;
@@ -281,12 +284,12 @@ public interface Framework extends Bundl
/**
* Returns the Framework location identifier. This Framework is assigned the
- * unique location "<code>System Bundle</code>" since this
+ * unique location "{@code System Bundle}" since this
* Framework is also a System Bundle.
*
- * @return The string "<code>System Bundle</code>".
+ * @return The string "{@code System Bundle}".
* @throws SecurityException If the caller does not have the appropriate
- * <code>AdminPermission[this,METADATA]</code>, and the Java Runtime
+ * {@code AdminPermission[this,METADATA]}, and the Java Runtime
* Environment supports permissions.
* @see Bundle#getLocation()
* @see Constants#SYSTEM_BUNDLE_LOCATION
@@ -296,7 +299,7 @@ public interface Framework extends Bundl
/**
* Returns the symbolic name of this Framework. The symbolic name is unique
* for the implementation of the framework. However, the symbolic name
- * "<code>system.bundle</code>" must be recognized as an alias to
+ * "{@code system.bundle}" must be recognized as an alias to
* the implementation-defined symbolic name since this Framework is also a
* System Bundle.
*
@@ -305,4 +308,56 @@ public interface Framework extends Bundl
* @see Constants#SYSTEM_BUNDLE_SYMBOLICNAME
*/
String getSymbolicName();
+
+ /**
+ * Returns {@code null} as a framework implementation does not have a
+ * proper bundle from which to return entry paths.
+ *
+ * @param path Ignored.
+ * @return {@code null} as a framework implementation does not have a
+ * proper bundle from which to return entry paths.
+ */
+ Enumeration<String> getEntryPaths(String path);
+
+ /**
+ * Returns {@code null} as a framework implementation does not have a
+ * proper bundle from which to return an entry.
+ *
+ * @param path Ignored.
+ * @return {@code null} as a framework implementation does not have a
+ * proper bundle from which to return an entry.
+ */
+ URL getEntry(String path);
+
+ /**
+ * Returns {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entries.
+ *
+ * @param path Ignored.
+ * @param filePattern Ignored.
+ * @param recurse Ignored.
+ * @return {@code null} as a framework implementation does not have a proper
+ * bundle from which to return entries.
+ */
+ Enumeration<URL> findEntries(String path, String filePattern,
+ boolean recurse);
+
+ /**
+ * Adapt this Framework to the specified type.
+ *
+ * <p>
+ * Adapting this Framework to the specified type may require certain checks,
+ * including security checks, to succeed. If a check does not succeed, then
+ * this Framework cannot be adapted and {@code null} is returned. If this
+ * Framework is not {@link #init() initialized}, then {@code null} is
+ * returned if the specified type is one of the OSGi defined types to which
+ * a system bundle can be adapted.
+ *
+ * @param <A> The type to which this Framework is to be adapted.
+ * @param type Class object for the type to which this Framework is to be
+ * adapted.
+ * @return The object, of the specified type, to which this Framework has
+ * been adapted or {@code null} if this Framework cannot be adapted
+ */
+ <A> A adapt(Class<A> type);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2010). 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.
@@ -41,11 +41,12 @@ import org.osgi.framework.Bundle;
* the resource and then load and construct a FrameworkFactory object for the
* framework implementation. The FrameworkFactory implementation class must have
* a public, no-argument constructor. Java™ SE 6 introduced the
- * <code>ServiceLoader</code> class which can create a FrameworkFactory instance
+ * {@code ServiceLoader} class which can create a FrameworkFactory instance
* from the resource.
*
* @ThreadSafe
- * @version $Revision: 6888 $
+ * @noimplement
+ * @version $Id: c370e19dba77231f0dbf1601218ad97b20391ea0 $
*/
public interface FrameworkFactory {
@@ -58,15 +59,15 @@ public interface FrameworkFactory {
* use some reasonable default configuration appropriate for the
* current VM. For example, the system packages for the current
* execution environment should be properly exported. The specified
- * configuration argument may be <code>null</code>. The created
+ * configuration argument may be {@code null}. The created
* framework instance must copy any information needed from the
* specified configuration argument since the configuration argument
* can be changed after the framework instance has been created.
* @return A new, configured {@link Framework} instance. The framework
* instance must be in the {@link Bundle#INSTALLED} state.
* @throws SecurityException If the caller does not have
- * <code>AllPermission</code>, and the Java Runtime Environment
+ * {@code AllPermission}, and the Java Runtime Environment
* supports permissions.
*/
- Framework newFramework(Map configuration);
+ Framework newFramework(Map<String, String> configuration);
}
Modified: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2010). 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.
@@ -31,18 +31,21 @@ import org.osgi.framework.Version;
*
* <p>
* The information about an exported package provided by this object may change.
- * An <code>ExportedPackage</code> object becomes stale if the package it
+ * An {@code ExportedPackage} object becomes stale if the package it
* references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>.
+ * {@code PackageAdmin.refreshPackages()}.
*
- * If this object becomes stale, its <code>getName()</code> and
- * <code>getVersion()</code> methods continue to return their original values,
- * <code>isRemovalPending()</code> returns <code>true</code>, and
- * <code>getExportingBundle()</code> and <code>getImportingBundles()</code>
- * return <code>null</code>.
+ * If this object becomes stale, its {@code getName()} and
+ * {@code getVersion()} methods continue to return their original values,
+ * {@code isRemovalPending()} returns {@code true}, and
+ * {@code getExportingBundle()} and {@code getImportingBundles()}
+ * return {@code null}.
*
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @noimplement
+ * @deprecated The PackageAdmin service has been replaced by the
+ * <code>org.osgi.framework.wiring</code> package.
+ * @version $Id: c56b99465e3f62a9808297a47de8cb7edb802119 $
*/
public interface ExportedPackage {
/**
@@ -56,8 +59,8 @@ public interface ExportedPackage {
* Returns the bundle exporting the package associated with this exported
* package.
*
- * @return The exporting bundle, or <code>null</code> if this
- * <code>ExportedPackage</code> object has become stale.
+ * @return The exporting bundle, or {@code null} if this
+ * {@code ExportedPackage} object has become stale.
*/
public Bundle getExportingBundle();
@@ -71,8 +74,8 @@ public interface ExportedPackage {
* in the returned array. See {@link RequiredBundle#getRequiringBundles()}.
*
* @return The array of resolved bundles currently wired to this exported
- * package, or <code>null</code> if this
- * <code>ExportedPackage</code> object has become stale. The array
+ * package, or {@code null} if this
+ * {@code ExportedPackage} object has become stale. The array
* will be empty if no bundles are wired to this exported package.
*/
public Bundle[] getImportingBundles();
@@ -80,7 +83,7 @@ public interface ExportedPackage {
/**
* Returns the version of this exported package.
*
- * @return The version of this exported package, or <code>null</code> if
+ * @return The version of this exported package, or {@code null} if
* no version information is available.
* @deprecated As of 1.2, replaced by {@link #getVersion}.
*/
@@ -97,14 +100,14 @@ public interface ExportedPackage {
public Version getVersion();
/**
- * Returns <code>true</code> if the package associated with this
- * <code>ExportedPackage</code> object has been exported by a bundle that
+ * Returns {@code true} if the package associated with this
+ * {@code ExportedPackage} object has been exported by a bundle that
* has been updated or uninstalled.
*
- * @return <code>true</code> if the associated package is being exported
+ * @return {@code true} if the associated package is being exported
* by a bundle that has been updated or uninstalled, or if this
- * <code>ExportedPackage</code> object has become stale;
- * <code>false</code> otherwise.
+ * {@code ExportedPackage} object has become stale;
+ * {@code false} otherwise.
*/
public boolean isRemovalPending();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2001, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2010). 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.
@@ -28,7 +28,10 @@ import org.osgi.framework.Bundle;
* with the Framework.
*
* @ThreadSafe
- * @version $Revision: 6779 $
+ * @noimplement
+ * @version $Id: a268c3bdc986080fa16bdb2f56ba1d3800d030dd $
+ * @deprecated This service has been replaced by the
+ * <code>org.osgi.framework.wiring</code> package.
* @see org.osgi.service.packageadmin.ExportedPackage
* @see org.osgi.service.packageadmin.RequiredBundle
*/
@@ -37,19 +40,19 @@ public interface PackageAdmin {
* Gets the exported packages for the specified bundle.
*
* @param bundle The bundle whose exported packages are to be returned, or
- * <code>null</code> if all exported packages are to be returned. If
+ * {@code null} if all exported packages are to be returned. If
* the specified bundle is the system bundle (that is, the bundle
* with id zero), this method returns all the packages known to be
* exported by the system bundle. This will include the package
- * specified by the <code>org.osgi.framework.system.packages</code>
+ * specified by the {@code org.osgi.framework.system.packages}
* system property as well as any other package exported by the
* framework implementation.
*
- * @return An array of exported packages, or <code>null</code> if the
+ * @return An array of exported packages, or {@code null} if the
* specified bundle has no exported packages.
- * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+ * @throws IllegalArgumentException If the specified {@code Bundle} was
* not created by the same framework instance that registered this
- * <code>PackageAdmin</code> service.
+ * {@code PackageAdmin} service.
*/
public ExportedPackage[] getExportedPackages(Bundle bundle);
@@ -58,7 +61,7 @@ public interface PackageAdmin {
*
* @param name The name of the exported packages to be returned.
*
- * @return An array of the exported packages, or <code>null</code> if no
+ * @return An array of the exported packages, or {@code null} if no
* exported packages with the specified name exists.
* @since 1.2
*/
@@ -73,7 +76,7 @@ public interface PackageAdmin {
*
* @param name The name of the exported package to be returned.
*
- * @return The exported package, or <code>null</code> if no exported
+ * @return The exported package, or {@code null} if no exported
* package with the specified name exists.
* @see #getExportedPackages(String)
*/
@@ -101,49 +104,49 @@ public interface PackageAdmin {
* graph any bundle that is wired to a package that is currently exported by
* a bundle in the graph. The graph is fully constructed when there is no
* bundle outside the graph that is wired to a bundle in the graph. The
- * graph may contain <code>UNINSTALLED</code> bundles that are currently
+ * graph may contain {@code UNINSTALLED} bundles that are currently
* still exporting packages.
*
- * <li>Each bundle in the graph that is in the <code>ACTIVE</code> state
- * will be stopped as described in the <code>Bundle.stop</code> method.
+ * <li>Each bundle in the graph that is in the {@code ACTIVE} state
+ * will be stopped as described in the {@code Bundle.stop} method.
*
- * <li>Each bundle in the graph that is in the <code>RESOLVED</code> state
- * is unresolved and thus moved to the <code>INSTALLED</code> state. The
+ * <li>Each bundle in the graph that is in the {@code RESOLVED} state
+ * is unresolved and thus moved to the {@code INSTALLED} state. The
* effect of this step is that bundles in the graph are no longer
- * <code>RESOLVED</code>.
+ * {@code RESOLVED}.
*
- * <li>Each bundle in the graph that is in the <code>UNINSTALLED</code>
+ * <li>Each bundle in the graph that is in the {@code UNINSTALLED}
* state is removed from the graph and is now completely removed from the
* Framework.
*
- * <li>Each bundle in the graph that was in the <code>ACTIVE</code> state
- * prior to Step 2 is started as described in the <code>Bundle.start</code>
+ * <li>Each bundle in the graph that was in the {@code ACTIVE} state
+ * prior to Step 2 is started as described in the {@code Bundle.start}
* method, causing all bundles required for the restart to be resolved. It
* is possible that, as a result of the previous steps, packages that were
* previously exported no longer are. Therefore, some bundles may be
* unresolvable until another bundle offering a compatible package for
* export has been installed in the Framework.
* <li>A framework event of type
- * <code>FrameworkEvent.PACKAGES_REFRESHED</code> is fired.
+ * {@code FrameworkEvent.PACKAGES_REFRESHED} is fired.
* </ol>
*
* <p>
* For any exceptions that are thrown during any of these steps, a
- * <code>FrameworkEvent</code> of type <code>ERROR</code> is fired
+ * {@code FrameworkEvent} of type {@code ERROR} is fired
* containing the exception. The source bundle for these events should be
* the specific bundle to which the exception is related. If no specific
* bundle can be associated with the exception then the System Bundle must
* be used as the source bundle for the event.
*
* @param bundles The bundles whose exported packages are to be updated or
- * removed, or <code>null</code> for all bundles updated or
+ * removed, or {@code null} for all bundles updated or
* uninstalled since the last call to this method.
* @throws SecurityException If the caller does not have
- * <code>AdminPermission[System Bundle,RESOLVE]</code> and the Java
+ * {@code AdminPermission[System Bundle,RESOLVE]} and the Java
* runtime environment supports permissions.
- * @throws IllegalArgumentException If the specified <code>Bundle</code>s
+ * @throws IllegalArgumentException If the specified {@code Bundle}s
* were not created by the same framework instance that registered
- * this <code>PackageAdmin</code> service.
+ * this {@code PackageAdmin} service.
*/
public void refreshPackages(Bundle[] bundles);
@@ -155,20 +158,20 @@ public interface PackageAdmin {
* resolve all unresolved bundles installed in the framework.
*
* <p>
- * If <code>null</code> is specified then the Framework will attempt to
+ * If {@code null} is specified then the Framework will attempt to
* resolve all unresolved bundles. This method must not cause any bundle to
* be refreshed, stopped, or started. This method will not return until the
* operation has completed.
*
- * @param bundles The bundles to resolve or <code>null</code> to resolve all
+ * @param bundles The bundles to resolve or {@code null} to resolve all
* unresolved bundles installed in the Framework.
- * @return <code>true</code> if all specified bundles are resolved;
+ * @return {@code true} if all specified bundles are resolved;
* @throws SecurityException If the caller does not have
- * <code>AdminPermission[System Bundle,RESOLVE]</code> and the Java
+ * {@code AdminPermission[System Bundle,RESOLVE]} and the Java
* runtime environment supports permissions.
- * @throws IllegalArgumentException If the specified <code>Bundle</code>s
+ * @throws IllegalArgumentException If the specified {@code Bundle}s
* were not created by the same framework instance that registered
- * this <code>PackageAdmin</code> service.
+ * this {@code PackageAdmin} service.
* @since 1.2
*/
public boolean resolveBundles(Bundle[] bundles);
@@ -177,12 +180,12 @@ public interface PackageAdmin {
* Returns an array of required bundles having the specified symbolic name.
*
* <p>
- * If <code>null</code> is specified, then all required bundles will be
+ * If {@code null} is specified, then all required bundles will be
* returned.
*
- * @param symbolicName The bundle symbolic name or <code>null</code> for
+ * @param symbolicName The bundle symbolic name or {@code null} for
* all required bundles.
- * @return An array of required bundles or <code>null</code> if no
+ * @return An array of required bundles or {@code null} if no
* required bundles exist for the specified symbolic name.
* @since 1.2
*/
@@ -191,7 +194,7 @@ public interface PackageAdmin {
/**
* Returns the bundles with the specified symbolic name whose bundle version
* is within the specified version range. If no bundles are installed that
- * have the specified symbolic name, then <code>null</code> is returned.
+ * have the specified symbolic name, then {@code null} is returned.
* If a version range is specified, then only the bundles that have the
* specified symbolic name and whose bundle versions belong to the specified
* version range are returned. The returned bundles are ordered by version
@@ -201,31 +204,31 @@ public interface PackageAdmin {
* @see org.osgi.framework.Constants#BUNDLE_VERSION_ATTRIBUTE
* @param symbolicName The symbolic name of the desired bundles.
* @param versionRange The version range of the desired bundles, or
- * <code>null</code> if all versions are desired.
+ * {@code null} if all versions are desired.
* @return An array of bundles with the specified name belonging to the
* specified version range ordered in descending version order, or
- * <code>null</code> if no bundles are found.
+ * {@code null} if no bundles are found.
* @since 1.2
*/
public Bundle[] getBundles(String symbolicName, String versionRange);
/**
* Returns an array of attached fragment bundles for the specified bundle.
- * If the specified bundle is a fragment then <code>null</code> is returned.
+ * If the specified bundle is a fragment then {@code null} is returned.
* If no fragments are attached to the specified bundle then
- * <code>null</code> is returned.
+ * {@code null} is returned.
* <p>
* This method does not attempt to resolve the specified bundle. If the
- * specified bundle is not resolved then <code>null</code> is returned.
+ * specified bundle is not resolved then {@code null} is returned.
*
* @param bundle The bundle whose attached fragment bundles are to be
* returned.
- * @return An array of fragment bundles or <code>null</code> if the bundle
+ * @return An array of fragment bundles or {@code null} if the bundle
* does not have any attached fragment bundles or the bundle is not
* resolved.
- * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+ * @throws IllegalArgumentException If the specified {@code Bundle} was
* not created by the same framework instance that registered this
- * <code>PackageAdmin</code> service.
+ * {@code PackageAdmin} service.
* @since 1.2
*/
public Bundle[] getFragments(Bundle bundle);
@@ -236,11 +239,11 @@ public interface PackageAdmin {
*
* @param bundle The fragment bundle whose host bundles are to be returned.
* @return An array containing the host bundles to which the specified
- * fragment is attached or <code>null</code> if the specified bundle
+ * fragment is attached or {@code null} if the specified bundle
* is not a fragment or is not attached to any host bundles.
- * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+ * @throws IllegalArgumentException If the specified {@code Bundle} was
* not created by the same framework instance that registered this
- * <code>PackageAdmin</code> service.
+ * {@code PackageAdmin} service.
* @since 1.2
*/
public Bundle[] getHosts(Bundle bundle);
@@ -249,13 +252,13 @@ public interface PackageAdmin {
* Returns the bundle from which the specified class is loaded. The class
* loader of the returned bundle must have been used to load the specified
* class. If the class was not loaded by a bundle class loader then
- * <code>null</code> is returned.
+ * {@code null} is returned.
*
* @param clazz The class object from which to locate the bundle.
* @return The bundle from which the specified class is loaded or
- * <code>null</code> if the class was not loaded by a bundle class
+ * {@code null} if the class was not loaded by a bundle class
* loader created by the same framework instance that registered
- * this <code>PackageAdmin</code> service.
+ * this {@code PackageAdmin} service.
* @since 1.2
*/
public Bundle getBundle(Class clazz);
@@ -264,7 +267,7 @@ public interface PackageAdmin {
* Bundle type indicating the bundle is a fragment bundle.
*
* <p>
- * The value of <code>BUNDLE_TYPE_FRAGMENT</code> is 0x00000001.
+ * The value of {@code BUNDLE_TYPE_FRAGMENT} is 0x00000001.
*
* @since 1.2
*/
@@ -286,9 +289,9 @@ public interface PackageAdmin {
*
* @param bundle The bundle for which to return the special type.
* @return The special type of the bundle.
- * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+ * @throws IllegalArgumentException If the specified {@code Bundle} was
* not created by the same framework instance that registered this
- * <code>PackageAdmin</code> service.
+ * {@code PackageAdmin} service.
* @since 1.2
*/
public int getBundleType(Bundle bundle);
Modified: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2004, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2010). 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.
@@ -25,25 +25,28 @@ import org.osgi.framework.Version;
* Objects implementing this interface are created by the Package Admin service.
*
* <p>
- * The term <i>required bundle</i> refers to a resolved bundle that has a
- * bundle symbolic name and is not a fragment. That is, a bundle that may be
- * required by other bundles. This bundle may or may not be currently required
- * by other bundles.
+ * The term <i>required bundle</i> refers to a resolved bundle that has a bundle
+ * symbolic name and is not a fragment. That is, a bundle that may be required
+ * by other bundles. This bundle may or may not be currently required by other
+ * bundles.
*
* <p>
* The information about a required bundle provided by this object may change. A
- * <code>RequiredBundle</code> object becomes stale if an exported package of
+ * {@code RequiredBundle} object becomes stale if an exported package of
* the bundle it references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>).
+ * {@code PackageAdmin.refreshPackages()}).
*
- * If this object becomes stale, its <code>getSymbolicName()</code> and
- * <code>getVersion()</code> methods continue to return their original values,
- * <code>isRemovalPending()</code> returns true, and <code>getBundle()</code>
- * and <code>getRequiringBundles()</code> return <code>null</code>.
+ * If this object becomes stale, its {@code getSymbolicName()} and
+ * {@code getVersion()} methods continue to return their original values,
+ * {@code isRemovalPending()} returns true, and {@code getBundle()}
+ * and {@code getRequiringBundles()} return {@code null}.
*
* @since 1.2
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @noimplement
+ * @deprecated The PackageAdmin service has been replaced by the
+ * <code>org.osgi.framework.wiring</code> package.
+ * @version $Id: 1606b0422cae6769b7eedc2d565df61841da1e22 $
*/
public interface RequiredBundle {
/**
@@ -56,8 +59,8 @@ public interface RequiredBundle {
/**
* Returns the bundle associated with this required bundle.
*
- * @return The bundle, or <code>null</code> if this
- * <code>RequiredBundle</code> object has become stale.
+ * @return The bundle, or {@code null} if this
+ * {@code RequiredBundle} object has become stale.
*/
public Bundle getBundle();
@@ -70,7 +73,7 @@ public interface RequiredBundle {
* included in the returned array.
*
* @return An array of bundles currently requiring this required bundle, or
- * <code>null</code> if this <code>RequiredBundle</code> object
+ * {@code null} if this {@code RequiredBundle} object
* has become stale. The array will be empty if no bundles require
* this required package.
*/
@@ -86,12 +89,12 @@ public interface RequiredBundle {
public Version getVersion();
/**
- * Returns <code>true</code> if the bundle associated with this
- * <code>RequiredBundle</code> object has been updated or uninstalled.
+ * Returns {@code true} if the bundle associated with this
+ * {@code RequiredBundle} object has been updated or uninstalled.
*
- * @return <code>true</code> if the required bundle has been updated or
- * uninstalled, or if the <code>RequiredBundle</code> object has
- * become stale; <code>false</code> otherwise.
+ * @return {@code true} if the required bundle has been updated or
+ * uninstalled, or if the {@code RequiredBundle} object has
+ * become stale; {@code false} otherwise.
*/
public boolean isRemovalPending();
}
Modified: felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2009). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2010). 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.
@@ -31,7 +31,7 @@ import org.osgi.framework.Bundle;
* higher start level than 1.
* <p>
* Access to the StartLevel service is protected by corresponding
- * <code>ServicePermission</code>. In addition <code>AdminPermission</code>
+ * {@code ServicePermission}. In addition {@code AdminPermission}
* is required to actually modify start level information.
* <p>
* Start Level support in the Framework includes the ability to control the
@@ -48,17 +48,17 @@ import org.osgi.framework.Bundle;
* When the Framework is launched, the Framework will enter start level one and
* 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
+ * {@code Bundle.start} 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
- * <code>FrameworkEvent.STARTED</code> to announce it has completed its
+ * {@code FrameworkEvent.STARTED} to announce it has completed its
* 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
+ * {@code Bundle.getBundleId} order or an order based upon dependencies
* between bundles. A similar but reversed order may be used when stopping
* bundles within a start level.
*
@@ -67,7 +67,10 @@ import org.osgi.framework.Bundle;
* start level of the framework.
*
* @ThreadSafe
- * @version $Revision: 6747 $
+ * @noimplement
+ * @version $Id: bf1b71ed6c9f9d75785b26dccb34362017d93f4a $
+ * @deprecated This service has been replaced by the
+ * <code>org.osgi.framework.startlevel</code> package.
*/
public interface StartLevel {
/**
@@ -103,12 +106,12 @@ public interface StartLevel {
* 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>
+ * {@link #isBundleActivationPolicyUsed(Bundle)} returns {@code true}
* for the bundle.
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
- * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+ * {@code FrameworkEvent.STARTLEVEL_CHANGED} to announce it has moved
* to the specified start level.
*
* <p>
@@ -126,13 +129,13 @@ public interface StartLevel {
* </ol>
* When this process completes after the specified start level is reached,
* the Framework will fire a Framework event of type
- * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+ * {@code FrameworkEvent.STARTLEVEL_CHANGED} to announce it has moved
* to the specified start level.
*
* <p>
* If the specified start level is equal to the active start level, then no
* bundles are started or stopped, however, the Framework must fire a
- * Framework event of type <code>FrameworkEvent.STARTLEVEL_CHANGED</code>
+ * Framework event of type {@code FrameworkEvent.STARTLEVEL_CHANGED}
* to announce it has finished moving to the specified start level. This
* event may arrive before this method return.
*
@@ -140,7 +143,7 @@ public interface StartLevel {
* @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
+ * {@code AdminPermission[System Bundle,STARTLEVEL]} and the
* Java runtime environment supports permissions.
*/
public void setStartLevel(int startlevel);
@@ -153,7 +156,7 @@ public interface StartLevel {
* @throws java.lang.IllegalArgumentException If the specified bundle has
* been uninstalled or if the specified bundle was not created by
* the same framework instance that registered this
- * <code>StartLevel</code> service.
+ * {@code StartLevel} service.
*/
public int getBundleStartLevel(Bundle bundle);
@@ -171,7 +174,7 @@ public interface StartLevel {
* 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>
+ * {@link #isBundleActivationPolicyUsed(Bundle)} returns {@code true}
* for the bundle. The actual starting of this bundle must occur
* asynchronously.
* <p>
@@ -187,9 +190,9 @@ public interface StartLevel {
* uninstalled, or if the specified start level is less than or
* equal to zero, or if the specified bundle is the system bundle,
* or if the specified bundle was not created by the same framework
- * instance that registered this <code>StartLevel</code> service.
+ * instance that registered this {@code StartLevel} service.
* @throws SecurityException If the caller does not have
- * <code>AdminPermission[bundle,EXECUTE]</code> and the Java runtime
+ * {@code AdminPermission[bundle,EXECUTE]} and the Java runtime
* environment supports permissions.
*/
public void setBundleStartLevel(Bundle bundle, int startlevel);
@@ -213,7 +216,7 @@ public interface StartLevel {
* Framework.
*
* <p>
- * When a Bundle is installed via <code>BundleContext.installBundle</code>,
+ * When a Bundle is installed via {@code BundleContext.installBundle},
* it is assigned the initial bundle start level value.
*
* <p>
@@ -227,7 +230,7 @@ public interface StartLevel {
* @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
+ * {@code AdminPermission[System Bundle,STARTLEVEL]} and the
* Java runtime environment supports permissions.
*/
public void setInitialBundleStartLevel(int startlevel);
@@ -240,13 +243,13 @@ public interface StartLevel {
* started when its start level is reached.
*
* @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>
+ * @return {@code true} if the autostart setting of the bundle
+ * indicates the bundle is to be started. {@code false}
* otherwise.
* @throws java.lang.IllegalArgumentException If the specified bundle has
* been uninstalled or if the specified bundle was not created by
* the same framework instance that registered this
- * <code>StartLevel</code> service.
+ * {@code StartLevel} service.
* @see Bundle#START_TRANSIENT
*/
public boolean isBundlePersistentlyStarted(Bundle bundle);
@@ -259,13 +262,13 @@ public interface StartLevel {
* 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
+ * @return {@code true} 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.
+ * {@code false} if the bundle must be eagerly activated.
* @throws java.lang.IllegalArgumentException If the specified bundle has
* been uninstalled or if the specified bundle was not created by
* the same framework instance that registered this
- * <code>StartLevel</code> service.
+ * {@code StartLevel} service.
* @since 1.1
* @see Bundle#START_ACTIVATION_POLICY
*/
Modified: felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2010). 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,16 +19,16 @@ package org.osgi.service.url;
import java.net.*;
/**
- * Abstract implementation of the <code>URLStreamHandlerService</code>
+ * Abstract implementation of the {@code URLStreamHandlerService}
* interface. All the methods simply invoke the corresponding methods on
- * <code>java.net.URLStreamHandler</code> except for <code>parseURL</code>
- * and <code>setURL</code>, which use the <code>URLStreamHandlerSetter</code>
+ * {@code java.net.URLStreamHandler} except for {@code parseURL}
+ * and {@code setURL}, which use the {@code URLStreamHandlerSetter}
* parameter. Subclasses of this abstract class should not need to override the
- * <code>setURL</code> and <code>parseURL(URLStreamHandlerSetter,...)</code>
+ * {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)}
* methods.
*
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: 465a0ed86f5d49b338ffc6a13bb68f60f04e54d6 $
*/
public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
implements URLStreamHandlerService {
@@ -39,18 +39,18 @@ public abstract class AbstractURLStreamH
throws java.io.IOException;
/**
- * The <code>URLStreamHandlerSetter</code> object passed to the parseURL
+ * The {@code URLStreamHandlerSetter} object passed to the parseURL
* method.
*/
protected volatile URLStreamHandlerSetter realHandler;
/**
- * Parse a URL using the <code>URLStreamHandlerSetter</code> object. This
- * method sets the <code>realHandler</code> field with the specified
- * <code>URLStreamHandlerSetter</code> object and then calls
- * <code>parseURL(URL,String,int,int)</code>.
+ * Parse a URL using the {@code URLStreamHandlerSetter} object. This
+ * method sets the {@code realHandler} field with the specified
+ * {@code URLStreamHandlerSetter} object and then calls
+ * {@code parseURL(URL,String,int,int)}.
*
- * @param realHandler The object on which the <code>setURL</code> method
+ * @param realHandler The object on which the {@code setURL} method
* must be invoked for the specified URL.
* @see "java.net.URLStreamHandler.parseURL"
*/
@@ -61,7 +61,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.toExternalForm</code>.
+ * This method calls {@code super.toExternalForm}.
*
* @see "java.net.URLStreamHandler.toExternalForm"
*/
@@ -70,7 +70,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.equals(URL,URL)</code>.
+ * This method calls {@code super.equals(URL,URL)}.
*
* @see "java.net.URLStreamHandler.equals(URL,URL)"
*/
@@ -79,7 +79,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.getDefaultPort</code>.
+ * This method calls {@code super.getDefaultPort}.
*
* @see "java.net.URLStreamHandler.getDefaultPort"
*/
@@ -88,7 +88,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.getHostAddress</code>.
+ * This method calls {@code super.getHostAddress}.
*
* @see "java.net.URLStreamHandler.getHostAddress"
*/
@@ -97,7 +97,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.hashCode(URL)</code>.
+ * This method calls {@code super.hashCode(URL)}.
*
* @see "java.net.URLStreamHandler.hashCode(URL)"
*/
@@ -106,7 +106,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.hostsEqual</code>.
+ * This method calls {@code super.hostsEqual}.
*
* @see "java.net.URLStreamHandler.hostsEqual"
*/
@@ -115,7 +115,7 @@ public abstract class AbstractURLStreamH
}
/**
- * This method calls <code>super.sameFile</code>.
+ * This method calls {@code super.sameFile}.
*
* @see "java.net.URLStreamHandler.sameFile"
*/
@@ -125,7 +125,7 @@ public abstract class AbstractURLStreamH
/**
* This method calls
- * <code>realHandler.setURL(URL,String,String,int,String,String)</code>.
+ * {@code realHandler.setURL(URL,String,String,int,String,String)}.
*
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
* @deprecated This method is only for compatibility with handlers written
@@ -138,7 +138,7 @@ public abstract class AbstractURLStreamH
/**
* This method calls
- * <code>realHandler.setURL(URL,String,String,int,String,String,String,String)</code>.
+ * {@code realHandler.setURL(URL,String,String,int,String,String,String,String)}.
*
* @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
*/
Modified: felix/trunk/framework/src/main/java/org/osgi/service/url/URLConstants.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/url/URLConstants.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/url/URLConstants.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/url/URLConstants.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2010). 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,15 +18,16 @@ package org.osgi.service.url;
/**
* Defines standard names for property keys associated with
- * {@link URLStreamHandlerService} and <code>java.net.ContentHandler</code>
+ * {@link URLStreamHandlerService} and {@code java.net.ContentHandler}
* services.
*
* <p>
* The values associated with these keys are of type
- * <code>java.lang.String[]</code> or <code>java.lang.String</code>, unless
+ * {@code java.lang.String[]} or {@code java.lang.String}, unless
* otherwise indicated.
*
- * @version $Revision: 5673 $
+ * @noimplement
+ * @version $Id: 5ec8db316249f4b956fe083b986c11153d0fa8fe $
*/
public interface URLConstants {
/**
Modified: felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2010). 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.
@@ -20,22 +20,22 @@ import java.net.*;
/**
* Service interface with public versions of the protected
- * <code>java.net.URLStreamHandler</code> methods.
+ * {@code java.net.URLStreamHandler} methods.
* <p>
* The important differences between this interface and the
- * <code>URLStreamHandler</code> class are that the <code>setURL</code>
- * method is absent and the <code>parseURL</code> method takes a
+ * {@code URLStreamHandler} class are that the {@code setURL}
+ * method is absent and the {@code parseURL} method takes a
* {@link URLStreamHandlerSetter} object as the first argument. Classes
- * implementing this interface must call the <code>setURL</code> method on the
- * <code>URLStreamHandlerSetter</code> object received in the
- * <code>parseURL</code> method instead of
- * <code>URLStreamHandler.setURL</code> to avoid a
- * <code>SecurityException</code>.
+ * implementing this interface must call the {@code setURL} method on the
+ * {@code URLStreamHandlerSetter} object received in the
+ * {@code parseURL} method instead of
+ * {@code URLStreamHandler.setURL} to avoid a
+ * {@code SecurityException}.
*
* @see AbstractURLStreamHandlerService
*
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: 4982ef5b407669975afe2856a9702246d2d9c2ba $
*/
public interface URLStreamHandlerService {
/**
@@ -44,11 +44,11 @@ public interface URLStreamHandlerService
public URLConnection openConnection(URL u) throws java.io.IOException;
/**
- * Parse a URL. This method is called by the <code>URLStreamHandler</code>
- * proxy, instead of <code>java.net.URLStreamHandler.parseURL</code>,
- * passing a <code>URLStreamHandlerSetter</code> object.
+ * Parse a URL. This method is called by the {@code URLStreamHandler}
+ * proxy, instead of {@code java.net.URLStreamHandler.parseURL},
+ * passing a {@code URLStreamHandlerSetter} object.
*
- * @param realHandler The object on which <code>setURL</code> must be
+ * @param realHandler The object on which {@code setURL} must be
* invoked for this URL.
* @see "java.net.URLStreamHandler.parseURL"
*/
Modified: felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2002, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2010). 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,20 +19,20 @@ package org.osgi.service.url;
import java.net.URL;
/**
- * Interface used by <code>URLStreamHandlerService</code> objects to call the
- * <code>setURL</code> method on the proxy <code>URLStreamHandler</code>
+ * Interface used by {@code URLStreamHandlerService} objects to call the
+ * {@code setURL} method on the proxy {@code URLStreamHandler}
* object.
*
* <p>
* Objects of this type are passed to the
* {@link URLStreamHandlerService#parseURL} method. Invoking the
- * <code>setURL</code> method on the <code>URLStreamHandlerSetter</code>
- * object will invoke the <code>setURL</code> method on the proxy
- * <code>URLStreamHandler</code> object that is actually registered with
- * <code>java.net.URL</code> for the protocol.
+ * {@code setURL} method on the {@code URLStreamHandlerSetter}
+ * object will invoke the {@code setURL} method on the proxy
+ * {@code URLStreamHandler} object that is actually registered with
+ * {@code java.net.URL} for the protocol.
*
* @ThreadSafe
- * @version $Revision: 5673 $
+ * @version $Id: f55d4c29678503c244f56dcb2b5621b3be11cc8d $
*/
public interface URLStreamHandlerSetter {
/**
Modified: felix/trunk/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java?rev=1124290&r1=1124289&r2=1124290&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java Wed May 18 14:52:16 2011
@@ -1,5 +1,5 @@
/*
- * Copyright (c) OSGi Alliance (2007, 2008). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2010). 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.
@@ -30,11 +30,14 @@ import java.util.Map;
* tracked items. This is not a public class. It is only for use by the
* implementation of the Tracker class.
*
+ * @param <S> The tracked item. It is the key.
+ * @param <T> The value mapped to the tracked item.
+ * @param <R> The reason the tracked item is being tracked or untracked.
* @ThreadSafe
- * @version $Revision: 5871 $
+ * @version $Id: 79452e6c28683021f2bcf11d3689ec75c6b5642f $
* @since 1.4
*/
-abstract class AbstractTracked {
+abstract class AbstractTracked<S, T, R> {
/* set this to true to compile in debug messages */
static final boolean DEBUG = false;
@@ -43,7 +46,7 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final Map tracked;
+ private final Map<S, T> tracked;
/**
* Modification count. This field is initialized to zero and incremented by
@@ -67,7 +70,7 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final List adding;
+ private final List<S> adding;
/**
* true if the tracked object is closed.
@@ -94,16 +97,16 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- private final LinkedList initial;
+ private final LinkedList<S> initial;
/**
* AbstractTracked constructor.
*/
AbstractTracked() {
- tracked = new HashMap();
+ tracked = new HashMap<S, T>();
trackingCount = 0;
- adding = new ArrayList(6);
- initial = new LinkedList();
+ adding = new ArrayList<S>(6);
+ initial = new LinkedList<S>();
closed = false;
}
@@ -114,17 +117,15 @@ abstract class AbstractTracked {
* This method must be called from Tracker's open method while synchronized
* on this object in the same synchronized block as the add listener call.
*
- * @param list The initial list of items to be tracked. <code>null</code>
+ * @param list The initial list of items to be tracked. {@code null}
* entries in the list are ignored.
* @GuardedBy this
*/
- void setInitial(Object[] list) {
+ void setInitial(S[] list) {
if (list == null) {
return;
}
- int size = list.length;
- for (int i = 0; i < size; i++) {
- Object item = list[i];
+ for (S item : list) {
if (item == null) {
continue;
}
@@ -145,7 +146,7 @@ abstract class AbstractTracked {
*/
void trackInitial() {
while (true) {
- Object item;
+ S item;
synchronized (this) {
if (closed || (initial.size() == 0)) {
/*
@@ -202,8 +203,8 @@ abstract class AbstractTracked {
* @param item Item to be tracked.
* @param related Action related object.
*/
- void track(final Object item, final Object related) {
- final Object object;
+ void track(final S item, final R related) {
+ final T object;
synchronized (this) {
if (closed) {
return;
@@ -250,11 +251,11 @@ abstract class AbstractTracked {
* @param item Item to be tracked.
* @param related Action related object.
*/
- private void trackAdding(final Object item, final Object related) {
+ private void trackAdding(final S item, final R related) {
if (DEBUG) {
System.out.println("AbstractTracked.trackAdding: " + item); //$NON-NLS-1$
}
- Object object = null;
+ T object = null;
boolean becameUntracked = false;
/* Call customizer outside of synchronized region */
try {
@@ -305,8 +306,8 @@ abstract class AbstractTracked {
* @param item Item to be untracked.
* @param related Action related object.
*/
- void untrack(final Object item, final Object related) {
- final Object object;
+ void untrack(final S item, final R related) {
+ final T object;
synchronized (this) {
if (initial.remove(item)) { /*
* if this item is already in the list
@@ -367,6 +368,18 @@ abstract class AbstractTracked {
}
/**
+ * Returns if the tracker is empty.
+ *
+ * @return Whether the tracker is empty.
+ *
+ * @GuardedBy this
+ * @since 1.5
+ */
+ boolean isEmpty() {
+ return tracked.isEmpty();
+ }
+
+ /**
* Return the customized object for the specified item
*
* @param item The item to lookup in the map
@@ -374,19 +387,19 @@ abstract class AbstractTracked {
*
* @GuardedBy this
*/
- Object getCustomizedObject(final Object item) {
+ T getCustomizedObject(final S item) {
return tracked.get(item);
}
/**
- * Return the list of tracked items.
+ * Copy the tracked items into an array.
*
* @param list An array to contain the tracked items.
* @return The specified list if it is large enough to hold the tracked
* items or a new array large enough to hold the tracked items.
* @GuardedBy this
*/
- Object[] getTracked(final Object[] list) {
+ S[] copyKeys(final S[] list) {
return tracked.keySet().toArray(list);
}
@@ -401,7 +414,7 @@ abstract class AbstractTracked {
}
/**
- * Returns the tracking count for this <code>ServiceTracker</code> object.
+ * Returns the tracking count for this {@code ServiceTracker} object.
*
* The tracking count is initialized to 0 when this object is opened. Every
* time an item is added, modified or removed from this object the tracking
@@ -415,15 +428,32 @@ abstract class AbstractTracked {
}
/**
+ * Copy the tracked items and associated values into the specified map.
+ *
+ * @param <M> Type of {@code Map} to hold the tracked items and
+ * associated values.
+ * @param map The map into which to copy the tracked items and associated
+ * values. This map must not be a user provided map so that user code
+ * is not executed while synchronized on this.
+ * @return The specified map.
+ * @GuardedBy this
+ * @since 1.5
+ */
+ <M extends Map< ? super S, ? super T>> M copyEntries(final M map) {
+ map.putAll(tracked);
+ return map;
+ }
+
+ /**
* Call the specific customizer adding method. This method must not be
* called while synchronized on this object.
*
* @param item Item to be tracked.
* @param related Action related object.
- * @return Customized object for the tracked item or <code>null</code> if
+ * @return Customized object for the tracked item or {@code null} if
* the item is not to be tracked.
*/
- abstract Object customizerAdding(final Object item, final Object related);
+ abstract T customizerAdding(final S item, final R related);
/**
* Call the specific customizer modified method. This method must not be
@@ -433,8 +463,8 @@ abstract class AbstractTracked {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerModified(final Object item, final Object related,
- final Object object);
+ abstract void customizerModified(final S item, final R related,
+ final T object);
/**
* Call the specific customizer removed method. This method must not be
@@ -444,6 +474,6 @@ abstract class AbstractTracked {
* @param related Action related object.
* @param object Customized object for the tracked item.
*/
- abstract void customizerRemoved(final Object item, final Object related,
- final Object object);
+ abstract void customizerRemoved(final S item, final R related,
+ final T object);
}