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 2009/06/08 21:31:08 UTC

svn commit: r782737 [8/8] - in /felix/trunk/org.osgi.core/src/main/java/org/osgi: framework/ framework/hooks/ framework/hooks/service/ framework/launch/ service/condpermadmin/ service/packageadmin/ service/permissionadmin/ service/startlevel/ service/url/

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/PackageAdmin.java,v 1.19 2006/06/16 16:31:49 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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.
@@ -29,7 +27,8 @@
  * If present, there will only be a single instance of this service registered
  * with the Framework.
  * 
- * @version $Revision: 1.19 $
+ * @ThreadSafe
+ * @version $Revision: 6779 $
  * @see org.osgi.service.packageadmin.ExportedPackage
  * @see org.osgi.service.packageadmin.RequiredBundle
  */
@@ -38,8 +37,8 @@
 	 * 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 the specified bundle is the system bundle (that is, the bundle
+	 *        <code>null</code> 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>
@@ -48,6 +47,9 @@
 	 * 
 	 * @return An array of exported packages, or <code>null</code> if the
 	 *         specified bundle has no exported packages.
+	 * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+	 *         not created by the same framework instance that registered this
+	 *         <code>PackageAdmin</code> service.
 	 */
 	public ExportedPackage[] getExportedPackages(Bundle bundle);
 
@@ -93,8 +95,8 @@
 	 * following steps on a separate thread:
 	 * 
 	 * <ol>
-	 * <li>Compute a graph of bundles starting with the specified bundles. If
-	 * no bundles are specified, compute a graph of bundles starting with bundle
+	 * <li>Compute a graph of bundles starting with the specified bundles. If no
+	 * bundles are specified, compute a graph of bundles starting with bundle
 	 * updated or uninstalled since the last call to this method. Add to the
 	 * 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
@@ -105,9 +107,9 @@
 	 * <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>RESOLVED</code>
-	 * state is unresolved and thus moved to the <code>INSTALLED</code> state.
-	 * The effect of this step is that bundles in the graph are no longer
+	 * <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
+	 * effect of this step is that bundles in the graph are no longer
 	 * <code>RESOLVED</code>.
 	 * 
 	 * <li>Each bundle in the graph that is in the <code>UNINSTALLED</code>
@@ -137,8 +139,11 @@
 	 *        removed, or <code>null</code> 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 runtime environment supports permissions.
+	 *         <code>AdminPermission[System Bundle,RESOLVE]</code> and the Java
+	 *         runtime environment supports permissions.
+	 * @throws IllegalArgumentException If the specified <code>Bundle</code>s
+	 *         were not created by the same framework instance that registered
+	 *         this <code>PackageAdmin</code> service.
 	 */
 	public void refreshPackages(Bundle[] bundles);
 
@@ -155,12 +160,15 @@
 	 * 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 unresolved bundles installed in the Framework.
+	 * @param bundles The bundles to resolve or <code>null</code> to resolve all
+	 *        unresolved bundles installed in the Framework.
 	 * @return <code>true</code> if all specified bundles are resolved;
 	 * @throws SecurityException If the caller does not have
-	 *         <code>AdminPermission[System Bundle,RESOLVE]</code> and the
-	 *         Java runtime environment supports permissions.
+	 *         <code>AdminPermission[System Bundle,RESOLVE]</code> and the Java
+	 *         runtime environment supports permissions.
+	 * @throws IllegalArgumentException If the specified <code>Bundle</code>s
+	 *         were not created by the same framework instance that registered
+	 *         this <code>PackageAdmin</code> service.
 	 * @since 1.2
 	 */
 	public boolean resolveBundles(Bundle[] bundles);
@@ -203,8 +211,8 @@
 
 	/**
 	 * 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 no fragments are attached to the specified bundle then
+	 * If the specified bundle is a fragment then <code>null</code> is returned.
+	 * If no fragments are attached to the specified bundle then
 	 * <code>null</code> is returned.
 	 * <p>
 	 * This method does not attempt to resolve the specified bundle. If the
@@ -215,19 +223,24 @@
 	 * @return An array of fragment bundles or <code>null</code> 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
+	 *         not created by the same framework instance that registered this
+	 *         <code>PackageAdmin</code> service.
 	 * @since 1.2
 	 */
 	public Bundle[] getFragments(Bundle bundle);
 
 	/**
-	 * Returns an array containing the host bundle to which the specified
-	 * fragment bundle is attached or <code>null</code> if the specified
-	 * bundle is not attached to a host or is not a fragment bundle. A fragment
-	 * may only be attached to a single host bundle.
-	 * 
-	 * @param bundle The bundle whose host bundle is to be returned.
-	 * @return An array containing the host bundle or <code>null</code> if the
-	 *         bundle does not have a host bundle.
+	 * Returns the host bundles to which the specified fragment bundle is
+	 * attached.
+	 * 
+	 * @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
+	 *         is not a fragment or is not attached to any host bundles.
+	 * @throws IllegalArgumentException If the specified <code>Bundle</code> was
+	 *         not created by the same framework instance that registered this
+	 *         <code>PackageAdmin</code> service.
 	 * @since 1.2
 	 */
 	public Bundle[] getHosts(Bundle bundle);
@@ -241,7 +254,8 @@
 	 * @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
-	 *         loader.
+	 *         loader created by the same framework instance that registered
+	 *         this <code>PackageAdmin</code> service.
 	 * @since 1.2
 	 */
 	public Bundle getBundle(Class clazz);
@@ -272,6 +286,9 @@
 	 * 
 	 * @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
+	 *         not created by the same framework instance that registered this
+	 *         <code>PackageAdmin</code> service.
 	 * @since 1.2
 	 */
 	public int getBundleType(Bundle bundle);

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/RequiredBundle.java,v 1.11 2006/06/16 16:31:49 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2004, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 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.
@@ -44,7 +42,8 @@
  * and <code>getRequiringBundles()</code> return <code>null</code>.
  * 
  * @since 1.2
- * @version $Revision: 1.11 $
+ * @ThreadSafe
+ * @version $Revision: 5673 $
  */
 public interface RequiredBundle {
 	/**
@@ -72,7 +71,8 @@
 	 * 
 	 * @return An array of bundles currently requiring this required bundle, or
 	 *         <code>null</code> if this <code>RequiredBundle</code> object
-	 *         has become stale.
+	 *         has become stale. The array will be empty if no bundles require
+	 *         this required package.
 	 */
 	public Bundle[] getRequiringBundles();
 
@@ -89,7 +89,7 @@
 	 * Returns <code>true</code> if the bundle associated with this
 	 * <code>RequiredBundle</code> object has been updated or uninstalled.
 	 * 
-	 * @return <code>true</code> if the reqiured bundle has been updated or
+	 * @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.
 	 */

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html Mon Jun  8 19:31:06 2009
@@ -0,0 +1,11 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>Package Admin Package Version 1.2.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.service.packageadmin; version=&quot;[1.2,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo Mon Jun  8 19:31:06 2009
@@ -0,0 +1 @@
+version 1.2

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionAdmin.java,v 1.12 2006/06/16 16:31:44 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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.
@@ -24,39 +22,41 @@
  * in the OSGi environment.
  * <p>
  * Access to the Permission Admin service is protected by corresponding
- * <code>ServicePermission</code>. In addition <code>AdminPermission</code> is
- * required to actually set permissions.
+ * <code>ServicePermission</code>. In addition <code>AdminPermission</code>
+ * is required to actually set permissions.
  * 
  * <p>
  * Bundle permissions are managed using a permission table. A bundle's location
  * serves as the key into this permission table. The value of a table entry is
- * the set of permissions (of type <code>PermissionInfo</code>) granted to the
- * bundle named by the given location. A bundle may have an entry in the
+ * the set of permissions (of type <code>PermissionInfo</code>) granted to
+ * the bundle named by the given location. A bundle may have an entry in the
  * permission table prior to being installed in the Framework.
  * 
  * <p>
- * The permissions specified in <code>setDefaultPermissions</code> are used as the
- * default permissions which are granted to all bundles that do not have an
+ * The permissions specified in <code>setDefaultPermissions</code> are used as
+ * the default permissions which are granted to all bundles that do not have an
  * entry in the permission table.
  * 
  * <p>
  * Any changes to a bundle's permissions in the permission table will take
- * effect no later than when bundle's <code>java.security.ProtectionDomain</code>
- * is next involved in a permission check, and will be made persistent.
+ * effect no later than when bundle's
+ * <code>java.security.ProtectionDomain</code> is next involved in a
+ * permission check, and will be made persistent.
  * 
  * <p>
  * Only permission classes on the system classpath or from an exported package
  * are considered during a permission check. Additionally, only permission
- * classes that are subclasses of <code>java.security.Permission</code> and define
- * a 2-argument constructor that takes a <i>name </i> string and an <i>actions
- * </i> string can be used.
+ * classes that are subclasses of <code>java.security.Permission</code> and
+ * define a 2-argument constructor that takes a <i>name </i> string and an
+ * <i>actions </i> string can be used.
  * <p>
  * Permissions implicitly granted by the Framework (for example, a bundle's
  * permission to access its persistent storage area) cannot be changed, and are
- * not reflected in the permissions returned by <code>getPermissions</code> and
- * <code>getDefaultPermissions</code>.
+ * not reflected in the permissions returned by <code>getPermissions</code>
+ * and <code>getDefaultPermissions</code>.
  * 
- * @version $Revision: 1.12 $
+ * @ThreadSafe
+ * @version $Revision: 5673 $
  */
 public interface PermissionAdmin {
 	/**
@@ -66,8 +66,8 @@
 	 *        returned.
 	 * 
 	 * @return The permissions assigned to the bundle with the specified
-	 *         location, or <code>null</code> if that bundle has not been assigned
-	 *         any permissions.
+	 *         location, or <code>null</code> if that bundle has not been
+	 *         assigned any permissions.
 	 */
 	PermissionInfo[] getPermissions(String location);
 
@@ -77,10 +77,11 @@
 	 * 
 	 * @param location The location of the bundle that will be assigned the
 	 *        permissions.
-	 * @param permissions The permissions to be assigned, or <code>null</code> if
-	 *        the specified location is to be removed from the permission table.
+	 * @param permissions The permissions to be assigned, or <code>null</code>
+	 *        if the specified location is to be removed from the permission
+	 *        table.
 	 * @throws SecurityException If the caller does not have
-	 *            <code>AllPermission</code>.
+	 *         <code>AllPermission</code>.
 	 */
 	void setPermissions(String location, PermissionInfo[] permissions);
 
@@ -115,7 +116,7 @@
 	 * @param permissions The default permissions, or <code>null</code> if the
 	 *        default permissions are to be removed from the permission table.
 	 * @throws SecurityException If the caller does not have
-	 *            <code>AllPermission</code>.
+	 *         <code>AllPermission</code>.
 	 */
 	void setDefaultPermissions(PermissionInfo[] permissions);
 }

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionInfo.java,v 1.16 2006/06/16 16:31:44 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 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.
@@ -24,8 +22,8 @@
  * <p>
  * This class encapsulates three pieces of information: a Permission <i>type
  * </i> (class name), which must be a subclass of
- * <code>java.security.Permission</code>, and the <i>name </i> and <i>actions
- * </i> arguments passed to its constructor.
+ * <code>java.security.Permission</code>, and the <i>name</i> and <i>actions</i>
+ * arguments passed to its constructor.
  * 
  * <p>
  * In order for a permission represented by a <code>PermissionInfo</code> to be
@@ -35,22 +33,23 @@
  * <code>PermissionInfo</code> may be delayed until the package containing its
  * Permission class has been exported by a bundle.
  * 
- * @version $Revision: 1.16 $
+ * @Immutable
+ * @version $Revision: 6492 $
  */
 public class PermissionInfo {
-	private String	type;
-	private String	name;
-	private String	actions;
+	private final String	type;
+	private final String	name;
+	private final String	actions;
 
 	/**
-	 * Constructs a <code>PermissionInfo</code> from the specified type, name, and
-	 * actions.
+	 * Constructs a <code>PermissionInfo</code> from the specified type, name,
+	 * and actions.
 	 * 
 	 * @param type The fully qualified class name of the permission represented
 	 *        by this <code>PermissionInfo</code>. The class must be a subclass
 	 *        of <code>java.security.Permission</code> and must define a
-	 *        2-argument constructor that takes a <i>name </i> string and an
-	 *        <i>actions </i> string.
+	 *        2-argument constructor that takes a <i>name</i> string and an
+	 *        <i>actions</i> string.
 	 * 
 	 * @param name The permission name that will be passed as the first argument
 	 *        to the constructor of the <code>Permission</code> class identified
@@ -60,10 +59,9 @@
 	 *        argument to the constructor of the <code>Permission</code> class
 	 *        identified by <code>type</code>.
 	 * 
-	 * @throws java.lang.NullPointerException if <code>type</code> is
-	 *            <code>null</code>.
-	 * @throws java.lang.IllegalArgumentException if <code>action</code> is not
-	 *            <code>null</code> and <code>name</code> is <code>null</code>.
+	 * @throws NullPointerException If <code>type</code> is <code>null</code>.
+	 * @throws IllegalArgumentException If <code>action</code> is not
+	 *         <code>null</code> and <code>name</code> is <code>null</code>.
 	 */
 	public PermissionInfo(String type, String name, String actions) {
 		this.type = type;
@@ -78,15 +76,15 @@
 	}
 
 	/**
-	 * Constructs a <code>PermissionInfo</code> object from the specified encoded
-	 * <code>PermissionInfo</code> string. White space in the encoded
+	 * Constructs a <code>PermissionInfo</code> object from the specified
+	 * encoded <code>PermissionInfo</code> string. White space in the encoded
 	 * <code>PermissionInfo</code> string is ignored.
 	 * 
 	 * 
 	 * @param encodedPermission The encoded <code>PermissionInfo</code>.
 	 * @see #getEncoded
-	 * @throws java.lang.IllegalArgumentException If the 
-	 *            <code>encodedPermission</code> is not properly formatted.
+	 * @throws IllegalArgumentException If the specified
+	 *         <code>encodedPermission</code> is not properly formatted.
 	 */
 	public PermissionInfo(String encodedPermission) {
 		if (encodedPermission == null) {
@@ -95,20 +93,22 @@
 		if (encodedPermission.length() == 0) {
 			throw new IllegalArgumentException("empty encoded permission");
 		}
+		String parsedType = null;
+		String parsedName = null;
+		String parsedActions = null;
 		try {
 			char[] encoded = encodedPermission.toCharArray();
 			int length = encoded.length;
 			int pos = 0;
-			
+
 			/* skip whitespace */
 			while (Character.isWhitespace(encoded[pos])) {
 				pos++;
 			}
-			
+
 			/* the first character must be '(' */
 			if (encoded[pos] != '(') {
-				throw new IllegalArgumentException(
-						"expecting open parenthesis");
+				throw new IllegalArgumentException("expecting open parenthesis");
 			}
 			pos++;
 
@@ -116,22 +116,23 @@
 			while (Character.isWhitespace(encoded[pos])) {
 				pos++;
 			}
-			
+
 			/* type is not quoted or encoded */
 			int begin = pos;
-			while (!Character.isWhitespace(encoded[pos]) && (encoded[pos] != ')')) {
+			while (!Character.isWhitespace(encoded[pos])
+					&& (encoded[pos] != ')')) {
 				pos++;
 			}
 			if (pos == begin || encoded[begin] == '"') {
 				throw new IllegalArgumentException("expecting type");
 			}
-			this.type = new String(encoded, begin, pos - begin);
-			
+			parsedType = new String(encoded, begin, pos - begin);
+
 			/* skip whitespace */
 			while (Character.isWhitespace(encoded[pos])) {
 				pos++;
 			}
-			
+
 			/* type may be followed by name which is quoted and encoded */
 			if (encoded[pos] == '"') {
 				pos++;
@@ -142,7 +143,7 @@
 					}
 					pos++;
 				}
-				this.name = unescapeString(encoded, begin, pos);
+				parsedName = unescapeString(encoded, begin, pos);
 				pos++;
 
 				if (Character.isWhitespace(encoded[pos])) {
@@ -150,8 +151,11 @@
 					while (Character.isWhitespace(encoded[pos])) {
 						pos++;
 					}
-					
-					/* name may be followed by actions which is quoted and encoded */
+
+					/*
+					 * name may be followed by actions which is quoted and
+					 * encoded
+					 */
 					if (encoded[pos] == '"') {
 						pos++;
 						begin = pos;
@@ -161,7 +165,7 @@
 							}
 							pos++;
 						}
-						this.actions = unescapeString(encoded, begin, pos);
+						parsedActions = unescapeString(encoded, begin, pos);
 						pos++;
 
 						/* skip whitespace */
@@ -171,7 +175,7 @@
 					}
 				}
 			}
-			
+
 			/* the final character must be ')' */
 			char c = encoded[pos];
 			pos++;
@@ -179,12 +183,17 @@
 				pos++;
 			}
 			if ((c != ')') || (pos != length)) {
-				throw new IllegalArgumentException("expecting close parenthesis");
+				throw new IllegalArgumentException(
+						"expecting close parenthesis");
 			}
 		}
 		catch (ArrayIndexOutOfBoundsException e) {
 			throw new IllegalArgumentException("parsing terminated abruptly");
 		}
+
+		type = parsedType;
+		name = parsedName;
+		actions = parsedActions;
 	}
 
 	/**
@@ -210,15 +219,17 @@
 	 * (type &quot;name&quot; &quot;actions&quot;)
 	 * </pre>
 	 * 
-	 * where <i>name</i> and <i>actions</i> are strings that are encoded for
-	 * proper parsing. Specifically, the <code>"</code>,<code>\</code>, carriage
-	 * return, and linefeed characters are escaped using <code>\"</code>,
-	 * <code>\\</code>,<code>\r</code>, and <code>\n</code>, respectively.
+	 * where <i>name</i> and <i>actions</i> are strings that must be encoded for
+	 * proper parsing. Specifically, the <code>&quot;</code>,<code>\</code>,
+	 * carriage return, and line feed characters must be escaped using
+	 * <code>\&quot;</code>, <code>\\</code>,<code>\r</code>, and
+	 * <code>\n</code>, respectively.
 	 * 
 	 * <p>
-	 * The encoded string contains no leading or trailing whitespace
-	 * characters. A single space character is used between <i>type</i> and 
-	 * &quot;<i>name</i>&quot; and between &quot;<i>name</i>&quot; and &quot;<i>actions</i>&quot;.
+	 * The encoded string contains no leading or trailing whitespace characters.
+	 * A single space character is used between <i>type</i> and
+	 * &quot;<i>name</i>&quot; and between &quot;<i>name</i>&quot; and
+	 * &quot;<i>actions</i>&quot;.
 	 * 
 	 * @return The string encoding of this <code>PermissionInfo</code>.
 	 */
@@ -244,9 +255,9 @@
 	}
 
 	/**
-	 * Returns the string representation of this <code>PermissionInfo</code>. The
-	 * string is created by calling the <code>getEncoded</code> method on this
-	 * <code>PermissionInfo</code>.
+	 * Returns the string representation of this <code>PermissionInfo</code>.
+	 * The string is created by calling the <code>getEncoded</code> method on
+	 * this <code>PermissionInfo</code>.
 	 * 
 	 * @return The string representation of this <code>PermissionInfo</code>.
 	 */
