felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r465392 [9/10] - in /incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi: framework/ service/condpermadmin/ service/packageadmin/ service/permissionadmin/ service/startlevel/ service/url/
Date Wed, 18 Oct 2006 22:01:24 GMT
Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java Wed Oct 18 15:01:22 2006
@@ -1,278 +1,278 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/PackageAdmin.java,v 1.18 2006/03/14 01:20:05 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2005). 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.service.packageadmin;
-
-import org.osgi.framework.Bundle;
-
-/**
- * Framework service which allows bundle programmers to inspect the package
- * wiring state of bundles in the Framework as well as other functions related
- * to the class loader network among bundles.
- * 
- * <p>
- * If present, there will only be a single instance of this service registered
- * with the Framework.
- * 
- * @version $Revision: 1.18 $
- * @see org.osgi.service.packageadmin.ExportedPackage
- * @see org.osgi.service.packageadmin.RequiredBundle
- */
-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 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>
-	 *        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
-	 *         specified bundle has no exported packages.
-	 */
-	public ExportedPackage[] getExportedPackages(Bundle bundle);
-
-	/**
-	 * Gets the exported packages for the specified package name.
-	 * 
-	 * @param name The name of the exported packages to be returned.
-	 * 
-	 * @return An array of the exported packages, or <code>null</code> if no
-	 *         exported packages with the specified name exists.
-	 * @since 1.2
-	 */
-	public ExportedPackage[] getExportedPackages(String name);
-
-	/**
-	 * Gets the exported package for the specified package name.
-	 * 
-	 * <p>
-	 * If there are multiple exported packages with specified name, the exported
-	 * package with the highest version will be returned.
-	 * 
-	 * @param name The name of the exported package to be returned.
-	 * 
-	 * @return The exported package, or <code>null</code> if no exported
-	 *         package with the specified name exists.
-	 * @see #getExportedPackages(String)
-	 */
-	public ExportedPackage getExportedPackage(String name);
-
-	/**
-	 * Forces the update (replacement) or removal of packages exported by the
-	 * specified bundles.
-	 * 
-	 * <p>
-	 * If no bundles are specified, this method will update or remove any
-	 * packages exported by any bundles that were previously updated or
-	 * uninstalled since the last call to this method. The technique by which
-	 * this is accomplished may vary among different Framework implementations.
-	 * One permissible implementation is to stop and restart the Framework.
-	 * 
-	 * <p>
-	 * This method returns to the caller immediately and then performs the
-	 * 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
-	 * 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
-	 * bundle outside the graph that is wired to a bundle in the graph. The
-	 * graph may contain <code>UNINSTALLED</code> 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>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>
-	 * 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>
-	 * 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.
-	 * </ol>
-	 * 
-	 * <p>
-	 * For any exceptions that are thrown during any of these steps, a
-	 * <code>FrameworkEvent</code> of type <code>ERROR</code> 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
-	 *        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.
-	 */
-	public void refreshPackages(Bundle[] bundles);
-
-	/**
-	 * Resolve the specified bundles. The Framework must attempt to resolve the
-	 * specified bundles that are unresolved. Additional bundles that are not
-	 * included in the specified bundles may be resolved as a result of calling
-	 * this method. A permissible implementation of this method is to attempt to
-	 * resolve all unresolved bundles installed in the framework.
-	 * 
-	 * <p>
-	 * If <code>null</code> 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 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.
-	 * @since 1.2
-	 */
-	public boolean resolveBundles(Bundle[] bundles);
-
-	/**
-	 * Returns an array of required bundles having the specified symbolic name.
-	 * 
-	 * <p>
-	 * If <code>null</code> is specified, then all required bundles will be
-	 * returned.
-	 * 
-	 * @param symbolicName The bundle symbolic name or <code>null</code> for
-	 *        all required bundles.
-	 * @return An array of required bundles or <code>null</code> if no
-	 *         required bundles exist for the specified symbolic name.
-	 * @since 1.2
-	 */
-	public RequiredBundle[] getRequiredBundles(String symbolicName);
-
-	/**
-	 * 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.
-	 * 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
-	 * in descending version order so that the first element of the array
-	 * contains the bundle with the highest version.
-	 * 
-	 * @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.
-	 * @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.
-	 * @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 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
-	 * specified bundle is not resolved then <code>null</code> 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
-	 *         does not have any attached fragment bundles or the bundle is not
-	 *         resolved.
-	 * @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.
-	 * @since 1.2
-	 */
-	public Bundle[] getHosts(Bundle bundle);
-
-	/**
-	 * 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.
-	 * 
-	 * @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.
-	 * @since 1.2
-	 */
-	public Bundle getBundle(Class clazz);
-
-	/**
-	 * Bundle type indicating the bundle is a fragment bundle.
-	 * 
-	 * <p>
-	 * The value of <code>BUNDLE_TYPE_FRAGMENT</code> is 0x00000001.
-	 * 
-	 * @since 1.2
-	 */
-	public static final int	BUNDLE_TYPE_FRAGMENT	= 0x00000001;
-
-	/**
-	 * Returns the special type of the specified bundle. The bundle type values
-	 * are:
-	 * <ul>
-	 * <li>{@link #BUNDLE_TYPE_FRAGMENT}
-	 * </ul>
-	 * 
-	 * A bundle may be more than one type at a time. A type code is used to
-	 * identify the bundle type for future extendability.
-	 * 
-	 * <p>
-	 * If a bundle is not one or more of the defined types then 0x00000000 is
-	 * returned.
-	 * 
-	 * @param bundle The bundle for which to return the special type.
-	 * @return The special type of the bundle.
-	 * @since 1.2
-	 */
-	public int getBundleType(Bundle bundle);
-}
\ No newline at end of file
+/*
+ * $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.
+ * 
+ * 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.service.packageadmin;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * Framework service which allows bundle programmers to inspect the package
+ * wiring state of bundles in the Framework as well as other functions related
+ * to the class loader network among bundles.
+ * 
+ * <p>
+ * If present, there will only be a single instance of this service registered
+ * with the Framework.
+ * 
+ * @version $Revision: 1.19 $
+ * @see org.osgi.service.packageadmin.ExportedPackage
+ * @see org.osgi.service.packageadmin.RequiredBundle
+ */
+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 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>
+	 *        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
+	 *         specified bundle has no exported packages.
+	 */
+	public ExportedPackage[] getExportedPackages(Bundle bundle);
+
+	/**
+	 * Gets the exported packages for the specified package name.
+	 * 
+	 * @param name The name of the exported packages to be returned.
+	 * 
+	 * @return An array of the exported packages, or <code>null</code> if no
+	 *         exported packages with the specified name exists.
+	 * @since 1.2
+	 */
+	public ExportedPackage[] getExportedPackages(String name);
+
+	/**
+	 * Gets the exported package for the specified package name.
+	 * 
+	 * <p>
+	 * If there are multiple exported packages with specified name, the exported
+	 * package with the highest version will be returned.
+	 * 
+	 * @param name The name of the exported package to be returned.
+	 * 
+	 * @return The exported package, or <code>null</code> if no exported
+	 *         package with the specified name exists.
+	 * @see #getExportedPackages(String)
+	 */
+	public ExportedPackage getExportedPackage(String name);
+
+	/**
+	 * Forces the update (replacement) or removal of packages exported by the
+	 * specified bundles.
+	 * 
+	 * <p>
+	 * If no bundles are specified, this method will update or remove any
+	 * packages exported by any bundles that were previously updated or
+	 * uninstalled since the last call to this method. The technique by which
+	 * this is accomplished may vary among different Framework implementations.
+	 * One permissible implementation is to stop and restart the Framework.
+	 * 
+	 * <p>
+	 * This method returns to the caller immediately and then performs the
+	 * 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
+	 * 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
+	 * bundle outside the graph that is wired to a bundle in the graph. The
+	 * graph may contain <code>UNINSTALLED</code> 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>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>
+	 * 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>
+	 * 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.
+	 * </ol>
+	 * 
+	 * <p>
+	 * For any exceptions that are thrown during any of these steps, a
+	 * <code>FrameworkEvent</code> of type <code>ERROR</code> 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
+	 *        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.
+	 */
+	public void refreshPackages(Bundle[] bundles);
+
+	/**
+	 * Resolve the specified bundles. The Framework must attempt to resolve the
+	 * specified bundles that are unresolved. Additional bundles that are not
+	 * included in the specified bundles may be resolved as a result of calling
+	 * this method. A permissible implementation of this method is to attempt to
+	 * resolve all unresolved bundles installed in the framework.
+	 * 
+	 * <p>
+	 * If <code>null</code> 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 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.
+	 * @since 1.2
+	 */
+	public boolean resolveBundles(Bundle[] bundles);
+
+	/**
+	 * Returns an array of required bundles having the specified symbolic name.
+	 * 
+	 * <p>
+	 * If <code>null</code> is specified, then all required bundles will be
+	 * returned.
+	 * 
+	 * @param symbolicName The bundle symbolic name or <code>null</code> for
+	 *        all required bundles.
+	 * @return An array of required bundles or <code>null</code> if no
+	 *         required bundles exist for the specified symbolic name.
+	 * @since 1.2
+	 */
+	public RequiredBundle[] getRequiredBundles(String symbolicName);
+
+	/**
+	 * 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.
+	 * 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
+	 * in descending version order so that the first element of the array
+	 * contains the bundle with the highest version.
+	 * 
+	 * @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.
+	 * @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.
+	 * @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 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
+	 * specified bundle is not resolved then <code>null</code> 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
+	 *         does not have any attached fragment bundles or the bundle is not
+	 *         resolved.
+	 * @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.
+	 * @since 1.2
+	 */
+	public Bundle[] getHosts(Bundle bundle);
+
+	/**
+	 * 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.
+	 * 
+	 * @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.
+	 * @since 1.2
+	 */
+	public Bundle getBundle(Class clazz);
+
+	/**
+	 * Bundle type indicating the bundle is a fragment bundle.
+	 * 
+	 * <p>
+	 * The value of <code>BUNDLE_TYPE_FRAGMENT</code> is 0x00000001.
+	 * 
+	 * @since 1.2
+	 */
+	public static final int	BUNDLE_TYPE_FRAGMENT	= 0x00000001;
+
+	/**
+	 * Returns the special type of the specified bundle. The bundle type values
+	 * are:
+	 * <ul>
+	 * <li>{@link #BUNDLE_TYPE_FRAGMENT}
+	 * </ul>
+	 * 
+	 * A bundle may be more than one type at a time. A type code is used to
+	 * identify the bundle type for future extendability.
+	 * 
+	 * <p>
+	 * If a bundle is not one or more of the defined types then 0x00000000 is
+	 * returned.
+	 * 
+	 * @param bundle The bundle for which to return the special type.
+	 * @return The special type of the bundle.
+	 * @since 1.2
+	 */
+	public int getBundleType(Bundle bundle);
+}

Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java Wed Oct 18 15:01:22 2006
@@ -1,97 +1,97 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/RequiredBundle.java,v 1.10 2006/03/14 21:02:47 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2004, 2005). 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.service.packageadmin;
-
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-/**
- * A required bundle.
- * 
- * 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.
- * 
- * <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
- * the bundle it references has been updated or removed as a result of calling
- * <code>PackageAdmin.refreshPackages()</code>).
- * 
- * 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>.
- * 
- * @since 1.2
- * @version $Revision: 1.10 $
- */
-public interface RequiredBundle {
-	/**
-	 * Returns the symbolic name of this required bundle.
-	 * 
-	 * @return The symbolic name of this required bundle.
-	 */
-	public String getSymbolicName();
-
-	/**
-	 * Returns the bundle associated with this required bundle.
-	 * 
-	 * @return The bundle, or <code>null</code> if this
-	 *         <code>RequiredBundle</code> object has become stale.
-	 */
-	public Bundle getBundle();
-
-	/**
-	 * Returns the bundles that currently require this required bundle.
-	 * 
-	 * <p>
-	 * If this required bundle is required and then re-exported by another
-	 * bundle then all the requiring bundles of the re-exporting bundle are
-	 * 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
-	 *         has become stale.
-	 */
-	public Bundle[] getRequiringBundles();
-
-	/**
-	 * Returns the version of this required bundle.
-	 * 
-	 * @return The version of this required bundle, or
-	 *         {@link Version#emptyVersion} if no version information is
-	 *         available.
-	 */
-	public Version getVersion();
-
-	/**
-	 * 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
-	 *         uninstalled, or if the <code>RequiredBundle</code> object has
-	 *         become stale; <code>false</code> otherwise.
-	 */
-	public boolean isRemovalPending();
-}
\ No newline at end of file
+/*
+ * $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.
+ * 
+ * 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.service.packageadmin;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.Version;
+
+/**
+ * A required bundle.
+ * 
+ * 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.
+ * 
+ * <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
+ * the bundle it references has been updated or removed as a result of calling
+ * <code>PackageAdmin.refreshPackages()</code>).
+ * 
+ * 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>.
+ * 
+ * @since 1.2
+ * @version $Revision: 1.11 $
+ */
+public interface RequiredBundle {
+	/**
+	 * Returns the symbolic name of this required bundle.
+	 * 
+	 * @return The symbolic name of this required bundle.
+	 */
+	public String getSymbolicName();
+
+	/**
+	 * Returns the bundle associated with this required bundle.
+	 * 
+	 * @return The bundle, or <code>null</code> if this
+	 *         <code>RequiredBundle</code> object has become stale.
+	 */
+	public Bundle getBundle();
+
+	/**
+	 * Returns the bundles that currently require this required bundle.
+	 * 
+	 * <p>
+	 * If this required bundle is required and then re-exported by another
+	 * bundle then all the requiring bundles of the re-exporting bundle are
+	 * 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
+	 *         has become stale.
+	 */
+	public Bundle[] getRequiringBundles();
+
+	/**
+	 * Returns the version of this required bundle.
+	 * 
+	 * @return The version of this required bundle, or
+	 *         {@link Version#emptyVersion} if no version information is
+	 *         available.
+	 */
+	public Version getVersion();
+
+	/**
+	 * 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
+	 *         uninstalled, or if the <code>RequiredBundle</code> object has
+	 *         become stale; <code>false</code> otherwise.
+	 */
+	public boolean isRemovalPending();
+}

Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/package.html Wed Oct 18 15:01:22 2006
@@ -1,6 +1,6 @@
-<!-- $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/package.html,v 1.2 2004/12/01 19:01:45 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/org.osgi.service.packageadmin/src/org/osgi/service/packageadmin/package.html,v 1.3 2006/07/12 21:07:01 hargrave Exp $ -->
 <BODY>
