felix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rickh...@apache.org
Subject svn commit: r926997 [6/7] - in /felix/trunk/framework: ./ src/main/java/org/osgi/ src/main/java/org/osgi/framework/ src/main/java/org/osgi/framework/hooks/ src/main/java/org/osgi/framework/hooks/service/ src/main/java/org/osgi/framework/launch/ src/mai...
Date Wed, 24 Mar 2010 09:51:13 GMT
Added: felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,53 @@
+/*
+ * 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework;
+
+/**
+ * A synchronous <code>BundleEvent</code> listener.
+ * <code>SynchronousBundleListener</code> is a listener interface that may be
+ * implemented by a bundle developer. When a <code>BundleEvent</code> is
+ * fired, it is synchronously delivered to a
+ * <code>SynchronousBundleListener</code>. The Framework may deliver
+ * <code>BundleEvent</code> objects to a
+ * <code>SynchronousBundleListener</code> out of order and may concurrently
+ * call and/or reenter a <code>SynchronousBundleListener</code>.
+ * <p>
+ * A <code>SynchronousBundleListener</code> object is registered with the
+ * Framework using the {@link BundleContext#addBundleListener} method.
+ * <code>SynchronousBundleListener</code> objects are called with a
+ * <code>BundleEvent</code> object when a bundle has been installed, resolved,
+ * starting, started, stopping, stopped, updated, unresolved, or uninstalled.
+ * <p>
+ * Unlike normal <code>BundleListener</code> objects,
+ * <code>SynchronousBundleListener</code>s are synchronously called during
+ * bundle lifecycle processing. The bundle lifecycle processing will not proceed
+ * until all <code>SynchronousBundleListener</code>s have completed.
+ * <code>SynchronousBundleListener</code> objects will be called prior to
+ * <code>BundleListener</code> objects.
+ * <p>
+ * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove
+ * a <code>SynchronousBundleListener</code> object.
+ * 
+ * @since 1.1
+ * @see BundleEvent
+ * @ThreadSafe
+ * @version $Revision: 5673 $
+ */
+
+public interface SynchronousBundleListener extends BundleListener {
+	// This is a marker interface
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/Version.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/Version.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/Version.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,368 @@
+/*
+ * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework;
+
+import java.util.NoSuchElementException;
+import java.util.StringTokenizer;
+
+/**
+ * Version identifier for bundles and packages.
+ * 
+ * <p>
+ * Version identifiers have four components.
+ * <ol>
+ * <li>Major version. A non-negative integer.</li>
+ * <li>Minor version. A non-negative integer.</li>
+ * <li>Micro version. A non-negative integer.</li>
+ * <li>Qualifier. A text string. See <code>Version(String)</code> for the
+ * format of the qualifier string.</li>
+ * </ol>
+ * 
+ * <p>
+ * <code>Version</code> objects are immutable.
+ * 
+ * @since 1.3
+ * @Immutable
+ * @version $Revision: 6860 $
+ */
+
+public class Version implements Comparable {
+	private final int			major;
+	private final int			minor;
+	private final int			micro;
+	private final String		qualifier;
+	private static final String	SEPARATOR		= ".";					//$NON-NLS-1$
+
+	/**
+	 * The empty version "0.0.0".
+	 */
+	public static final Version	emptyVersion	= new Version(0, 0, 0);
+
+	/**
+	 * Creates a version identifier from the specified numerical components.
+	 * 
+	 * <p>
+	 * The qualifier is set to the empty string.
+	 * 
+	 * @param major Major component of the version identifier.
+	 * @param minor Minor component of the version identifier.
+	 * @param micro Micro component of the version identifier.
+	 * @throws IllegalArgumentException If the numerical components are
+	 *         negative.
+	 */
+	public Version(int major, int minor, int micro) {
+		this(major, minor, micro, null);
+	}
+
+	/**
+	 * Creates a version identifier from the specified components.
+	 * 
+	 * @param major Major component of the version identifier.
+	 * @param minor Minor component of the version identifier.
+	 * @param micro Micro component of the version identifier.
+	 * @param qualifier Qualifier component of the version identifier. If
+	 *        <code>null</code> is specified, then the qualifier will be set to
+	 *        the empty string.
+	 * @throws IllegalArgumentException If the numerical components are negative
+	 *         or the qualifier string is invalid.
+	 */
+	public Version(int major, int minor, int micro, String qualifier) {
+		if (qualifier == null) {
+			qualifier = ""; //$NON-NLS-1$
+		}
+
+		this.major = major;
+		this.minor = minor;
+		this.micro = micro;
+		this.qualifier = qualifier;
+		validate();
+	}
+
+	/**
+	 * Created a version identifier from the specified string.
+	 * 
+	 * <p>
+	 * Here is the grammar for version strings.
+	 * 
+	 * <pre>
+	 * version ::= major('.'minor('.'micro('.'qualifier)?)?)?
+	 * major ::= digit+
+	 * minor ::= digit+
+	 * micro ::= digit+
+	 * qualifier ::= (alpha|digit|'_'|'-')+
+	 * digit ::= [0..9]
+	 * alpha ::= [a..zA..Z]
+	 * </pre>
+	 * 
+	 * There must be no whitespace in version.
+	 * 
+	 * @param version String representation of the version identifier.
+	 * @throws IllegalArgumentException If <code>version</code> is improperly
+	 *         formatted.
+	 */
+	public Version(String version) {
+		int maj = 0;
+		int min = 0;
+		int mic = 0;
+		String qual = ""; //$NON-NLS-1$
+
+		try {
+			StringTokenizer st = new StringTokenizer(version, SEPARATOR, true);
+			maj = Integer.parseInt(st.nextToken());
+
+			if (st.hasMoreTokens()) {
+				st.nextToken(); // consume delimiter
+				min = Integer.parseInt(st.nextToken());
+
+				if (st.hasMoreTokens()) {
+					st.nextToken(); // consume delimiter
+					mic = Integer.parseInt(st.nextToken());
+
+					if (st.hasMoreTokens()) {
+						st.nextToken(); // consume delimiter
+						qual = st.nextToken();
+
+						if (st.hasMoreTokens()) {
+							throw new IllegalArgumentException("invalid format"); //$NON-NLS-1$
+						}
+					}
+				}
+			}
+		}
+		catch (NoSuchElementException e) {
+			throw new IllegalArgumentException("invalid format"); //$NON-NLS-1$
+		}
+
+		major = maj;
+		minor = min;
+		micro = mic;
+		qualifier = qual;
+		validate();
+	}
+
+	/**
+	 * Called by the Version constructors to validate the version components.
+	 * 
+	 * @throws IllegalArgumentException If the numerical components are negative
+	 *         or the qualifier string is invalid.
+	 */
+	private void validate() {
+		if (major < 0) {
+			throw new IllegalArgumentException("negative major"); //$NON-NLS-1$
+		}
+		if (minor < 0) {
+			throw new IllegalArgumentException("negative minor"); //$NON-NLS-1$
+		}
+		if (micro < 0) {
+			throw new IllegalArgumentException("negative micro"); //$NON-NLS-1$
+		}
+		char[] chars = qualifier.toCharArray();
+		for (int i = 0, length = chars.length; i < length; i++) {
+	        char ch = chars[i];
+			if (('A' <= ch) && (ch <= 'Z')) {
+				continue;
+			}
+			if (('a' <= ch) && (ch <= 'z')) {
+				continue;
+			}
+			if (('0' <= ch) && (ch <= '9')) {
+				continue;
+			}
+			if ((ch == '_') || (ch == '-')) {
+				continue;
+			}
+			throw new IllegalArgumentException(
+					"invalid qualifier: " + qualifier); //$NON-NLS-1$
+		}
+	}
+
+	/**
+	 * Parses a version identifier from the specified string.
+	 * 
+	 * <p>
+	 * See <code>Version(String)</code> for the format of the version string.
+	 * 
+	 * @param version String representation of the version identifier. Leading
+	 *        and trailing whitespace will be ignored.
+	 * @return A <code>Version</code> object representing the version
+	 *         identifier. If <code>version</code> is <code>null</code> or
+	 *         the empty string then <code>emptyVersion</code> will be
+	 *         returned.
+	 * @throws IllegalArgumentException If <code>version</code> is improperly
+	 *         formatted.
+	 */
+	public static Version parseVersion(String version) {
+		if (version == null) {
+			return emptyVersion;
+		}
+
+		version = version.trim();
+		if (version.length() == 0) {
+			return emptyVersion;
+		}
+
+		return new Version(version);
+	}
+
+	/**
+	 * Returns the major component of this version identifier.
+	 * 
+	 * @return The major component.
+	 */
+	public int getMajor() {
+		return major;
+	}
+
+	/**
+	 * Returns the minor component of this version identifier.
+	 * 
+	 * @return The minor component.
+	 */
+	public int getMinor() {
+		return minor;
+	}
+
+	/**
+	 * Returns the micro component of this version identifier.
+	 * 
+	 * @return The micro component.
+	 */
+	public int getMicro() {
+		return micro;
+	}
+
+	/**
+	 * Returns the qualifier component of this version identifier.
+	 * 
+	 * @return The qualifier component.
+	 */
+	public String getQualifier() {
+		return qualifier;
+	}
+
+	/**
+	 * Returns the string representation of this version identifier.
+	 * 
+	 * <p>
+	 * The format of the version string will be <code>major.minor.micro</code>
+	 * if qualifier is the empty string or
+	 * <code>major.minor.micro.qualifier</code> otherwise.
+	 * 
+	 * @return The string representation of this version identifier.
+	 */
+	public String toString() {
+		int q = qualifier.length();
+		StringBuffer result = new StringBuffer(20 + q);
+		result.append(major);
+		result.append(SEPARATOR);
+		result.append(minor);
+		result.append(SEPARATOR);
+		result.append(micro);
+		if (q > 0) {
+			result.append(SEPARATOR);
+			result.append(qualifier);
+		}
+		return result.toString();
+	}
+
+	/**
+	 * Returns a hash code value for the object.
+	 * 
+	 * @return An integer which is a hash code value for this object.
+	 */
+	public int hashCode() {
+		return (major << 24) + (minor << 16) + (micro << 8)
+				+ qualifier.hashCode();
+	}
+
+	/**
+	 * Compares this <code>Version</code> object to another object.
+	 * 
+	 * <p>
+	 * A version is considered to be <b>equal to </b> another version if the
+	 * major, minor and micro components are equal and the qualifier component
+	 * is equal (using <code>String.equals</code>).
+	 * 
+	 * @param object The <code>Version</code> object to be compared.
+	 * @return <code>true</code> if <code>object</code> is a
+	 *         <code>Version</code> and is equal to this object;
+	 *         <code>false</code> otherwise.
+	 */
+	public boolean equals(Object object) {
+		if (object == this) { // quicktest
+			return true;
+		}
+
+		if (!(object instanceof Version)) {
+			return false;
+		}
+
+		Version other = (Version) object;
+		return (major == other.major) && (minor == other.minor)
+				&& (micro == other.micro) && qualifier.equals(other.qualifier);
+	}
+
+	/**
+	 * Compares this <code>Version</code> object to another object.
+	 * 
+	 * <p>
+	 * A version is considered to be <b>less than </b> another version if its
+	 * major component is less than the other version's major component, or the
+	 * major components are equal and its minor component is less than the other
+	 * version's minor component, or the major and minor components are equal
+	 * and its micro component is less than the other version's micro component,
+	 * or the major, minor and micro components are equal and it's qualifier
+	 * component is less than the other version's qualifier component (using
+	 * <code>String.compareTo</code>).
+	 * 
+	 * <p>
+	 * A version is considered to be <b>equal to</b> another version if the
+	 * major, minor and micro components are equal and the qualifier component
+	 * is equal (using <code>String.compareTo</code>).
+	 * 
+	 * @param object The <code>Version</code> object to be compared.
+	 * @return A negative integer, zero, or a positive integer if this object is
+	 *         less than, equal to, or greater than the specified
+	 *         <code>Version</code> object.
+	 * @throws ClassCastException If the specified object is not a
+	 *         <code>Version</code>.
+	 */
+	public int compareTo(Object object) {
+		if (object == this) { // quicktest
+			return 0;
+		}
+
+		Version other = (Version) object;
+
+		int result = major - other.major;
+		if (result != 0) {
+			return result;
+		}
+
+		result = minor - other.minor;
+		if (result != 0) {
+			return result;
+		}
+
+		result = micro - other.micro;
+		if (result != 0) {
+			return result;
+		}
+
+		return qualifier.compareTo(other.qualifier);
+	}
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.hooks.service;
+
+import java.util.Collection;
+
+import org.osgi.framework.ServiceEvent;
+
+/**
+ * OSGi Framework Service Event Hook Service.
+ * 
+ * <p>
+ * Bundles registering this service will be called during framework service
+ * (register, modify, and unregister service) operations.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6967 $
+ */
+
+public interface EventHook {
+	/**
+	 * Event hook method. This method is called prior to service event delivery
+	 * when a publishing bundle registers, modifies or unregisters a service.
+	 * This method can filter the bundles which receive the event.
+	 * 
+	 * @param event The service event to be delivered.
+	 * @param contexts A <code>Collection</code> of Bundle Contexts for bundles
+	 *        which have listeners to which the specified event will be
+	 *        delivered. The implementation of this method may remove bundle
+	 *        contexts from the collection to prevent the event from being
+	 *        delivered to the associated bundles. The collection supports all
+	 *        the optional <code>Collection</code> operations except
+	 *        <code>add</code> and <code>addAll</code>. Attempting to add to the
+	 *        collection will result in an
+	 *        <code>UnsupportedOperationException</code>. The collection is not
+	 *        synchronized.
+	 */
+	void event(ServiceEvent event,
+			Collection/* <BundleContext> */contexts);
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,63 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.hooks.service;
+
+import java.util.Collection;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi Framework Service Find Hook Service.
+ * 
+ * <p>
+ * Bundles registering this service will be called during framework service find
+ * (get service references) operations.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6967 $
+ */
+
+public interface FindHook {
+	/**
+	 * Find hook method. This method is called during the service find operation
+	 * (for example, {@link BundleContext#getServiceReferences(String, String)}
+	 * ). This method can filter the result of the find operation.
+	 * 
+	 * @param context The bundle context of the bundle performing the find
+	 *        operation.
+	 * @param name The class name of the services to find or <code>null</code>
+	 *        to find all services.
+	 * @param filter The filter criteria of the services to find or
+	 *        <code>null</code> for no filter criteria.
+	 * @param allServices <code>true</code> if the find operation is the result
+	 *        of a call to
+	 *        {@link BundleContext#getAllServiceReferences(String, String)}
+	 * @param references A <code>Collection</code> of Service References to be
+	 *        returned as a result of the find operation. The implementation of
+	 *        this method may remove service references from the collection to
+	 *        prevent the references from being returned to the bundle
+	 *        performing the find operation. The collection supports all the
+	 *        optional <code>Collection</code> operations except
+	 *        <code>add</code> and <code>addAll</code>. Attempting to add to the
+	 *        collection will result in an
+	 *        <code>UnsupportedOperationException</code>. The collection is not
+	 *        synchronized.
+	 */
+	void find(BundleContext context, String name, String filter,
+			boolean allServices,
+			Collection/* <ServiceReference> */references);
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,134 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.hooks.service;
+
+import java.util.Collection;
+
+import org.osgi.framework.BundleContext;
+
+/**
+ * OSGi Framework Service Listener Hook Service.
+ * 
+ * <p>
+ * Bundles registering this service will be called during service listener
+ * addition and removal.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6967 $
+ */
+
+public interface ListenerHook {
+	/**
+	 * Added listeners hook method. This method is called to provide the hook
+	 * implementation with information on newly added service listeners. This
+	 * method will be called as service listeners are added while this hook is
+	 * registered. Also, immediately after registration of this hook, this
+	 * method will be called to provide the current collection of service
+	 * listeners which had been added prior to the hook being registered.
+	 * 
+	 * @param listeners A <code>Collection</code> of {@link ListenerInfo}s for
+	 *        newly added service listeners which are now listening to service
+	 *        events. Attempting to add to or remove from the collection will
+	 *        result in an <code>UnsupportedOperationException</code>. The
+	 *        collection is not synchronized.
+	 */
+	void added(Collection/* <ListenerInfo> */listeners);
+
+	/**
+	 * Removed listeners hook method. This method is called to provide the hook
+	 * implementation with information on newly removed service listeners. This
+	 * method will be called as service listeners are removed while this hook is
+	 * registered.
+	 * 
+	 * @param listeners A <code>Collection</code> of {@link ListenerInfo}s for
+	 *        newly removed service listeners which are no longer listening to
+	 *        service events. Attempting to add to or remove from the collection
+	 *        will result in an <code>UnsupportedOperationException</code>. The
+	 *        collection is not synchronized.
+	 */
+	void removed(Collection/* <ListenerInfo> */listeners);
+
+	/**
+	 * Information about a Service Listener. This interface describes the bundle
+	 * which added the Service Listener and the filter with which it was added.
+	 * 
+	 * @ThreadSafe
+	 */
+	public interface ListenerInfo {
+		/**
+		 * Return the context of the bundle which added the listener.
+		 * 
+		 * @return The context of the bundle which added the listener.
+		 */
+		BundleContext getBundleContext();
+
+		/**
+		 * Return the filter string with which the listener was added.
+		 * 
+		 * @return The filter string with which the listener was added. This may
+		 *         be <code>null</code> if the listener was added without a
+		 *         filter.
+		 */
+		String getFilter();
+
+		/**
+		 * Return the state of the listener for this addition and removal life
+		 * cycle. Initially this method will return <code>false</code>
+		 * indicating the listener has been added but has not been removed.
+		 * After the listener has been removed, this method must always return
+		 * <code>true</code>.
+		 * 
+		 * <p>
+		 * There is an extremely rare case in which removed notification to
+		 * {@link ListenerHook}s can be made before added notification if two
+		 * threads are racing to add and remove the same service listener.
+		 * Because {@link ListenerHook}s are called synchronously during service
+		 * listener addition and removal, the Framework cannot guarantee
+		 * in-order delivery of added and removed notification for a given
+		 * service listener. This method can be used to detect this rare
+		 * occurrence.
+		 * 
+		 * @return <code>false</code> if the listener has not been been removed,
+		 *         <code>true</code> otherwise.
+		 */
+		boolean isRemoved();
+
+		/**
+		 * Compares this <code>ListenerInfo</code> to another
+		 * <code>ListenerInfo</code>. Two <code>ListenerInfo</code>s are equals
+		 * if they refer to the same listener for a given addition and removal
+		 * life cycle. If the same listener is added again, it must have a
+		 * different <code>ListenerInfo</code> which is not equal to this
+		 * <code>ListenerInfo</code>.
+		 * 
+		 * @param obj The object to compare against this
+		 *        <code>ListenerInfo</code>.
+		 * @return <code>true</code> if the other object is a
+		 *         <code>ListenerInfo</code> object and both objects refer to
+		 *         the same listener for a given addition and removal life
+		 *         cycle.
+		 */
+		boolean equals(Object obj);
+
+		/**
+		 * Returns the hash code for this <code>ListenerInfo</code>.
+		 * 
+		 * @return The hash code of this <code>ListenerInfo</code>.
+		 */
+		int hashCode();
+	}
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package.html?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package.html (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/package.html Wed Mar 24 09:51:11 2010
@@ -0,0 +1,11 @@
+<!-- $Revision: 6211 $ -->
+<BODY>
+<p>Framework Service Hooks 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.framework.hooks.service;version=&quot;[1.0,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/hooks/service/packageinfo Wed Mar 24 09:51:11 2010
@@ -0,0 +1 @@
+version 1.0

Added: felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/Framework.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,308 @@
+/*
+ * Copyright (c) OSGi Alliance (2008, 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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.launch;
+
+import java.io.InputStream;
+
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleException;
+import org.osgi.framework.Constants;
+import org.osgi.framework.FrameworkEvent;
+
+/**
+ * A Framework instance. A Framework is also known as a System Bundle.
+ * 
+ * <p>
+ * Framework instances are created using a {@link FrameworkFactory}. The methods
+ * of this interface can be used to manage and control the created framework
+ * instance.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6542 $
+ */
+public interface Framework extends Bundle {
+
+	/**
+	 * Initialize this Framework. After calling this method, this Framework
+	 * must:
+	 * <ul>
+	 * <li>Be in the {@link #STARTING} state.</li>
+	 * <li>Have a valid Bundle Context.</li>
+	 * <li>Be at start level 0.</li>
+	 * <li>Have event handling enabled.</li>
+	 * <li>Have reified Bundle objects for all installed bundles.</li>
+	 * <li>Have registered any framework services. For example,
+	 * <code>PackageAdmin</code>, <code>ConditionalPermissionAdmin</code>,
+	 * <code>StartLevel</code>.</li>
+	 * </ul>
+	 * 
+	 * <p>
+	 * This Framework will not actually be started until {@link #start() start}
+	 * is called.
+	 * 
+	 * <p>
+	 * This method does nothing if called when this Framework is in the
+	 * {@link #STARTING}, {@link #ACTIVE} or {@link #STOPPING} states.
+	 * 
+	 * @throws BundleException If this Framework could not be initialized.
+	 * @throws SecurityException If the Java Runtime Environment supports
+	 *         permissions and the caller does not have the appropriate
+	 *         <code>AdminPermission[this,EXECUTE]</code> or if there is a
+	 *         security manager already installed and the
+	 *         {@link Constants#FRAMEWORK_SECURITY} configuration property is
+	 *         set.
+	 * 
+	 */
+	void init() throws BundleException;
+
+	/**
+	 * Wait until this Framework has completely stopped. The <code>stop</code>
+	 * and <code>update</code> methods on a Framework performs an asynchronous
+	 * stop of the Framework. This method can be used to wait until the
+	 * asynchronous stop of this Framework has completed. This method will only
+	 * wait if called when this Framework is in the {@link #STARTING},
+	 * {@link #ACTIVE}, or {@link #STOPPING} states. Otherwise it will return
+	 * immediately.
+	 * <p>
+	 * A Framework Event is returned to indicate why this Framework has stopped.
+	 * 
+	 * @param timeout Maximum number of milliseconds to wait until this
+	 *        Framework has completely stopped. A value of zero will wait
+	 *        indefinitely.
+	 * @return A Framework Event indicating the reason this method returned. The
+	 *         following <code>FrameworkEvent</code> types may be returned by
+	 *         this method.
+	 *         <ul>
+	 *         <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
+	 *         been stopped. </li>
+	 * 
+	 *         <li>{@link FrameworkEvent#STOPPED_UPDATE STOPPED_UPDATE} - This
+	 *         Framework has been updated which has shutdown and will now
+	 *         restart.</li>
+	 * 
+	 *         <li> {@link FrameworkEvent#STOPPED_BOOTCLASSPATH_MODIFIED
+	 *         STOPPED_BOOTCLASSPATH_MODIFIED} - This Framework has been stopped
+	 *         and a bootclasspath extension bundle has been installed or
+	 *         updated. The VM must be restarted in order for the changed boot
+	 *         class path to take affect. </li>
+	 * 
+	 *         <li>{@link FrameworkEvent#ERROR ERROR} - The Framework
+	 *         encountered an error while shutting down or an error has occurred
+	 *         which forced the framework to shutdown. </li>
+	 * 
+	 *         <li> {@link FrameworkEvent#WAIT_TIMEDOUT WAIT_TIMEDOUT} - This
+	 *         method has timed out and returned before this Framework has
+	 *         stopped.</li>
+	 *         </ul>
+	 * @throws InterruptedException If another thread interrupted the current
+	 *         thread before or while the current thread was waiting for this
+	 *         Framework to completely stop. The <i>interrupted status</i> of
+	 *         the current thread is cleared when this exception is thrown.
+	 * @throws IllegalArgumentException If the value of timeout is negative.
+	 */
+	FrameworkEvent waitForStop(long timeout) throws InterruptedException;
+
+	/**
+	 * Start this Framework.
+	 * 
+	 * <p>
+	 * The following steps are taken to start this Framework:
+	 * <ol>
+	 * <li>If this Framework is not in the {@link #STARTING} state,
+	 * {@link #init() initialize} this Framework.</li>
+	 * <li>All installed bundles must be started in accordance with each
+	 * bundle's persistent <i>autostart setting</i>. This means some bundles
+	 * will not be started, some will be started with <i>eager activation</i>
+	 * and some will be started with their <i>declared activation</i> policy. If
+	 * this Framework implements the optional <i>Start Level Service
+	 * Specification</i>, then the start level of this Framework is moved to the
+	 * start level specified by the
+	 * {@link Constants#FRAMEWORK_BEGINNING_STARTLEVEL beginning start level}
+	 * framework property, as described in the <i>Start Level Service
+	 * Specification</i>. If this framework property is not specified, then the
+	 * start level of this Framework is moved to start level one (1). Any
+	 * exceptions that occur during bundle starting must be wrapped in a
+	 * {@link BundleException} and then published as a framework event of type
+	 * {@link FrameworkEvent#ERROR}</li>
+	 * <li>This Framework's state is set to {@link #ACTIVE}.</li>
+	 * <li>A framework event of type {@link FrameworkEvent#STARTED} is fired</li>
+	 * </ol>
+	 * 
+	 * @throws BundleException If this Framework could not be started.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+	 *         Environment supports permissions.
+	 * @see "Start Level Service Specification"
+	 */
+	void start() throws BundleException;
+
+	/**
+	 * Start this Framework.
+	 * 
+	 * <p>
+	 * Calling this method is the same as calling {@link #start()}. There are no
+	 * start options for the Framework.
+	 * 
+	 * @param options Ignored. There are no start options for the Framework.
+	 * @throws BundleException If this Framework could not be started.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+	 *         Environment supports permissions.
+	 * @see #start()
+	 */
+	void start(int options) throws BundleException;
+
+	/**
+	 * Stop this Framework.
+	 * 
+	 * <p>
+	 * The method returns immediately to the caller after initiating the
+	 * following steps to be taken on another thread.
+	 * <ol>
+	 * <li>This Framework's state is set to {@link #STOPPING}.</li>
+	 * <li>All installed bundles must be stopped without changing each bundle's
+	 * persistent <i>autostart setting</i>. If this Framework implements the
+	 * optional <i>Start Level Service Specification</i>, then the start level
+	 * of this Framework is moved to start level zero (0), as described in the
+	 * <i>Start Level Service Specification</i>. Any exceptions that occur
+	 * during bundle stopping must be wrapped in a {@link BundleException} and
+	 * then published as a framework event of type {@link FrameworkEvent#ERROR}</li>
+	 * <li>Unregister all services registered by this Framework.</li>
+	 * <li>Event handling is disabled.</li>
+	 * <li>This Framework's state is set to {@link #RESOLVED}.</li>
+	 * <li>All resources held by this Framework are released. This includes
+	 * threads, bundle class loaders, open files, etc.</li>
+	 * <li>Notify all threads that are waiting at {@link #waitForStop(long)
+	 * waitForStop} that the stop operation has completed.</li>
+	 * </ol>
+	 * <p>
+	 * After being stopped, this Framework may be discarded, initialized or
+	 * started.
+	 * 
+	 * @throws BundleException If stopping this Framework could not be
+	 *         initiated.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+	 *         Environment supports permissions.
+	 * @see "Start Level Service Specification"
+	 */
+	void stop() throws BundleException;
+
+	/**
+	 * Stop this Framework.
+	 * 
+	 * <p>
+	 * Calling this method is the same as calling {@link #stop()}. There are no
+	 * stop options for the Framework.
+	 * 
+	 * @param options Ignored. There are no stop options for the Framework.
+	 * @throws BundleException If stopping this Framework could not be
+	 *         initiated.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,EXECUTE]</code>, and the Java Runtime
+	 *         Environment supports permissions.
+	 * @see #stop()
+	 */
+	void stop(int options) throws BundleException;
+
+	/**
+	 * The Framework cannot be uninstalled.
+	 * 
+	 * <p>
+	 * This method always throws a BundleException.
+	 * 
+	 * @throws BundleException This Framework cannot be uninstalled.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+	 *         Runtime Environment supports permissions.
+	 */
+	void uninstall() throws BundleException;
+
+	/**
+	 * Stop and restart this Framework.
+	 * 
+	 * <p>
+	 * The method returns immediately to the caller after initiating the
+	 * following steps to be taken on another thread.
+	 * <ol>
+	 * <li>Perform the steps in the {@link #stop()} method to stop this
+	 * Framework.</li>
+	 * <li>Perform the steps in the {@link #start()} method to start this
+	 * Framework.</li>
+	 * </ol>
+	 * 
+	 * @throws BundleException If stopping and restarting this Framework could
+	 *         not be initiated.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+	 *         Runtime Environment supports permissions.
+	 */
+	void update() throws BundleException;
+
+	/**
+	 * Stop and restart this Framework.
+	 * 
+	 * <p>
+	 * Calling this method is the same as calling {@link #update()} except that
+	 * any provided InputStream is immediately closed.
+	 * 
+	 * @param in Any provided InputStream is immediately closed before returning
+	 *        from this method and otherwise ignored.
+	 * @throws BundleException If stopping and restarting this Framework could
+	 *         not be initiated.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,LIFECYCLE]</code>, and the Java
+	 *         Runtime Environment supports permissions.
+	 */
+	void update(InputStream in) throws BundleException;
+
+	/**
+	 * Returns the Framework unique identifier. This Framework is assigned the
+	 * unique identifier zero (0) since this Framework is also a System Bundle.
+	 * 
+	 * @return 0.
+	 * @see Bundle#getBundleId()
+	 */
+	long getBundleId();
+
+	/**
+	 * Returns the Framework location identifier. This Framework is assigned the
+	 * unique location &quot;<code>System Bundle</code>&quot; since this
+	 * Framework is also a System Bundle.
+	 * 
+	 * @return The string &quot;<code>System Bundle</code>&quot;.
+	 * @throws SecurityException If the caller does not have the appropriate
+	 *         <code>AdminPermission[this,METADATA]</code>, and the Java Runtime
+	 *         Environment supports permissions.
+	 * @see Bundle#getLocation()
+	 * @see Constants#SYSTEM_BUNDLE_LOCATION
+	 */
+	String getLocation();
+
+	/**
+	 * Returns the symbolic name of this Framework. The symbolic name is unique
+	 * for the implementation of the framework. However, the symbolic name
+	 * &quot;<code>system.bundle</code>&quot; must be recognized as an alias to
+	 * the implementation-defined symbolic name since this Framework is also a
+	 * System Bundle.
+	 * 
+	 * @return The symbolic name of this Framework.
+	 * @see Bundle#getSymbolicName()
+	 * @see Constants#SYSTEM_BUNDLE_SYMBOLICNAME
+	 */
+	String getSymbolicName();
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) OSGi Alliance (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.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework.launch;
+
+import java.util.Map;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * A factory for creating {@link Framework} instances.
+ * 
+ * <p>
+ * A framework implementation jar must contain the following resource:
+ * 
+ * <pre>
+ * /META-INF/services/org.osgi.framework.launch.FrameworkFactory
+ * </pre>
+ * 
+ * This UTF-8 encoded resource must contain the name of the framework
+ * implementation's FrameworkFactory implementation class. Space and tab
+ * characters, including blank lines, in the resource must be ignored. The
+ * number sign ('#' &#92;u0023) and all characters following it on each line are
+ * a comment and must be ignored.
+ * 
+ * <p>
+ * Launchers can find the name of the FrameworkFactory implementation class in
+ * the resource and then load and construct a FrameworkFactory object for the
+ * framework implementation. The FrameworkFactory implementation class must have
+ * a public, no-argument constructor. Java&#8482; SE 6 introduced the
+ * <code>ServiceLoader</code> class which can create a FrameworkFactory instance
+ * from the resource.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6888 $
+ */
+public interface FrameworkFactory {
+
+	/**
+	 * Create a new {@link Framework} instance.
+	 * 
+	 * @param configuration The framework properties to configure the new
+	 *        framework instance. If framework properties are not provided by
+	 *        the configuration argument, the created framework instance must
+	 *        use some reasonable default configuration appropriate for the
+	 *        current VM. For example, the system packages for the current
+	 *        execution environment should be properly exported. The specified
+	 *        configuration argument may be <code>null</code>. The created
+	 *        framework instance must copy any information needed from the
+	 *        specified configuration argument since the configuration argument
+	 *        can be changed after the framework instance has been created.
+	 * @return A new, configured {@link Framework} instance. The framework
+	 *         instance must be in the {@link Bundle#INSTALLED} state.
+	 * @throws SecurityException If the caller does not have
+	 *         <code>AllPermission</code>, and the Java Runtime Environment
+	 *         supports permissions.
+	 */
+	Framework newFramework(Map configuration);
+}

Added: felix/trunk/framework/src/main/java/org/osgi/framework/launch/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/package.html?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/package.html (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/package.html Wed Mar 24 09:51:11 2010
@@ -0,0 +1,11 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>Framework Launch 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.framework.launch;version=&quot;[1.0,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/framework/src/main/java/org/osgi/framework/launch/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/launch/packageinfo?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/launch/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/launch/packageinfo Wed Mar 24 09:51:11 2010
@@ -0,0 +1 @@
+version 1.0

Added: felix/trunk/framework/src/main/java/org/osgi/framework/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/package.html?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/package.html (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/package.html Wed Mar 24 09:51:11 2010
@@ -0,0 +1,11 @@
+<!-- $Revision: 6204 $ -->
+<BODY>
+<p>Framework Package Version 1.5.
+<p>Bundles wishing to use this package must list the package
+in the Import-Package header of the bundle's manifest.
+For example:
+<pre>
+Import-Package: org.osgi.framework;version=&quot;[1.5,2.0)&quot;
+</pre>
+</BODY>
+

Added: felix/trunk/framework/src/main/java/org/osgi/framework/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/packageinfo?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/packageinfo Wed Mar 24 09:51:11 2010
@@ -0,0 +1 @@
+version 1.5

Added: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,110 @@
+/*
+ * 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.
+ * 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;
+
+/**
+ * An exported package.
+ * 
+ * Objects implementing this interface are created by the Package Admin service.
+ * 
+ * <p>
+ * The term <i>exported package</i> refers to a package that has been exported
+ * from a resolved bundle. This package may or may not be currently wired to
+ * other bundles.
+ * 
+ * <p>
+ * The information about an exported package provided by this object may change.
+ * An <code>ExportedPackage</code> object becomes stale if the package it
+ * references has been updated or removed as a result of calling
+ * <code>PackageAdmin.refreshPackages()</code>.
+ * 
+ * If this object becomes stale, its <code>getName()</code> and
+ * <code>getVersion()</code> methods continue to return their original values,
+ * <code>isRemovalPending()</code> returns <code>true</code>, and
+ * <code>getExportingBundle()</code> and <code>getImportingBundles()</code>
+ * return <code>null</code>.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 5673 $
+ */
+public interface ExportedPackage {
+	/**
+	 * Returns the name of the package associated with this exported package.
+	 * 
+	 * @return The name of this exported package.
+	 */
+	public String getName();
+
+	/**
+	 * Returns the bundle exporting the package associated with this exported
+	 * package.
+	 * 
+	 * @return The exporting bundle, or <code>null</code> if this
+	 *         <code>ExportedPackage</code> object has become stale.
+	 */
+	public Bundle getExportingBundle();
+
+	/**
+	 * Returns the resolved bundles that are currently wired to this exported
+	 * package.
+	 * 
+	 * <p>
+	 * Bundles which require the exporting bundle associated with this exported
+	 * package are considered to be wired to this exported package are included
+	 * in the returned array. See {@link RequiredBundle#getRequiringBundles()}.
+	 * 
+	 * @return The array of resolved bundles currently wired to this exported
+	 *         package, or <code>null</code> if this
+	 *         <code>ExportedPackage</code> object has become stale. The array
+	 *         will be empty if no bundles are wired to this exported package.
+	 */
+	public Bundle[] getImportingBundles();
+
+	/**
+	 * Returns the version of this exported package.
+	 * 
+	 * @return The version of this exported package, or <code>null</code> if
+	 *         no version information is available.
+	 * @deprecated As of 1.2, replaced by {@link #getVersion}.
+	 */
+	public String getSpecificationVersion();
+
+	/**
+	 * Returns the version of this exported package.
+	 * 
+	 * @return The version of this exported package, or
+	 *         {@link Version#emptyVersion} if no version information is
+	 *         available.
+	 * @since 1.2
+	 */
+	public Version getVersion();
+
+	/**
+	 * Returns <code>true</code> if the package associated with this
+	 * <code>ExportedPackage</code> object has been exported by a bundle that
+	 * has been updated or uninstalled.
+	 * 
+	 * @return <code>true</code> if the associated package is being exported
+	 *         by a bundle that has been updated or uninstalled, or if this
+	 *         <code>ExportedPackage</code> object has become stale;
+	 *         <code>false</code> otherwise.
+	 */
+	public boolean isRemovalPending();
+}

Added: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/PackageAdmin.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,295 @@
+/*
+ * 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.
+ * 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.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6779 $
+ * @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.
+	 * @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);
+
+	/**
+	 * 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.
+	 * @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);
+
+	/**
+	 * 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.
+	 * @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);
+
+	/**
+	 * 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.
+	 * @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 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);
+
+	/**
+	 * 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 created by the same framework instance that registered
+	 *         this <code>PackageAdmin</code> service.
+	 * @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.
+	 * @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);
+}

Added: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/RequiredBundle.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,97 @@
+/*
+ * 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.
+ * 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
+ * @ThreadSafe
+ * @version $Revision: 5673 $
+ */
+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. The array will be empty if no bundles require
+	 *         this required package.
+	 */
+	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 required bundle has been updated or
+	 *         uninstalled, or if the <code>RequiredBundle</code> object has
+	 *         become stale; <code>false</code> otherwise.
+	 */
+	public boolean isRemovalPending();
+}

Added: felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/package.html?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/package.html (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/package.html Wed Mar 24 09:51:11 2010
@@ -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/framework/src/main/java/org/osgi/service/packageadmin/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/packageinfo?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/packageadmin/packageinfo Wed Mar 24 09:51:11 2010
@@ -0,0 +1 @@
+version 1.2

Added: felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,273 @@
+/*
+ * 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.
+ * 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.startlevel;
+
+import org.osgi.framework.Bundle;
+
+/**
+ * The StartLevel service allows management agents to manage a start level
+ * assigned to each bundle and the active start level of the Framework. There is
+ * at most one StartLevel service present in the OSGi environment.
+ * 
+ * <p>
+ * A start level is defined to be a state of execution in which the Framework
+ * exists. StartLevel values are defined as unsigned integers with 0 (zero)
+ * being the state where the Framework is not launched. Progressively higher
+ * integral values represent progressively higher start levels. e.g. 2 is a
+ * higher start level than 1.
+ * <p>
+ * Access to the StartLevel service is protected by corresponding
+ * <code>ServicePermission</code>. In addition <code>AdminPermission</code>
+ * is required to actually modify start level information.
+ * <p>
+ * Start Level support in the Framework includes the ability to control the
+ * beginning start level of the Framework, to modify the active start level of
+ * the Framework and to assign a specific start level to a bundle. How the
+ * beginning start level of a Framework is specified is implementation
+ * dependent. It may be a command line argument when invoking the Framework
+ * implementation.
+ * <p>
+ * When the Framework is first started it must be at start level zero. In this
+ * state, no bundles are running. This is the initial state of the Framework
+ * before it is launched.
+ * 
+ * When the Framework is launched, the Framework will enter start level one and
+ * all bundles which are assigned to start level one and whose autostart setting
+ * indicates the bundle should be started are started as described in the
+ * <code>Bundle.start</code> method. The Framework will continue to increase
+ * the start level, starting bundles at each start level, until the Framework
+ * has reached a beginning start level. At this point the Framework has
+ * completed starting bundles and will then fire a Framework event of type
+ * <code>FrameworkEvent.STARTED</code> to announce it has completed its
+ * launch.
+ * 
+ * <p>
+ * Within a start level, bundles may be started in an order defined by the
+ * Framework implementation. This may be something like ascending
+ * <code>Bundle.getBundleId</code> order or an order based upon dependencies
+ * between bundles. A similar but reversed order may be used when stopping
+ * bundles within a start level.
+ * 
+ * <p>
+ * The StartLevel service can be used by management bundles to alter the active
+ * start level of the framework.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 6747 $
+ */
+public interface StartLevel {
+	/**
+	 * Return the active start level value of the Framework.
+	 * 
+	 * If the Framework is in the process of changing the start level this
+	 * method must return the active start level if this differs from the
+	 * requested start level.
+	 * 
+	 * @return The active start level value of the Framework.
+	 */
+	public int getStartLevel();
+
+	/**
+	 * Modify the active start level of the Framework.
+	 * 
+	 * <p>
+	 * The Framework will move to the requested start level. This method will
+	 * return immediately to the caller and the start level change will occur
+	 * asynchronously on another thread.
+	 * 
+	 * <p>
+	 * If the specified start level is higher than the active start level, the
+	 * Framework will continue to increase the start level until the Framework
+	 * has reached the specified start level.
+	 * 
+	 * At each intermediate start level value on the way to and including the
+	 * target start level, the Framework must:
+	 * <ol>
+	 * <li>Change the active start level to the intermediate start level value.
+	 * <li>Start bundles at the intermediate start level whose autostart
+	 * setting indicate they must be started. They are started as described in
+	 * the {@link Bundle#start(int)} method using the
+	 * {@link Bundle#START_TRANSIENT} option. The
+	 * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if
+	 * {@link #isBundleActivationPolicyUsed(Bundle)} returns <code>true</code>
+	 * for the bundle.
+	 * </ol>
+	 * When this process completes after the specified start level is reached,
+	 * the Framework will fire a Framework event of type
+	 * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+	 * to the specified start level.
+	 * 
+	 * <p>
+	 * If the specified start level is lower than the active start level, the
+	 * Framework will continue to decrease the start level until the Framework
+	 * has reached the specified start level.
+	 * 
+	 * At each intermediate start level value on the way to and including the
+	 * specified start level, the framework must:
+	 * <ol>
+	 * <li>Stop bundles at the intermediate start level as described in the
+	 * {@link Bundle#stop(int)} method using the {@link Bundle#STOP_TRANSIENT}
+	 * option.
+	 * <li>Change the active start level to the intermediate start level value.
+	 * </ol>
+	 * When this process completes after the specified start level is reached,
+	 * the Framework will fire a Framework event of type
+	 * <code>FrameworkEvent.STARTLEVEL_CHANGED</code> to announce it has moved
+	 * to the specified start level.
+	 * 
+	 * <p>
+	 * If the specified start level is equal to the active start level, then no
+	 * bundles are started or stopped, however, the Framework must fire a
+	 * Framework event of type <code>FrameworkEvent.STARTLEVEL_CHANGED</code>
+	 * to announce it has finished moving to the specified start level. This
+	 * event may arrive before this method return.
+	 * 
+	 * @param startlevel The requested start level for the Framework.
+	 * @throws IllegalArgumentException If the specified start level is less
+	 *         than or equal to zero.
+	 * @throws SecurityException If the caller does not have
+	 *         <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the
+	 *         Java runtime environment supports permissions.
+	 */
+	public void setStartLevel(int startlevel);
+
+	/**
+	 * Return the assigned start level value for the specified Bundle.
+	 * 
+	 * @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 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);
+
+	/**
+	 * Assign a start level value to the specified Bundle.
+	 * 
+	 * <p>
+	 * The specified bundle will be assigned the specified start level. The
+	 * start level value assigned to the bundle will be persistently recorded by
+	 * the Framework.
+	 * <p>
+	 * If the new start level for the bundle is lower than or equal to the
+	 * active start level of the Framework and the bundle's autostart setting
+	 * indicates the bundle must be started, the Framework will start the
+	 * specified bundle as described in the {@link Bundle#start(int)} method
+	 * using the {@link Bundle#START_TRANSIENT} option. The
+	 * {@link Bundle#START_ACTIVATION_POLICY} option must also be used if
+	 * {@link #isBundleActivationPolicyUsed(Bundle)} returns <code>true</code>
+	 * for the bundle. The actual starting of this bundle must occur
+	 * asynchronously.
+	 * <p>
+	 * If the new start level for the bundle is higher than the active start
+	 * level of the Framework, the Framework will stop the specified bundle as
+	 * described in the {@link Bundle#stop(int)} method using the
+	 * {@link Bundle#STOP_TRANSIENT} option. The actual stopping of this bundle
+	 * must occur asynchronously.
+	 * 
+	 * @param bundle The target bundle.
+	 * @param startlevel The new start level for the specified Bundle.
+	 * @throws IllegalArgumentException If the specified bundle has been
+	 *         uninstalled, or if the specified start level is less than or
+	 *         equal to zero, or 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.
+	 */
+	public void setBundleStartLevel(Bundle bundle, int startlevel);
+
+	/**
+	 * Return the initial start level value that is assigned to a Bundle when it
+	 * is first installed.
+	 * 
+	 * @return The initial start level value for Bundles.
+	 * @see #setInitialBundleStartLevel
+	 */
+	public int getInitialBundleStartLevel();
+
+	/**
+	 * Set the initial start level value that is assigned to a Bundle when it is
+	 * first installed.
+	 * 
+	 * <p>
+	 * The initial bundle start level will be set to the specified start level.
+	 * The initial bundle start level value will be persistently recorded by the
+	 * Framework.
+	 * 
+	 * <p>
+	 * When a Bundle is installed via <code>BundleContext.installBundle</code>,
+	 * it is assigned the initial bundle start level value.
+	 * 
+	 * <p>
+	 * The default initial bundle start level value is 1 unless this method has
+	 * been called to assign a different initial bundle start level value.
+	 * 
+	 * <p>
+	 * 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
+	 *         than or equal to zero.
+	 * @throws SecurityException If the caller does not have
+	 *         <code>AdminPermission[System Bundle,STARTLEVEL]</code> and the
+	 *         Java runtime environment supports permissions.
+	 */
+	public void setInitialBundleStartLevel(int startlevel);
+
+	/**
+	 * Returns whether the specified bundle's autostart setting indicates the
+	 * bundle must be started.
+	 * <p>
+	 * The autostart setting of a bundle indicates whether the bundle is to be
+	 * started when its start level is reached.
+	 * 
+	 * @param bundle The bundle whose autostart setting is to be examined.
+	 * @return <code>true</code> if the autostart setting of the bundle
+	 *         indicates the bundle is to be started. <code>false</code>
+	 *         otherwise.
+	 * @throws java.lang.IllegalArgumentException If the specified bundle has
+	 *         been uninstalled or if the specified bundle was not created by
+	 *         the same framework instance that registered this
+	 *         <code>StartLevel</code> service.
+	 * @see Bundle#START_TRANSIENT
+	 */
+	public boolean isBundlePersistentlyStarted(Bundle bundle);
+
+	/**
+	 * Returns whether the specified bundle's autostart setting indicates that
+	 * the activation policy declared in the bundle's manifest must be used.
+	 * <p>
+	 * The autostart setting of a bundle indicates whether the bundle's declared
+	 * activation policy is to be used when the bundle is started.
+	 * 
+	 * @param bundle The bundle whose autostart setting is to be examined.
+	 * @return <code>true</code> if the bundle's autostart setting indicates the
+	 *         activation policy declared in the manifest must be used.
+	 *         <code>false</code> if the bundle must be eagerly activated.
+	 * @throws java.lang.IllegalArgumentException If the specified bundle has
+	 *         been uninstalled 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
+	 */
+	public boolean isBundleActivationPolicyUsed(Bundle bundle);
+}

Added: felix/trunk/framework/src/main/java/org/osgi/service/startlevel/package.html
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/startlevel/package.html?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/startlevel/package.html (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/startlevel/package.html Wed Mar 24 09:51:11 2010
@@ -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/framework/src/main/java/org/osgi/service/startlevel/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/startlevel/packageinfo?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/startlevel/packageinfo (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/startlevel/packageinfo Wed Mar 24 09:51:11 2010
@@ -0,0 +1 @@
+version 1.1

Added: felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java?rev=926997&view=auto
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java (added)
+++ felix/trunk/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java Wed Mar 24 09:51:11 2010
@@ -0,0 +1,149 @@
+/*
+ * 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.
+ * 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.url;
+
+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>
+ * parameter. Subclasses of this abstract class should not need to override the
+ * <code>setURL</code> and <code>parseURL(URLStreamHandlerSetter,...)</code>
+ * methods.
+ * 
+ * @ThreadSafe
+ * @version $Revision: 5673 $
+ */
+public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
+		implements URLStreamHandlerService {
+	/**
+	 * @see "java.net.URLStreamHandler.openConnection"
+	 */
+	public abstract URLConnection openConnection(URL u)
+			throws java.io.IOException;
+
+	/**
+	 * The <code>URLStreamHandlerSetter</code> object passed to the parseURL
+	 * method.
+	 */
+	protected volatile URLStreamHandlerSetter	realHandler;
+
+	/**
+	 * Parse a URL using the <code>URLStreamHandlerSetter</code> object. This
+	 * method sets the <code>realHandler</code> field with the specified
+	 * <code>URLStreamHandlerSetter</code> object and then calls
+	 * <code>parseURL(URL,String,int,int)</code>.
+	 * 
+	 * @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,
+			String spec, int start, int limit) {
+		this.realHandler = realHandler;
+		parseURL(u, spec, start, limit);
+	}
+
+	/**
+	 * This method calls <code>super.toExternalForm</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.toExternalForm"
+	 */
+	public String toExternalForm(URL u) {
+		return super.toExternalForm(u);
+	}
+
+	/**
+	 * This method calls <code>super.equals(URL,URL)</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.equals(URL,URL)"
+	 */
+	public boolean equals(URL u1, URL u2) {
+		return super.equals(u1, u2);
+	}
+
+	/**
+	 * This method calls <code>super.getDefaultPort</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.getDefaultPort"
+	 */
+	public int getDefaultPort() {
+		return super.getDefaultPort();
+	}
+
+	/**
+	 * This method calls <code>super.getHostAddress</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.getHostAddress"
+	 */
+	public InetAddress getHostAddress(URL u) {
+		return super.getHostAddress(u);
+	}
+
+	/**
+	 * This method calls <code>super.hashCode(URL)</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.hashCode(URL)"
+	 */
+	public int hashCode(URL u) {
+		return super.hashCode(u);
+	}
+
+	/**
+	 * This method calls <code>super.hostsEqual</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.hostsEqual"
+	 */
+	public boolean hostsEqual(URL u1, URL u2) {
+		return super.hostsEqual(u1, u2);
+	}
+
+	/**
+	 * This method calls <code>super.sameFile</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.sameFile"
+	 */
+	public boolean sameFile(URL u1, URL u2) {
+		return super.sameFile(u1, u2);
+	}
+
+	/**
+	 * This method calls
+	 * <code>realHandler.setURL(URL,String,String,int,String,String)</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String)"
+	 * @deprecated This method is only for compatibility with handlers written
+	 *             for JDK 1.1.
+	 */
+	protected void setURL(URL u, String proto, String host, int port,
+			String file, String ref) {
+		realHandler.setURL(u, proto, host, port, file, ref);
+	}
+
+	/**
+	 * This method calls
+	 * <code>realHandler.setURL(URL,String,String,int,String,String,String,String)</code>.
+	 * 
+	 * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
+	 */
+	protected void setURL(URL u, String proto, String host, int port,
+			String auth, String user, String path, String query, String ref) {
+		realHandler.setURL(u, proto, host, port, auth, user, path, query, ref);
+	}
+}



Mime
View raw message