@@ -270,8 +281,8 @@
 	 * <code>PermissionInfo</code>.
 	 * 
 	 * @return The name of the permission represented by this
-	 *         <code>PermissionInfo</code>, or <code>null</code> if the permission
-	 *         does not have a name.
+	 *         <code>PermissionInfo</code>, or <code>null</code> if the
+	 *         permission does not have a name.
 	 */
 	public final String getName() {
 		return name;
@@ -282,8 +293,8 @@
 	 * <code>PermissionInfo</code>.
 	 * 
 	 * @return The actions of the permission represented by this
-	 *         <code>PermissionInfo</code>, or <code>null</code> if the permission
-	 *         does not have any actions associated with it.
+	 *         <code>PermissionInfo</code>, or <code>null</code> if the
+	 *         permission does not have any actions associated with it.
 	 */
 	public final String getActions() {
 		return actions;
@@ -297,9 +308,10 @@
 	 * 
 	 * @param obj The object to test for equality with this
 	 *        <code>PermissionInfo</code> object.
-	 * @return <code>true</code> if <code>obj</code> is a <code>PermissionInfo</code>,
-	 *         and has the same type, name and actions as this
-	 *         <code>PermissionInfo</code> object; <code>false</code> otherwise.
+	 * @return <code>true</code> if <code>obj</code> is a
+	 *         <code>PermissionInfo</code>, and has the same type, name and
+	 *         actions as this <code>PermissionInfo</code> object;
+	 *         <code>false</code> otherwise.
 	 */
 	public boolean equals(Object obj) {
 		if (obj == this) {
@@ -315,8 +327,7 @@
 		}
 		if (name != null) {
 			if (actions != null) {
-				return name.equals(other.name) && actions
-						.equals(other.actions);
+				return name.equals(other.name) && actions.equals(other.actions);
 			}
 			else {
 				return name.equals(other.name);
@@ -333,14 +344,14 @@
 	 * @return A hash code value for this object.
 	 */
 	public int hashCode() {
-		int hash = type.hashCode();
+		int h = 31 * 17 + type.hashCode();
 		if (name != null) {
-			hash ^= name.hashCode();
+			h = 31 * h + name.hashCode();
 			if (actions != null) {
-				hash ^= actions.hashCode();
+				h = 31 * h + actions.hashCode();
 			}
 		}
-		return hash;
+		return h;
 	}
 
 	/**
@@ -400,7 +411,7 @@
 			}
 			output.append(c);
 		}
-		
+
 		return output.toString();
 	}
 }

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html Mon Jun  8 19:31:06 2009
@@ -0,0 +1,11 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>Permission Admin Package Version 1.2.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.service.permissionadmin; version=&quot;[1.2,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo Mon Jun  8 19:31:06 2009
@@ -0,0 +1 @@
+version 1.2

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/StartLevel.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.startlevel/src/org/osgi/service/startlevel/StartLevel.java,v 1.19 2007/02/09 03:20:24 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2002, 2007). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -68,7 +66,8 @@
  * The StartLevel service can be used by management bundles to alter the active
  * start level of the framework.
  * 
- * @version $Revision: 1.19 $
+ * @ThreadSafe
+ * @version $Revision: 6747 $
  */
 public interface StartLevel {
 	/**
@@ -152,7 +151,9 @@
 	 * @param bundle The target bundle.
 	 * @return The start level value of the specified Bundle.
 	 * @throws java.lang.IllegalArgumentException If the specified bundle has
-	 *         been uninstalled.
+	 *         been uninstalled or if the specified bundle was not created by
+	 *         the same framework instance that registered this
+	 *         <code>StartLevel</code> service.
 	 */
 	public int getBundleStartLevel(Bundle bundle);
 
@@ -183,11 +184,13 @@
 	 * @param bundle The target bundle.
 	 * @param startlevel The new start level for the specified Bundle.
 	 * @throws IllegalArgumentException If the specified bundle has been
-	 *         uninstalled or if the specified start level is less than or equal
-	 *         to zero, or the specified bundle is the system bundle.
+	 *         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.
 	 * @throws SecurityException If the caller does not have
-	 *         <code>AdminPermission[bundle,EXECUTE]</code> and the Java
-	 *         runtime environment supports permissions.
+	 *         <code>AdminPermission[bundle,EXECUTE]</code> and the Java runtime
+	 *         environment supports permissions.
 	 */
 	public void setBundleStartLevel(Bundle bundle, int startlevel);
 
@@ -218,7 +221,7 @@
 	 * been called to assign a different initial bundle start level value.
 	 * 
 	 * <p>
-	 * Thie method does not change the start level values of installed bundles.
+	 * This method does not change the start level values of installed bundles.
 	 * 
 	 * @param startlevel The initial start level for newly installed bundles.
 	 * @throws IllegalArgumentException If the specified start level is less
@@ -241,7 +244,9 @@
 	 *         indicates the bundle is to be started. <code>false</code>
 	 *         otherwise.
 	 * @throws java.lang.IllegalArgumentException If the specified bundle has
-	 *         been uninstalled.
+	 *         been uninstalled or if the specified bundle was not created by
+	 *         the same framework instance that registered this
+	 *         <code>StartLevel</code> service.
 	 * @see Bundle#START_TRANSIENT
 	 */
 	public boolean isBundlePersistentlyStarted(Bundle bundle);
@@ -254,11 +259,13 @@
 	 * activation policy is to be used when the bundle is started.
 	 * 
 	 * @param bundle The bundle whose autostart setting is to be examined.
-	 * @return <code>true</code> if the bundle’s autostart setting indicates
-	 *         the activation policy declared in the manifest must be used.
+	 * @return <code>true</code> if the bundle's autostart setting indicates the
+	 *         activation policy declared in the manifest must be used.
 	 *         <code>false</code> if the bundle must be eagerly activated.
 	 * @throws java.lang.IllegalArgumentException If the specified bundle has
-	 *         been uninstalled.
+	 *         been uninstalled or if the specified bundle was not created by
+	 *         the same framework instance that registered this
+	 *         <code>StartLevel</code> service.
 	 * @since 1.1
 	 * @see Bundle#START_ACTIVATION_POLICY
 	 */

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/package.html?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/package.html (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/package.html Mon Jun  8 19:31:06 2009
@@ -0,0 +1,11 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>Start Level Package Version 1.1.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.service.startlevel; version=&quot;[1.1,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/packageinfo?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/packageinfo (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/startlevel/packageinfo Mon Jun  8 19:31:06 2009
@@ -0,0 +1 @@
+version 1.1

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/AbstractURLStreamHandlerService.java,v 1.8 2006/06/16 16:31:31 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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,15 +19,16 @@
 import java.net.*;
 
 /**
- * Abstract implementation of the <code>URLStreamHandlerService</code> 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>
+ * Abstract implementation of the <code>URLStreamHandlerService</code>
+ * 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>
  * parameter. Subclasses of this abstract class should not need to override the
  * <code>setURL</code> and <code>parseURL(URLStreamHandlerSetter,...)</code>
  * methods.
  * 
- * @version $Revision: 1.8 $
+ * @ThreadSafe
+ * @version $Revision: 5673 $
  */
 public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
 		implements URLStreamHandlerService {
@@ -43,7 +42,7 @@
 	 * The <code>URLStreamHandlerSetter</code> object passed to the parseURL
 	 * method.
 	 */
-	protected URLStreamHandlerSetter	realHandler;
+	protected volatile URLStreamHandlerSetter	realHandler;
 
 	/**
 	 * Parse a URL using the <code>URLStreamHandlerSetter</code> object. This
@@ -51,8 +50,8 @@
 	 * <code>URLStreamHandlerSetter</code> object and then calls
 	 * <code>parseURL(URL,String,int,int)</code>.
 	 * 
-	 * @param realHandler The object on which the <code>setURL</code> method must
-	 *        be invoked for the specified URL.
+	 * @param realHandler The object on which the <code>setURL</code> method
+	 *        must be invoked for the specified URL.
 	 * @see "java.net.URLStreamHandler.parseURL"
 	 */
 	public void parseURL(URLStreamHandlerSetter realHandler, URL u,

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLConstants.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/URLConstants.java,v 1.10 2006/12/01 06:38:45 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -24,23 +22,23 @@
  * services.
  * 
  * <p>
- * The values associated with these keys are of type <code>java.lang.String[]</code>
- * or <code>java.lang.String</code>,
- * unless otherwise indicated.
+ * The values associated with these keys are of type
+ * <code>java.lang.String[]</code> or <code>java.lang.String</code>, unless
+ * otherwise indicated.
  * 
- * @version $Revision: 1.10 $
+ * @version $Revision: 5673 $
  */
 public interface URLConstants {
 	/**
 	 * Service property naming the protocols serviced by a
-	 * URLStreamHandlerService. The property's value is 
-	 * a protocol name or an array of protocol names.
+	 * URLStreamHandlerService. The property's value is a protocol name or an
+	 * array of protocol names.
 	 */
 	public static final String	URL_HANDLER_PROTOCOL	= "url.handler.protocol";
 	/**
 	 * Service property naming the MIME types serviced by a
-	 * java.net.ContentHandler. The property's value is a
-	 * MIME type or an array of MIME types.
+	 * java.net.ContentHandler. The property's value is a MIME type or an array
+	 * of MIME types.
 	 */
 	public static final String	URL_CONTENT_MIMETYPE	= "url.content.mimetype";
 }

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerService.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerService.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerService.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/URLStreamHandlerService.java,v 1.9 2006/07/11 00:53:59 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -25,17 +23,19 @@
  * <code>java.net.URLStreamHandler</code> 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</code> class are that the <code>setURL</code>
+ * method is absent and the <code>parseURL</code> 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>URLStreamHandlerSetter</code> object received in the
+ * <code>parseURL</code> method instead of
+ * <code>URLStreamHandler.setURL</code> to avoid a
  * <code>SecurityException</code>.
  * 
  * @see AbstractURLStreamHandlerService
  * 
- * @version $Revision: 1.9 $
+ * @ThreadSafe
+ * @version $Revision: 5673 $
  */
 public interface URLStreamHandlerService {
 	/**
@@ -45,11 +45,11 @@
 
 	/**
 	 * 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.
+	 * proxy, instead of <code>java.net.URLStreamHandler.parseURL</code>,
+	 * passing a <code>URLStreamHandlerSetter</code> object.
 	 * 
-	 * @param realHandler The object on which <code>setURL</code> must be invoked
-	 *        for this URL.
+	 * @param realHandler The object on which <code>setURL</code> must be
+	 *        invoked for this URL.
 	 * @see "java.net.URLStreamHandler.parseURL"
 	 */
 	public void parseURL(URLStreamHandlerSetter realHandler, URL u,

Modified: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java?rev=782737&r1=782736&r2=782737&view=diff
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java (original)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java Mon Jun  8 19:31:06 2009
@@ -1,7 +1,5 @@
 /*
- * $Header: /cvshome/build/org.osgi.service.url/src/org/osgi/service/url/URLStreamHandlerSetter.java,v 1.9 2006/07/11 00:53:59 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2002, 2006). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 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.
@@ -22,16 +20,19 @@
 
 /**
  * Interface used by <code>URLStreamHandlerService</code> objects to call the
- * <code>setURL</code> method on the proxy <code>URLStreamHandler</code> object.
+ * <code>setURL</code> method on the proxy <code>URLStreamHandler</code>
+ * 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.
+ * {@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.
  * 
- * @version $Revision: 1.9 $
+ * @ThreadSafe
+ * @version $Revision: 5673 $
  */
 public interface URLStreamHandlerSetter {
 	/**

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/package.html?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/package.html (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/package.html Mon Jun  8 19:31:06 2009
@@ -0,0 +1,10 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>URL Stream and Content Handlers Package Version 1.0.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.service.url; version=&quot;[1.0,2.0)&quot;
+</pre>
+</BODY>

Added: felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/packageinfo?rev=782737&view=auto
==============================================================================
--- felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/packageinfo (added)
+++ felix/trunk/org.osgi.core/src/main/java/org/osgi/service/url/packageinfo Mon Jun  8 19:31:06 2009
@@ -0,0 +1 @@
+version 1.0