-<P>The OSGi Package Admin service Package. Specification Version 1.2.
+<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:

Added: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo?view=auto&rev=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo (added)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/packageadmin/packageinfo Wed Oct 18 15:01:22 2006
@@ -0,0 +1 @@
+version 1.2

Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionAdmin.java Wed Oct 18 15:01:22 2006
@@ -1,121 +1,121 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionAdmin.java,v 1.11 2006/03/14 01:21:28 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2005). 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.service.permissionadmin;
-
-/**
- * The Permission Admin service allows management agents to manage the
- * permissions of bundles. There is at most one Permission Admin service present
- * 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.
- * 
- * <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
- * 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
- * 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.
- * 
- * <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.
- * <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>.
- * 
- * @version $Revision: 1.11 $
- */
-public interface PermissionAdmin {
-	/**
-	 * Gets the permissions assigned to the bundle with the specified location.
-	 * 
-	 * @param location The location of the bundle whose permissions are to be
-	 *        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.
-	 */
-	PermissionInfo[] getPermissions(String location);
-
-	/**
-	 * Assigns the specified permissions to the bundle with the specified
-	 * location.
-	 * 
-	 * @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.
-	 * @throws SecurityException If the caller does not have
-	 *            <code>AllPermission</code>.
-	 */
-	void setPermissions(String location, PermissionInfo[] permissions);
-
-	/**
-	 * Returns the bundle locations that have permissions assigned to them, that
-	 * is, bundle locations for which an entry exists in the permission table.
-	 * 
-	 * @return The locations of bundles that have been assigned any permissions,
-	 *         or <code>null</code> if the permission table is empty.
-	 */
-	String[] getLocations();
-
-	/**
-	 * Gets the default permissions.
-	 * 
-	 * <p>
-	 * These are the permissions granted to any bundle that does not have
-	 * permissions assigned to its location.
-	 * 
-	 * @return The default permissions, or <code>null</code> if no default
-	 *         permissions are set.
-	 */
-	PermissionInfo[] getDefaultPermissions();
-
-	/**
-	 * Sets the default permissions.
-	 * 
-	 * <p>
-	 * These are the permissions granted to any bundle that does not have
-	 * permissions assigned to its location.
-	 * 
-	 * @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>.
-	 */
-	void setDefaultPermissions(PermissionInfo[] permissions);
-}
\ No newline at end of file
+/*
+ * $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.
+ * 
+ * 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.service.permissionadmin;
+
+/**
+ * The Permission Admin service allows management agents to manage the
+ * permissions of bundles. There is at most one Permission Admin service present
+ * 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.
+ * 
+ * <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
+ * 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
+ * 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.
+ * 
+ * <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.
+ * <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>.
+ * 
+ * @version $Revision: 1.12 $
+ */
+public interface PermissionAdmin {
+	/**
+	 * Gets the permissions assigned to the bundle with the specified location.
+	 * 
+	 * @param location The location of the bundle whose permissions are to be
+	 *        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.
+	 */
+	PermissionInfo[] getPermissions(String location);
+
+	/**
+	 * Assigns the specified permissions to the bundle with the specified
+	 * location.
+	 * 
+	 * @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.
+	 * @throws SecurityException If the caller does not have
+	 *            <code>AllPermission</code>.
+	 */
+	void setPermissions(String location, PermissionInfo[] permissions);
+
+	/**
+	 * Returns the bundle locations that have permissions assigned to them, that
+	 * is, bundle locations for which an entry exists in the permission table.
+	 * 
+	 * @return The locations of bundles that have been assigned any permissions,
+	 *         or <code>null</code> if the permission table is empty.
+	 */
+	String[] getLocations();
+
+	/**
+	 * Gets the default permissions.
+	 * 
+	 * <p>
+	 * These are the permissions granted to any bundle that does not have
+	 * permissions assigned to its location.
+	 * 
+	 * @return The default permissions, or <code>null</code> if no default
+	 *         permissions are set.
+	 */
+	PermissionInfo[] getDefaultPermissions();
+
+	/**
+	 * Sets the default permissions.
+	 * 
+	 * <p>
+	 * These are the permissions granted to any bundle that does not have
+	 * permissions assigned to its location.
+	 * 
+	 * @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>.
+	 */
+	void setDefaultPermissions(PermissionInfo[] permissions);
+}

Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/PermissionInfo.java Wed Oct 18 15:01:22 2006
@@ -1,406 +1,406 @@
-/*
- * $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/PermissionInfo.java,v 1.15 2006/03/14 01:21:28 hargrave Exp $
- * 
- * Copyright (c) OSGi Alliance (2001, 2005). 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.service.permissionadmin;
-
-/**
- * Permission representation used by the Permission Admin service.
- * 
- * <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.
- * 
- * <p>
- * In order for a permission represented by a <code>PermissionInfo</code> to be
- * instantiated and considered during a permission check, its Permission class
- * must be available from the system classpath or an exported package. This
- * means that the instantiation of a permission represented by a
- * <code>PermissionInfo</code> may be delayed until the package containing its
- * Permission class has been exported by a bundle.
- * 
- * @version $Revision: 1.15 $
- */
-public class PermissionInfo {
-	private String	type;
-	private String	name;
-	private String	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.
-	 * 
-	 * @param name The permission name that will be passed as the first argument
-	 *        to the constructor of the <code>Permission</code> class identified
-	 *        by <code>type</code>.
-	 * 
-	 * @param actions The permission actions that will be passed as the second
-	 *        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>.
-	 */
-	public PermissionInfo(String type, String name, String actions) {
-		this.type = type;
-		this.name = name;
-		this.actions = actions;
-		if (type == null) {
-			throw new NullPointerException("type is null");
-		}
-		if ((name == null) && (actions != null)) {
-			throw new IllegalArgumentException("name missing");
-		}
-	}
-
-	/**
-	 * 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.
-	 */
-	public PermissionInfo(String encodedPermission) {
-		if (encodedPermission == null) {
-			throw new NullPointerException("missing encoded permission");
-		}
-		if (encodedPermission.length() == 0) {
-			throw new IllegalArgumentException("empty encoded permission");
-		}
-		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");
-			}
-			pos++;
-
-			/* skip whitespace */
-			while (Character.isWhitespace(encoded[pos])) {
-				pos++;
-			}
-			
-			/* type is not quoted or encoded */
-			int begin = 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);
-			
-			/* skip whitespace */
-			while (Character.isWhitespace(encoded[pos])) {
-				pos++;
-			}
-			
-			/* type may be followed by name which is quoted and encoded */
-			if (encoded[pos] == '"') {
-				pos++;
-				begin = pos;
-				while (encoded[pos] != '"') {
-					if (encoded[pos] == '\\') {
-						pos++;
-					}
-					pos++;
-				}
-				this.name = unescapeString(encoded, begin, pos);
-				pos++;
-
-				if (Character.isWhitespace(encoded[pos])) {
-					/* skip whitespace */
-					while (Character.isWhitespace(encoded[pos])) {
-						pos++;
-					}
-					
-					/* name may be followed by actions which is quoted and encoded */
-					if (encoded[pos] == '"') {
-						pos++;
-						begin = pos;
-						while (encoded[pos] != '"') {
-							if (encoded[pos] == '\\') {
-								pos++;
-							}
-							pos++;
-						}
-						this.actions = unescapeString(encoded, begin, pos);
-						pos++;
-
-						/* skip whitespace */
-						while (Character.isWhitespace(encoded[pos])) {
-							pos++;
-						}
-					}
-				}
-			}
-			
-			/* the final character must be ')' */
-			char c = encoded[pos];
-			pos++;
-			while ((pos < length) && Character.isWhitespace(encoded[pos])) {
-				pos++;
-			}
-			if ((c != ')') || (pos != length)) {
-				throw new IllegalArgumentException("expecting close parenthesis");
-			}
-		}
-		catch (ArrayIndexOutOfBoundsException e) {
-			throw new IllegalArgumentException("parsing terminated abruptly");
-		}
-	}
-
-	/**
-	 * Returns the string encoding of this <code>PermissionInfo</code> in a form
-	 * suitable for restoring this <code>PermissionInfo</code>.
-	 * 
-	 * <p>
-	 * The encoded format is:
-	 * 
-	 * <pre>
-	 * (type)
-	 * </pre>
-	 * 
-	 * or
-	 * 
-	 * <pre>
-	 * (type &quot;name&quot;)
-	 * </pre>
-	 * 
-	 * or
-	 * 
-	 * <pre>
-	 * (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.
-	 * 
-	 * <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;.
-	 * 
-	 * @return The string encoding of this <code>PermissionInfo</code>.
-	 */
-	public final String getEncoded() {
-		StringBuffer output = new StringBuffer(
-				8
-						+ type.length()
-						+ ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0
-								: actions.length())) << 1));
-		output.append('(');
-		output.append(type);
-		if (name != null) {
-			output.append(" \"");
-			escapeString(name, output);
-			if (actions != null) {
-				output.append("\" \"");
-				escapeString(actions, output);
-			}
-			output.append('\"');
-		}
-		output.append(')');
-		return output.toString();
-	}
-
-	/**
-	 * 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>.
-	 */
-	public String toString() {
-		return getEncoded();
-	}
-
-	/**
-	 * Returns the fully qualified class name of the permission represented by
-	 * this <code>PermissionInfo</code>.
-	 * 
-	 * @return The fully qualified class name of the permission represented by
-	 *         this <code>PermissionInfo</code>.
-	 */
-	public final String getType() {
-		return type;
-	}
-
-	/**
-	 * Returns the name of the permission represented by this
-	 * <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.
-	 */
-	public final String getName() {
-		return name;
-	}
-
-	/**
-	 * Returns the actions of the permission represented by this
-	 * <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.
-	 */
-	public final String getActions() {
-		return actions;
-	}
-
-	/**
-	 * Determines the equality of two <code>PermissionInfo</code> objects.
-	 * 
-	 * This method checks that specified object has the same type, name and
-	 * actions as this <code>PermissionInfo</code> object.
-	 * 
-	 * @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.
-	 */
-	public boolean equals(Object obj) {
-		if (obj == this) {
-			return true;
-		}
-		if (!(obj instanceof PermissionInfo)) {
-			return false;
-		}
-		PermissionInfo other = (PermissionInfo) obj;
-		if (!type.equals(other.type) || ((name == null) ^ (other.name == null))
-				|| ((actions == null) ^ (other.actions == null))) {
-			return false;
-		}
-		if (name != null) {
-			if (actions != null) {
-				return name.equals(other.name) && actions
-						.equals(other.actions);
-			}
-			else {
-				return name.equals(other.name);
-			}
-		}
-		else {
-			return true;
-		}
-	}
-
-	/**
-	 * Returns the hash code value for this object.
-	 * 
-	 * @return A hash code value for this object.
-	 */
-	public int hashCode() {
-		int hash = type.hashCode();
-		if (name != null) {
-			hash ^= name.hashCode();
-			if (actions != null) {
-				hash ^= actions.hashCode();
-			}
-		}
-		return hash;
-	}
-
-	/**
-	 * This escapes the quotes, backslashes, \n, and \r in the string using a
-	 * backslash and appends the newly escaped string to a StringBuffer.
-	 */
-	private static void escapeString(String str, StringBuffer output) {
-		int len = str.length();
-		for (int i = 0; i < len; i++) {
-			char c = str.charAt(i);
-			switch (c) {
-				case '"' :
-				case '\\' :
-					output.append('\\');
-					output.append(c);
-					break;
-				case '\r' :
-					output.append("\\r");
-					break;
-				case '\n' :
-					output.append("\\n");
-					break;
-				default :
-					output.append(c);
-					break;
-			}
-		}
-	}
-
-	/**
-	 * Takes an encoded character array and decodes it into a new String.
-	 */
-	private static String unescapeString(char[] str, int begin, int end) {
-		StringBuffer output = new StringBuffer(end - begin);
-		for (int i = begin; i < end; i++) {
-			char c = str[i];
-			if (c == '\\') {
-				i++;
-				if (i < end) {
-					c = str[i];
-					switch (c) {
-						case '"' :
-						case '\\' :
-							break;
-						case 'r' :
-							c = '\r';
-							break;
-						case 'n' :
-							c = '\n';
-							break;
-						default :
-							c = '\\';
-							i--;
-							break;
-					}
-				}
-			}
-			output.append(c);
-		}
-		
-		return output.toString();
-	}
-}
\ No newline at end of file
+/*
+ * $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.
+ * 
+ * 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.service.permissionadmin;
+
+/**
+ * Permission representation used by the Permission Admin service.
+ * 
+ * <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.
+ * 
+ * <p>
+ * In order for a permission represented by a <code>PermissionInfo</code> to be
+ * instantiated and considered during a permission check, its Permission class
+ * must be available from the system classpath or an exported package. This
+ * means that the instantiation of a permission represented by a
+ * <code>PermissionInfo</code> may be delayed until the package containing its
+ * Permission class has been exported by a bundle.
+ * 
+ * @version $Revision: 1.16 $
+ */
+public class PermissionInfo {
+	private String	type;
+	private String	name;
+	private String	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.
+	 * 
+	 * @param name The permission name that will be passed as the first argument
+	 *        to the constructor of the <code>Permission</code> class identified
+	 *        by <code>type</code>.
+	 * 
+	 * @param actions The permission actions that will be passed as the second
+	 *        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>.
+	 */
+	public PermissionInfo(String type, String name, String actions) {
+		this.type = type;
+		this.name = name;
+		this.actions = actions;
+		if (type == null) {
+			throw new NullPointerException("type is null");
+		}
+		if ((name == null) && (actions != null)) {
+			throw new IllegalArgumentException("name missing");
+		}
+	}
+
+	/**
+	 * 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.
+	 */
+	public PermissionInfo(String encodedPermission) {
+		if (encodedPermission == null) {
+			throw new NullPointerException("missing encoded permission");
+		}
+		if (encodedPermission.length() == 0) {
+			throw new IllegalArgumentException("empty encoded permission");
+		}
+		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");
+			}
+			pos++;
+
+			/* skip whitespace */
+			while (Character.isWhitespace(encoded[pos])) {
+				pos++;
+			}
+			
+			/* type is not quoted or encoded */
+			int begin = 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);
+			
+			/* skip whitespace */
+			while (Character.isWhitespace(encoded[pos])) {
+				pos++;
+			}
+			
+			/* type may be followed by name which is quoted and encoded */
+			if (encoded[pos] == '"') {
+				pos++;
+				begin = pos;
+				while (encoded[pos] != '"') {
+					if (encoded[pos] == '\\') {
+						pos++;
+					}
+					pos++;
+				}
+				this.name = unescapeString(encoded, begin, pos);
+				pos++;
+
+				if (Character.isWhitespace(encoded[pos])) {
+					/* skip whitespace */
+					while (Character.isWhitespace(encoded[pos])) {
+						pos++;
+					}
+					
+					/* name may be followed by actions which is quoted and encoded */
+					if (encoded[pos] == '"') {
+						pos++;
+						begin = pos;
+						while (encoded[pos] != '"') {
+							if (encoded[pos] == '\\') {
+								pos++;
+							}
+							pos++;
+						}
+						this.actions = unescapeString(encoded, begin, pos);
+						pos++;
+
+						/* skip whitespace */
+						while (Character.isWhitespace(encoded[pos])) {
+							pos++;
+						}
+					}
+				}
+			}
+			
+			/* the final character must be ')' */
+			char c = encoded[pos];
+			pos++;
+			while ((pos < length) && Character.isWhitespace(encoded[pos])) {
+				pos++;
+			}
+			if ((c != ')') || (pos != length)) {
+				throw new IllegalArgumentException("expecting close parenthesis");
+			}
+		}
+		catch (ArrayIndexOutOfBoundsException e) {
+			throw new IllegalArgumentException("parsing terminated abruptly");
+		}
+	}
+
+	/**
+	 * Returns the string encoding of this <code>PermissionInfo</code> in a form
+	 * suitable for restoring this <code>PermissionInfo</code>.
+	 * 
+	 * <p>
+	 * The encoded format is:
+	 * 
+	 * <pre>
+	 * (type)
+	 * </pre>
+	 * 
+	 * or
+	 * 
+	 * <pre>
+	 * (type &quot;name&quot;)
+	 * </pre>
+	 * 
+	 * or
+	 * 
+	 * <pre>
+	 * (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.
+	 * 
+	 * <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;.
+	 * 
+	 * @return The string encoding of this <code>PermissionInfo</code>.
+	 */
+	public final String getEncoded() {
+		StringBuffer output = new StringBuffer(
+				8
+						+ type.length()
+						+ ((((name == null) ? 0 : name.length()) + ((actions == null) ? 0
+								: actions.length())) << 1));
+		output.append('(');
+		output.append(type);
+		if (name != null) {
+			output.append(" \"");
+			escapeString(name, output);
+			if (actions != null) {
+				output.append("\" \"");
+				escapeString(actions, output);
+			}
+			output.append('\"');
+		}
+		output.append(')');
+		return output.toString();
+	}
+
+	/**
+	 * 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>.
+	 */
+	public String toString() {
+		return getEncoded();
+	}
+
+	/**
+	 * Returns the fully qualified class name of the permission represented by
+	 * this <code>PermissionInfo</code>.
+	 * 
+	 * @return The fully qualified class name of the permission represented by
+	 *         this <code>PermissionInfo</code>.
+	 */
+	public final String getType() {
+		return type;
+	}
+
+	/**
+	 * Returns the name of the permission represented by this
+	 * <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.
+	 */
+	public final String getName() {
+		return name;
+	}
+
+	/**
+	 * Returns the actions of the permission represented by this
+	 * <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.
+	 */
+	public final String getActions() {
+		return actions;
+	}
+
+	/**
+	 * Determines the equality of two <code>PermissionInfo</code> objects.
+	 * 
+	 * This method checks that specified object has the same type, name and
+	 * actions as this <code>PermissionInfo</code> object.
+	 * 
+	 * @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.
+	 */
+	public boolean equals(Object obj) {
+		if (obj == this) {
+			return true;
+		}
+		if (!(obj instanceof PermissionInfo)) {
+			return false;
+		}
+		PermissionInfo other = (PermissionInfo) obj;
+		if (!type.equals(other.type) || ((name == null) ^ (other.name == null))
+				|| ((actions == null) ^ (other.actions == null))) {
+			return false;
+		}
+		if (name != null) {
+			if (actions != null) {
+				return name.equals(other.name) && actions
+						.equals(other.actions);
+			}
+			else {
+				return name.equals(other.name);
+			}
+		}
+		else {
+			return true;
+		}
+	}
+
+	/**
+	 * Returns the hash code value for this object.
+	 * 
+	 * @return A hash code value for this object.
+	 */
+	public int hashCode() {
+		int hash = type.hashCode();
+		if (name != null) {
+			hash ^= name.hashCode();
+			if (actions != null) {
+				hash ^= actions.hashCode();
+			}
+		}
+		return hash;
+	}
+
+	/**
+	 * This escapes the quotes, backslashes, \n, and \r in the string using a
+	 * backslash and appends the newly escaped string to a StringBuffer.
+	 */
+	private static void escapeString(String str, StringBuffer output) {
+		int len = str.length();
+		for (int i = 0; i < len; i++) {
+			char c = str.charAt(i);
+			switch (c) {
+				case '"' :
+				case '\\' :
+					output.append('\\');
+					output.append(c);
+					break;
+				case '\r' :
+					output.append("\\r");
+					break;
+				case '\n' :
+					output.append("\\n");
+					break;
+				default :
+					output.append(c);
+					break;
+			}
+		}
+	}
+
+	/**
+	 * Takes an encoded character array and decodes it into a new String.
+	 */
+	private static String unescapeString(char[] str, int begin, int end) {
+		StringBuffer output = new StringBuffer(end - begin);
+		for (int i = begin; i < end; i++) {
+			char c = str[i];
+			if (c == '\\') {
+				i++;
+				if (i < end) {
+					c = str[i];
+					switch (c) {
+						case '"' :
+						case '\\' :
+							break;
+						case 'r' :
+							c = '\r';
+							break;
+						case 'n' :
+							c = '\n';
+							break;
+						default :
+							c = '\\';
+							i--;
+							break;
+					}
+				}
+			}
+			output.append(c);
+		}
+		
+		return output.toString();
+	}
+}

Modified: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html?view=diff&rev=465392&r1=465391&r2=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html (original)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/package.html Wed Oct 18 15:01:22 2006
@@ -1,6 +1,6 @@
-<!-- $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/package.html,v 1.3 2005/08/04 03:34:57 hargrave Exp $ -->
+<!-- $Header: /cvshome/build/org.osgi.service.permissionadmin/src/org/osgi/service/permissionadmin/package.html,v 1.4 2006/07/12 21:07:17 hargrave Exp $ -->
 <BODY>
-<P>The OSGi Permission Admin service Package. Specification Version 1.2.
+<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:

Added: incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo
URL: http://svn.apache.org/viewvc/incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo?view=auto&rev=465392
==============================================================================
--- incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo (added)
+++ incubator/felix/trunk/org.osgi.core/src/main/java/org/osgi/service/permissionadmin/packageinfo Wed Oct 18 15:01:22 2006
@@ -0,0 +1 @@
+version 1.2



Mime
View raw message