Move framework to OSGi R5 API. (FELIX-3504)


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1337360 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/framework/pom.xml b/framework/pom.xml
index eaecc88..b9fd228 100644
--- a/framework/pom.xml
+++ b/framework/pom.xml
@@ -60,7 +60,7 @@
             <Bundle-Name>Apache Felix Framework</Bundle-Name>
             <Bundle-Description>OSGi R4 framework implementation.</Bundle-Description>
             <Bundle-Vendor>The Apache Software Foundation</Bundle-Vendor>
-            <Export-Package>org.osgi.framework.*;-split-package:=merge-first,org.osgi.service.packageadmin,org.osgi.service.url,org.osgi.service.startlevel,org.osgi.util.tracker</Export-Package>
+            <Export-Package>org.osgi.framework.*;-split-package:=merge-first,org.osgi.resource,org.osgi.service.*,org.osgi.util.tracker</Export-Package>
             <Private-Package>org.apache.felix.framework.*</Private-Package>
             <Import-Package>!*</Import-Package>
           </instructions>
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
index f7a075c..5a4e3b3 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleRevisionImpl.java
@@ -22,7 +22,6 @@
 import java.io.InputStream;
 import java.net.MalformedURLException;
 import java.net.URL;
-import java.net.URLStreamHandler;
 import java.security.ProtectionDomain;
 import java.util.ArrayList;
 import java.util.Collections;
@@ -43,8 +42,11 @@
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
 
-public class BundleRevisionImpl implements BundleRevision
+public class BundleRevisionImpl implements BundleRevision, Resource
 {
     public final static int EAGER_ACTIVATION = 0;
     public final static int LAZY_ACTIVATION = 1;
@@ -189,6 +191,16 @@
         return m_version;
     }
 
+    public List<Capability> getCapabilities(String namespace)
+    {
+        return asCapabilityList(getDeclaredCapabilities(namespace));
+    }
+
+    static List<Capability> asCapabilityList(List reqs)
+    {
+        return (List<Capability>) reqs;
+    }
+
     public List<BundleCapability> getDeclaredCapabilities(String namespace)
     {
         List<BundleCapability> result = m_declaredCaps;
@@ -206,6 +218,16 @@
         return result;
     }
 
+    public List<Requirement> getRequirements(String namespace)
+    {
+        return asRequirementList(getDeclaredRequirements(namespace));
+    }
+
+    static List<Requirement> asRequirementList(List reqs)
+    {
+        return (List<Requirement>) reqs;
+    }
+
     public List<BundleRequirement> getDeclaredRequirements(String namespace)
     {
         List<BundleRequirement> result = m_declaredReqs;
diff --git a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
index 13a323b..5ee1c1e 100644
--- a/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/BundleWiringImpl.java
@@ -68,6 +68,9 @@
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWire;
 import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Wire;
 
 public class BundleWiringImpl implements BundleWiring
 {
@@ -496,6 +499,11 @@
         return !m_isDisposed;
     }
 
+    public List<Capability> getResourceCapabilities(String namespace)
+    {
+        return BundleRevisionImpl.asCapabilityList(getCapabilities(namespace));
+    }
+
     public List<BundleCapability> getCapabilities(String namespace)
     {
         if (isInUse())
@@ -517,6 +525,11 @@
         return null;
     }
 
+    public List<Requirement> getResourceRequirements(String namespace)
+    {
+        return BundleRevisionImpl.asRequirementList(getRequirements(namespace));
+    }
+
     public List<BundleRequirement> getRequirements(String namespace)
     {
         if (isInUse())
@@ -553,6 +566,16 @@
         return m_resolvedNativeLibs;
     }
 
+    private static List<Wire> asWireList(List wires)
+    {
+        return (List<Wire>) wires;
+    }
+
+    public List<Wire> getProvidedResourceWires(String namespace)
+    {
+        return asWireList(getProvidedWires(namespace));
+    }
+
     public List<BundleWire> getProvidedWires(String namespace)
     {
         if (isInUse())
@@ -563,6 +586,11 @@
         return null;
     }
 
+    public List<Wire> getRequiredResourceWires(String namespace)
+    {
+        return asWireList(getRequiredWires(namespace));
+    }
+
     public List<BundleWire> getRequiredWires(String namespace)
     {
         if (isInUse())
@@ -603,6 +631,11 @@
         m_importedPkgs = importedPkgs;
     }
 
+    public BundleRevision getResource()
+    {
+        return null;
+    }
+
     public BundleRevision getRevision()
     {
         return m_revision;
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java b/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java
index 5e31d03..89b2984 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/SimpleHostedCapability.java
@@ -33,6 +33,11 @@
         m_cap = cap;
     }
 
+    public BundleRevision getResource()
+    {
+        return m_host;
+    }
+
     public BundleRevision getRevision()
     {
         return m_host;
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
index 7a21ec4..ee159ff 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedCapability.java
@@ -20,6 +20,7 @@
 import org.apache.felix.framework.wiring.BundleCapabilityImpl;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
 
 public class WrappedCapability extends BundleCapabilityImpl implements HostedCapability
 {
@@ -71,6 +72,12 @@
     }
 
     @Override
+    public BundleRevision getResource()
+    {
+        return m_host;
+    }
+
+    @Override
     public BundleRevision getRevision()
     {
         return m_host;
diff --git a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java
index bdd2a2d..fa4ab5d 100644
--- a/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java
+++ b/framework/src/main/java/org/apache/felix/framework/resolver/WrappedRevision.java
@@ -29,6 +29,8 @@
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.BundleWiring;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
 
 class WrappedRevision implements BundleRevision
 {
@@ -63,6 +65,16 @@
         throw new UnsupportedOperationException("Not supported yet.");
     }
 
+    public List<Capability> getCapabilities(String namespace)
+    {
+        return asCapabilityList(getDeclaredCapabilities(namespace));
+    }
+
+    private static List<Capability> asCapabilityList(List caps)
+    {
+        return (List<Capability>) caps;
+    }
+
     public List<BundleCapability> getDeclaredCapabilities(String namespace)
     {
         if (m_cachedCapabilities == null)
@@ -93,6 +105,16 @@
         return m_cachedCapabilities;
     }
 
+    public List<Requirement> getRequirements(String namespace)
+    {
+        return asRequirementList(getDeclaredRequirements(namespace));
+    }
+
+    private static List<Requirement> asRequirementList(List reqs)
+    {
+        return (List<Requirement>) reqs;
+    }
+
     public List<BundleRequirement> getDeclaredRequirements(String namespace)
     {
         if (m_cachedRequirements == null)
diff --git a/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java b/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
index dd08ba5..0128568 100644
--- a/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/wiring/BundleCapabilityImpl.java
@@ -19,11 +19,11 @@
 package org.apache.felix.framework.wiring;
 
 import java.util.ArrayList;
-import java.util.HashSet;
 import java.util.Collections;
-import java.util.Set;
-import java.util.Map;
+import java.util.HashSet;
 import java.util.List;
+import java.util.Map;
+import java.util.Set;
 import java.util.StringTokenizer;
 import org.apache.felix.framework.capabilityset.SimpleFilter;
 import org.apache.felix.framework.util.ImmutableMap;
@@ -32,6 +32,7 @@
 import org.osgi.framework.Constants;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
 
 public class BundleCapabilityImpl implements BundleCapability
 {
@@ -126,6 +127,11 @@
         m_mandatory = mandatory;
     }
 
+    public BundleRevision getResource()
+    {
+        return m_revision;
+    }
+
     public BundleRevision getRevision()
     {
         return m_revision;
diff --git a/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java b/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java
index 0477c70..398272e 100644
--- a/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java
+++ b/framework/src/main/java/org/apache/felix/framework/wiring/BundleRequirementImpl.java
@@ -27,6 +27,7 @@
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;
+import org.osgi.resource.Resource;
 
 public class BundleRequirementImpl implements BundleRequirement
 {
@@ -79,6 +80,11 @@
         return m_attrs;
     }
 
+    public BundleRevision getResource()
+    {
+        return m_revision;
+    }
+
     public BundleRevision getRevision()
     {
         return m_revision;
diff --git a/framework/src/main/java/org/osgi/framework/AdaptPermission.java b/framework/src/main/java/org/osgi/framework/AdaptPermission.java
index f95c1fe..fbe70c1 100644
--- a/framework/src/main/java/org/osgi/framework/AdaptPermission.java
+++ b/framework/src/main/java/org/osgi/framework/AdaptPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). 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.
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.osgi.framework;
 
 import java.io.IOException;
@@ -40,9 +41,9 @@
  * {@code AdaptPermission} has one action: {@code adapt}.
  * 
  * @ThreadSafe
- * @version $Id: bc4c5d392d2534a7744f6fc00f4665502f82033c $
+ * @version $Id: 3bc095bd294db2d8ea25971a3d71991de1495b1a $
  */
-public class AdaptPermission extends BasicPermission {
+public final class AdaptPermission extends BasicPermission {
 
 	private static final long						serialVersionUID	= 1L;
 
@@ -137,8 +138,7 @@
 	 *        adapted.
 	 * @param actions {@code adapt}.
 	 */
-	public AdaptPermission(String adaptClass, Bundle adaptableBundle,
-			String actions) {
+	public AdaptPermission(String adaptClass, Bundle adaptableBundle, String actions) {
 		super(adaptClass);
 		setTransients(null, parseActions(actions));
 		this.bundle = adaptableBundle;
@@ -201,9 +201,7 @@
 			char c;
 
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
 
 			// check for the known strings
@@ -217,11 +215,9 @@
 				matchlen = 5;
 				mask |= ACTION_ADAPT;
 
-			}
-			else {
+			} else {
 				// parse error
-				throw new IllegalArgumentException("invalid actions: "
-						+ actions);
+				throw new IllegalArgumentException("invalid actions: " + actions);
 			}
 
 			// make sure we didn't just match the tail of a word
@@ -239,8 +235,7 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
@@ -270,10 +265,8 @@
 		}
 		try {
 			return FrameworkUtil.createFilter(filterString);
-		}
-		catch (InvalidSyntaxException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid filter");
+		} catch (InvalidSyntaxException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
 			iae.initCause(e);
 			throw iae;
 		}
@@ -387,10 +380,7 @@
 
 		AdaptPermission cp = (AdaptPermission) obj;
 
-		return (action_mask == cp.action_mask)
-				&& getName().equals(cp.getName())
-				&& ((bundle == cp.bundle) || ((bundle != null) && bundle
-						.equals(cp.bundle)));
+		return (action_mask == cp.action_mask) && getName().equals(cp.getName()) && ((bundle == cp.bundle) || ((bundle != null) && bundle.equals(cp.bundle)));
 	}
 
 	/**
@@ -412,8 +402,7 @@
 	 * stream. The actions are serialized, and the superclass takes care of the
 	 * name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		if (bundle != null) {
 			throw new NotSerializableException("cannot serialize");
 		}
@@ -428,8 +417,7 @@
 	 * readObject is called to restore the state of this permission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the action, then initialize the rest
 		s.defaultReadObject();
 		setTransients(parseFilter(getName()), parseActions(actions));
@@ -516,18 +504,15 @@
 	 */
 	public void add(final Permission permission) {
 		if (!(permission instanceof AdaptPermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection");
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 
 		final AdaptPermission ap = (AdaptPermission) permission;
 		if (ap.bundle != null) {
-			throw new IllegalArgumentException("cannot add to collection: "
-					+ ap);
+			throw new IllegalArgumentException("cannot add to collection: " + ap);
 		}
 
 		final String name = ap.getName();
@@ -538,12 +523,10 @@
 				final int oldMask = existing.action_mask;
 				final int newMask = ap.action_mask;
 				if (oldMask != newMask) {
-					pc.put(name, new AdaptPermission(existing.filter, oldMask
-							| newMask));
+					pc.put(name, new AdaptPermission(existing.filter, oldMask | newMask));
 
 				}
-			}
-			else {
+			} else {
 				pc.put(name, ap);
 			}
 
@@ -613,23 +596,18 @@
 	}
 
 	/* serialization logic */
-	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", HashMap.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE)			};
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", HashMap.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
 
-	private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", permissions);
 		pfields.put("all_allowed", all_allowed);
 		out.writeFields();
 	}
 
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		permissions = (HashMap<String, AdaptPermission>) gfields.get(
-				"permissions", null);
+		permissions = (HashMap<String, AdaptPermission>) gfields.get("permissions", null);
 		all_allowed = gfields.get("all_allowed", false);
 	}
 }
diff --git a/framework/src/main/java/org/osgi/framework/AdminPermission.java b/framework/src/main/java/org/osgi/framework/AdminPermission.java
index fc7b1f4..324360c 100644
--- a/framework/src/main/java/org/osgi/framework/AdminPermission.java
+++ b/framework/src/main/java/org/osgi/framework/AdminPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,34 +41,34 @@
  * permission are:
  * 
  * <pre>
- *  Action               Methods
- *  class                Bundle.loadClass
- *  execute              Bundle.start
- *                       Bundle.stop
- *                       BundleStartLevel.setStartLevel
- *  extensionLifecycle   BundleContext.installBundle for extension bundles
- *                       Bundle.update for extension bundles
- *                       Bundle.uninstall for extension bundles
- *  lifecycle            BundleContext.installBundle
- *                       Bundle.update
- *                       Bundle.uninstall
- *  listener             BundleContext.addBundleListener for SynchronousBundleListener
- *                       BundleContext.removeBundleListener for SynchronousBundleListener
- *  metadata             Bundle.getHeaders
- *                       Bundle.getLocation
- *  resolve              FrameworkWiring.refreshBundles
- *                       FrameworkWiring.resolveBundles
- *  resource             Bundle.getResource
- *                       Bundle.getResources
- *                       Bundle.getEntry
- *                       Bundle.getEntryPaths
- *                       Bundle.findEntries
- *                       Bundle resource/entry URL creation
- *  startlevel           FrameworkStartLevel.setStartLevel
- *                       FrameworkStartLevel.setInitialBundleStartLevel 
- *  context              Bundle.getBundleContext
- *  weave                WovenClass.setBytes
- *                       WovenClass.getDynamicImports for modification
+ * Action             Methods
+ * class              Bundle.loadClass
+ * execute            Bundle.start
+ *                    Bundle.stop
+ *                    BundleStartLevel.setStartLevel
+ * extensionLifecycle BundleContext.installBundle for extension bundles
+ *                    Bundle.update for extension bundles
+ *                    Bundle.uninstall for extension bundles
+ * lifecycle          BundleContext.installBundle
+ *                    Bundle.update
+ *                    Bundle.uninstall
+ * listener           BundleContext.addBundleListener for SynchronousBundleListener
+ *                    BundleContext.removeBundleListener for SynchronousBundleListener
+ * metadata           Bundle.getHeaders
+ *                    Bundle.getLocation
+ * resolve            FrameworkWiring.refreshBundles
+ *                    FrameworkWiring.resolveBundles
+ * resource           Bundle.getResource
+ *                    Bundle.getResources
+ *                    Bundle.getEntry
+ *                    Bundle.getEntryPaths
+ *                    Bundle.findEntries
+ *                    Bundle resource/entry URL creation
+ * startlevel         FrameworkStartLevel.setStartLevel
+ *                    FrameworkStartLevel.setInitialBundleStartLevel
+ * context            Bundle.getBundleContext
+ * weave              WovenClass.setBytes
+ *                    WovenClass.getDynamicImports for modification
  * </pre>
  * 
  * <p>
@@ -89,78 +89,77 @@
  * Filter attribute names are processed in a case sensitive manner.
  * 
  * @ThreadSafe
- * @version $Id: 43baf9a6d7ce5e6108507834e841e340fd91c513 $
+ * @version $Id: cd883e81fde210ce8f0cabaebea377378d672818 $
  */
 
 public final class AdminPermission extends BasicPermission {
-	static final long						serialVersionUID			= 307051004521261705L;
+	static final long								serialVersionUID			= 307051004521261705L;
 
 	/**
-	 * The action string {@code class}. The {@code class} action
-	 * implies the {@code resolve} action.
+	 * The action string {@code class}. The {@code class} action implies the
+	 * {@code resolve} action.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	CLASS						= "class";
+	public final static String						CLASS						= "class";
 	/**
-	 * The action string {@code execute}. The {@code execute} action
-	 * implies the {@code resolve} action.
+	 * The action string {@code execute}. The {@code execute} action implies the
+	 * {@code resolve} action.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	EXECUTE						= "execute";
+	public final static String						EXECUTE						= "execute";
 	/**
 	 * The action string {@code extensionLifecycle}.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	EXTENSIONLIFECYCLE			= "extensionLifecycle";
+	public final static String						EXTENSIONLIFECYCLE			= "extensionLifecycle";
 	/**
 	 * The action string {@code lifecycle}.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	LIFECYCLE					= "lifecycle";
+	public final static String						LIFECYCLE					= "lifecycle";
 	/**
 	 * The action string {@code listener}.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	LISTENER					= "listener";
+	public final static String						LISTENER					= "listener";
 	/**
 	 * The action string {@code metadata}.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	METADATA					= "metadata";
+	public final static String						METADATA					= "metadata";
 	/**
-	 * The action string {@code resolve}. The {@code resolve} action
-	 * is implied by the {@code class}, {@code execute} and
-	 * {@code resource} actions.
+	 * The action string {@code resolve}. The {@code resolve} action is implied
+	 * by the {@code class}, {@code execute} and {@code resource} actions.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	RESOLVE						= "resolve";
+	public final static String						RESOLVE						= "resolve";
 	/**
-	 * The action string {@code resource}. The {@code resource} action
-	 * implies the {@code resolve} action.
+	 * The action string {@code resource}. The {@code resource} action implies
+	 * the {@code resolve} action.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	RESOURCE					= "resource";
+	public final static String						RESOURCE					= "resource";
 	/**
 	 * The action string {@code startlevel}.
 	 * 
 	 * @since 1.3
 	 */
-	public final static String	STARTLEVEL					= "startlevel";
+	public final static String						STARTLEVEL					= "startlevel";
 
 	/**
 	 * The action string {@code context}.
 	 * 
 	 * @since 1.4
 	 */
-	public final static String	CONTEXT						= "context";
+	public final static String						CONTEXT						= "context";
 
 	/**
 	 * The action string {@code weave}.
@@ -169,52 +168,43 @@
 	 */
 	public final static String						WEAVE						= "weave";
 
-	private final static int	ACTION_CLASS				= 0x00000001;
-	private final static int	ACTION_EXECUTE				= 0x00000002;
-	private final static int	ACTION_LIFECYCLE			= 0x00000004;
-	private final static int	ACTION_LISTENER				= 0x00000008;
-	private final static int	ACTION_METADATA				= 0x00000010;
-	private final static int	ACTION_RESOLVE				= 0x00000040;
-	private final static int	ACTION_RESOURCE				= 0x00000080;
-	private final static int	ACTION_STARTLEVEL			= 0x00000100;
-	private final static int	ACTION_EXTENSIONLIFECYCLE	= 0x00000200;
-	private final static int	ACTION_CONTEXT				= 0x00000400;
+	private final static int						ACTION_CLASS				= 0x00000001;
+	private final static int						ACTION_EXECUTE				= 0x00000002;
+	private final static int						ACTION_LIFECYCLE			= 0x00000004;
+	private final static int						ACTION_LISTENER				= 0x00000008;
+	private final static int						ACTION_METADATA				= 0x00000010;
+	private final static int						ACTION_RESOLVE				= 0x00000040;
+	private final static int						ACTION_RESOURCE				= 0x00000080;
+	private final static int						ACTION_STARTLEVEL			= 0x00000100;
+	private final static int						ACTION_EXTENSIONLIFECYCLE	= 0x00000200;
+	private final static int						ACTION_CONTEXT				= 0x00000400;
 	private final static int						ACTION_WEAVE				= 0x00000800;
-	private final static int	ACTION_ALL					= ACTION_CLASS
-																	| ACTION_EXECUTE
-																	| ACTION_LIFECYCLE
-																	| ACTION_LISTENER
-																	| ACTION_METADATA
-																	| ACTION_RESOLVE
-																	| ACTION_RESOURCE
-																	| ACTION_STARTLEVEL
-																	| ACTION_EXTENSIONLIFECYCLE
-																						| ACTION_CONTEXT
-																						| ACTION_WEAVE;
-	final static int						ACTION_NONE					= 0;
+	private final static int						ACTION_ALL					= ACTION_CLASS | ACTION_EXECUTE | ACTION_LIFECYCLE | ACTION_LISTENER | ACTION_METADATA | ACTION_RESOLVE
+																						| ACTION_RESOURCE | ACTION_STARTLEVEL | ACTION_EXTENSIONLIFECYCLE | ACTION_CONTEXT | ACTION_WEAVE;
+	final static int								ACTION_NONE					= 0;
 
 	/**
 	 * The actions in canonical form.
 	 * 
 	 * @serial
 	 */
-	private volatile String		actions						= null;
+	private volatile String							actions						= null;
 
 	/**
 	 * The actions mask.
 	 */
-	transient int							action_mask;
+	transient int									action_mask;
 
 	/**
 	 * If this AdminPermission was constructed with a filter, this holds a
 	 * Filter matching object used to evaluate the filter in implies.
 	 */
-	transient Filter						filter;
+	transient Filter								filter;
 
 	/**
 	 * The bundle governed by this AdminPermission - only used if filter == null
 	 */
-	transient final Bundle					bundle;
+	transient final Bundle							bundle;
 
 	/**
 	 * This map holds the properties of the permission, used to match a filter
@@ -227,14 +217,14 @@
 	 * ThreadLocal used to determine if we have recursively called
 	 * getProperties.
 	 */
-	private static final ThreadLocal<Bundle>	recurse						= new ThreadLocal<Bundle>();
+	private static final ThreadLocal<Bundle>		recurse						= new ThreadLocal<Bundle>();
 
 	/**
-	 * Creates a new {@code AdminPermission} object that matches all
-	 * bundles and has all actions. Equivalent to AdminPermission("*","*");
+	 * Creates a new {@code AdminPermission} object that matches all bundles and
+	 * has all actions. Equivalent to AdminPermission("*","*");
 	 */
 	public AdminPermission() {
-		this(null, ACTION_ALL); 
+		this(null, ACTION_ALL);
 	}
 
 	/**
@@ -346,29 +336,27 @@
 		if ((actions == null) || actions.equals("*")) {
 			return ACTION_ALL;
 		}
-	
+
 		boolean seencomma = false;
-	
+
 		int mask = ACTION_NONE;
 
 		char[] a = actions.toCharArray();
-	
+
 		int i = a.length - 1;
 		if (i < 0)
 			return mask;
-	
+
 		while (i != -1) {
 			char c;
-	
+
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
-	
+
 			// check for the known strings
 			int matchlen;
-	
+
 			if (i >= 4 && (a[i - 4] == 'c' || a[i - 4] == 'C')
 					&& (a[i - 3] == 'l' || a[i - 3] == 'L')
 					&& (a[i - 2] == 'a' || a[i - 2] == 'A')
@@ -376,9 +364,8 @@
 					&& (a[i] == 's' || a[i] == 'S')) {
 				matchlen = 5;
 				mask |= ACTION_CLASS | ACTION_RESOLVE;
-	
-			}
-			else
+
+			} else
 				if (i >= 6 && (a[i - 6] == 'e' || a[i - 6] == 'E')
 						&& (a[i - 5] == 'x' || a[i - 5] == 'X')
 						&& (a[i - 4] == 'e' || a[i - 4] == 'E')
@@ -388,9 +375,8 @@
 						&& (a[i] == 'e' || a[i] == 'E')) {
 					matchlen = 7;
 					mask |= ACTION_EXECUTE | ACTION_RESOLVE;
-	
-				}
-				else
+
+				} else
 					if (i >= 17 && (a[i - 17] == 'e' || a[i - 17] == 'E')
 							&& (a[i - 16] == 'x' || a[i - 16] == 'X')
 							&& (a[i - 15] == 't' || a[i - 15] == 'T')
@@ -411,9 +397,8 @@
 							&& (a[i] == 'e' || a[i] == 'E')) {
 						matchlen = 18;
 						mask |= ACTION_EXTENSIONLIFECYCLE;
-	
-					}
-					else
+
+					} else
 						if (i >= 8 && (a[i - 8] == 'l' || a[i - 8] == 'L')
 								&& (a[i - 7] == 'i' || a[i - 7] == 'I')
 								&& (a[i - 6] == 'f' || a[i - 6] == 'F')
@@ -425,9 +410,8 @@
 								&& (a[i] == 'e' || a[i] == 'E')) {
 							matchlen = 9;
 							mask |= ACTION_LIFECYCLE;
-	
-						}
-						else
+
+						} else
 							if (i >= 7 && (a[i - 7] == 'l' || a[i - 7] == 'L')
 									&& (a[i - 6] == 'i' || a[i - 6] == 'I')
 									&& (a[i - 5] == 's' || a[i - 5] == 'S')
@@ -438,9 +422,8 @@
 									&& (a[i] == 'r' || a[i] == 'R')) {
 								matchlen = 8;
 								mask |= ACTION_LISTENER;
-	
-							}
-							else
+
+							} else
 								if (i >= 7
 										&& (a[i - 7] == 'm' || a[i - 7] == 'M')
 										&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -452,9 +435,8 @@
 										&& (a[i] == 'a' || a[i] == 'A')) {
 									matchlen = 8;
 									mask |= ACTION_METADATA;
-	
-								}
-								else
+
+								} else
 									if (i >= 6
 											&& (a[i - 6] == 'r' || a[i - 6] == 'R')
 											&& (a[i - 5] == 'e' || a[i - 5] == 'E')
@@ -465,9 +447,8 @@
 											&& (a[i] == 'e' || a[i] == 'E')) {
 										matchlen = 7;
 										mask |= ACTION_RESOLVE;
-	
-									}
-									else
+
+									} else
 										if (i >= 7
 												&& (a[i - 7] == 'r' || a[i - 7] == 'R')
 												&& (a[i - 6] == 'e' || a[i - 6] == 'E')
@@ -480,9 +461,8 @@
 											matchlen = 8;
 											mask |= ACTION_RESOURCE
 													| ACTION_RESOLVE;
-	
-										}
-										else
+
+										} else
 											if (i >= 9
 													&& (a[i - 9] == 's' || a[i - 9] == 'S')
 													&& (a[i - 8] == 't' || a[i - 8] == 'T')
@@ -496,9 +476,8 @@
 													&& (a[i] == 'l' || a[i] == 'L')) {
 												matchlen = 10;
 												mask |= ACTION_STARTLEVEL;
-	
-											}
-											else
+
+											} else
 												if (i >= 6
 														&& (a[i - 6] == 'c' || a[i - 6] == 'C')
 														&& (a[i - 5] == 'o' || a[i - 5] == 'O')
@@ -509,9 +488,8 @@
 														&& (a[i] == 't' || a[i] == 'T')) {
 													matchlen = 7;
 													mask |= ACTION_CONTEXT;
-	
-												}
-												else
+
+												} else
 													if (i >= 4
 															&& (a[i - 4] == 'w' || a[i - 4] == 'W')
 															&& (a[i - 3] == 'e' || a[i - 3] == 'E')
@@ -521,21 +499,16 @@
 														matchlen = 5;
 														mask |= ACTION_WEAVE;
 
-													}
-													else
-														if (i >= 0
-																&& (a[i] == '*')) {
+													} else
+														if (i >= 0 && (a[i] == '*')) {
 															matchlen = 1;
 															mask |= ACTION_ALL;
 
-														}
-														else {
+														} else {
 															// parse error
-															throw new IllegalArgumentException(
-																	"invalid permission: "
-																			+ actions);
+															throw new IllegalArgumentException("invalid permission: " + actions);
 														}
-	
+
 			// make sure we didn't just match the tail of a word
 			// like "ackbarfstartlevel". Also, skip to the comma.
 			seencomma = false;
@@ -551,21 +524,19 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions); 
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
-	
+
 			// point i at the location of the comma minus one (or -1).
 			i -= matchlen;
 		}
-	
+
 		if (seencomma) {
-			throw new IllegalArgumentException("invalid permission: " + 
-					actions);
+			throw new IllegalArgumentException("invalid permission: " + actions);
 		}
-	
+
 		return mask;
 	}
 
@@ -574,8 +545,8 @@
 	 * 
 	 * @param filterString The filter string to parse.
 	 * @return a Filter for this bundle. If the specified filterString is
-	 *         {@code null} or equals "*", then {@code null} is
-	 *         returned to indicate a wildcard.
+	 *         {@code null} or equals "*", then {@code null} is returned to
+	 *         indicate a wildcard.
 	 * @throws IllegalArgumentException If the filter syntax is invalid.
 	 */
 	private static Filter parseFilter(String filterString) {
@@ -586,13 +557,11 @@
 		if (filterString.equals("*")) {
 			return null;
 		}
-		
+
 		try {
 			return FrameworkUtil.createFilter(filterString);
-		}
-		catch (InvalidSyntaxException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid filter");
+		} catch (InvalidSyntaxException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
 			iae.initCause(e);
 			throw iae;
 		}
@@ -616,9 +585,9 @@
 	 * actions.
 	 * <p>
 	 * Special case: if the specified permission was constructed with "*"
-	 * filter, then this method returns {@code true} if this object's
-	 * filter is "*" and this object's actions include all of the specified
-	 * permission's actions
+	 * filter, then this method returns {@code true} if this object's filter is
+	 * "*" and this object's actions include all of the specified permission's
+	 * actions
 	 * 
 	 * @param p The requested permission.
 	 * @return {@code true} if the specified permission is implied by this
@@ -657,7 +626,7 @@
 		if ((effective & desired) != desired) {
 			return false;
 		}
-	
+
 		/* Get our filter */
 		Filter f = filter;
 		if (f == null) {
@@ -668,8 +637,7 @@
 		if (requested.bundle == null) {
 			return false;
 		}
-		Map<String, Object> requestedProperties = requested
-				.getProperties();
+		Map<String, Object> requestedProperties = requested.getProperties();
 		if (requestedProperties == null) {
 			/*
 			 * If the requested properties are null, then we have detected a
@@ -699,53 +667,53 @@
 		String result = actions;
 		if (result == null) {
 			StringBuffer sb = new StringBuffer();
-	
+
 			int mask = action_mask;
 			if ((mask & ACTION_CLASS) == ACTION_CLASS) {
 				sb.append(CLASS);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_EXECUTE) == ACTION_EXECUTE) {
 				sb.append(EXECUTE);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_EXTENSIONLIFECYCLE) == ACTION_EXTENSIONLIFECYCLE) {
 				sb.append(EXTENSIONLIFECYCLE);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_LIFECYCLE) == ACTION_LIFECYCLE) {
 				sb.append(LIFECYCLE);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_LISTENER) == ACTION_LISTENER) {
 				sb.append(LISTENER);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_METADATA) == ACTION_METADATA) {
 				sb.append(METADATA);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_RESOLVE) == ACTION_RESOLVE) {
 				sb.append(RESOLVE);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_RESOURCE) == ACTION_RESOURCE) {
 				sb.append(RESOURCE);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_STARTLEVEL) == ACTION_STARTLEVEL) {
 				sb.append(STARTLEVEL);
 				sb.append(',');
 			}
-	
+
 			if ((mask & ACTION_CONTEXT) == ACTION_CONTEXT) {
 				sb.append(CONTEXT);
 				sb.append(',');
@@ -755,20 +723,20 @@
 				sb.append(WEAVE);
 				sb.append(',');
 			}
-	
+
 			// remove trailing comma
 			if (sb.length() > 0) {
 				sb.setLength(sb.length() - 1);
 			}
-	
+
 			actions = result = sb.toString();
 		}
 		return result;
 	}
 
 	/**
-	 * Returns a new {@code PermissionCollection} object suitable for
-	 * storing {@code AdminPermission}s.
+	 * Returns a new {@code PermissionCollection} object suitable for storing
+	 * {@code AdminPermission}s.
 	 * 
 	 * @return A new {@code PermissionCollection} object.
 	 */
@@ -794,11 +762,7 @@
 
 		AdminPermission ap = (AdminPermission) obj;
 
-		return (action_mask == ap.action_mask)
-				&& ((bundle == ap.bundle) || ((bundle != null) && bundle
-						.equals(ap.bundle)))
-				&& (filter == null ? ap.filter == null : filter
-						.equals(ap.filter));
+		return (action_mask == ap.action_mask) && ((bundle == ap.bundle) || ((bundle != null) && bundle.equals(ap.bundle))) && (filter == null ? ap.filter == null : filter.equals(ap.filter));
 	}
 
 	/**
@@ -820,8 +784,7 @@
 	 * stream. The actions are serialized, and the superclass takes care of the
 	 * name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		if (bundle != null) {
 			throw new NotSerializableException("cannot serialize");
 		}
@@ -836,8 +799,7 @@
 	 * readObject is called to restore the state of this permission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the data, then initialize the transients
 		s.defaultReadObject();
 		setTransients(parseFilter(getName()), parseActions(actions));
@@ -870,8 +832,7 @@
 		}
 		recurse.set(bundle);
 		try {
-			final Map<String, Object> map = new HashMap<String, Object>(
-					4);
+			final Map<String, Object> map = new HashMap<String, Object>(4);
 			AccessController.doPrivileged(new PrivilegedAction<Object>() {
 				public Object run() {
 					map.put("id", new Long(bundle.getBundleId()));
@@ -888,8 +849,7 @@
 				}
 			});
 			return properties = map;
-		}
-		finally {
+		} finally {
 			recurse.set(null);
 		}
 	}
@@ -899,7 +859,7 @@
  * Stores a collection of {@code AdminPermission}s.
  */
 final class AdminPermissionCollection extends PermissionCollection {
-	private static final long	serialVersionUID	= 3906372644575328048L;
+	private static final long						serialVersionUID	= 3906372644575328048L;
 	/**
 	 * Collection of permissions.
 	 * 
@@ -913,7 +873,7 @@
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private boolean				all_allowed;
+	private boolean									all_allowed;
 
 	/**
 	 * Create an empty AdminPermissions object.
@@ -928,24 +888,21 @@
 	 * 
 	 * @param permission The {@code AdminPermission} object to add.
 	 * @throws IllegalArgumentException If the specified permission is not an
-	 *         {@code AdminPermission} instance or was constructed with a
-	 *         Bundle object.
+	 *         {@code AdminPermission} instance or was constructed with a Bundle
+	 *         object.
 	 * @throws SecurityException If this {@code AdminPermissionCollection}
 	 *         object has been marked read-only.
 	 */
 	public void add(Permission permission) {
 		if (!(permission instanceof AdminPermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection"); 
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 		final AdminPermission ap = (AdminPermission) permission;
 		if (ap.bundle != null) {
-			throw new IllegalArgumentException("cannot add to collection: "
-					+ ap);
+			throw new IllegalArgumentException("cannot add to collection: " + ap);
 		}
 		final String name = ap.getName();
 		synchronized (this) {
@@ -956,11 +913,9 @@
 				int newMask = ap.action_mask;
 
 				if (oldMask != newMask) {
-					pc.put(name, new AdminPermission(existing.filter, oldMask
-							| newMask));
+					pc.put(name, new AdminPermission(existing.filter, oldMask | newMask));
 				}
-			}
-			else {
+			} else {
 				pc.put(name, ap);
 			}
 			if (!all_allowed) {
@@ -978,8 +933,8 @@
 	 * @param permission The Permission object to compare with the
 	 *        {@code AdminPermission} objects in this collection.
 	 * @return {@code true} if {@code permission} is implied by an
-	 *         {@code AdminPermission} in this collection,
-	 *         {@code false} otherwise.
+	 *         {@code AdminPermission} in this collection, {@code false}
+	 *         otherwise.
 	 */
 	public boolean implies(Permission permission) {
 		if (!(permission instanceof AdminPermission)) {
@@ -1028,28 +983,21 @@
 		List<Permission> all = new ArrayList<Permission>(permissions.values());
 		return Collections.enumeration(all);
 	}
-	
+
 	/* serialization logic */
-    private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", Hashtable.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE)			};
-    
-    private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
-		Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(
-				permissions);
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
+
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+		Hashtable<String, AdminPermission> hashtable = new Hashtable<String, AdminPermission>(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", hashtable);
 		pfields.put("all_allowed", all_allowed);
 		out.writeFields();
 	}
-    
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException,
-			ClassNotFoundException {
+
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields
-				.get("permissions", null);
+		Hashtable<String, AdminPermission> hashtable = (Hashtable<String, AdminPermission>) gfields.get("permissions", null);
 		permissions = new HashMap<String, AdminPermission>(hashtable);
 		all_allowed = gfields.get("all_allowed", false);
 	}
diff --git a/framework/src/main/java/org/osgi/framework/AllServiceListener.java b/framework/src/main/java/org/osgi/framework/AllServiceListener.java
index 9874a4b..71e27cd 100644
--- a/framework/src/main/java/org/osgi/framework/AllServiceListener.java
+++ b/framework/src/main/java/org/osgi/framework/AllServiceListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2005, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,45 +17,42 @@
 package org.osgi.framework;
 
 /**
- * A {@code ServiceEvent} listener that does not filter based upon
- * package wiring. {@code AllServiceListener} is a listener interface
- * that may be implemented by a bundle developer. When a
- * {@code ServiceEvent} is fired, it is synchronously delivered to an
- * {@code AllServiceListener}. The Framework may deliver
- * {@code ServiceEvent} objects to an {@code AllServiceListener}
- * out of order and may concurrently call and/or reenter an
+ * A {@code ServiceEvent} listener that does not filter based upon package
+ * wiring. {@code AllServiceListener} is a listener interface that may be
+ * implemented by a bundle developer. When a {@code ServiceEvent} is fired, it
+ * is synchronously delivered to an {@code AllServiceListener}. The Framework
+ * may deliver {@code ServiceEvent} objects to an {@code AllServiceListener} out
+ * of order and may concurrently call and/or reenter an
  * {@code AllServiceListener}.
  * <p>
- * An {@code AllServiceListener} object is registered with the Framework
- * using the {@code BundleContext.addServiceListener} method.
- * {@code AllServiceListener} objects are called with a
- * {@code ServiceEvent} object when a service is registered, modified, or
- * is in the process of unregistering.
+ * An {@code AllServiceListener} object is registered with the Framework using
+ * the {@code BundleContext.addServiceListener} method.
+ * {@code AllServiceListener} objects are called with a {@code ServiceEvent}
+ * object when a service is registered, modified, or is in the process of
+ * unregistering.
  * 
  * <p>
- * {@code ServiceEvent} object delivery to
- * {@code AllServiceListener} objects is filtered by the filter specified
- * when the listener was registered. If the Java Runtime Environment supports
- * permissions, then additional filtering is done. {@code ServiceEvent}
- * objects are only delivered to the listener if the bundle which defines the
- * listener object's class has the appropriate {@code ServicePermission}
- * to get the service using at least one of the named classes under which the
- * service was registered.
+ * {@code ServiceEvent} object delivery to {@code AllServiceListener} objects is
+ * filtered by the filter specified when the listener was registered. If the
+ * Java Runtime Environment supports permissions, then additional filtering is
+ * done. {@code ServiceEvent} objects are only delivered to the listener if the
+ * bundle which defines the listener object's class has the appropriate
+ * {@code ServicePermission} to get the service using at least one of the named
+ * classes under which the service was registered.
  * 
  * <p>
- * Unlike normal {@code ServiceListener} objects,
- * {@code AllServiceListener} objects receive all
- * {@code ServiceEvent} objects regardless of whether the package source
- * of the listening bundle is equal to the package source of the bundle that
- * registered the service. This means that the listener may not be able to cast
- * the service object to any of its corresponding service interfaces if the
- * service object is retrieved.
+ * Unlike normal {@code ServiceListener} objects, {@code AllServiceListener}
+ * objects receive all {@code ServiceEvent} objects regardless of whether the
+ * package source of the listening bundle is equal to the package source of the
+ * bundle that registered the service. This means that the listener may not be
+ * able to cast the service object to any of its corresponding service
+ * interfaces if the service object is retrieved.
  * 
  * @see ServiceEvent
  * @see ServicePermission
  * @ThreadSafe
  * @since 1.3
- * @version $Id: 35cee8a49e89b7b222aa3f85e1af0b4a4b550ce6 $
+ * @version $Id: 7a0c82db414be7064a06e1868eb41a8c8f8d9d6c $
  */
 
 public interface AllServiceListener extends ServiceListener {
diff --git a/framework/src/main/java/org/osgi/framework/Bundle.java b/framework/src/main/java/org/osgi/framework/Bundle.java
index 8f4002c..d814e9a 100644
--- a/framework/src/main/java/org/osgi/framework/Bundle.java
+++ b/framework/src/main/java/org/osgi/framework/Bundle.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2000, 2012). 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
@@ -25,7 +25,6 @@
 import java.util.Enumeration;
 import java.util.List;
 import java.util.Map;
-
 import org.osgi.framework.wiring.FrameworkWiring;
 
 /**
@@ -59,9 +58,9 @@
  * 
  * <p>
  * A bundle should only have active threads of execution when its state is one
- * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An {@code
- * UNINSTALLED} bundle can not be set to another state; it is a zombie and can
- * only be reached because references are kept somewhere.
+ * of {@code STARTING},{@code ACTIVE}, or {@code STOPPING}. An
+ * {@code UNINSTALLED} bundle can not be set to another state; it is a zombie
+ * and can only be reached because references are kept somewhere.
  * 
  * <p>
  * The Framework is the only entity that is allowed to create {@code Bundle}
@@ -76,7 +75,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 239108e8d54ff493587b9cdfe1688bdefc5a714c $
+ * @version $Id: 8a58ab72af389b1999b88348e4944203b7096510 $
  */
 public interface Bundle extends Comparable<Bundle> {
 	/**
@@ -139,9 +138,9 @@
 	 * <p>
 	 * A bundle is in the {@code STARTING} state when its {@link #start(int)
 	 * start} method is active. A bundle must be in this state when the bundle's
-	 * {@link BundleActivator#start} is called. If the {@code
-	 * BundleActivator.start} method completes without exception, then the
-	 * bundle has successfully started and must move to the {@code ACTIVE}
+	 * {@link BundleActivator#start(BundleContext)} is called. If the
+	 * {@code BundleActivator.start} method completes without exception, then
+	 * the bundle has successfully started and must move to the {@code ACTIVE}
 	 * state.
 	 * <p>
 	 * If the bundle has a {@link Constants#ACTIVATION_LAZY lazy activation
@@ -158,9 +157,9 @@
 	 * <p>
 	 * A bundle is in the {@code STOPPING} state when its {@link #stop(int)
 	 * stop} method is active. A bundle must be in this state when the bundle's
-	 * {@link BundleActivator#stop} method is called. When the {@code
-	 * BundleActivator.stop} method completes the bundle is stopped and must
-	 * move to the {@code RESOLVED} state.
+	 * {@link BundleActivator#stop(BundleContext)} method is called. When the
+	 * {@code BundleActivator.stop} method completes the bundle is stopped and
+	 * must move to the {@code RESOLVED} state.
 	 * <p>
 	 * The value of {@code STOPPING} is 0x00000010.
 	 */
@@ -312,8 +311,8 @@
 	 * 
 	 * <li>A bundle event of type {@link BundleEvent#STARTING} is fired.
 	 * 
-	 * <li>The {@link BundleActivator#start} method of this bundle's
-	 * {@code BundleActivator}, if one is specified, is called. If the
+	 * <li>The {@link BundleActivator#start(BundleContext)} method of this
+	 * bundle's {@code BundleActivator}, if one is specified, is called. If the
 	 * {@code BundleActivator} is invalid or throws an exception then:
 	 * <ul>
 	 * <li>This bundle's state is set to {@code STOPPING}.
@@ -425,11 +424,11 @@
 	 * <li>A bundle event of type {@link BundleEvent#STOPPING} is fired.
 	 * 
 	 * <li>If this bundle's state was {@code ACTIVE} prior to setting the state
-	 * to {@code STOPPING}, the {@link BundleActivator#stop} method of this
-	 * bundle's {@code BundleActivator}, if one is specified, is called. If that
-	 * method throws an exception, this method must continue to stop this bundle
-	 * and a {@code BundleException} must be thrown after completion of the
-	 * remaining steps.
+	 * to {@code STOPPING}, the {@link BundleActivator#stop(BundleContext)}
+	 * method of this bundle's {@code BundleActivator}, if one is specified, is
+	 * called. If that method throws an exception, this method must continue to
+	 * stop this bundle and a {@code BundleException} must be thrown after
+	 * completion of the remaining steps.
 	 * 
 	 * <li>Any services registered by this bundle must be unregistered.
 	 * <li>Any services used by this bundle must be released.
@@ -748,10 +747,10 @@
 	 * Returns this bundle's location identifier.
 	 * 
 	 * <p>
-	 * The location identifier is the location passed to {@code
-	 * BundleContext.installBundle} when a bundle is installed. The location
-	 * identifier does not change while this bundle remains installed, even if
-	 * this bundle is updated.
+	 * The location identifier is the location passed to
+	 * {@code BundleContext.installBundle} when a bundle is installed. The
+	 * location identifier does not change while this bundle remains installed,
+	 * even if this bundle is updated.
 	 * 
 	 * <p>
 	 * This method must continue to return this bundle's location identifier
@@ -785,7 +784,7 @@
 	 * @see ServiceReference
 	 * @see ServicePermission
 	 */
-	ServiceReference< ? >[] getRegisteredServices();
+	ServiceReference<?>[] getRegisteredServices();
 
 	/**
 	 * Returns this bundle's {@code ServiceReference} list for all services it
@@ -794,10 +793,11 @@
 	 * for that service is greater than zero.
 	 * 
 	 * <p>
-	 * If the Java Runtime Environment supports permissions, a {@code
-	 * ServiceReference} object to a service is included in the returned list
-	 * only if the caller has the {@code ServicePermission} to get the service
-	 * using at least one of the named classes the service was registered under.
+	 * If the Java Runtime Environment supports permissions, a
+	 * {@code ServiceReference} object to a service is included in the returned
+	 * list only if the caller has the {@code ServicePermission} to get the
+	 * service using at least one of the named classes the service was
+	 * registered under.
 	 * <p>
 	 * The list is valid at the time of the call to this method, however, as the
 	 * Framework is a very dynamic environment, services can be modified or
@@ -808,7 +808,7 @@
 	 * @see ServiceReference
 	 * @see ServicePermission
 	 */
-	ServiceReference< ? >[] getServicesInUse();
+	ServiceReference<?>[] getServicesInUse();
 
 	/**
 	 * Determines if this bundle has the specified permissions.
@@ -832,8 +832,8 @@
 	 * @return {@code true} if this bundle has the specified permission or the
 	 *         permissions possessed by this bundle imply the specified
 	 *         permission; {@code false} if this bundle does not have the
-	 *         specified permission or {@code permission} is not an {@code
-	 *         instanceof} {@code java.security.Permission}.
+	 *         specified permission or {@code permission} is not an
+	 *         {@code instanceof} {@code java.security.Permission}.
 	 * @throws IllegalStateException If this bundle has been uninstalled.
 	 */
 	boolean hasPermission(Object permission);
@@ -857,12 +857,12 @@
 	 *        for a description of the format of a resource name.
 	 * @return A URL to the named resource, or {@code null} if the resource
 	 *         could not be found or if this bundle is a fragment bundle or if
-	 *         the caller does not have the appropriate {@code
-	 *         AdminPermission[this,RESOURCE]}, and the Java Runtime Environment
-	 *         supports permissions.
+	 *         the caller does not have the appropriate
+	 *         {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
+	 *         Environment supports permissions.
 	 * @throws IllegalStateException If this bundle has been uninstalled.
-	 * @see #getEntry
-	 * @see #findEntries
+	 * @see #getEntry(String)
+	 * @see #findEntries(String, String, boolean)
 	 * @since 1.1
 	 */
 	URL getResource(String name);
@@ -926,10 +926,10 @@
 	Dictionary<String, String> getHeaders(String locale);
 
 	/**
-	 * Returns the symbolic name of this bundle as specified by its {@code
-	 * Bundle-SymbolicName} manifest header. The bundle symbolic name should be
-	 * based on the reverse domain name naming convention like that used for
-	 * java packages.
+	 * Returns the symbolic name of this bundle as specified by its
+	 * {@code Bundle-SymbolicName} manifest header. The bundle symbolic name
+	 * should be based on the reverse domain name naming convention like that
+	 * used for java packages.
 	 * 
 	 * <p>
 	 * This method must continue to return this bundle's symbolic name while
@@ -945,8 +945,8 @@
 	 * Loads the specified class using this bundle's class loader.
 	 * 
 	 * <p>
-	 * If this bundle is a fragment bundle then this method must throw a {@code
-	 * ClassNotFoundException}.
+	 * If this bundle is a fragment bundle then this method must throw a
+	 * {@code ClassNotFoundException}.
 	 * 
 	 * <p>
 	 * If this bundle's state is {@code INSTALLED}, this method must attempt to
@@ -954,13 +954,13 @@
 	 * 
 	 * <p>
 	 * If this bundle cannot be resolved, a Framework event of type
-	 * {@link FrameworkEvent#ERROR} is fired containing a {@code
-	 * BundleException} with details of the reason this bundle could not be
-	 * resolved. This method must then throw a {@code ClassNotFoundException}.
+	 * {@link FrameworkEvent#ERROR} is fired containing a
+	 * {@code BundleException} with details of the reason this bundle could not
+	 * be resolved. This method must then throw a {@code ClassNotFoundException}.
 	 * 
 	 * <p>
-	 * If this bundle's state is {@code UNINSTALLED}, then an {@code
-	 * IllegalStateException} is thrown.
+	 * If this bundle's state is {@code UNINSTALLED}, then an
+	 * {@code IllegalStateException} is thrown.
 	 * 
 	 * @param name The name of the class to load.
 	 * @return The Class object for the requested class.
@@ -971,7 +971,7 @@
 	 * @throws IllegalStateException If this bundle has been uninstalled.
 	 * @since 1.3
 	 */
-	Class< ? > loadClass(String name) throws ClassNotFoundException;
+	Class<?> loadClass(String name) throws ClassNotFoundException;
 
 	/**
 	 * Find the specified resources from this bundle's class loader.
@@ -988,14 +988,14 @@
 	 * URLs to directory entries will not be returned if the bundle contents do
 	 * not contain directory entries.
 	 * 
-	 * @param name The name of the resource. See {@code
-	 *        ClassLoader.getResources} for a description of the format of a
-	 *        resource name.
+	 * @param name The name of the resource. See
+	 *        {@code ClassLoader.getResources} for a description of the format
+	 *        of a resource name.
 	 * @return An enumeration of URLs to the named resources, or {@code null} if
 	 *         the resource could not be found or if this bundle is a fragment
-	 *         bundle or if the caller does not have the appropriate {@code
-	 *         AdminPermission[this,RESOURCE]}, and the Java Runtime Environment
-	 *         supports permissions.
+	 *         bundle or if the caller does not have the appropriate
+	 *         {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
+	 *         Environment supports permissions.
 	 * @throws IllegalStateException If this bundle has been uninstalled.
 	 * @throws IOException If there is an I/O error.
 	 * @since 1.3
@@ -1045,9 +1045,9 @@
 	 * 
 	 * @param path The path name of the entry.
 	 * @return A URL to the entry, or {@code null} if no entry could be found or
-	 *         if the caller does not have the appropriate {@code
-	 *         AdminPermission[this,RESOURCE]} and the Java Runtime Environment
-	 *         supports permissions.
+	 *         if the caller does not have the appropriate
+	 *         {@code AdminPermission[this,RESOURCE]} and the Java Runtime
+	 *         Environment supports permissions.
 	 * @throws IllegalStateException If this bundle has been uninstalled.
 	 * @since 1.3
 	 */
@@ -1059,7 +1059,7 @@
 	 * 
 	 * <p>
 	 * The time value is the number of milliseconds since January 1, 1970,
-	 * 00:00:00 GMT.
+	 * 00:00:00 UTC.
 	 * 
 	 * @return The time when this bundle was last modified.
 	 * @since 1.3
@@ -1078,7 +1078,7 @@
 	 * This method is intended to be used to obtain configuration, setup,
 	 * localization and other information from this bundle. This method takes
 	 * into account that the &quot;contents&quot; of this bundle can be extended
-	 * with fragments. This &quot;bundle space&quot; is not a name space with
+	 * with fragments. This &quot;bundle space&quot; is not a namespace with
 	 * unique members; the same entry name can be present multiple times. This
 	 * method therefore returns an enumeration of URL objects. These URLs can
 	 * come from different JARs but have the same path name. This method can
@@ -1096,13 +1096,15 @@
 	 * Enumeration e = b.findEntries(&quot;OSGI-INF&quot;, &quot;*.xml&quot;, true);
 	 * 
 	 * // Find a specific localization file
-	 * Enumeration e = b
-	 * 		.findEntries(&quot;OSGI-INF/l10n&quot;, &quot;bundle_nl_DU.properties&quot;, false);
+	 * Enumeration e = b.findEntries(&quot;OSGI-INF/l10n&quot;,
+	 *     &quot;bundle_nl_DU.properties&quot;, false);
 	 * if (e.hasMoreElements())
-	 * 	return (URL) e.nextElement();
+	 *     return (URL) e.nextElement();
 	 * </pre>
 	 * 
 	 * <p>
+	 * URLs for directory entries must have their path end with &quot;/&quot;.
+	 * <p>
 	 * Note: Jar and zip files are not required to include directory entries.
 	 * URLs to directory entries will not be returned if the bundle contents do
 	 * not contain directory entries.
@@ -1121,8 +1123,8 @@
 	 * @param recurse If {@code true}, recurse into subdirectories. Otherwise
 	 *        only return entries from the specified path.
 	 * @return An enumeration of URL objects for each matching entry, or
-	 *         {@code null} if no matching entry could not be found or if the
-	 *         caller does not have the appropriate
+	 *         {@code null} if no matching entry could be found or if the caller
+	 *         does not have the appropriate
 	 *         {@code AdminPermission[this,RESOURCE]}, and the Java Runtime
 	 *         Environment supports permissions. The URLs are sorted such that
 	 *         entries from this bundle are returned first followed by the
@@ -1132,12 +1134,12 @@
 	 * @throws IllegalStateException If this bundle has been uninstalled.
 	 * @since 1.3
 	 */
-	Enumeration<URL> findEntries(String path, String filePattern,
-			boolean recurse);
+	Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
 
 	/**
-	 * Returns this bundle's {@link BundleContext}. The returned {@code
-	 * BundleContext} can be used by the caller to act on behalf of this bundle.
+	 * Returns this bundle's {@link BundleContext}. The returned
+	 * {@code BundleContext} can be used by the caller to act on behalf of this
+	 * bundle.
 	 * 
 	 * <p>
 	 * If this bundle is not in the {@link #STARTING}, {@link #ACTIVE}, or
@@ -1176,13 +1178,12 @@
 	 *         not {@link #SIGNERS_ALL} or {@link #SIGNERS_TRUSTED}.
 	 * @since 1.5
 	 */
-	Map<X509Certificate, List<X509Certificate>> getSignerCertificates(
-			int signersType);
+	Map<X509Certificate, List<X509Certificate>> getSignerCertificates(int signersType);
 
 	/**
-	 * Returns the version of this bundle as specified by its {@code
-	 * Bundle-Version} manifest header. If this bundle does not have a specified
-	 * version then {@link Version#emptyVersion} is returned.
+	 * Returns the version of this bundle as specified by its
+	 * {@code Bundle-Version} manifest header. If this bundle does not have a
+	 * specified version then {@link Version#emptyVersion} is returned.
 	 * 
 	 * <p>
 	 * This method must continue to return this bundle's version while this
diff --git a/framework/src/main/java/org/osgi/framework/BundleActivator.java b/framework/src/main/java/org/osgi/framework/BundleActivator.java
index aefb036..acdb825 100644
--- a/framework/src/main/java/org/osgi/framework/BundleActivator.java
+++ b/framework/src/main/java/org/osgi/framework/BundleActivator.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,20 +19,19 @@
 /**
  * Customizes the starting and stopping of a bundle.
  * <p>
- * {@code BundleActivator} is an interface that may be implemented when a
- * bundle is started or stopped. The Framework can create instances of a
- * bundle's {@code BundleActivator} as required. If an instance's
- * {@code BundleActivator.start} method executes successfully, it is
- * guaranteed that the same instance's {@code BundleActivator.stop}
- * method will be called when the bundle is to be stopped. The Framework must
- * not concurrently call a {@code BundleActivator} object.
+ * {@code BundleActivator} is an interface that may be implemented when a bundle
+ * is started or stopped. The Framework can create instances of a bundle's
+ * {@code BundleActivator} as required. If an instance's
+ * {@code BundleActivator.start} method executes successfully, it is guaranteed
+ * that the same instance's {@code BundleActivator.stop} method will be called
+ * when the bundle is to be stopped. The Framework must not concurrently call a
+ * {@code BundleActivator} object.
  * 
  * <p>
- * {@code BundleActivator} is specified through the
- * {@code Bundle-Activator} Manifest header. A bundle can only specify a
- * single {@code BundleActivator} in the Manifest file. Fragment bundles
- * must not have a {@code BundleActivator}. The form of the Manifest
- * header is:
+ * {@code BundleActivator} is specified through the {@code Bundle-Activator}
+ * Manifest header. A bundle can only specify a single {@code BundleActivator}
+ * in the Manifest file. Fragment bundles must not have a
+ * {@code BundleActivator}. The form of the Manifest header is:
  * 
  * <p>
  * {@code Bundle-Activator: <i>class-name</i>}
@@ -40,12 +39,12 @@
  * <p>
  * where {@code <i>class-name</i>} is a fully qualified Java classname.
  * <p>
- * The specified {@code BundleActivator} class must have a public
- * constructor that takes no parameters so that a {@code BundleActivator}
- * object can be created by {@code Class.newInstance()}.
+ * The specified {@code BundleActivator} class must have a public constructor
+ * that takes no parameters so that a {@code BundleActivator} object can be
+ * created by {@code Class.newInstance()}.
  * 
  * @NotThreadSafe
- * @version $Id: 1b73057bd270ab07f0a16430dba16e5132eea24f $
+ * @version $Id: f5b2debe0064ab60669102d0a087feaeab13dc0e $
  */
 
 public interface BundleActivator {
@@ -59,29 +58,29 @@
 	 * This method must complete and return to its caller in a timely manner.
 	 * 
 	 * @param context The execution context of the bundle being started.
-	 * @throws Exception If this method throws an exception, this
-	 *         bundle is marked as stopped and the Framework will remove this
-	 *         bundle's listeners, unregister all services registered by this
-	 *         bundle, and release all services used by this bundle.
+	 * @throws Exception If this method throws an exception, this bundle is
+	 *         marked as stopped and the Framework will remove this bundle's
+	 *         listeners, unregister all services registered by this bundle, and
+	 *         release all services used by this bundle.
 	 */
 	public void start(BundleContext context) throws Exception;
 
 	/**
 	 * Called when this bundle is stopped so the Framework can perform the
 	 * bundle-specific activities necessary to stop the bundle. In general, this
-	 * method should undo the work that the {@code BundleActivator.start}
-	 * method started. There should be no active threads that were started by
-	 * this bundle when this bundle returns. A stopped bundle must not call any
+	 * method should undo the work that the {@code BundleActivator.start} method
+	 * started. There should be no active threads that were started by this
+	 * bundle when this bundle returns. A stopped bundle must not call any
 	 * Framework objects.
 	 * 
 	 * <p>
 	 * This method must complete and return to its caller in a timely manner.
 	 * 
 	 * @param context The execution context of the bundle being stopped.
-	 * @throws Exception If this method throws an exception, the
-	 *         bundle is still marked as stopped, and the Framework will remove
-	 *         the bundle's listeners, unregister all services registered by the
-	 *         bundle, and release all services used by the bundle.
+	 * @throws Exception If this method throws an exception, the bundle is still
+	 *         marked as stopped, and the Framework will remove the bundle's
+	 *         listeners, unregister all services registered by the bundle, and
+	 *         release all services used by the bundle.
 	 */
 	public void stop(BundleContext context) throws Exception;
 }
diff --git a/framework/src/main/java/org/osgi/framework/BundleContext.java b/framework/src/main/java/org/osgi/framework/BundleContext.java
index c587d03..71c3b92 100644
--- a/framework/src/main/java/org/osgi/framework/BundleContext.java
+++ b/framework/src/main/java/org/osgi/framework/BundleContext.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -47,11 +47,11 @@
  * 
  * <p>
  * The {@code BundleContext} object will be passed to the
- * {@link BundleActivator#start} method during activation of the context bundle.
- * The same {@code BundleContext} object will be passed to the
- * {@link BundleActivator#stop} method when the context bundle is stopped. A
- * {@code BundleContext} object is generally for the private use of its
- * associated bundle and is not meant to be shared with other bundles in the
+ * {@link BundleActivator#start(BundleContext)} method during activation of the
+ * context bundle. The same {@code BundleContext} object will be passed to the
+ * {@link BundleActivator#stop(BundleContext)} method when the context bundle is
+ * stopped. A {@code BundleContext} object is generally for the private use of
+ * its associated bundle and is not meant to be shared with other bundles in the
  * OSGi environment.
  * 
  * <p>
@@ -76,7 +76,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 6d4b5967b9fe706b1dfbdd42b3d759028ed9826d $
+ * @version $Id: 4f166fd274f3965e48a7dbc239213d00e062b6d0 $
  */
 
 public interface BundleContext extends BundleReference {
@@ -175,8 +175,7 @@
 	 *         Runtime Environment supports permissions.
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 */
-	Bundle installBundle(String location, InputStream input)
-			throws BundleException;
+	Bundle installBundle(String location, InputStream input) throws BundleException;
 
 	/**
 	 * Installs a bundle from the specified {@code location} identifier.
@@ -270,8 +269,7 @@
 	 * @see ServiceListener
 	 * @see ServicePermission
 	 */
-	void addServiceListener(ServiceListener listener, String filter)
-			throws InvalidSyntaxException;
+	void addServiceListener(ServiceListener listener, String filter) throws InvalidSyntaxException;
 
 	/**
 	 * Adds the specified {@code ServiceListener} object to the context bundle's
@@ -374,8 +372,11 @@
 	 * {@code ServiceRegistration} object is for the private use of the bundle
 	 * registering the service and should not be shared with other bundles. The
 	 * registering bundle is defined to be the context bundle. Other bundles can
-	 * locate the service by using either the {@link #getServiceReferences} or
-	 * {@link #getServiceReference} method.
+	 * locate the service by using one of the
+	 * {@link #getServiceReferences(Class, String)},
+	 * {@link #getServiceReferences(String, String)},
+	 * {@link #getServiceReference(Class)} or
+	 * {@link #getServiceReference(String)} methods.
 	 * 
 	 * <p>
 	 * A bundle can register a service object that implements the
@@ -413,9 +414,9 @@
 	 *        {@link Constants} for a list of standard service property keys.
 	 *        Changes should not be made to this object after calling this
 	 *        method. To update the service's properties the
-	 *        {@link ServiceRegistration#setProperties} method must be called.
-	 *        The set of properties may be {@code null} if the service has no
-	 *        properties.
+	 *        {@link ServiceRegistration#setProperties(Dictionary)} method must
+	 *        be called. The set of properties may be {@code null} if the
+	 *        service has no properties.
 	 * @return A {@code ServiceRegistration} object for use by the bundle
 	 *         registering the service to update the service's properties or to
 	 *         unregister the service.
@@ -434,8 +435,7 @@
 	 * @see ServiceRegistration
 	 * @see ServiceFactory
 	 */
-	ServiceRegistration< ? > registerService(String[] clazzes, Object service,
-			Dictionary<String, ? > properties);
+	ServiceRegistration<?> registerService(String[] clazzes, Object service, Dictionary<String, ?> properties);
 
 	/**
 	 * Registers the specified service object with the specified properties
@@ -458,34 +458,29 @@
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 * @see #registerService(String[], Object, Dictionary)
 	 */
-	ServiceRegistration< ? > registerService(String clazz, Object service,
-			Dictionary<String, ? > properties);
+	ServiceRegistration<?> registerService(String clazz, Object service, Dictionary<String, ?> properties);
 
 	/**
 	 * Registers the specified service object with the specified properties
-	 * under the specified class name with the Framework.
+	 * under the name of the specified class with the Framework.
 	 * 
 	 * <p>
 	 * This method is otherwise identical to
-	 * {@link #registerService(String[], Object, Dictionary)} and is provided as
-	 * a convenience when {@code service} will only be registered under a single
-	 * class name. Note that even in this case the value of the service's
-	 * {@link Constants#OBJECTCLASS} property will be an array of string, rather
-	 * than just a single string.
+	 * {@link #registerService(String, Object, Dictionary)} and is provided to
+	 * return a type safe {@code ServiceRegistration}.
 	 * 
 	 * @param <S> Type of Service.
-	 * @param clazz The class name under which the service can be located.
+	 * @param clazz The class under whose name the service can be located.
 	 * @param service The service object or a {@code ServiceFactory} object.
 	 * @param properties The properties for this service.
 	 * @return A {@code ServiceRegistration} object for use by the bundle
 	 *         registering the service to update the service's properties or to
 	 *         unregister the service.
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
-	 * @see #registerService(String[], Object, Dictionary)
+	 * @see #registerService(String, Object, Dictionary)
 	 * @since 1.6
 	 */
-	<S> ServiceRegistration<S> registerService(Class<S> clazz, S service,
-			Dictionary<String, ? > properties);
+	<S> ServiceRegistration<S> registerService(Class<S> clazz, S service, Dictionary<String, ?> properties);
 
 	/**
 	 * Returns an array of {@code ServiceReference} objects. The returned array
@@ -539,8 +534,7 @@
 	 *         an invalid filter expression that cannot be parsed.
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 */
-	ServiceReference< ? >[] getServiceReferences(String clazz, String filter)
-			throws InvalidSyntaxException;
+	ServiceReference<?>[] getServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
 
 	/**
 	 * Returns an array of {@code ServiceReference} objects. The returned array
@@ -589,8 +583,7 @@
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 * @since 1.3
 	 */
-	ServiceReference< ? >[] getAllServiceReferences(String clazz, String filter)
-			throws InvalidSyntaxException;
+	ServiceReference<?>[] getAllServiceReferences(String clazz, String filter) throws InvalidSyntaxException;
 
 	/**
 	 * Returns a {@code ServiceReference} object for a service that implements
@@ -623,11 +616,11 @@
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 * @see #getServiceReferences(String, String)
 	 */
-	ServiceReference< ? > getServiceReference(String clazz);
+	ServiceReference<?> getServiceReference(String clazz);
 
 	/**
 	 * Returns a {@code ServiceReference} object for a service that implements
-	 * and was registered under the specified class.
+	 * and was registered under the name of the specified class.
 	 * 
 	 * <p>
 	 * The returned {@code ServiceReference} object is valid at the time of the
@@ -648,9 +641,10 @@
 	 * service that was registered first is returned.
 	 * 
 	 * @param <S> Type of Service.
-	 * @param clazz The class name with which the service was registered.
+	 * @param clazz The class under whose name the service was registered. Must
+	 *        not be {@code null}.
 	 * @return A {@code ServiceReference} object, or {@code null} if no services
-	 *         are registered which implement the named class.
+	 *         are registered which implement the specified class.
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 * @see #getServiceReferences(Class, String)
 	 * @since 1.6
@@ -660,10 +654,10 @@
 	/**
 	 * Returns a collection of {@code ServiceReference} objects. The returned
 	 * collection of {@code ServiceReference} objects contains services that
-	 * were registered under the specified class, match the specified filter
-	 * expression, and the packages for the class names under which the services
-	 * were registered match the context bundle's packages as defined in
-	 * {@link ServiceReference#isAssignableTo(Bundle, String)}.
+	 * were registered under the name of the specified class, match the
+	 * specified filter expression, and the packages for the class names under
+	 * which the services were registered match the context bundle's packages as
+	 * defined in {@link ServiceReference#isAssignableTo(Bundle, String)}.
 	 * 
 	 * <p>
 	 * The collection is valid at the time of the call to this method. However
@@ -684,11 +678,10 @@
 	 * The result is a collection of {@code ServiceReference} objects for all
 	 * services that meet all of the following conditions:
 	 * <ul>
-	 * <li>If the specified class name, {@code clazz}, is not {@code null}, the
-	 * service must have been registered with the specified class name. The
-	 * complete list of class names with which a service was registered is
-	 * available from the service's {@link Constants#OBJECTCLASS objectClass}
-	 * property.
+	 * <li>The service must have been registered with the name of the specified
+	 * class. The complete list of class names with which a service was
+	 * registered is available from the service's {@link Constants#OBJECTCLASS
+	 * objectClass} property.
 	 * <li>If the specified {@code filter} is not {@code null}, the filter
 	 * expression must match the service.
 	 * <li>If the Java Runtime Environment supports permissions, the caller must
@@ -701,7 +694,7 @@
 	 * </ul>
 	 * 
 	 * @param <S> Type of Service
-	 * @param clazz The class name with which the service was registered. Must
+	 * @param clazz The class under whose name the service was registered. Must
 	 *        not be {@code null}.
 	 * @param filter The filter expression or {@code null} for all services.
 	 * @return A collection of {@code ServiceReference} objects. May be empty if
@@ -711,8 +704,7 @@
 	 * @throws IllegalStateException If this BundleContext is no longer valid.
 	 * @since 1.6
 	 */
-	<S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz,
-			String filter) throws InvalidSyntaxException;
+	<S> Collection<ServiceReference<S>> getServiceReferences(Class<S> clazz, String filter) throws InvalidSyntaxException;
 
 	/**
 	 * Returns the service object referenced by the specified
@@ -810,10 +802,10 @@
 	 * @throws IllegalArgumentException If the specified
 	 *         {@code ServiceReference} was not created by the same framework
 	 *         instance as this {@code BundleContext}.
-	 * @see #getService
+	 * @see #getService(ServiceReference)
 	 * @see ServiceFactory
 	 */
-	boolean ungetService(ServiceReference< ? > reference);
+	boolean ungetService(ServiceReference<?> reference);
 
 	/**
 	 * Creates a {@code File} object for a file in the persistent storage area
diff --git a/framework/src/main/java/org/osgi/framework/BundleEvent.java b/framework/src/main/java/org/osgi/framework/BundleEvent.java
index 13c68be..04a34a3 100644
--- a/framework/src/main/java/org/osgi/framework/BundleEvent.java
+++ b/framework/src/main/java/org/osgi/framework/BundleEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,9 +22,9 @@
  * An event from the Framework describing a bundle lifecycle change.
  * <p>
  * {@code BundleEvent} objects are delivered to
- * {@code SynchronousBundleListener}s and {@code BundleListener}s
- * when a change occurs in a bundle's lifecycle. A type code is used to identify
- * the event type for future extendability.
+ * {@code SynchronousBundleListener}s and {@code BundleListener}s when a change
+ * occurs in a bundle's lifecycle. A type code is used to identify the event
+ * type for future extendability.
  * 
  * <p>
  * OSGi Alliance reserves the right to extend the set of types.
@@ -32,7 +32,7 @@
  * @Immutable
  * @see BundleListener
  * @see SynchronousBundleListener
- * @version $Id: ed3c40cd707bed45681cadce114a6cc5db27a844 $
+ * @version $Id: 9e2102212eb526b5f11fdde4b0fc5c171a0b39c8 $
  */
 
 public class BundleEvent extends EventObject {
@@ -57,9 +57,9 @@
 	/**
 	 * The bundle has been started.
 	 * <p>
-	 * The bundle's
-	 * {@link BundleActivator#start(BundleContext) BundleActivator start} method
-	 * has been executed if the bundle has a bundle activator class.
+	 * The bundle's {@link BundleActivator#start(BundleContext) BundleActivator
+	 * start} method has been executed if the bundle has a bundle activator
+	 * class.
 	 * 
 	 * @see Bundle#start()
 	 */
@@ -68,9 +68,9 @@
 	/**
 	 * The bundle has been stopped.
 	 * <p>
-	 * The bundle's
-	 * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
-	 * has been executed if the bundle has a bundle activator class.
+	 * The bundle's {@link BundleActivator#stop(BundleContext) BundleActivator
+	 * stop} method has been executed if the bundle has a bundle activator
+	 * class.
 	 * 
 	 * @see Bundle#stop()
 	 */
@@ -86,7 +86,7 @@
 	/**
 	 * The bundle has been uninstalled.
 	 * 
-	 * @see Bundle#uninstall
+	 * @see Bundle#uninstall()
 	 */
 	public final static int	UNINSTALLED			= 0x00000010;
 
@@ -109,11 +109,10 @@
 	/**
 	 * The bundle is about to be activated.
 	 * <p>
-	 * The bundle's
-	 * {@link BundleActivator#start(BundleContext) BundleActivator start} method
-	 * is about to be called if the bundle has a bundle activator class. This
-	 * event is only delivered to {@link SynchronousBundleListener}s. It is not
-	 * delivered to {@code BundleListener}s.
+	 * The bundle's {@link BundleActivator#start(BundleContext) BundleActivator
+	 * start} method is about to be called if the bundle has a bundle activator
+	 * class. This event is only delivered to {@link SynchronousBundleListener}
+	 * s. It is not delivered to {@code BundleListener}s.
 	 * 
 	 * @see Bundle#start()
 	 * @since 1.3
@@ -123,11 +122,10 @@
 	/**
 	 * The bundle is about to deactivated.
 	 * <p>
-	 * The bundle's
-	 * {@link BundleActivator#stop(BundleContext) BundleActivator stop} method
-	 * is about to be called if the bundle has a bundle activator class. This
-	 * event is only delivered to {@link SynchronousBundleListener}s. It is not
-	 * delivered to {@code BundleListener}s.
+	 * The bundle's {@link BundleActivator#stop(BundleContext) BundleActivator
+	 * stop} method is about to be called if the bundle has a bundle activator
+	 * class. This event is only delivered to {@link SynchronousBundleListener}
+	 * s. It is not delivered to {@code BundleListener}s.
 	 * 
 	 * @see Bundle#stop()
 	 * @since 1.3
@@ -138,10 +136,9 @@
 	 * The bundle will be lazily activated.
 	 * <p>
 	 * The bundle has a {@link Constants#ACTIVATION_LAZY lazy activation policy}
-	 * and is waiting to be activated. It is now in the
-	 * {@link Bundle#STARTING STARTING} state and has a valid
-	 * {@code BundleContext}. This event is only delivered to
-	 * {@link SynchronousBundleListener}s. It is not delivered to
+	 * and is waiting to be activated. It is now in the {@link Bundle#STARTING
+	 * STARTING} state and has a valid {@code BundleContext}. This event is only
+	 * delivered to {@link SynchronousBundleListener}s. It is not delivered to
 	 * {@code BundleListener}s.
 	 * 
 	 * @since 1.4
diff --git a/framework/src/main/java/org/osgi/framework/BundleException.java b/framework/src/main/java/org/osgi/framework/BundleException.java
index 9cae61a..c47eb77 100644
--- a/framework/src/main/java/org/osgi/framework/BundleException.java
+++ b/framework/src/main/java/org/osgi/framework/BundleException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,10 +21,10 @@
  * occurred.
  * 
  * <p>
- * A {@code BundleException} object is created by the Framework to denote
- * an exception condition in the lifecycle of a bundle.
- * {@code BundleException}s should not be created by bundle developers.
- * A type code is used to identify the exception type for future extendability.
+ * A {@code BundleException} object is created by the Framework to denote an
+ * exception condition in the lifecycle of a bundle. {@code BundleException}s
+ * should not be created by bundle developers. A type code is used to identify
+ * the exception type for future extendability.
  * 
  * <p>
  * OSGi Alliance reserves the right to extend the set of types.
@@ -32,7 +32,7 @@
  * <p>
  * This exception conforms to the general purpose exception chaining mechanism.
  * 
- * @version $Id: 9e117ec9667b040f7752e342aa07d6c7d5bf0275 $
+ * @version $Id: 0c97ed2696b4576d61440020922b1a97545beb1e $
  */
 
 public class BundleException extends Exception {
@@ -51,7 +51,7 @@
 	 */
 	public static final int	UNSPECIFIED				= 0;
 	/**
-	 * The operation was unsupported. This type can be used anywhere a 
+	 * The operation was unsupported. This type can be used anywhere a
 	 * BundleException can be thrown.
 	 * 
 	 * @since 1.5
@@ -112,8 +112,8 @@
 	 * @since 1.5
 	 */
 	public static final int	DUPLICATE_BUNDLE_ERROR	= 9;
-	
-    /**
+
+	/**
 	 * The start transient operation failed because the start level of the
 	 * bundle is greater than the current framework start level
 	 * 
@@ -157,8 +157,8 @@
 	}
 
 	/**
-	 * Creates a {@code BundleException} with the specified message, type
-	 * and exception cause.
+	 * Creates a {@code BundleException} with the specified message, type and
+	 * exception cause.
 	 * 
 	 * @param msg The associated message.
 	 * @param type The type for this exception.
@@ -171,8 +171,7 @@
 	}
 
 	/**
-	 * Creates a {@code BundleException} with the specified message and
-	 * type.
+	 * Creates a {@code BundleException} with the specified message and type.
 	 * 
 	 * @param msg The message.
 	 * @param type The type for this exception.
@@ -189,8 +188,8 @@
 	 * 
 	 * <p>
 	 * This method predates the general purpose exception chaining mechanism.
-	 * The {@code getCause()} method is now the preferred means of
-	 * obtaining this information.
+	 * The {@code getCause()} method is now the preferred means of obtaining
+	 * this information.
 	 * 
 	 * @return The result of calling {@code getCause()}.
 	 */
@@ -199,11 +198,9 @@
 	}
 
 	/**
-	 * Returns the cause of this exception or {@code null} if no cause was
-	 * set.
+	 * Returns the cause of this exception or {@code null} if no cause was set.
 	 * 
-	 * @return The cause of this exception or {@code null} if no cause was
-	 *         set.
+	 * @return The cause of this exception or {@code null} if no cause was set.
 	 * @since 1.3
 	 */
 	public Throwable getCause() {
@@ -226,8 +223,8 @@
 	}
 
 	/**
-	 * Returns the type for this exception or {@code UNSPECIFIED} if the
-	 * type was unspecified or unknown.
+	 * Returns the type for this exception or {@code UNSPECIFIED} if the type
+	 * was unspecified or unknown.
 	 * 
 	 * @return The type of this exception.
 	 * @since 1.5
diff --git a/framework/src/main/java/org/osgi/framework/BundleListener.java b/framework/src/main/java/org/osgi/framework/BundleListener.java
index d9bb54c..8d86d30 100644
--- a/framework/src/main/java/org/osgi/framework/BundleListener.java
+++ b/framework/src/main/java/org/osgi/framework/BundleListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,22 +19,22 @@
 import java.util.EventListener;
 
 /**
- * A {@code BundleEvent} listener. {@code BundleListener} is a
- * listener interface that may be implemented by a bundle developer. When a
+ * A {@code BundleEvent} listener. {@code BundleListener} is a listener
+ * interface that may be implemented by a bundle developer. When a
  * {@code BundleEvent} is fired, it is asynchronously delivered to a
- * {@code BundleListener}. The Framework delivers
- * {@code BundleEvent} objects to a {@code BundleListener} in
- * order and must not concurrently call a {@code BundleListener}.
+ * {@code BundleListener}. The Framework delivers {@code BundleEvent} objects to
+ * a {@code BundleListener} in order and must not concurrently call a
+ * {@code BundleListener}.
  * <p>
- * A {@code BundleListener} object is registered with the Framework using
- * the {@link BundleContext#addBundleListener} method.
- * {@code BundleListener}s are called with a {@code BundleEvent}
- * object when a bundle has been installed, resolved, started, stopped, updated,
- * unresolved, or uninstalled.
+ * A {@code BundleListener} object is registered with the Framework using the
+ * {@link BundleContext#addBundleListener(BundleListener)} method.
+ * {@code BundleListener}s are called with a {@code BundleEvent} object when a
+ * bundle has been installed, resolved, started, stopped, updated, unresolved,
+ * or uninstalled.
  * 
  * @see BundleEvent
  * @NotThreadSafe
- * @version $Id: 77cdaebd3ac97c6798fc3043957abd1bd6d01ccb $
+ * @version $Id: d48b4a8a59c839466a3d749dde23980d236f58c6 $
  */
 
 public interface BundleListener extends EventListener {
diff --git a/framework/src/main/java/org/osgi/framework/BundlePermission.java b/framework/src/main/java/org/osgi/framework/BundlePermission.java
index e6f9356..f9e64ae 100644
--- a/framework/src/main/java/org/osgi/framework/BundlePermission.java
+++ b/framework/src/main/java/org/osgi/framework/BundlePermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2012). 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.
@@ -52,13 +52,13 @@
  * </pre>
  * 
  * <p>
- * {@code BundlePermission} has four actions: {@code provide},
- * {@code require},{@code host}, and {@code fragment}. The
- * {@code provide} action implies the {@code require} action.
+ * {@code BundlePermission} has four actions: {@code provide}, {@code require},
+ * {@code host}, and {@code fragment}. The {@code provide} action implies the
+ * {@code require} action.
  * 
  * @since 1.3
  * @ThreadSafe
- * @version $Id: d30c9c987cc13007ed19d3a9fdd11b00739591c0 $
+ * @version $Id: ccba905e3373800dfdb080118e97145abf778da2 $
  */
 
 public final class BundlePermission extends BasicPermission {
@@ -66,14 +66,14 @@
 	private static final long	serialVersionUID	= 3257846601685873716L;
 
 	/**
-	 * The action string {@code provide}. The {@code provide} action
-	 * implies the {@code require} action.
+	 * The action string {@code provide}. The {@code provide} action implies the
+	 * {@code require} action.
 	 */
 	public final static String	PROVIDE				= "provide";
 
 	/**
-	 * The action string {@code require}. The {@code require} action
-	 * is implied by the {@code provide} action.
+	 * The action string {@code require}. The {@code require} action is implied
+	 * by the {@code provide} action.
 	 */
 	public final static String	REQUIRE				= "require";
 
@@ -91,10 +91,7 @@
 	private final static int	ACTION_REQUIRE		= 0x00000002;
 	private final static int	ACTION_HOST			= 0x00000004;
 	private final static int	ACTION_FRAGMENT		= 0x00000008;
-	private final static int	ACTION_ALL			= ACTION_PROVIDE
-															| ACTION_REQUIRE
-															| ACTION_HOST
-															| ACTION_FRAGMENT;
+	private final static int	ACTION_ALL			= ACTION_PROVIDE | ACTION_REQUIRE | ACTION_HOST | ACTION_FRAGMENT;
 	final static int			ACTION_NONE			= 0;
 	/**
 	 * The actions mask.
@@ -115,14 +112,14 @@
 	 * Bundle Permissions are granted over all possible versions of a bundle.
 	 * 
 	 * A bundle that needs to provide a bundle must have the appropriate
-	 * {@code BundlePermission} for the symbolic name; a bundle that
-	 * requires a bundle must have the appropriate {@code BundlePermssion}
-	 * for that symbolic name; a bundle that specifies a fragment host must have
-	 * the appropriate {@code BundlePermission} for that symbolic name.
+	 * {@code BundlePermission} for the symbolic name; a bundle that requires a
+	 * bundle must have the appropriate {@code BundlePermssion} for that
+	 * symbolic name; a bundle that specifies a fragment host must have the
+	 * appropriate {@code BundlePermission} for that symbolic name.
 	 * 
 	 * @param symbolicName The bundle symbolic name.
-	 * @param actions {@code provide},{@code require},
-	 *        {@code host},{@code fragment} (canonical order).
+	 * @param actions {@code provide},{@code require}, {@code host},
+	 *        {@code fragment} (canonical order).
 	 */
 	public BundlePermission(String symbolicName, String actions) {
 		this(symbolicName, parseActions(actions));
@@ -188,9 +185,7 @@
 			char c;
 
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
 
 			// check for the known strings
@@ -205,8 +200,7 @@
 					&& (a[i] == 'e' || a[i] == 'E')) {
 				matchlen = 7;
 				mask |= ACTION_PROVIDE | ACTION_REQUIRE;
-			}
-			else
+			} else
 				if (i >= 6 && (a[i - 6] == 'r' || a[i - 6] == 'R')
 						&& (a[i - 5] == 'e' || a[i - 5] == 'E')
 						&& (a[i - 4] == 'q' || a[i - 4] == 'Q')
@@ -216,16 +210,14 @@
 						&& (a[i] == 'e' || a[i] == 'E')) {
 					matchlen = 7;
 					mask |= ACTION_REQUIRE;
-				}
-				else
+				} else
 					if (i >= 3 && (a[i - 3] == 'h' || a[i - 3] == 'H')
 							&& (a[i - 2] == 'o' || a[i - 2] == 'O')
 							&& (a[i - 1] == 's' || a[i - 1] == 'S')
 							&& (a[i] == 't' || a[i] == 'T')) {
 						matchlen = 4;
 						mask |= ACTION_HOST;
-					}
-					else
+					} else
 						if (i >= 7 && (a[i - 7] == 'f' || a[i - 7] == 'F')
 								&& (a[i - 6] == 'r' || a[i - 6] == 'R')
 								&& (a[i - 5] == 'a' || a[i - 5] == 'A')
@@ -236,11 +228,9 @@
 								&& (a[i] == 't' || a[i] == 'T')) {
 							matchlen = 8;
 							mask |= ACTION_FRAGMENT;
-						}
-						else {
+						} else {
 							// parse error
-							throw new IllegalArgumentException(
-									"invalid permission: " + actions);
+							throw new IllegalArgumentException("invalid permission: " + actions);
 						}
 
 			// make sure we didn't just match the tail of a word
@@ -258,8 +248,7 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
@@ -295,8 +284,8 @@
 	 * </pre>
 	 * 
 	 * @param p The requested permission.
-	 * @return {@code true} if the specified {@code BundlePermission}
-	 *         action is implied by this object; {@code false} otherwise.
+	 * @return {@code true} if the specified {@code BundlePermission} action is
+	 *         implied by this object; {@code false} otherwise.
 	 */
 	public boolean implies(Permission p) {
 		if (!(p instanceof BundlePermission)) {
@@ -306,8 +295,7 @@
 
 		final int effective = getActionsMask();
 		final int desired = requested.getActionsMask();
-		return ((effective & desired) == desired)
-				&& super.implies(requested);
+		return ((effective & desired) == desired) && super.implies(requested);
 	}
 
 	/**
@@ -315,9 +303,8 @@
 	 * {@code BundlePermission} actions.
 	 * 
 	 * <p>
-	 * Always returns present {@code BundlePermission} actions in the
-	 * following order: {@code provide}, {@code require},
-	 * {@code host}, {@code fragment}.
+	 * Always returns present {@code BundlePermission} actions in the following
+	 * order: {@code provide}, {@code require}, {@code host}, {@code fragment}.
 	 * 
 	 * @return Canonical string representation of the {@code BundlePermission
 	 *         } actions.
@@ -359,8 +346,8 @@
 	}
 
 	/**
-	 * Returns a new {@code PermissionCollection} object suitable for
-	 * storing {@code BundlePermission} objects.
+	 * Returns a new {@code PermissionCollection} object suitable for storing
+	 * {@code BundlePermission} objects.
 	 * 
 	 * @return A new {@code PermissionCollection} object.
 	 */
@@ -377,10 +364,9 @@
 	 * 
 	 * @param obj The object to test for equality with this
 	 *        {@code BundlePermission} object.
-	 * @return {@code true} if {@code obj} is a
-	 *         {@code BundlePermission}, and has the same bundle symbolic
-	 *         name and actions as this {@code BundlePermission} object;
-	 *         {@code false} otherwise.
+	 * @return {@code true} if {@code obj} is a {@code BundlePermission}, and
+	 *         has the same bundle symbolic name and actions as this
+	 *         {@code BundlePermission} object; {@code false} otherwise.
 	 */
 	public boolean equals(Object obj) {
 		if (obj == this) {
@@ -393,8 +379,7 @@
 
 		BundlePermission bp = (BundlePermission) obj;
 
-		return (getActionsMask() == bp.getActionsMask())
-				&& getName().equals(bp.getName());
+		return (getActionsMask() == bp.getActionsMask()) && getName().equals(bp.getName());
 	}
 
 	/**
@@ -409,12 +394,11 @@
 	}
 
 	/**
-	 * WriteObject is called to save the state of the
-	 * {@code BundlePermission} object to a stream. The actions are
-	 * serialized, and the superclass takes care of the name.
+	 * WriteObject is called to save the state of the {@code BundlePermission}
+	 * object to a stream. The actions are serialized, and the superclass takes
+	 * care of the name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		// Write out the actions. The superclass takes care of the name
 		// call getActions to make sure actions field is initialized
 		if (actions == null)
@@ -426,8 +410,7 @@
 	 * readObject is called to restore the state of the BundlePermission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the action, then initialize the rest
 		s.defaultReadObject();
 		setTransients(parseActions(actions));
@@ -443,7 +426,7 @@
  */
 
 final class BundlePermissionCollection extends PermissionCollection {
-	private static final long	serialVersionUID	= 3258407326846433079L;
+	private static final long						serialVersionUID	= 3258407326846433079L;
 
 	/**
 	 * Table of permissions.
@@ -458,7 +441,7 @@
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private boolean				all_allowed;
+	private boolean									all_allowed;
 
 	/**
 	 * Create an empty BundlePermissions object.
@@ -480,12 +463,10 @@
 	 */
 	public void add(final Permission permission) {
 		if (!(permission instanceof BundlePermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection");
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 		final BundlePermission bp = (BundlePermission) permission;
 		final String name = bp.getName();
@@ -496,12 +477,10 @@
 				final int oldMask = existing.getActionsMask();
 				final int newMask = bp.getActionsMask();
 				if (oldMask != newMask) {
-					pc.put(name, new BundlePermission(name, oldMask
-							| newMask));
+					pc.put(name, new BundlePermission(name, oldMask | newMask));
 
 				}
-			}
-			else {
+			} else {
 				pc.put(name, bp);
 			}
 
@@ -518,8 +497,8 @@
 	 * 
 	 * @param permission The Permission object to compare with this
 	 *        {@code BundlePermission} object.
-	 * @return {@code true} if {@code permission} is a proper subset
-	 *         of a permission in the set; {@code false} otherwise.
+	 * @return {@code true} if {@code permission} is a proper subset of a
+	 *         permission in the set; {@code false} otherwise.
 	 */
 	public boolean implies(final Permission permission) {
 		if (!(permission instanceof BundlePermission)) {
@@ -575,8 +554,8 @@
 	}
 
 	/**
-	 * Returns an enumeration of all {@code BundlePermission} objects in
-	 * the container.
+	 * Returns an enumeration of all {@code BundlePermission} objects in the
+	 * container.
 	 * 
 	 * @return Enumeration of all {@code BundlePermission} objects.
 	 */
@@ -584,27 +563,21 @@
 		List<Permission> all = new ArrayList<Permission>(permissions.values());
 		return Collections.enumeration(all);
 	}
-	
-	/* serialization logic */
-	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", Hashtable.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE)			};
 
-	private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
-		Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(
-				permissions);
+	/* serialization logic */
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE)};
+
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+		Hashtable<String, BundlePermission> hashtable = new Hashtable<String, BundlePermission>(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", hashtable);
 		pfields.put("all_allowed", all_allowed);
 		out.writeFields();
 	}
 
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields
-				.get("permissions", null);
+		Hashtable<String, BundlePermission> hashtable = (Hashtable<String, BundlePermission>) gfields.get("permissions", null);
 		permissions = new HashMap<String, BundlePermission>(hashtable);
 		all_allowed = gfields.get("all_allowed", false);
 	}
diff --git a/framework/src/main/java/org/osgi/framework/CapabilityPermission.java b/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
index bcac790..c27e1ac 100644
--- a/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
+++ b/framework/src/main/java/org/osgi/framework/CapabilityPermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -47,7 +47,7 @@
  * </ul>
  * 
  * @ThreadSafe
- * @version $Id: bab1ac06b46613f6cff39b291295d8b3e51d58ce $
+ * @version $Id: b17bcaec959f67c3eae4c4c80c39a0a8716b22dc $
  * @since 1.6
  */
 
@@ -64,8 +64,7 @@
 
 	private final static int						ACTION_REQUIRE		= 0x00000001;
 	private final static int						ACTION_PROVIDE		= 0x00000002;
-	private final static int						ACTION_ALL			= ACTION_REQUIRE
-																				| ACTION_PROVIDE;
+	private final static int						ACTION_ALL			= ACTION_REQUIRE | ACTION_PROVIDE;
 	final static int								ACTION_NONE			= 0;
 
 	/**
@@ -133,7 +132,7 @@
 	 * <li>location - The location of the bundle providing the capability.</li>
 	 * <li>id - The bundle ID of the bundle providing the capability.</li>
 	 * <li>name - The symbolic name of the bundle providing the capability.</li>
-	 * <li>capability.namespace - The name space of the required capability.</li>
+	 * <li>capability.namespace - The namespace of the required capability.</li>
 	 * </ul>
 	 * Since the above attribute names may conflict with attribute names of a
 	 * capability, you can prefix an attribute name with '@' in the filter
@@ -146,9 +145,9 @@
 	 * {@code require} permission allows the owner of this permission to require
 	 * a capability matching the attributes. The {@code provide} permission
 	 * allows the bundle to provide a capability in the specified capability
-	 * name space.
+	 * namespace.
 	 * 
-	 * @param name The capability name space or a filter over the attributes.
+	 * @param name The capability namespace or a filter over the attributes.
 	 * @param actions {@code require},{@code provide} (canonical order)
 	 * @throws IllegalArgumentException If the specified name is a filter
 	 *         expression and either the specified action is not {@code require}
@@ -156,10 +155,8 @@
 	 */
 	public CapabilityPermission(String name, String actions) {
 		this(name, parseActions(actions));
-		if ((this.filter != null)
-				&& ((action_mask & ACTION_ALL) != ACTION_REQUIRE)) {
-			throw new IllegalArgumentException(
-					"invalid action string for filter expression");
+		if ((this.filter != null) && ((action_mask & ACTION_ALL) != ACTION_REQUIRE)) {
+			throw new IllegalArgumentException("invalid action string for filter expression");
 		}
 	}
 
@@ -170,7 +167,7 @@
 	 * constructor cannot be added to a {@code CapabilityPermission} permission
 	 * collection.
 	 * 
-	 * @param namespace The requested capability name space.
+	 * @param namespace The requested capability namespace.
 	 * @param attributes The requested capability attributes.
 	 * @param providingBundle The bundle providing the requested capability.
 	 * @param actions The action {@code require}.
@@ -178,8 +175,7 @@
 	 *         {@code require} or attributes or providingBundle are {@code null}
 	 *         .
 	 */
-	public CapabilityPermission(String namespace, Map<String, ? > attributes,
-			Bundle providingBundle, String actions) {
+	public CapabilityPermission(String namespace, Map<String, ?> attributes, Bundle providingBundle, String actions) {
 		super(namespace);
 		setTransients(namespace, parseActions(actions));
 		if (attributes == null) {
@@ -246,9 +242,7 @@
 			char c;
 
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
 
 			// check for the known strings
@@ -263,8 +257,7 @@
 					&& (a[i] == 'e' || a[i] == 'E')) {
 				matchlen = 7;
 				mask |= ACTION_REQUIRE;
-			}
-			else
+			} else
 				if (i >= 6 && (a[i - 6] == 'p' || a[i - 6] == 'P')
 						&& (a[i - 5] == 'r' || a[i - 5] == 'R')
 						&& (a[i - 4] == 'o' || a[i - 4] == 'O')
@@ -274,11 +267,9 @@
 						&& (a[i] == 'e' || a[i] == 'E')) {
 					matchlen = 7;
 					mask |= ACTION_PROVIDE;
-				}
-				else {
+				} else {
 					// parse error
-					throw new IllegalArgumentException("invalid permission: "
-							+ actions);
+					throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 
 			// make sure we didn't just match the tail of a word
@@ -296,8 +287,7 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
@@ -329,10 +319,8 @@
 
 		try {
 			return FrameworkUtil.createFilter(filterString);
-		}
-		catch (InvalidSyntaxException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid filter");
+		} catch (InvalidSyntaxException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
 			iae.initCause(e);
 			throw iae;
 		}
@@ -451,12 +439,8 @@
 
 		CapabilityPermission cp = (CapabilityPermission) obj;
 
-		return (action_mask == cp.action_mask)
-				&& getName().equals(cp.getName())
-				&& ((attributes == cp.attributes) || ((attributes != null) && (attributes
-						.equals(cp.attributes))))
-				&& ((bundle == cp.bundle) || ((bundle != null) && bundle
-						.equals(cp.bundle)));
+		return (action_mask == cp.action_mask) && getName().equals(cp.getName()) && ((attributes == cp.attributes) || ((attributes != null) && (attributes.equals(cp.attributes))))
+				&& ((bundle == cp.bundle) || ((bundle != null) && bundle.equals(cp.bundle)));
 	}
 
 	/**
@@ -480,8 +464,7 @@
 	 * WriteObject is called to save the state of this permission to a stream.
 	 * The actions are serialized, and the superclass takes care of the name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		if (bundle != null) {
 			throw new NotSerializableException("cannot serialize");
 		}
@@ -496,8 +479,7 @@
 	 * readObject is called to restore the state of this permission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the action, then initialize the rest
 		s.defaultReadObject();
 		setTransients(getName(), parseActions(actions));
@@ -543,8 +525,7 @@
 		private final Map<String, Object>							attributes;
 		private transient volatile Set<Map.Entry<String, Object>>	entries;
 
-		Properties(Map<String, Object> properties,
-				Map<String, Object> attributes) {
+		Properties(Map<String, Object> properties, Map<String, Object> attributes) {
 			this.properties = properties;
 			this.attributes = attributes;
 			entries = null;
@@ -569,8 +550,7 @@
 			if (entries != null) {
 				return entries;
 			}
-			Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(
-					attributes.size() + properties.size());
+			Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(attributes.size() + properties.size());
 			all.addAll(attributes.entrySet());
 			all.addAll(properties.entrySet());
 			return entries = Collections.unmodifiableSet(all);
@@ -631,18 +611,15 @@
 	 */
 	public void add(final Permission permission) {
 		if (!(permission instanceof CapabilityPermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection");
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 
 		final CapabilityPermission cp = (CapabilityPermission) permission;
 		if (cp.bundle != null) {
-			throw new IllegalArgumentException("cannot add to collection: "
-					+ cp);
+			throw new IllegalArgumentException("cannot add to collection: " + cp);
 		}
 
 		final String name = cp.getName();
@@ -655,8 +632,7 @@
 				if (pc == null) {
 					filterPermissions = pc = new HashMap<String, CapabilityPermission>();
 				}
-			}
-			else {
+			} else {
 				pc = permissions;
 			}
 			final CapabilityPermission existing = pc.get(name);
@@ -665,11 +641,9 @@
 				final int oldMask = existing.action_mask;
 				final int newMask = cp.action_mask;
 				if (oldMask != newMask) {
-					pc.put(name, new CapabilityPermission(name, oldMask
-							| newMask));
+					pc.put(name, new CapabilityPermission(name, oldMask | newMask));
 				}
-			}
-			else {
+			} else {
 				pc.put(name, cp);
 			}
 
@@ -779,13 +753,10 @@
 	}
 
 	/* serialization logic */
-	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", HashMap.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE),
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", HashMap.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
 			new ObjectStreamField("filterPermissions", HashMap.class)	};
 
-	private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", permissions);
 		pfields.put("all_allowed", all_allowed);
@@ -793,15 +764,12 @@
 		out.writeFields();
 	}
 
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		HashMap<String, CapabilityPermission> p = (HashMap<String, CapabilityPermission>) gfields
-				.get("permissions", null);
+		HashMap<String, CapabilityPermission> p = (HashMap<String, CapabilityPermission>) gfields.get("permissions", null);
 		permissions = p;
 		all_allowed = gfields.get("all_allowed", false);
-		HashMap<String, CapabilityPermission> fp = (HashMap<String, CapabilityPermission>) gfields
-				.get("filterPermissions", null);
+		HashMap<String, CapabilityPermission> fp = (HashMap<String, CapabilityPermission>) gfields.get("filterPermissions", null);
 		filterPermissions = fp;
 	}
 }
diff --git a/framework/src/main/java/org/osgi/framework/Configurable.java b/framework/src/main/java/org/osgi/framework/Configurable.java
index d82da9b..5fa08c4 100644
--- a/framework/src/main/java/org/osgi/framework/Configurable.java
+++ b/framework/src/main/java/org/osgi/framework/Configurable.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -26,7 +26,7 @@
  * {@code instanceof Configurable}.
  * 
  * @deprecated As of 1.2. Please use Configuration Admin service.
- * @version $Id: 29705c0c238aa456cda1b1a13458079bf1542771 $
+ * @version $Id: 1018601ae90d2d16ec34136db4b04dca3ccf8e65 $
  */
 public interface Configurable {
 	/**
@@ -42,9 +42,8 @@
 	 * returning the configuration object.
 	 * 
 	 * @return The configuration object for this service.
-	 * @throws SecurityException If the caller does not have an
-	 *         appropriate permission and the Java Runtime Environment supports
-	 *         permissions.
+	 * @throws SecurityException If the caller does not have an appropriate
+	 *         permission and the Java Runtime Environment supports permissions.
 	 * @deprecated As of 1.2. Please use Configuration Admin service.
 	 */
 	public Object getConfigurationObject();
diff --git a/framework/src/main/java/org/osgi/framework/Constants.java b/framework/src/main/java/org/osgi/framework/Constants.java
index b71a12d..10618a1 100644
--- a/framework/src/main/java/org/osgi/framework/Constants.java
+++ b/framework/src/main/java/org/osgi/framework/Constants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -16,6 +16,7 @@
 
 package org.osgi.framework;
 
+import org.osgi.framework.hooks.bundle.CollisionHook;
 import org.osgi.framework.launch.Framework;
 
 /**
@@ -28,7 +29,7 @@
  * 
  * @since 1.1
  * @noimplement
- * @version $Id: 517c954ed7d34d2ee762933466f69fa03db7cd37 $
+ * @version $Id: 6d07a4c3e29a5cd93b3daf0f9fcdab5472b357f6 $
  */
 
 public interface Constants {
@@ -1149,8 +1150,9 @@
 	/**
 	 * Framework launching property specifying the trust repositories used by
 	 * the framework. The value is a {@code java.io.File.pathSeparator}
-	 * separated list of valid file paths to files that contain key stores of
-	 * type {@code JKS}. The framework will use the key stores as trust
+	 * separated list of valid file paths to files that contain key stores. Key
+	 * stores of type {@code JKS} must be supported and other key store types
+	 * may be supported. The framework will use the key stores as trust
 	 * repositories to authenticate certificates of trusted signers. The key
 	 * stores are only used as read-only trust repositories to access public
 	 * keys. No passwords are required to access the key stores' public keys.
@@ -1276,9 +1278,9 @@
 	 * persists across multiple Framework invocations.
 	 * 
 	 * <p>
-	 * By convention, every bundle has its own unique name space, starting with
-	 * the bundle's identifier (see {@link Bundle#getBundleId}) and followed by
-	 * a dot (.). A bundle may use this as the prefix of the persistent
+	 * By convention, every bundle has its own unique namespace, starting with
+	 * the bundle's identifier (see {@link Bundle#getBundleId()}) and followed
+	 * by a dot (.). A bundle may use this as the prefix of the persistent
 	 * identifiers for the services it registers.
 	 */
 	String	SERVICE_PID								= "service.pid";
@@ -1293,9 +1295,10 @@
 	 * 
 	 * <p>
 	 * The service ranking is used by the Framework to determine the <i>natural
-	 * order</i> of services, see {@link ServiceReference#compareTo}, and the
-	 * <i>default</i> service to be returned from a call to the
-	 * {@link BundleContext#getServiceReference} method.
+	 * order</i> of services, see {@link ServiceReference#compareTo(Object)},
+	 * and the <i>default</i> service to be returned from a call to the
+	 * {@link BundleContext#getServiceReference(Class)} or
+	 * {@link BundleContext#getServiceReference(String)} method.
 	 * 
 	 * <p>
 	 * The default ranking is zero (0). A service with a ranking of
@@ -1434,11 +1437,11 @@
 	 * Service property marking the service for export. It defines the
 	 * interfaces under which this service can be exported. This list must be a
 	 * subset of the types under which the service was registered. The single
-	 * value of an asterisk (&quot;*&quot;, &#92;u002A) indicates all the
-	 * interface types under which the service was registered excluding the
-	 * non-interface types. It is strongly recommended to only export interface
-	 * types and not concrete classes due to the complexity of creating proxies
-	 * for some type of concrete classes.
+	 * value of an asterisk ({@code '*'} &#92;u002A) indicates all the interface
+	 * types under which the service was registered excluding the non-interface
+	 * types. It is strongly recommended to only export interface types and not
+	 * concrete classes due to the complexity of creating proxies for some type
+	 * of concrete classes.
 	 * 
 	 * <p>
 	 * This property may be supplied in the {@code properties}
@@ -1645,12 +1648,11 @@
 	 * {@link #BUNDLE_VERSION version} may be installed.
 	 * 
 	 * <p>
-	 * Default value is {@link #FRAMEWORK_BSNVERSION_SINGLE single} in this
-	 * release of the specification. This default may change to
-	 * {@link #FRAMEWORK_BSNVERSION_MULTIPLE multiple} in a future specification
-	 * release. Therefore, code must not assume the default behavior is
-	 * {@code single} and should interrogate the value of this property to
-	 * determine the behavior.
+	 * Default value is {@link #FRAMEWORK_BSNVERSION_MANAGED managed} in this
+	 * release of the specification. This default may change in a future
+	 * specification release. Therefore, code must not assume the default
+	 * behavior is {@code managed} and should interrogate the value of this
+	 * property to determine the behavior.
 	 * 
 	 * <p>
 	 * The value of this property may be retrieved by calling the
@@ -1658,6 +1660,7 @@
 	 * 
 	 * @see #FRAMEWORK_BSNVERSION_MULTIPLE
 	 * @see #FRAMEWORK_BSNVERSION_SINGLE
+	 * @see #FRAMEWORK_BSNVERSION_MANAGED
 	 * @since 1.6
 	 */
 	String	FRAMEWORK_BSNVERSION					= "org.osgi.framework.bsnversion";
@@ -1679,6 +1682,22 @@
 	 * 
 	 * @since 1.6
 	 * @see #FRAMEWORK_BSNVERSION
+	 * @see BundleException#DUPLICATE_BUNDLE_ERROR
 	 */
 	String	FRAMEWORK_BSNVERSION_SINGLE				= "single";
+
+	/**
+	 * Specifies the framework must consult the {@link CollisionHook bundle
+	 * collision hook} services to determine if it will be an error to install a
+	 * bundle or update a bundle to have the same symbolic name and version as
+	 * another installed bundle. If no bundle collision hook services are
+	 * registered, then it will be an error to install a bundle or update a
+	 * bundle to have the same symbolic name and version as another installed
+	 * bundle.
+	 * 
+	 * @since 1.7
+	 * @see #FRAMEWORK_BSNVERSION
+	 * @see BundleException#DUPLICATE_BUNDLE_ERROR
+	 */
+	String	FRAMEWORK_BSNVERSION_MANAGED			= "managed";
 }
diff --git a/framework/src/main/java/org/osgi/framework/Filter.java b/framework/src/main/java/org/osgi/framework/Filter.java
index a9bb6c3..230a6e9 100644
--- a/framework/src/main/java/org/osgi/framework/Filter.java
+++ b/framework/src/main/java/org/osgi/framework/Filter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -13,6 +13,7 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.osgi.framework;
 
 import java.util.Dictionary;
@@ -21,8 +22,9 @@
 /**
  * An <a href="http://www.ietf.org/rfc/rfc1960.txt">RFC 1960</a>-based Filter.
  * <p>
- * {@code Filter}s can be created by calling {@link BundleContext#createFilter}
- * or {@link FrameworkUtil#createFilter} with a filter string.
+ * {@code Filter}s can be created by calling
+ * {@link BundleContext#createFilter(String)} or
+ * {@link FrameworkUtil#createFilter(String)} with a filter string.
  * <p>
  * A {@code Filter} can be used numerous times to determine if the match
  * argument matches the filter string that was used to create the {@code Filter}.
@@ -40,7 +42,7 @@
  * @see "Core Specification, Filters, for a description of the filter string syntax."
  * @ThreadSafe
  * @noimplement
- * @version $Id: 4d21267f4b85d1912d73f7e2c049cc968c4237f9 $
+ * @version $Id: 807a04ac07c3230b8f4d4e0f9588a35fbdc41e18 $
  */
 public interface Filter {
 	/**
@@ -55,7 +57,7 @@
 	 * @return {@code true} if the service's properties match this
 	 *         {@code Filter}; {@code false} otherwise.
 	 */
-	boolean match(ServiceReference< ? > reference);
+	boolean match(ServiceReference<?> reference);
 
 	/**
 	 * Filter using a {@code Dictionary} with case insensitive key lookup. This
@@ -69,7 +71,7 @@
 	 * @throws IllegalArgumentException If {@code dictionary} contains case
 	 *         variants of the same key name.
 	 */
-	boolean match(Dictionary<String, ? > dictionary);
+	boolean match(Dictionary<String, ?> dictionary);
 
 	/**
 	 * Returns this {@code Filter}'s filter string.
@@ -89,9 +91,8 @@
 	 * {@code this.toString().equals(obj.toString())}.
 	 * 
 	 * @param obj The object to compare against this {@code Filter}.
-	 * @return If the other object is a {@code Filter} object, then returns
-	 *         the result of calling
-	 *         {@code this.toString().equals(obj.toString())};
+	 * @return If the other object is a {@code Filter} object, then returns the
+	 *         result of calling {@code this.toString().equals(obj.toString())};
 	 *         {@code false} otherwise.
 	 */
 	boolean equals(Object obj);
@@ -118,7 +119,7 @@
 	 *         filter; {@code false} otherwise.
 	 * @since 1.3
 	 */
-	boolean matchCase(Dictionary<String, ? > dictionary);
+	boolean matchCase(Dictionary<String, ?> dictionary);
 
 	/**
 	 * Filter using a {@code Map}. This {@code Filter} is executed using the
@@ -132,5 +133,5 @@
 	 *         {@code false} otherwise.
 	 * @since 1.6
 	 */
-	boolean matches(Map<String, ? > map);
+	boolean matches(Map<String, ?> map);
 }
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkEvent.java b/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
index d309699..59fa92e 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework;
 
 import java.util.EventObject;
-
 import org.osgi.framework.startlevel.FrameworkStartLevel;
 import org.osgi.framework.wiring.FrameworkWiring;
 
@@ -25,17 +24,16 @@
  * A general event from the Framework.
  * 
  * <p>
- * {@code FrameworkEvent} objects are delivered to
- * {@code FrameworkListener}s when a general event occurs within the OSGi
- * environment. A type code is used to identify the event type for future
- * extendability.
+ * {@code FrameworkEvent} objects are delivered to {@code FrameworkListener}s
+ * when a general event occurs within the OSGi environment. A type code is used
+ * to identify the event type for future extendability.
  * 
  * <p>
  * OSGi Alliance reserves the right to extend the set of event types.
  * 
  * @Immutable
  * @see FrameworkListener
- * @version $Id: e05c6ffd542fa432835961882bf6b15b0620ffb6 $
+ * @version $Id: f679c7581879a2e6006ecdd317a5dd5f735764e3 $
  */
 
 public class FrameworkEvent extends EventObject {
@@ -191,8 +189,8 @@
 	 * 
 	 * @param type The event type.
 	 * @param bundle The event source.
-	 * @param throwable The related exception. This argument may be
-	 *        {@code null} if there is no related exception.
+	 * @param throwable The related exception. This argument may be {@code null}
+	 *        if there is no related exception.
 	 */
 	public FrameworkEvent(int type, Bundle bundle, Throwable throwable) {
 		super(bundle);
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkListener.java b/framework/src/main/java/org/osgi/framework/FrameworkListener.java
index 5d73fb9..7e1e813 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkListener.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,23 +19,22 @@
 import java.util.EventListener;
 
 /**
- * A {@code FrameworkEvent} listener. {@code FrameworkListener} is
- * a listener interface that may be implemented by a bundle developer. When a
+ * A {@code FrameworkEvent} listener. {@code FrameworkListener} is a listener
+ * interface that may be implemented by a bundle developer. When a
  * {@code FrameworkEvent} is fired, it is asynchronously delivered to a
- * {@code FrameworkListener}. The Framework delivers
- * {@code FrameworkEvent} objects to a {@code FrameworkListener}
- * in order and must not concurrently call a {@code FrameworkListener}.
+ * {@code FrameworkListener}. The Framework delivers {@code FrameworkEvent}
+ * objects to a {@code FrameworkListener} in order and must not concurrently
+ * call a {@code FrameworkListener}.
  * 
  * <p>
- * A {@code FrameworkListener} object is registered with the Framework
- * using the {@link BundleContext#addFrameworkListener} method.
- * {@code FrameworkListener} objects are called with a
- * {@code FrameworkEvent} objects when the Framework starts and when
- * asynchronous errors occur.
+ * A {@code FrameworkListener} object is registered with the Framework using the
+ * {@link BundleContext#addFrameworkListener(FrameworkListener)} method.
+ * {@code FrameworkListener} objects are called with a {@code FrameworkEvent}
+ * objects when the Framework starts and when asynchronous errors occur.
  * 
  * @see FrameworkEvent
  * @NotThreadSafe
- * @version $Id: a32e7599ea09d3510759d77e824cb8d9eff67f9d $
+ * @version $Id: ad7f563bd13b60e2b8a378f147057ca7f0accae2 $
  */
 
 public interface FrameworkListener extends EventListener {
diff --git a/framework/src/main/java/org/osgi/framework/FrameworkUtil.java b/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
index ec0af1e..c26ba43 100644
--- a/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
+++ b/framework/src/main/java/org/osgi/framework/FrameworkUtil.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2005, 2010). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2005, 2012). 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
@@ -16,12 +16,22 @@
 
 package org.osgi.framework;
 
+import java.lang.reflect.AccessibleObject;
+import java.lang.reflect.Constructor;
+import java.lang.reflect.InvocationTargetException;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
 import java.security.AccessController;
 import java.security.PrivilegedAction;
+import java.util.AbstractMap;
 import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Dictionary;
+import java.util.Enumeration;
 import java.util.Iterator;
 import java.util.List;
-
+import java.util.Map;
+import java.util.Set;
 import javax.security.auth.x500.X500Principal;
 
 /**
@@ -33,7 +43,7 @@
  * 
  * @since 1.3
  * @ThreadSafe
- * @version $Id: a902bc156ea997ed244831c7fab0f290a08ac0c1 $
+ * @version $Id: 1f46ea2bbbe2a1242fdaf0877709fb9c02eefae1 $
  */
 public class FrameworkUtil {
 	/**
@@ -44,9 +54,9 @@
 	}
 
 	/**
-	 * Creates a {@code Filter} object. This {@code Filter} object may
-	 * be used to match a {@code ServiceReference} object or a
-	 * {@code Dictionary} object.
+	 * Creates a {@code Filter} object. This {@code Filter} object may be used
+	 * to match a {@code ServiceReference} object or a {@code Dictionary}
+	 * object.
 	 * 
 	 * <p>
 	 * If the filter cannot be parsed, an {@link InvalidSyntaxException} will be
@@ -65,14 +75,13 @@
 	 * 
 	 * @see Filter
 	 */
-	public static Filter createFilter(String filter)
-			throws InvalidSyntaxException {
-		return new org.apache.felix.framework.FilterImpl(filter);
+	public static Filter createFilter(String filter) throws InvalidSyntaxException {
+		return FilterImpl.newInstance(filter);
 	}
 
 	/**
 	 * Match a Distinguished Name (DN) chain against a pattern. DNs can be
-	 * matched using wildcards. A wildcard ('*' &#92;u002A) replaces all
+	 * matched using wildcards. A wildcard ({@code '*'} &#92;u002A) replaces all
 	 * possible values. Due to the structure of the DN, the comparison is more
 	 * complicated than string-based wildcard matching.
 	 * <p>
@@ -85,11 +94,11 @@
 	 * The format of a wildcard match pattern is:
 	 * 
 	 * <pre>
-	 * matchPattern	::= dn-match ( ';' dn-match ) *
-	 * dn-match 	::= ( '*' | rdn-match ) ( ',' rdn-match ) * | '-'
-	 * rdn-match 	::= name '=' value-match
-	 * value-match 	::= '*' | value-star
-	 * value-star 	::= &lt; value, requires escaped '*' and '-' &gt;
+	 * matchPattern ::= dn-match ( ';' dn-match ) *
+	 * dn-match     ::= ( '*' | rdn-match ) ( ',' rdn-match ) * | '-'
+	 * rdn-match    ::= name '=' value-match
+	 * value-match  ::= '*' | value-star
+	 * value-star   ::= &lt; value, requires escaped '*' and '-' &gt;
 	 * </pre>
 	 * <p>
 	 * The most simple case is a single wildcard; it must match any DN. A
@@ -144,8 +153,8 @@
 	 * </pre>
 	 * 
 	 * <p>
-	 * A match pattern may contain a chain of DN match patterns. The
-	 * semicolon(';' &#92;u003B) must be used to separate DN match patterns in a
+	 * A match pattern may contain a chain of DN match patterns. The semicolon(
+	 * {@code ';'} &#92;u003B) must be used to separate DN match patterns in a
 	 * chain. Wildcards can also be used to match against a complete DN within a
 	 * chain.
 	 * <p>
@@ -158,10 +167,10 @@
 	 * </pre>
 	 * <p>
 	 * The wildcard ('*') matches zero or one DN in the chain, however,
-	 * sometimes it is necessary to match a longer chain. The minus sign ('-'
-	 * &#92;u002D) represents zero or more DNs, whereas the asterisk only
-	 * represents a single DN. For example, to match a DN where the Tweety Inc.
-	 * is in the DN chain, use the following expression:
+	 * sometimes it is necessary to match a longer chain. The minus sign (
+	 * {@code '-'} &#92;u002D) represents zero or more DNs, whereas the asterisk
+	 * only represents a single DN. For example, to match a DN where the Tweety
+	 * Inc. is in the DN chain, use the following expression:
 	 * </p>
 	 * 
 	 * <pre>
@@ -179,8 +188,7 @@
 	 *         chain is invalid.
 	 * @since 1.5
 	 */
-	public static boolean matchDistinguishedNameChain(String matchPattern,
-			List<String> dnChain) {
+	public static boolean matchDistinguishedNameChain(String matchPattern, List<String> dnChain) {
 		return DNChainMatching.match(matchPattern, dnChain);
 	}
 
@@ -190,16 +198,14 @@
 	 * which defined the specified class.
 	 * 
 	 * @param classFromBundle A class defined by a bundle class loader.
-	 * @return A {@code Bundle} for the specified bundle class or
-	 *         {@code null} if the specified class was not defined by a
-	 *         bundle class loader.
+	 * @return A {@code Bundle} for the specified bundle class or {@code null}
+	 *         if the specified class was not defined by a bundle class loader.
 	 * @since 1.5
 	 */
-	public static Bundle getBundle(final Class< ? > classFromBundle) {
+	public static Bundle getBundle(final Class<?> classFromBundle) {
 		// We use doPriv since the caller may not have permission
 		// to call getClassLoader.
-		Object cl = AccessController
-				.doPrivileged(new PrivilegedAction<Object>() {
+		Object cl = AccessController.doPrivileged(new PrivilegedAction<Object>() {
 			public Object run() {
 				return classFromBundle.getClassLoader();
 			}
@@ -212,6 +218,1457 @@
 	}
 
 	/**
+	 * RFC 1960-based Filter. Filter objects can be created by calling the
+	 * constructor with the desired filter string. A Filter object can be called
+	 * numerous times to determine if the match argument matches the filter
+	 * string that was used to create the Filter object.
+	 * 
+	 * <p>
+	 * The syntax of a filter string is the string representation of LDAP search
+	 * filters as defined in RFC 1960: <i>A String Representation of LDAP Search
+	 * Filters</i> (available at http://www.ietf.org/rfc/rfc1960.txt). It should
+	 * be noted that RFC 2254: <i>A String Representation of LDAP Search
+	 * Filters</i> (available at http://www.ietf.org/rfc/rfc2254.txt) supersedes
+	 * RFC 1960 but only adds extensible matching and is not applicable for this
+	 * API.
+	 * 
+	 * <p>
+	 * The string representation of an LDAP search filter is defined by the
+	 * following grammar. It uses a prefix format.
+	 * 
+	 * <pre>
+	 *   &lt;filter&gt; ::= '(' &lt;filtercomp&gt; ')'
+	 *   &lt;filtercomp&gt; ::= &lt;and&gt; | &lt;or&gt; | &lt;not&gt; | &lt;item&gt;
+	 *   &lt;and&gt; ::= '&amp;' &lt;filterlist&gt;
+	 *   &lt;or&gt; ::= '|' &lt;filterlist&gt;
+	 *   &lt;not&gt; ::= '!' &lt;filter&gt;
+	 *   &lt;filterlist&gt; ::= &lt;filter&gt; | &lt;filter&gt; &lt;filterlist&gt;
+	 *   &lt;item&gt; ::= &lt;simple&gt; | &lt;present&gt; | &lt;substring&gt;
+	 *   &lt;simple&gt; ::= &lt;attr&gt; &lt;filtertype&gt; &lt;value&gt;
+	 *   &lt;filtertype&gt; ::= &lt;equal&gt; | &lt;approx&gt; | &lt;greater&gt; | &lt;less&gt;
+	 *   &lt;equal&gt; ::= '='
+	 *   &lt;approx&gt; ::= '&tilde;='
+	 *   &lt;greater&gt; ::= '&gt;='
+	 *   &lt;less&gt; ::= '&lt;='
+	 *   &lt;present&gt; ::= &lt;attr&gt; '=*'
+	 *   &lt;substring&gt; ::= &lt;attr&gt; '=' &lt;initial&gt; &lt;any&gt; &lt;final&gt;
+	 *   &lt;initial&gt; ::= NULL | &lt;value&gt;
+	 *   &lt;any&gt; ::= '*' &lt;starval&gt;
+	 *   &lt;starval&gt; ::= NULL | &lt;value&gt; '*' &lt;starval&gt;
+	 *   &lt;final&gt; ::= NULL | &lt;value&gt;
+	 * </pre>
+	 * 
+	 * {@code &lt;attr&gt;} is a string representing an attribute, or key, in
+	 * the properties objects of the registered services. Attribute names are
+	 * not case sensitive; that is cn and CN both refer to the same attribute.
+	 * {@code &lt;value&gt;} is a string representing the value, or part of one,
+	 * of a key in the properties objects of the registered services. If a
+	 * {@code &lt;value&gt;} must contain one of the characters ' {@code *}' or
+	 * '{@code (}' or '{@code )}', these characters should be escaped by
+	 * preceding them with the backslash '{@code \}' character. Note that
+	 * although both the {@code &lt;substring&gt;} and {@code &lt;present&gt;}
+	 * productions can produce the {@code 'attr=*'} construct, this construct is
+	 * used only to denote a presence filter.
+	 * 
+	 * <p>
+	 * Examples of LDAP filters are:
+	 * 
+	 * <pre>
+	 *   &quot;(cn=Babs Jensen)&quot;
+	 *   &quot;(!(cn=Tim Howes))&quot;
+	 *   &quot;(&amp;(&quot; + Constants.OBJECTCLASS + &quot;=Person)(|(sn=Jensen)(cn=Babs J*)))&quot;
+	 *   &quot;(o=univ*of*mich*)&quot;
+	 * </pre>
+	 * 
+	 * <p>
+	 * The approximate match ({@code ~=}) is implementation specific but should
+	 * at least ignore case and white space differences. Optional are codes like
+	 * soundex or other smart "closeness" comparisons.
+	 * 
+	 * <p>
+	 * Comparison of values is not straightforward. Strings are compared
+	 * differently than numbers and it is possible for a key to have multiple
+	 * values. Note that that keys in the match argument must always be strings.
+	 * The comparison is defined by the object type of the key's value. The
+	 * following rules apply for comparison:
+	 * 
+	 * <blockquote>
+	 * <TABLE BORDER=0>
+	 * <TR>
+	 * <TD><b>Property Value Type </b></TD>
+	 * <TD><b>Comparison Type</b></TD>
+	 * </TR>
+	 * <TR>
+	 * <TD>String</TD>
+	 * <TD>String comparison</TD>
+	 * </TR>
+	 * <TR valign=top>
+	 * <TD>Integer, Long, Float, Double, Byte, Short, BigInteger, BigDecimal</TD>
+	 * <TD>numerical comparison</TD>
+	 * </TR>
+	 * <TR>
+	 * <TD>Character</TD>
+	 * <TD>character comparison</TD>
+	 * </TR>
+	 * <TR>
+	 * <TD>Boolean</TD>
+	 * <TD>equality comparisons only</TD>
+	 * </TR>
+	 * <TR>
+	 * <TD>[] (array)</TD>
+	 * <TD>recursively applied to values</TD>
+	 * </TR>
+	 * <TR>
+	 * <TD>Collection</TD>
+	 * <TD>recursively applied to values</TD>
+	 * </TR>
+	 * </TABLE>
+	 * Note: arrays of primitives are also supported. </blockquote>
+	 * 
+	 * A filter matches a key that has multiple values if it matches at least
+	 * one of those values. For example,
+	 * 
+	 * <pre>
+	 * Dictionary d = new Hashtable();
+	 * d.put(&quot;cn&quot;, new String[] {&quot;a&quot;, &quot;b&quot;, &quot;c&quot;});
+	 * </pre>
+	 * 
+	 * d will match {@code (cn=a)} and also {@code (cn=b)}
+	 * 
+	 * <p>
+	 * A filter component that references a key having an unrecognizable data
+	 * type will evaluate to {@code false} .
+	 */
+	static private final class FilterImpl implements Filter {
+		/* filter operators */
+		private static final int	EQUAL		= 1;
+		private static final int	APPROX		= 2;
+		private static final int	GREATER		= 3;
+		private static final int	LESS		= 4;
+		private static final int	PRESENT		= 5;
+		private static final int	SUBSTRING	= 6;
+		private static final int	AND			= 7;
+		private static final int	OR			= 8;
+		private static final int	NOT			= 9;
+
+		/** filter operation */
+		private final int			op;
+		/** filter attribute or null if operation AND, OR or NOT */
+		private final String		attr;
+		/** filter operands */
+		private final Object		value;
+
+		/* normalized filter string for Filter object */
+		private transient String	filterString;
+
+		/**
+		 * Constructs a {@link FilterImpl} object. This filter object may be
+		 * used to match a {@link ServiceReference} or a Dictionary.
+		 * 
+		 * <p>
+		 * If the filter cannot be parsed, an {@link InvalidSyntaxException}
+		 * will be thrown with a human readable message where the filter became
+		 * unparsable.
+		 * 
+		 * @param filterString the filter string.
+		 * @throws InvalidSyntaxException If the filter parameter contains an
+		 *         invalid filter string that cannot be parsed.
+		 */
+		static FilterImpl newInstance(String filterString) throws InvalidSyntaxException {
+			return new Parser(filterString).parse();
+		}
+
+		FilterImpl(int operation, String attr, Object value) {
+			this.op = operation;
+			this.attr = attr;
+			this.value = value;
+			filterString = null;
+		}
+
+		/**
+		 * Filter using a service's properties.
+		 * <p>
+		 * This {@code Filter} is executed using the keys and values of the
+		 * referenced service's properties. The keys are looked up in a case
+		 * insensitive manner.
+		 * 
+		 * @param reference The reference to the service whose properties are
+		 *        used in the match.
+		 * @return {@code true} if the service's properties match this
+		 *         {@code Filter}; {@code false} otherwise.
+		 */
+		public boolean match(ServiceReference<?> reference) {
+			return matches(new ServiceReferenceMap(reference));
+		}
+
+		/**
+		 * Filter using a {@code Dictionary} with case insensitive key lookup.
+		 * This {@code Filter} is executed using the specified
+		 * {@code Dictionary}'s keys and values. The keys are looked up in a
+		 * case insensitive manner.
+		 * 
+		 * @param dictionary The {@code Dictionary} whose key/value pairs are
+		 *        used in the match.
+		 * @return {@code true} if the {@code Dictionary}'s values match this
+		 *         filter; {@code false} otherwise.
+		 * @throws IllegalArgumentException If {@code dictionary} contains case
+		 *         variants of the same key name.
+		 */
+		public boolean match(Dictionary<String, ?> dictionary) {
+			return matches(new CaseInsensitiveMap(dictionary));
+		}
+
+		/**
+		 * Filter using a {@code Dictionary}. This {@code Filter} is executed
+		 * using the specified {@code Dictionary}'s keys and values. The keys
+		 * are looked up in a normal manner respecting case.
+		 * 
+		 * @param dictionary The {@code Dictionary} whose key/value pairs are
+		 *        used in the match.
+		 * @return {@code true} if the {@code Dictionary}'s values match this
+		 *         filter; {@code false} otherwise.
+		 * @since 1.3
+		 */
+		public boolean matchCase(Dictionary<String, ?> dictionary) {
+			switch (op) {
+				case AND : {
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						if (!f.matchCase(dictionary)) {
+							return false;
+						}
+					}
+					return true;
+				}
+
+				case OR : {
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						if (f.matchCase(dictionary)) {
+							return true;
+						}
+					}
+					return false;
+				}
+
+				case NOT : {
+					FilterImpl filter = (FilterImpl) value;
+					return !filter.matchCase(dictionary);
+				}
+
+				case SUBSTRING :
+				case EQUAL :
+				case GREATER :
+				case LESS :
+				case APPROX : {
+					Object prop = (dictionary == null) ? null : dictionary.get(attr);
+					return compare(op, prop, value);
+				}
+
+				case PRESENT : {
+					Object prop = (dictionary == null) ? null : dictionary.get(attr);
+					return prop != null;
+				}
+			}
+
+			return false;
+		}
+
+		/**
+		 * Filter using a {@code Map}. This {@code Filter} is executed using the
+		 * specified {@code Map}'s keys and values. The keys are looked up in a
+		 * normal manner respecting case.
+		 * 
+		 * @param map The {@code Map} whose key/value pairs are used in the
+		 *        match. Maps with {@code null} key or values are not supported.
+		 *        A {@code null} value is considered not present to the filter.
+		 * @return {@code true} if the {@code Map}'s values match this filter;
+		 *         {@code false} otherwise.
+		 * @since 1.6
+		 */
+		public boolean matches(Map<String, ?> map) {
+			switch (op) {
+				case AND : {
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						if (!f.matches(map)) {
+							return false;
+						}
+					}
+					return true;
+				}
+
+				case OR : {
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						if (f.matches(map)) {
+							return true;
+						}
+					}
+					return false;
+				}
+
+				case NOT : {
+					FilterImpl filter = (FilterImpl) value;
+					return !filter.matches(map);
+				}
+
+				case SUBSTRING :
+				case EQUAL :
+				case GREATER :
+				case LESS :
+				case APPROX : {
+					Object prop = (map == null) ? null : map.get(attr);
+					return compare(op, prop, value);
+				}
+
+				case PRESENT : {
+					Object prop = (map == null) ? null : map.get(attr);
+					return prop != null;
+				}
+			}
+
+			return false;
+		}
+
+		/**
+		 * Returns this {@code Filter}'s filter string.
+		 * <p>
+		 * The filter string is normalized by removing whitespace which does not
+		 * affect the meaning of the filter.
+		 * 
+		 * @return This {@code Filter}'s filter string.
+		 */
+		public String toString() {
+			String result = filterString;
+			if (result == null) {
+				filterString = result = normalize().toString();
+			}
+			return result;
+		}
+
+		/**
+		 * Returns this {@code Filter}'s normalized filter string.
+		 * <p>
+		 * The filter string is normalized by removing whitespace which does not
+		 * affect the meaning of the filter.
+		 * 
+		 * @return This {@code Filter}'s filter string.
+		 */
+		private StringBuffer normalize() {
+			StringBuffer sb = new StringBuffer();
+			sb.append('(');
+
+			switch (op) {
+				case AND : {
+					sb.append('&');
+
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						sb.append(f.normalize());
+					}
+
+					break;
+				}
+
+				case OR : {
+					sb.append('|');
+
+					FilterImpl[] filters = (FilterImpl[]) value;
+					for (FilterImpl f : filters) {
+						sb.append(f.normalize());
+					}
+
+					break;
+				}
+
+				case NOT : {
+					sb.append('!');
+					FilterImpl filter = (FilterImpl) value;
+					sb.append(filter.normalize());
+
+					break;
+				}
+
+				case SUBSTRING : {
+					sb.append(attr);
+					sb.append('=');
+
+					String[] substrings = (String[]) value;
+
+					for (String substr : substrings) {
+						if (substr == null) /* * */{
+							sb.append('*');
+						} else /* xxx */{
+							sb.append(encodeValue(substr));
+						}
+					}
+
+					break;
+				}
+				case EQUAL : {
+					sb.append(attr);
+					sb.append('=');
+					sb.append(encodeValue((String) value));
+
+					break;
+				}
+				case GREATER : {
+					sb.append(attr);
+					sb.append(">=");
+					sb.append(encodeValue((String) value));
+
+					break;
+				}
+				case LESS : {
+					sb.append(attr);
+					sb.append("<=");
+					sb.append(encodeValue((String) value));
+
+					break;
+				}
+				case APPROX : {
+					sb.append(attr);
+					sb.append("~=");
+					sb.append(encodeValue(approxString((String) value)));
+
+					break;
+				}
+
+				case PRESENT : {
+					sb.append(attr);
+					sb.append("=*");
+
+					break;
+				}
+			}
+
+			sb.append(')');
+
+			return sb;
+		}
+
+		/**
+		 * Compares this {@code Filter} to another {@code Filter}.
+		 * 
+		 * <p>
+		 * This implementation returns the result of calling
+		 * {@code this.toString().equals(obj.toString()}.
+		 * 
+		 * @param obj The object to compare against this {@code Filter}.
+		 * @return If the other object is a {@code Filter} object, then returns
+		 *         the result of calling
+		 *         {@code this.toString().equals(obj.toString()}; {@code false}
+		 *         otherwise.
+		 */
+		public boolean equals(Object obj) {
+			if (obj == this) {
+				return true;
+			}
+
+			if (!(obj instanceof Filter)) {
+				return false;
+			}
+
+			return this.toString().equals(obj.toString());
+		}
+
+		/**
+		 * Returns the hashCode for this {@code Filter}.
+		 * 
+		 * <p>
+		 * This implementation returns the result of calling
+		 * {@code this.toString().hashCode()}.
+		 * 
+		 * @return The hashCode of this {@code Filter}.
+		 */
+		public int hashCode() {
+			return this.toString().hashCode();
+		}
+
+		/**
+		 * Encode the value string such that '(', '*', ')' and '\' are escaped.
+		 * 
+		 * @param value unencoded value string.
+		 * @return encoded value string.
+		 */
+		private static String encodeValue(String value) {
+			boolean encoded = false;
+			int inlen = value.length();
+			int outlen = inlen << 1; /* inlen 2 */
+
+			char[] output = new char[outlen];
+			value.getChars(0, inlen, output, inlen);
+
+			int cursor = 0;
+			for (int i = inlen; i < outlen; i++) {
+				char c = output[i];
+
+				switch (c) {
+					case '(' :
+					case '*' :
+					case ')' :
+					case '\\' : {
+						output[cursor] = '\\';
+						cursor++;
+						encoded = true;
+
+						break;
+					}
+				}
+
+				output[cursor] = c;
+				cursor++;
+			}
+
+			return encoded ? new String(output, 0, cursor) : value;
+		}
+
+		private boolean compare(int operation, Object value1, Object value2) {
+			if (value1 == null) {
+				return false;
+			}
+			if (value1 instanceof String) {
+				return compare_String(operation, (String) value1, value2);
+			}
+
+			Class<?> clazz = value1.getClass();
+			if (clazz.isArray()) {
+				Class<?> type = clazz.getComponentType();
+				if (type.isPrimitive()) {
+					return compare_PrimitiveArray(operation, type, value1, value2);
+				}
+				return compare_ObjectArray(operation, (Object[]) value1, value2);
+			}
+			if (value1 instanceof Collection<?>) {
+				return compare_Collection(operation, (Collection<?>) value1, value2);
+			}
+			if (value1 instanceof Integer) {
+				return compare_Integer(operation, ((Integer) value1).intValue(), value2);
+			}
+			if (value1 instanceof Long) {
+				return compare_Long(operation, ((Long) value1).longValue(), value2);
+			}
+			if (value1 instanceof Byte) {
+				return compare_Byte(operation, ((Byte) value1).byteValue(), value2);
+			}
+			if (value1 instanceof Short) {
+				return compare_Short(operation, ((Short) value1).shortValue(), value2);
+			}
+			if (value1 instanceof Character) {
+				return compare_Character(operation, ((Character) value1).charValue(), value2);
+			}
+			if (value1 instanceof Float) {
+				return compare_Float(operation, ((Float) value1).floatValue(), value2);
+			}
+			if (value1 instanceof Double) {
+				return compare_Double(operation, ((Double) value1).doubleValue(), value2);
+			}
+			if (value1 instanceof Boolean) {
+				return compare_Boolean(operation, ((Boolean) value1).booleanValue(), value2);
+			}
+			if (value1 instanceof Comparable<?>) {
+				Comparable<Object> comparable = (Comparable<Object>) value1;
+				return compare_Comparable(operation, comparable, value2);
+			}
+			return compare_Unknown(operation, value1, value2);
+		}
+
+		private boolean compare_Collection(int operation, Collection<?> collection, Object value2) {
+			for (Object value1 : collection) {
+				if (compare(operation, value1, value2)) {
+					return true;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_ObjectArray(int operation, Object[] array, Object value2) {
+			for (Object value1 : array) {
+				if (compare(operation, value1, value2)) {
+					return true;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_PrimitiveArray(int operation, Class<?> type, Object primarray, Object value2) {
+			if (Integer.TYPE.isAssignableFrom(type)) {
+				int[] array = (int[]) primarray;
+				for (int value1 : array) {
+					if (compare_Integer(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Long.TYPE.isAssignableFrom(type)) {
+				long[] array = (long[]) primarray;
+				for (long value1 : array) {
+					if (compare_Long(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Byte.TYPE.isAssignableFrom(type)) {
+				byte[] array = (byte[]) primarray;
+				for (byte value1 : array) {
+					if (compare_Byte(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Short.TYPE.isAssignableFrom(type)) {
+				short[] array = (short[]) primarray;
+				for (short value1 : array) {
+					if (compare_Short(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Character.TYPE.isAssignableFrom(type)) {
+				char[] array = (char[]) primarray;
+				for (char value1 : array) {
+					if (compare_Character(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Float.TYPE.isAssignableFrom(type)) {
+				float[] array = (float[]) primarray;
+				for (float value1 : array) {
+					if (compare_Float(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Double.TYPE.isAssignableFrom(type)) {
+				double[] array = (double[]) primarray;
+				for (double value1 : array) {
+					if (compare_Double(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			if (Boolean.TYPE.isAssignableFrom(type)) {
+				boolean[] array = (boolean[]) primarray;
+				for (boolean value1 : array) {
+					if (compare_Boolean(operation, value1, value2)) {
+						return true;
+					}
+				}
+				return false;
+			}
+			return false;
+		}
+
+		private boolean compare_String(int operation, String string, Object value2) {
+			switch (operation) {
+				case SUBSTRING : {
+					String[] substrings = (String[]) value2;
+					int pos = 0;
+					for (int i = 0, size = substrings.length; i < size; i++) {
+						String substr = substrings[i];
+
+						if (i + 1 < size) /* if this is not that last substr */{
+							if (substr == null) /* * */{
+								String substr2 = substrings[i + 1];
+
+								if (substr2 == null) /* ** */
+									continue; /* ignore first star */
+								/* xxx */
+								int index = string.indexOf(substr2, pos);
+								if (index == -1) {
+									return false;
+								}
+
+								pos = index + substr2.length();
+								if (i + 2 < size) // if there are more
+									// substrings, increment
+									// over the string we just
+									// matched; otherwise need
+									// to do the last substr
+									// check
+									i++;
+							} else /* xxx */{
+								int len = substr.length();
+								if (string.regionMatches(pos, substr, 0, len)) {
+									pos += len;
+								} else {
+									return false;
+								}
+							}
+						} else /* last substr */{
+							if (substr == null) /* * */{
+								return true;
+							}
+							/* xxx */
+							return string.endsWith(substr);
+						}
+					}
+
+					return true;
+				}
+				case EQUAL : {
+					return string.equals(value2);
+				}
+				case APPROX : {
+					string = approxString(string);
+					String string2 = approxString((String) value2);
+
+					return string.equalsIgnoreCase(string2);
+				}
+				case GREATER : {
+					return string.compareTo((String) value2) >= 0;
+				}
+				case LESS : {
+					return string.compareTo((String) value2) <= 0;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Integer(int operation, int intval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			int intval2;
+			try {
+				intval2 = Integer.parseInt(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return intval == intval2;
+				}
+				case GREATER : {
+					return intval >= intval2;
+				}
+				case LESS : {
+					return intval <= intval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Long(int operation, long longval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			long longval2;
+			try {
+				longval2 = Long.parseLong(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return longval == longval2;
+				}
+				case GREATER : {
+					return longval >= longval2;
+				}
+				case LESS : {
+					return longval <= longval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Byte(int operation, byte byteval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			byte byteval2;
+			try {
+				byteval2 = Byte.parseByte(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return byteval == byteval2;
+				}
+				case GREATER : {
+					return byteval >= byteval2;
+				}
+				case LESS : {
+					return byteval <= byteval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Short(int operation, short shortval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			short shortval2;
+			try {
+				shortval2 = Short.parseShort(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return shortval == shortval2;
+				}
+				case GREATER : {
+					return shortval >= shortval2;
+				}
+				case LESS : {
+					return shortval <= shortval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Character(int operation, char charval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			char charval2;
+			try {
+				charval2 = ((String) value2).charAt(0);
+			} catch (IndexOutOfBoundsException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case EQUAL : {
+					return charval == charval2;
+				}
+				case APPROX : {
+					return (charval == charval2) || (Character.toUpperCase(charval) == Character.toUpperCase(charval2)) || (Character.toLowerCase(charval) == Character.toLowerCase(charval2));
+				}
+				case GREATER : {
+					return charval >= charval2;
+				}
+				case LESS : {
+					return charval <= charval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Boolean(int operation, boolean boolval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			boolean boolval2 = Boolean.valueOf(((String) value2).trim()).booleanValue();
+			switch (operation) {
+				case APPROX :
+				case EQUAL :
+				case GREATER :
+				case LESS : {
+					return boolval == boolval2;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Float(int operation, float floatval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			float floatval2;
+			try {
+				floatval2 = Float.parseFloat(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return Float.compare(floatval, floatval2) == 0;
+				}
+				case GREATER : {
+					return Float.compare(floatval, floatval2) >= 0;
+				}
+				case LESS : {
+					return Float.compare(floatval, floatval2) <= 0;
+				}
+			}
+			return false;
+		}
+
+		private boolean compare_Double(int operation, double doubleval, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			double doubleval2;
+			try {
+				doubleval2 = Double.parseDouble(((String) value2).trim());
+			} catch (IllegalArgumentException e) {
+				return false;
+			}
+
+			switch (operation) {
+				case APPROX :
+				case EQUAL : {
+					return Double.compare(doubleval, doubleval2) == 0;
+				}
+				case GREATER : {
+					return Double.compare(doubleval, doubleval2) >= 0;
+				}
+				case LESS : {
+					return Double.compare(doubleval, doubleval2) <= 0;
+				}
+			}
+			return false;
+		}
+
+		private static Object valueOf(Class<?> target, String value2) {
+			do {
+				Method method;
+				try {
+					method = target.getMethod("valueOf", String.class);
+				} catch (NoSuchMethodException e) {
+					break;
+				}
+				if (Modifier.isStatic(method.getModifiers()) && target.isAssignableFrom(method.getReturnType())) {
+					setAccessible(method);
+					try {
+						return method.invoke(null, value2.trim());
+					} catch (IllegalAccessException e) {
+						return null;
+					} catch (InvocationTargetException e) {
+						return null;
+					}
+				}
+			} while (false);
+
+			do {
+				Constructor<?> constructor;
+				try {
+					constructor = target.getConstructor(String.class);
+				} catch (NoSuchMethodException e) {
+					break;
+				}
+				setAccessible(constructor);
+				try {
+					return constructor.newInstance(value2.trim());
+				} catch (IllegalAccessException e) {
+					return null;
+				} catch (InvocationTargetException e) {
+					return null;
+				} catch (InstantiationException e) {
+					return null;
+				}
+			} while (false);
+
+			return null;
+		}
+
+		private static void setAccessible(AccessibleObject accessible) {
+			if (!accessible.isAccessible()) {
+				AccessController.doPrivileged(new SetAccessibleAction(accessible));
+			}
+		}
+
+		private boolean compare_Comparable(int operation, Comparable<Object> value1, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			value2 = valueOf(value1.getClass(), (String) value2);
+			if (value2 == null) {
+				return false;
+			}
+			try {
+				switch (operation) {
+					case APPROX :
+					case EQUAL : {
+						return value1.compareTo(value2) == 0;
+					}
+					case GREATER : {
+						return value1.compareTo(value2) >= 0;
+					}
+					case LESS : {
+						return value1.compareTo(value2) <= 0;
+					}
+				}
+			} catch (Exception e) {
+				// if the compareTo method throws an exception; return false
+				return false;
+			}
+			return false;
+		}
+
+		private boolean compare_Unknown(int operation, Object value1, Object value2) {
+			if (operation == SUBSTRING) {
+				return false;
+			}
+			value2 = valueOf(value1.getClass(), (String) value2);
+			if (value2 == null) {
+				return false;
+			}
+			try {
+				switch (operation) {
+					case APPROX :
+					case EQUAL :
+					case GREATER :
+					case LESS : {
+						return value1.equals(value2);
+					}
+				}
+			} catch (Exception e) {
+				// if the equals method throws an exception; return false
+				return false;
+			}
+			return false;
+		}
+
+		/**
+		 * Map a string for an APPROX (~=) comparison.
+		 * 
+		 * This implementation removes white spaces. This is the minimum
+		 * implementation allowed by the OSGi spec.
+		 * 
+		 * @param input Input string.
+		 * @return String ready for APPROX comparison.
+		 */
+		private static String approxString(String input) {
+			boolean changed = false;
+			char[] output = input.toCharArray();
+			int cursor = 0;
+			for (char c : output) {
+				if (Character.isWhitespace(c)) {
+					changed = true;
+					continue;
+				}
+
+				output[cursor] = c;
+				cursor++;
+			}
+
+			return changed ? new String(output, 0, cursor) : input;
+		}
+
+		/**
+		 * Parser class for OSGi filter strings. This class parses the complete
+		 * filter string and builds a tree of Filter objects rooted at the
+		 * parent.
+		 */
+		static private final class Parser {
+			private final String	filterstring;
+			private final char[]	filterChars;
+			private int				pos;
+
+			Parser(String filterstring) {
+				this.filterstring = filterstring;
+				filterChars = filterstring.toCharArray();
+				pos = 0;
+			}
+
+			FilterImpl parse() throws InvalidSyntaxException {
+				FilterImpl filter;
+				try {
+					filter = parse_filter();
+				} catch (ArrayIndexOutOfBoundsException e) {
+					throw new InvalidSyntaxException("Filter ended abruptly", filterstring, e);
+				}
+
+				if (pos != filterChars.length) {
+					throw new InvalidSyntaxException("Extraneous trailing characters: " + filterstring.substring(pos), filterstring);
+				}
+				return filter;
+			}
+
+			private FilterImpl parse_filter() throws InvalidSyntaxException {
+				FilterImpl filter;
+				skipWhiteSpace();
+
+				if (filterChars[pos] != '(') {
+					throw new InvalidSyntaxException("Missing '(': " + filterstring.substring(pos), filterstring);
+				}
+
+				pos++;
+
+				filter = parse_filtercomp();
+
+				skipWhiteSpace();
+
+				if (filterChars[pos] != ')') {
+					throw new InvalidSyntaxException("Missing ')': " + filterstring.substring(pos), filterstring);
+				}
+
+				pos++;
+
+				skipWhiteSpace();
+
+				return filter;
+			}
+
+			private FilterImpl parse_filtercomp() throws InvalidSyntaxException {
+				skipWhiteSpace();
+
+				char c = filterChars[pos];
+
+				switch (c) {
+					case '&' : {
+						pos++;
+						return parse_and();
+					}
+					case '|' : {
+						pos++;
+						return parse_or();
+					}
+					case '!' : {
+						pos++;
+						return parse_not();
+					}
+				}
+				return parse_item();
+			}
+
+			private FilterImpl parse_and() throws InvalidSyntaxException {
+				int lookahead = pos;
+				skipWhiteSpace();
+
+				if (filterChars[pos] != '(') {
+					pos = lookahead - 1;
+					return parse_item();
+				}
+
+				List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
+
+				while (filterChars[pos] == '(') {
+					FilterImpl child = parse_filter();
+					operands.add(child);
+				}
+
+				return new FilterImpl(FilterImpl.AND, null, operands.toArray(new FilterImpl[operands.size()]));
+			}
+
+			private FilterImpl parse_or() throws InvalidSyntaxException {
+				int lookahead = pos;
+				skipWhiteSpace();
+
+				if (filterChars[pos] != '(') {
+					pos = lookahead - 1;
+					return parse_item();
+				}
+
+				List<FilterImpl> operands = new ArrayList<FilterImpl>(10);
+
+				while (filterChars[pos] == '(') {
+					FilterImpl child = parse_filter();
+					operands.add(child);
+				}
+
+				return new FilterImpl(FilterImpl.OR, null, operands.toArray(new FilterImpl[operands.size()]));
+			}
+
+			private FilterImpl parse_not() throws InvalidSyntaxException {
+				int lookahead = pos;
+				skipWhiteSpace();
+
+				if (filterChars[pos] != '(') {
+					pos = lookahead - 1;
+					return parse_item();
+				}
+
+				FilterImpl child = parse_filter();
+
+				return new FilterImpl(FilterImpl.NOT, null, child);
+			}
+
+			private FilterImpl parse_item() throws InvalidSyntaxException {
+				String attr = parse_attr();
+
+				skipWhiteSpace();
+
+				switch (filterChars[pos]) {
+					case '~' : {
+						if (filterChars[pos + 1] == '=') {
+							pos += 2;
+							return new FilterImpl(FilterImpl.APPROX, attr, parse_value());
+						}
+						break;
+					}
+					case '>' : {
+						if (filterChars[pos + 1] == '=') {
+							pos += 2;
+							return new FilterImpl(FilterImpl.GREATER, attr, parse_value());
+						}
+						break;
+					}
+					case '<' : {
+						if (filterChars[pos + 1] == '=') {
+							pos += 2;
+							return new FilterImpl(FilterImpl.LESS, attr, parse_value());
+						}
+						break;
+					}
+					case '=' : {
+						if (filterChars[pos + 1] == '*') {
+							int oldpos = pos;
+							pos += 2;
+							skipWhiteSpace();
+							if (filterChars[pos] == ')') {
+								return new FilterImpl(FilterImpl.PRESENT, attr, null);
+							}
+							pos = oldpos;
+						}
+
+						pos++;
+						Object string = parse_substring();
+
+						if (string instanceof String) {
+							return new FilterImpl(FilterImpl.EQUAL, attr, string);
+						}
+						return new FilterImpl(FilterImpl.SUBSTRING, attr, string);
+					}
+				}
+
+				throw new InvalidSyntaxException("Invalid operator: " + filterstring.substring(pos), filterstring);
+			}
+
+			private String parse_attr() throws InvalidSyntaxException {
+				skipWhiteSpace();
+
+				int begin = pos;
+				int end = pos;
+
+				char c = filterChars[pos];
+
+				while (c != '~' && c != '<' && c != '>' && c != '=' && c != '(' && c != ')') {
+					pos++;
+
+					if (!Character.isWhitespace(c)) {
+						end = pos;
+					}
+
+					c = filterChars[pos];
+				}
+
+				int length = end - begin;
+
+				if (length == 0) {
+					throw new InvalidSyntaxException("Missing attr: " + filterstring.substring(pos), filterstring);
+				}
+
+				return new String(filterChars, begin, length);
+			}
+
+			private String parse_value() throws InvalidSyntaxException {
+				StringBuffer sb = new StringBuffer(filterChars.length - pos);
+
+				parseloop: while (true) {
+					char c = filterChars[pos];
+
+					switch (c) {
+						case ')' : {
+							break parseloop;
+						}
+
+						case '(' : {
+							throw new InvalidSyntaxException("Invalid value: " + filterstring.substring(pos), filterstring);
+						}
+
+						case '\\' : {
+							pos++;
+							c = filterChars[pos];
+							/* fall through into default */
+						}
+
+						default : {
+							sb.append(c);
+							pos++;
+							break;
+						}
+					}
+				}
+
+				if (sb.length() == 0) {
+					throw new InvalidSyntaxException("Missing value: " + filterstring.substring(pos), filterstring);
+				}
+
+				return sb.toString();
+			}
+
+			private Object parse_substring() throws InvalidSyntaxException {
+				StringBuffer sb = new StringBuffer(filterChars.length - pos);
+
+				List<String> operands = new ArrayList<String>(10);
+
+				parseloop: while (true) {
+					char c = filterChars[pos];
+
+					switch (c) {
+						case ')' : {
+							if (sb.length() > 0) {
+								operands.add(sb.toString());
+							}
+
+							break parseloop;
+						}
+
+						case '(' : {
+							throw new InvalidSyntaxException("Invalid value: " + filterstring.substring(pos), filterstring);
+						}
+
+						case '*' : {
+							if (sb.length() > 0) {
+								operands.add(sb.toString());
+							}
+
+							sb.setLength(0);
+
+							operands.add(null);
+							pos++;
+
+							break;
+						}
+
+						case '\\' : {
+							pos++;
+							c = filterChars[pos];
+							/* fall through into default */
+						}
+
+						default : {
+							sb.append(c);
+							pos++;
+							break;
+						}
+					}
+				}
+
+				int size = operands.size();
+
+				if (size == 0) {
+					return "";
+				}
+
+				if (size == 1) {
+					Object single = operands.get(0);
+
+					if (single != null) {
+						return single;
+					}
+				}
+
+				return operands.toArray(new String[size]);
+			}
+
+			private void skipWhiteSpace() {
+				for (int length = filterChars.length; (pos < length) && Character.isWhitespace(filterChars[pos]);) {
+					pos++;
+				}
+			}
+		}
+	}
+
+	/**
+	 * This Map is used for case-insensitive key lookup during filter
+	 * evaluation. This Map implementation only supports the get operation using
+	 * a String key as no other operations are used by the Filter
+	 * implementation.
+	 */
+	static private final class CaseInsensitiveMap extends AbstractMap<String, Object> implements Map<String, Object> {
+		private final Dictionary<String, ?>	dictionary;
+		private final String[]				keys;
+
+		/**
+		 * Create a case insensitive map from the specified dictionary.
+		 * 
+		 * @param dictionary
+		 * @throws IllegalArgumentException If {@code dictionary} contains case
+		 *         variants of the same key name.
+		 */
+		CaseInsensitiveMap(Dictionary<String, ?> dictionary) {
+			if (dictionary == null) {
+				this.dictionary = null;
+				this.keys = new String[0];
+				return;
+			}
+			this.dictionary = dictionary;
+			List<String> keyList = new ArrayList<String>(dictionary.size());
+			for (Enumeration<?> e = dictionary.keys(); e.hasMoreElements();) {
+				Object k = e.nextElement();
+				if (k instanceof String) {
+					String key = (String) k;
+					for (String i : keyList) {
+						if (key.equalsIgnoreCase(i)) {
+							throw new IllegalArgumentException();
+						}
+					}
+					keyList.add(key);
+				}
+			}
+			this.keys = keyList.toArray(new String[keyList.size()]);
+		}
+
+		public Object get(Object o) {
+			String k = (String) o;
+			for (String key : keys) {
+				if (key.equalsIgnoreCase(k)) {
+					return dictionary.get(key);
+				}
+			}
+			return null;
+		}
+
+		public Set<java.util.Map.Entry<String, Object>> entrySet() {
+			throw new UnsupportedOperationException();
+		}
+	}
+
+	/**
+	 * This Map is used for key lookup from a ServiceReference during filter
+	 * evaluation. This Map implementation only supports the get operation using
+	 * a String key as no other operations are used by the Filter
+	 * implementation.
+	 */
+	static private final class ServiceReferenceMap extends AbstractMap<String, Object> implements Map<String, Object> {
+		private final ServiceReference<?>	reference;
+
+		ServiceReferenceMap(ServiceReference<?> reference) {
+			this.reference = reference;
+		}
+
+		public Object get(Object key) {
+			if (reference == null) {
+				return null;
+			}
+			return reference.getProperty((String) key);
+		}
+
+		public Set<java.util.Map.Entry<String, Object>> entrySet() {
+			throw new UnsupportedOperationException();
+		}
+	}
+
+	static private final class SetAccessibleAction implements PrivilegedAction<Object> {
+		private final AccessibleObject	accessible;
+
+		SetAccessibleAction(AccessibleObject accessible) {
+			this.accessible = accessible;
+		}
+
+		public Object run() {
+			accessible.setAccessible(true);
+			return null;
+		}
+	}
+
+	/**
 	 * This class contains a method to match a distinguished name (DN) chain
 	 * against and DN chain pattern.
 	 * <p>
@@ -225,12 +1682,11 @@
 	 *   cn=ben+ou=research,o=ACME,c=us;ou=Super CA,c=CA
 	 * </pre>
 	 * 
-	 * is made up of two DNs: "{@code cn=ben+ou=research,o=ACME,c=us}
-	 * " and " {@code ou=Super CA,c=CA}
-	 * ". The first DN is made of of three RDNs: "
-	 * {@code cn=ben+ou=research}" and "{@code o=ACME}" and "
-	 * {@code c=us}". The first RDN has two name value pairs: "
-	 * {@code cn=ben}" and "{@code ou=research}".
+	 * is made up of two DNs: "{@code cn=ben+ou=research,o=ACME,c=us} " and "
+	 * {@code ou=Super CA,c=CA} ". The first DN is made of of three RDNs: "
+	 * {@code cn=ben+ou=research}" and "{@code o=ACME}" and " {@code c=us}
+	 * ". The first RDN has two name value pairs: " {@code cn=ben}" and "
+	 * {@code ou=research}".
 	 * <p>
 	 * A chain pattern makes use of wildcards ('*' or '-') to match against DNs,
 	 * and wildcards ('*') to match againts DN prefixes, and value. If a DN in a
@@ -253,7 +1709,7 @@
 		 * @param rdnPattern List of name value pattern pairs.
 		 * @return true if the list of name value pairs match the pattern.
 		 */
-		private static boolean rdnmatch(List< ? > rdn, List< ? > rdnPattern) {
+		private static boolean rdnmatch(List<?> rdn, List<?> rdnPattern) {
 			if (rdn.size() != rdnPattern.size()) {
 				return false;
 			}
@@ -262,22 +1718,19 @@
 				String patNameValue = (String) rdnPattern.get(i);
 				int rdnNameEnd = rdnNameValue.indexOf('=');
 				int patNameEnd = patNameValue.indexOf('=');
-				if (rdnNameEnd != patNameEnd
-						|| !rdnNameValue.regionMatches(0, patNameValue, 0,
-								rdnNameEnd)) {
+				if (rdnNameEnd != patNameEnd || !rdnNameValue.regionMatches(0, patNameValue, 0, rdnNameEnd)) {
 					return false;
 				}
 				String patValue = patNameValue.substring(patNameEnd);
 				String rdnValue = rdnNameValue.substring(rdnNameEnd);
-				if (!rdnValue.equals(patValue) && !patValue.equals("=*")
-						&& !patValue.equals("=#16012a")) {
+				if (!rdnValue.equals(patValue) && !patValue.equals("=*") && !patValue.equals("=#16012a")) {
 					return false;
 				}
 			}
 			return true;
 		}
 
-		private static boolean dnmatch(List< ? > dn, List< ? > dnPattern) {
+		private static boolean dnmatch(List<?> dn, List<?> dnPattern) {
 			int dnStart = 0;
 			int patStart = 0;
 			int patLen = dnPattern.size();
@@ -290,8 +1743,7 @@
 			}
 			if (dn.size() < patLen) {
 				return false;
-			}
-			else {
+			} else {
 				if (dn.size() > patLen) {
 					if (!dnPattern.get(0).equals(STAR_WILDCARD)) {
 						// If the number of rdns do not match we must have a
@@ -304,9 +1756,7 @@
 				}
 			}
 			for (int i = 0; i < patLen; i++) {
-				if (!rdnmatch((List< ? >) dn.get(i + dnStart),
-						(List< ? >) dnPattern
-						.get(i + patStart))) {
+				if (!rdnmatch((List<?>) dn.get(i + dnStart), (List<?>) dnPattern.get(i + patStart))) {
 					return false;
 				}
 			}
@@ -328,8 +1778,7 @@
 		 */
 		private static List<Object> parseDNchainPattern(String dnChain) {
 			if (dnChain == null) {
-				throw new IllegalArgumentException(
-						"The DN chain must not be null.");
+				throw new IllegalArgumentException("The DN chain must not be null.");
 			}
 			List<Object> parsed = new ArrayList<Object>();
 			int startIndex = 0;
@@ -370,14 +1819,11 @@
 				List<Object> rdns = new ArrayList<Object>();
 				if (dn.charAt(0) == '*') {
 					if (dn.charAt(1) != ',') {
-						throw new IllegalArgumentException(
-								"invalid wildcard prefix");
+						throw new IllegalArgumentException("invalid wildcard prefix");
 					}
 					rdns.add(STAR_WILDCARD);
-					dn = new X500Principal(dn.substring(2))
-							.getName(X500Principal.CANONICAL);
-				}
-				else {
+					dn = new X500Principal(dn.substring(2)).getName(X500Principal.CANONICAL);
+				} else {
 					dn = new X500Principal(dn).getName(X500Principal.CANONICAL);
 				}
 				// Now dn is a nice CANONICAL DN
@@ -415,8 +1861,7 @@
 		 * the index of a non-space character.
 		 */
 		private static int skipSpaces(String dnChain, int startIndex) {
-			while (startIndex < dnChain.length()
-					&& dnChain.charAt(startIndex) == ' ') {
+			while (startIndex < dnChain.length() && dnChain.charAt(startIndex) == ' ') {
 				startIndex++;
 			}
 			return startIndex;
@@ -446,24 +1891,21 @@
 					}
 				}
 				if (endIndex > dn.length()) {
-					throw new IllegalArgumentException("unterminated escape "
-							+ dn);
+					throw new IllegalArgumentException("unterminated escape " + dn);
 				}
 				nameValues.add(dn.substring(startIndex, endIndex));
 				if (c != '+') {
 					rdn.add(nameValues);
 					if (endIndex != dn.length()) {
 						nameValues = new ArrayList<String>();
-					}
-					else {
+					} else {
 						nameValues = null;
 					}
 				}
 				startIndex = endIndex + 1;
 			}
 			if (nameValues != null) {
-				throw new IllegalArgumentException("improperly terminated DN "
-						+ dn);
+				throw new IllegalArgumentException("improperly terminated DN " + dn);
 			}
 		}
 
@@ -471,28 +1913,22 @@
 		 * This method will return an 'index' which points to a non-wildcard DN
 		 * or the end-of-list.
 		 */
-		private static int skipWildCards(List<Object> dnChainPattern,
-				int dnChainPatternIndex) {
+		private static int skipWildCards(List<Object> dnChainPattern, int dnChainPatternIndex) {
 			int i;
 			for (i = dnChainPatternIndex; i < dnChainPattern.size(); i++) {
 				Object dnPattern = dnChainPattern.get(i);
 				if (dnPattern instanceof String) {
-					if (!dnPattern.equals(STAR_WILDCARD)
-							&& !dnPattern.equals(MINUS_WILDCARD)) {
-						throw new IllegalArgumentException(
-								"expected wildcard in DN pattern");
+					if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+						throw new IllegalArgumentException("expected wildcard in DN pattern");
 					}
 					// otherwise continue skipping over wild cards
-				}
-				else {
-					if (dnPattern instanceof List< ? >) {
+				} else {
+					if (dnPattern instanceof List<?>) {
 						// if its a list then we have our 'non-wildcard' DN
 						break;
-					}
-					else {
+					} else {
 						// unknown member of the DNChainPattern
-						throw new IllegalArgumentException(
-								"expected String or List in DN Pattern");
+						throw new IllegalArgumentException("expected String or List in DN Pattern");
 					}
 				}
 			}
@@ -506,10 +1942,7 @@
 		 * where DNChain is of the format: "DN;DN;DN;" and DNChainPattern is of
 		 * the format: "DNPattern;*;DNPattern" (or combinations of this)
 		 */
-		private static boolean dnChainMatch(List<Object> dnChain,
-				int dnChainIndex, List<Object> dnChainPattern,
-				int dnChainPatternIndex)
-				throws IllegalArgumentException {
+		private static boolean dnChainMatch(List<Object> dnChain, int dnChainIndex, List<Object> dnChainPattern, int dnChainPatternIndex) throws IllegalArgumentException {
 			if (dnChainIndex >= dnChain.size()) {
 				return false;
 			}
@@ -519,25 +1952,20 @@
 			// check to see what the pattern starts with
 			Object dnPattern = dnChainPattern.get(dnChainPatternIndex);
 			if (dnPattern instanceof String) {
-				if (!dnPattern.equals(STAR_WILDCARD)
-						&& !dnPattern.equals(MINUS_WILDCARD)) {
-					throw new IllegalArgumentException(
-							"expected wildcard in DN pattern");
+				if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+					throw new IllegalArgumentException("expected wildcard in DN pattern");
 				}
 				// here we are processing a wild card as the first DN
 				// skip all wildcard DN's
 				if (dnPattern.equals(MINUS_WILDCARD)) {
-					dnChainPatternIndex = skipWildCards(dnChainPattern,
-							dnChainPatternIndex);
-				}
-				else {
+					dnChainPatternIndex = skipWildCards(dnChainPattern, dnChainPatternIndex);
+				} else {
 					dnChainPatternIndex++; // only skip the '*' wildcard
 				}
 				if (dnChainPatternIndex >= dnChainPattern.size()) {
 					// return true iff the wild card is '-' or if we are at the
 					// end of the chain
-					return dnPattern.equals(MINUS_WILDCARD) ? true : dnChain
-							.size() - 1 == dnChainIndex;
+					return dnPattern.equals(MINUS_WILDCARD) ? true : dnChain.size() - 1 == dnChainIndex;
 				}
 				//
 				// we will now recursively call to see if the rest of the
@@ -546,45 +1974,36 @@
 				//
 				if (dnPattern.equals(STAR_WILDCARD)) {
 					// '*' option: only wildcard on 0 or 1
-					return dnChainMatch(dnChain, dnChainIndex, dnChainPattern,
-							dnChainPatternIndex)
-							|| dnChainMatch(dnChain, dnChainIndex + 1,
-									dnChainPattern, dnChainPatternIndex);
+					return dnChainMatch(dnChain, dnChainIndex, dnChainPattern, dnChainPatternIndex) || dnChainMatch(dnChain, dnChainIndex + 1, dnChainPattern, dnChainPatternIndex);
 				}
 				for (int i = dnChainIndex; i < dnChain.size(); i++) {
 					// '-' option: wildcard 0 or more
-					if (dnChainMatch(dnChain, i, dnChainPattern,
-							dnChainPatternIndex)) {
+					if (dnChainMatch(dnChain, i, dnChainPattern, dnChainPatternIndex)) {
 						return true;
 					}
 				}
 				// if we are here, then we didn't find a match.. fall through to
 				// failure
-			}
-			else {
-				if (dnPattern instanceof List< ? >) {
+			} else {
+				if (dnPattern instanceof List<?>) {
 					// here we have to do a deeper check for each DN in the
 					// pattern until we hit a wild card
 					do {
-						if (!dnmatch((List< ? >) dnChain.get(dnChainIndex),
-								(List< ? >) dnPattern)) {
+						if (!dnmatch((List<?>) dnChain.get(dnChainIndex), (List<?>) dnPattern)) {
 							return false;
 						}
 						// go to the next set of DN's in both chains
 						dnChainIndex++;
 						dnChainPatternIndex++;
 						// if we finished the pattern then it all matched
-						if ((dnChainIndex >= dnChain.size())
-								&& (dnChainPatternIndex >= dnChainPattern
-										.size())) {
+						if ((dnChainIndex >= dnChain.size()) && (dnChainPatternIndex >= dnChainPattern.size())) {
 							return true;
 						}
 						// if the DN Chain is finished, but the pattern isn't
 						// finished then if the rest of the pattern is not
 						// wildcard then we are done
 						if (dnChainIndex >= dnChain.size()) {
-							dnChainPatternIndex = skipWildCards(dnChainPattern,
-									dnChainPatternIndex);
+							dnChainPatternIndex = skipWildCards(dnChainPattern, dnChainPatternIndex);
 							// return TRUE iff the pattern index moved past the
 							// list-size (implying that the rest of the pattern
 							// is all wildcards)
@@ -598,20 +2017,15 @@
 						// get the next DN Pattern
 						dnPattern = dnChainPattern.get(dnChainPatternIndex);
 						if (dnPattern instanceof String) {
-							if (!dnPattern.equals(STAR_WILDCARD)
-									&& !dnPattern.equals(MINUS_WILDCARD)) {
-								throw new IllegalArgumentException(
-										"expected wildcard in DN pattern");
+							if (!dnPattern.equals(STAR_WILDCARD) && !dnPattern.equals(MINUS_WILDCARD)) {
+								throw new IllegalArgumentException("expected wildcard in DN pattern");
 							}
 							// if the next DN is a 'wildcard', then we will
 							// recurse
-							return dnChainMatch(dnChain, dnChainIndex,
-									dnChainPattern, dnChainPatternIndex);
-						}
-						else {
-							if (!(dnPattern instanceof List< ? >)) {
-								throw new IllegalArgumentException(
-										"expected String or List in DN Pattern");
+							return dnChainMatch(dnChain, dnChainIndex, dnChainPattern, dnChainPatternIndex);
+						} else {
+							if (!(dnPattern instanceof List<?>)) {
+								throw new IllegalArgumentException("expected String or List in DN Pattern");
 							}
 						}
 						// if we are here, then we will just continue to the
@@ -619,10 +2033,8 @@
 						// DNChainPattern since both are lists
 					} while (true);
 					// should never reach here?
-				}
-				else {
-					throw new IllegalArgumentException(
-							"expected String or List in DN Pattern");
+				} else {
+					throw new IllegalArgumentException("expected String or List in DN Pattern");
 				}
 			}
 			// if we get here, the the default return is 'mis-match'
@@ -667,31 +2079,27 @@
 			List<Object> parsedDNPattern;
 			try {
 				parsedDNChain = parseDNchain(dnChain);
-			}
-			catch (RuntimeException e) {
-				IllegalArgumentException iae = new IllegalArgumentException(
-						"Invalid DN chain: " + toString(dnChain));
+			} catch (RuntimeException e) {
+				IllegalArgumentException iae = new IllegalArgumentException("Invalid DN chain: " + toString(dnChain));
 				iae.initCause(e);
 				throw iae;
 			}
 			try {
 				parsedDNPattern = parseDNchainPattern(pattern);
-			}
-			catch (RuntimeException e) {
-				IllegalArgumentException iae = new IllegalArgumentException(
-						"Invalid match pattern: " + pattern);
+			} catch (RuntimeException e) {
+				IllegalArgumentException iae = new IllegalArgumentException("Invalid match pattern: " + pattern);
 				iae.initCause(e);
 				throw iae;
 			}
 			return dnChainMatch(parsedDNChain, 0, parsedDNPattern, 0);
 		}
 
-		private static String toString(List< ? > dnChain) {
+		private static String toString(List<?> dnChain) {
 			if (dnChain == null) {
 				return null;
 			}
 			StringBuffer sb = new StringBuffer();
-			for (Iterator< ? > iChain = dnChain.iterator(); iChain.hasNext();) {
+			for (Iterator<?> iChain = dnChain.iterator(); iChain.hasNext();) {
 				sb.append(iChain.next());
 				if (iChain.hasNext()) {
 					sb.append("; ");
diff --git a/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java b/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
index 46d6d20..e2296c0 100644
--- a/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
+++ b/framework/src/main/java/org/osgi/framework/InvalidSyntaxException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,14 +21,14 @@
  * syntax.
  * 
  * <p>
- * An {@code InvalidSyntaxException} object indicates that a filter
- * string parameter has an invalid syntax and cannot be parsed. See
- * {@link Filter} for a description of the filter string syntax.
+ * An {@code InvalidSyntaxException} object indicates that a filter string
+ * parameter has an invalid syntax and cannot be parsed. See {@link Filter} for
+ * a description of the filter string syntax.
  * 
  * <p>
  * This exception conforms to the general purpose exception chaining mechanism.
  * 
- * @version $Id: adb84e3bc0b82b842e4da84542057fdf53e2ca6a $
+ * @version $Id: 8820ca2db85b557cef8da09ee861249dfb5ee914 $
  */
 
 public class InvalidSyntaxException extends Exception {
@@ -42,15 +42,14 @@
 	 * Creates an exception of type {@code InvalidSyntaxException}.
 	 * 
 	 * <p>
-	 * This method creates an {@code InvalidSyntaxException} object with
-	 * the specified message and the filter string which generated the
-	 * exception.
+	 * This method creates an {@code InvalidSyntaxException} object with the
+	 * specified message and the filter string which generated the exception.
 	 * 
 	 * @param msg The message.
 	 * @param filter The invalid filter string.
 	 */
 	public InvalidSyntaxException(String msg, String filter) {
-		super(msg);
+		super(message(msg, filter));
 		this.filter = filter;
 	}
 
@@ -58,9 +57,8 @@
 	 * Creates an exception of type {@code InvalidSyntaxException}.
 	 * 
 	 * <p>
-	 * This method creates an {@code InvalidSyntaxException} object with
-	 * the specified message and the filter string which generated the
-	 * exception.
+	 * This method creates an {@code InvalidSyntaxException} object with the
+	 * specified message and the filter string which generated the exception.
 	 * 
 	 * @param msg The message.
 	 * @param filter The invalid filter string.
@@ -68,16 +66,27 @@
 	 * @since 1.3
 	 */
 	public InvalidSyntaxException(String msg, String filter, Throwable cause) {
-		super(msg, cause);
+		super(message(msg, filter), cause);
 		this.filter = filter;
 	}
 
 	/**
+	 * Return message string for super constructor.
+	 */
+	private static String message(String msg, String filter) {
+		if ((msg == null) || (filter == null) || msg.indexOf(filter) >= 0) {
+			return msg;
+		}
+		return msg + ": " + filter;
+	}
+
+	/**
 	 * Returns the filter string that generated the
 	 * {@code InvalidSyntaxException} object.
 	 * 
 	 * @return The invalid filter string.
-	 * @see BundleContext#getServiceReferences
+	 * @see BundleContext#getServiceReferences(Class, String)
+	 * @see BundleContext#getServiceReferences(String, String)
 	 * @see BundleContext#addServiceListener(ServiceListener,String)
 	 */
 	public String getFilter() {
@@ -85,11 +94,9 @@
 	}
 
 	/**
-	 * Returns the cause of this exception or {@code null} if no cause was
-	 * set.
+	 * Returns the cause of this exception or {@code null} if no cause was set.
 	 * 
-	 * @return The cause of this exception or {@code null} if no cause was
-	 *         set.
+	 * @return The cause of this exception or {@code null} if no cause was set.
 	 * @since 1.3
 	 */
 	public Throwable getCause() {
diff --git a/framework/src/main/java/org/osgi/framework/PackagePermission.java b/framework/src/main/java/org/osgi/framework/PackagePermission.java
index b6697a5..62d0d8d 100644
--- a/framework/src/main/java/org/osgi/framework/PackagePermission.java
+++ b/framework/src/main/java/org/osgi/framework/PackagePermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -50,65 +50,64 @@
  * 
  * <p>
  * {@code PackagePermission} has three actions: {@code exportonly},
- * {@code import} and {@code export}. The {@code export} action,
- * which is deprecated, implies the {@code import} action.
+ * {@code import} and {@code export}. The {@code export} action, which is
+ * deprecated, implies the {@code import} action.
  * 
  * @ThreadSafe
- * @version $Id: a286af94405e583f8bedc2ff5d7c818198f8caaf $
+ * @version $Id: e993fbc36b6bff84182a8594af5af3cad8c4e2a3 $
  */
 
 public final class PackagePermission extends BasicPermission {
-	static final long						serialVersionUID	= -5107705877071099135L;
+	static final long								serialVersionUID	= -5107705877071099135L;
 
 	/**
-	 * The action string {@code export}. The {@code export} action
-	 * implies the {@code import} action.
+	 * The action string {@code export}. The {@code export} action implies the
+	 * {@code import} action.
 	 * 
 	 * @deprecated Since 1.5. Use {@code exportonly} instead.
 	 */
-	public final static String				EXPORT				= "export";
+	public final static String						EXPORT				= "export";
 
 	/**
-	 * The action string {@code exportonly}. The {@code exportonly}
-	 * action does not imply the {@code import} action.
+	 * The action string {@code exportonly}. The {@code exportonly} action does
+	 * not imply the {@code import} action.
 	 * 
 	 * @since 1.5
 	 */
-	public final static String				EXPORTONLY			= "exportonly";
+	public final static String						EXPORTONLY			= "exportonly";
 
 	/**
 	 * The action string {@code import}.
 	 */
-	public final static String				IMPORT				= "import";
+	public final static String						IMPORT				= "import";
 
-	private final static int				ACTION_EXPORT		= 0x00000001;
-	private final static int				ACTION_IMPORT		= 0x00000002;
-	private final static int				ACTION_ALL			= ACTION_EXPORT
-																		| ACTION_IMPORT;
-	final static int						ACTION_NONE			= 0;
+	private final static int						ACTION_EXPORT		= 0x00000001;
+	private final static int						ACTION_IMPORT		= 0x00000002;
+	private final static int						ACTION_ALL			= ACTION_EXPORT | ACTION_IMPORT;
+	final static int								ACTION_NONE			= 0;
 
 	/**
 	 * The actions mask.
 	 */
-	transient int							action_mask;
+	transient int									action_mask;
 
 	/**
 	 * The actions in canonical form.
 	 * 
 	 * @serial
 	 */
-	private volatile String					actions				= null;
+	private volatile String							actions				= null;
 
 	/**
 	 * The bundle used by this PackagePermission.
 	 */
-	transient final Bundle					bundle;
+	transient final Bundle							bundle;
 
 	/**
 	 * If this PackagePermission was constructed with a filter, this holds a
 	 * Filter matching object used to evaluate the filter in implies.
 	 */
-	transient Filter						filter;
+	transient Filter								filter;
 
 	/**
 	 * This map holds the properties of the permission, used to match a filter
@@ -136,8 +135,8 @@
 	 * *
 	 * </pre>
 	 * 
-	 * For the {@code import} action, the name can also be a filter
-	 * expression. The filter gives access to the following attributes:
+	 * For the {@code import} action, the name can also be a filter expression.
+	 * The filter gives access to the following attributes:
 	 * <ul>
 	 * <li>signer - A Distinguished Name chain used to sign the exporting
 	 * bundle. Wildcards in a DN are not matched according to the filter string
@@ -161,27 +160,23 @@
 	 * 
 	 * @param name Package name or filter expression. A filter expression can
 	 *        only be specified if the specified action is {@code import}.
-	 * @param actions {@code exportonly},{@code import} (canonical
-	 *        order).
+	 * @param actions {@code exportonly},{@code import} (canonical order).
 	 * @throws IllegalArgumentException If the specified name is a filter
-	 *         expression and either the specified action is not
-	 *         {@code import} or the filter has an invalid syntax.
+	 *         expression and either the specified action is not {@code import}
+	 *         or the filter has an invalid syntax.
 	 */
 	public PackagePermission(String name, String actions) {
 		this(name, parseActions(actions));
-		if ((filter != null)
-				&& ((action_mask & ACTION_ALL) != ACTION_IMPORT)) {
-			throw new IllegalArgumentException(
-					"invalid action string for filter expression");
+		if ((filter != null) && ((action_mask & ACTION_ALL) != ACTION_IMPORT)) {
+			throw new IllegalArgumentException("invalid action string for filter expression");
 		}
 	}
 
 	/**
-	 * Creates a new requested {@code PackagePermission} object to be used
-	 * by code that must perform {@code checkPermission} for the
-	 * {@code import} action. {@code PackagePermission} objects
-	 * created with this constructor cannot be added to a
-	 * {@code PackagePermission} permission collection.
+	 * Creates a new requested {@code PackagePermission} object to be used by
+	 * code that must perform {@code checkPermission} for the {@code import}
+	 * action. {@code PackagePermission} objects created with this constructor
+	 * cannot be added to a {@code PackagePermission} permission collection.
 	 * 
 	 * @param name The name of the requested package to import.
 	 * @param exportingBundle The bundle exporting the requested package.
@@ -255,9 +250,7 @@
 			char c;
 
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
 
 			// check for the known strings
@@ -272,8 +265,7 @@
 				matchlen = 6;
 				mask |= ACTION_IMPORT;
 
-			}
-			else
+			} else
 				if (i >= 5 && (a[i - 5] == 'e' || a[i - 5] == 'E')
 						&& (a[i - 4] == 'x' || a[i - 4] == 'X')
 						&& (a[i - 3] == 'p' || a[i - 3] == 'P')
@@ -283,8 +275,7 @@
 					matchlen = 6;
 					mask |= ACTION_EXPORT | ACTION_IMPORT;
 
-				}
-				else {
+				} else {
 					if (i >= 9 && (a[i - 9] == 'e' || a[i - 9] == 'E')
 							&& (a[i - 8] == 'x' || a[i - 8] == 'X')
 							&& (a[i - 7] == 'p' || a[i - 7] == 'P')
@@ -298,11 +289,9 @@
 						matchlen = 10;
 						mask |= ACTION_EXPORT;
 
-					}
-					else {
+					} else {
 						// parse error
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 					}
 				}
 
@@ -321,8 +310,7 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
@@ -354,10 +342,8 @@
 
 		try {
 			return FrameworkUtil.createFilter(filterString);
-		}
-		catch (InvalidSyntaxException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid filter");
+		} catch (InvalidSyntaxException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
 			iae.initCause(e);
 			throw iae;
 		}
@@ -432,11 +418,11 @@
 	 * {@code PackagePermission} actions.
 	 * 
 	 * <p>
-	 * Always returns present {@code PackagePermission} actions in the
-	 * following order: {@code EXPORTONLY},{@code IMPORT}.
+	 * Always returns present {@code PackagePermission} actions in the following
+	 * order: {@code EXPORTONLY},{@code IMPORT}.
 	 * 
-	 * @return Canonical string representation of the
-	 *         {@code PackagePermission} actions.
+	 * @return Canonical string representation of the {@code PackagePermission}
+	 *         actions.
 	 */
 	public String getActions() {
 		String result = actions;
@@ -462,8 +448,8 @@
 	}
 
 	/**
-	 * Returns a new {@code PermissionCollection} object suitable for
-	 * storing {@code PackagePermission} objects.
+	 * Returns a new {@code PermissionCollection} object suitable for storing
+	 * {@code PackagePermission} objects.
 	 * 
 	 * @return A new {@code PermissionCollection} object.
 	 */
@@ -475,15 +461,14 @@
 	 * Determines the equality of two {@code PackagePermission} objects.
 	 * 
 	 * This method checks that specified package has the same package name and
-	 * {@code PackagePermission} actions as this
-	 * {@code PackagePermission} object.
+	 * {@code PackagePermission} actions as this {@code PackagePermission}
+	 * object.
 	 * 
 	 * @param obj The object to test for equality with this
 	 *        {@code PackagePermission} object.
-	 * @return {@code true} if {@code obj} is a
-	 *         {@code PackagePermission}, and has the same package name and
-	 *         actions as this {@code PackagePermission} object;
-	 *         {@code false} otherwise.
+	 * @return {@code true} if {@code obj} is a {@code PackagePermission}, and
+	 *         has the same package name and actions as this
+	 *         {@code PackagePermission} object; {@code false} otherwise.
 	 */
 	public boolean equals(Object obj) {
 		if (obj == this) {
@@ -496,10 +481,7 @@
 
 		PackagePermission pp = (PackagePermission) obj;
 
-		return (action_mask == pp.action_mask)
-				&& getName().equals(pp.getName())
-				&& ((bundle == pp.bundle) || ((bundle != null) && bundle
-						.equals(pp.bundle)));
+		return (action_mask == pp.action_mask) && getName().equals(pp.getName()) && ((bundle == pp.bundle) || ((bundle != null) && bundle.equals(pp.bundle)));
 	}
 
 	/**
@@ -521,8 +503,7 @@
 	 * stream. The actions are serialized, and the superclass takes care of the
 	 * name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		if (bundle != null) {
 			throw new NotSerializableException("cannot serialize");
 		}
@@ -537,8 +518,7 @@
 	 * readObject is called to restore the state of this permission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the action, then initialize the rest
 		s.defaultReadObject();
 		setTransients(getName(), parseActions(actions));
@@ -588,7 +568,7 @@
  */
 
 final class PackagePermissionCollection extends PermissionCollection {
-	static final long		serialVersionUID	= -3350758995234427603L;
+	static final long									serialVersionUID	= -3350758995234427603L;
 	/**
 	 * Table of permissions with names.
 	 * 
@@ -602,7 +582,7 @@
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private boolean			all_allowed;
+	private boolean										all_allowed;
 
 	/**
 	 * Table of permissions with filter expressions.
@@ -627,24 +607,20 @@
 	 * @throws IllegalArgumentException If the specified permission is not a
 	 *         {@code PackagePermission} instance or was constructed with a
 	 *         Bundle object.
-	 * @throws SecurityException If this
-	 *         {@code PackagePermissionCollection} object has been marked
-	 *         read-only.
+	 * @throws SecurityException If this {@code PackagePermissionCollection}
+	 *         object has been marked read-only.
 	 */
 	public void add(final Permission permission) {
 		if (!(permission instanceof PackagePermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection");
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 
 		final PackagePermission pp = (PackagePermission) permission;
 		if (pp.bundle != null) {
-			throw new IllegalArgumentException("cannot add to collection: "
-					+ pp);
+			throw new IllegalArgumentException("cannot add to collection: " + pp);
 		}
 
 		final String name = pp.getName();
@@ -657,23 +633,19 @@
 				if (pc == null) {
 					filterPermissions = pc = new HashMap<String, PackagePermission>();
 				}
-			}
-			else {
+			} else {
 				pc = permissions;
 			}
-			
+
 			final PackagePermission existing = pc.get(name);
 			if (existing != null) {
 				final int oldMask = existing.action_mask;
 				final int newMask = pp.action_mask;
 				if (oldMask != newMask) {
-					pc
-							.put(name, new PackagePermission(name, oldMask
-									| newMask));
+					pc.put(name, new PackagePermission(name, oldMask | newMask));
 
 				}
-			}
-			else {
+			} else {
 				pc.put(name, pp);
 			}
 
@@ -691,8 +663,8 @@
 	 * 
 	 * @param permission The Permission object to compare with this
 	 *        {@code PackagePermission} object.
-	 * @return {@code true} if {@code permission} is a proper subset
-	 *         of a permission in the set; {@code false} otherwise.
+	 * @return {@code true} if {@code permission} is a proper subset of a
+	 *         permission in the set; {@code false} otherwise.
 	 */
 	public boolean implies(final Permission permission) {
 		if (!(permission instanceof PackagePermission)) {
@@ -767,8 +739,8 @@
 	}
 
 	/**
-	 * Returns an enumeration of all {@code PackagePermission} objects in
-	 * the container.
+	 * Returns an enumeration of all {@code PackagePermission} objects in the
+	 * container.
 	 * 
 	 * @return Enumeration of all {@code PackagePermission} objects.
 	 */
@@ -782,15 +754,11 @@
 	}
 
 	/* serialization logic */
-	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", Hashtable.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE),
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
 			new ObjectStreamField("filterPermissions", HashMap.class)	};
 
-	private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
-		Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(
-				permissions);
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+		Hashtable<String, PackagePermission> hashtable = new Hashtable<String, PackagePermission>(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", hashtable);
 		pfields.put("all_allowed", all_allowed);
@@ -798,15 +766,12 @@
 		out.writeFields();
 	}
 
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields
-				.get("permissions", null);
+		Hashtable<String, PackagePermission> hashtable = (Hashtable<String, PackagePermission>) gfields.get("permissions", null);
 		permissions = new HashMap<String, PackagePermission>(hashtable);
 		all_allowed = gfields.get("all_allowed", false);
-		HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields
-				.get("filterPermissions", null);
+		HashMap<String, PackagePermission> fp = (HashMap<String, PackagePermission>) gfields.get("filterPermissions", null);
 		filterPermissions = fp;
 	}
 }
diff --git a/framework/src/main/java/org/osgi/framework/ServiceEvent.java b/framework/src/main/java/org/osgi/framework/ServiceEvent.java
index 82ec899..2a59fe8 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceEvent.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceEvent.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,10 +22,9 @@
 /**
  * An event from the Framework describing a service lifecycle change.
  * <p>
- * {@code ServiceEvent} objects are delivered to
- * {@code ServiceListener}s and {@code AllServiceListener}s when a
- * change occurs in this service's lifecycle. A type code is used to identify
- * the event type for future extendability.
+ * {@code ServiceEvent} objects are delivered to {@code ServiceListener}s and
+ * {@code AllServiceListener}s when a change occurs in this service's lifecycle.
+ * A type code is used to identify the event type for future extendability.
  * 
  * <p>
  * OSGi Alliance reserves the right to extend the set of types.
@@ -33,20 +32,20 @@
  * @Immutable
  * @see ServiceListener
  * @see AllServiceListener
- * @version $Id: 2b9458d90004411b6ca0cb4b361bc282b04c85eb $
+ * @version $Id: 49e34e0ad5564d6f4ca0ab0053b272c22b9fb917 $
  */
 
 public class ServiceEvent extends EventObject {
-	static final long				serialVersionUID	= 8792901483909409299L;
+	static final long					serialVersionUID	= 8792901483909409299L;
 	/**
 	 * Reference to the service that had a change occur in its lifecycle.
 	 */
-	private final ServiceReference< ? >	reference;
+	private final ServiceReference<?>	reference;
 
 	/**
 	 * Type of service lifecycle change.
 	 */
-	private final int				type;
+	private final int					type;
 
 	/**
 	 * This service has been registered.
@@ -56,7 +55,7 @@
 	 * 
 	 * @see BundleContext#registerService(String[],Object,Dictionary)
 	 */
-	public final static int			REGISTERED			= 0x00000001;
+	public final static int				REGISTERED			= 0x00000001;
 
 	/**
 	 * The properties of a registered service have been modified.
@@ -64,9 +63,9 @@
 	 * This event is synchronously delivered <strong>after</strong> the service
 	 * properties have been modified.
 	 * 
-	 * @see ServiceRegistration#setProperties
+	 * @see ServiceRegistration#setProperties(Dictionary)
 	 */
-	public final static int			MODIFIED			= 0x00000002;
+	public final static int				MODIFIED			= 0x00000002;
 
 	/**
 	 * This service is in the process of being unregistered.
@@ -75,16 +74,16 @@
 	 * has completed unregistering.
 	 * 
 	 * <p>
-	 * If a bundle is using a service that is {@code UNREGISTERING}, the
-	 * bundle should release its use of the service when it receives this event.
-	 * If the bundle does not release its use of the service when it receives
-	 * this event, the Framework will automatically release the bundle's use of
-	 * the service while completing the service unregistration operation.
+	 * If a bundle is using a service that is {@code UNREGISTERING}, the bundle
+	 * should release its use of the service when it receives this event. If the
+	 * bundle does not release its use of the service when it receives this
+	 * event, the Framework will automatically release the bundle's use of the
+	 * service while completing the service unregistration operation.
 	 * 
-	 * @see ServiceRegistration#unregister
-	 * @see BundleContext#ungetService
+	 * @see ServiceRegistration#unregister()
+	 * @see BundleContext#ungetService(ServiceReference)
 	 */
-	public final static int			UNREGISTERING		= 0x00000004;
+	public final static int				UNREGISTERING		= 0x00000004;
 
 	/**
 	 * The properties of a registered service have been modified and the new
@@ -92,23 +91,23 @@
 	 * <p>
 	 * This event is synchronously delivered <strong>after</strong> the service
 	 * properties have been modified. This event is only delivered to listeners
-	 * which were added with a non-{@code null} filter where the filter
-	 * matched the service properties prior to the modification but the filter
-	 * does not match the modified service properties.
+	 * which were added with a non-{@code null} filter where the filter matched
+	 * the service properties prior to the modification but the filter does not
+	 * match the modified service properties.
 	 * 
-	 * @see ServiceRegistration#setProperties
+	 * @see ServiceRegistration#setProperties(Dictionary)
 	 * @since 1.5
 	 */
-	public final static int			MODIFIED_ENDMATCH	= 0x00000008;
+	public final static int				MODIFIED_ENDMATCH	= 0x00000008;
 
 	/**
 	 * Creates a new service event object.
 	 * 
 	 * @param type The event type.
-	 * @param reference A {@code ServiceReference} object to the service
-	 * 	that had a lifecycle change.
+	 * @param reference A {@code ServiceReference} object to the service that
+	 *        had a lifecycle change.
 	 */
-	public ServiceEvent(int type, ServiceReference< ? > reference) {
+	public ServiceEvent(int type, ServiceReference<?> reference) {
 		super(reference);
 		this.reference = reference;
 		this.type = type;
@@ -122,17 +121,17 @@
 	 * 
 	 * @return Reference to the service that had a lifecycle change.
 	 */
-	public ServiceReference< ? > getServiceReference() {
+	public ServiceReference<?> getServiceReference() {
 		return reference;
 	}
 
 	/**
 	 * Returns the type of event. The event type values are:
 	 * <ul>
-	 * <li>{@link #REGISTERED} </li> 
-	 * <li>{@link #MODIFIED} </li> 
-	 * <li>{@link #MODIFIED_ENDMATCH} </li> 
-	 * <li>{@link #UNREGISTERING} </li>
+	 * <li>{@link #REGISTERED}</li>
+	 * <li>{@link #MODIFIED}</li>
+	 * <li>{@link #MODIFIED_ENDMATCH}</li>
+	 * <li>{@link #UNREGISTERING}</li>
 	 * </ul>
 	 * 
 	 * @return Type of service lifecycle change.
diff --git a/framework/src/main/java/org/osgi/framework/ServiceException.java b/framework/src/main/java/org/osgi/framework/ServiceException.java
index d8ed3bd..de90784 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceException.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceException.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,18 +20,17 @@
  * A service exception used to indicate that a service problem occurred.
  * 
  * <p>
- * A {@code ServiceException} object is created by the Framework or
- * service implementation to denote an exception condition in the service. A
- * type code is used to identify the exception type for future extendability.
- * Service implementations may also create subclasses of
- * {@code ServiceException}. When subclassing, the subclass should set
- * the type to {@link #SUBCLASSED} to indicate that
- * {@code ServiceException} has been subclassed.
+ * A {@code ServiceException} object is created by the Framework or service
+ * implementation to denote an exception condition in the service. A type code
+ * is used to identify the exception type for future extendability. Service
+ * implementations may also create subclasses of {@code ServiceException}. When
+ * subclassing, the subclass should set the type to {@link #SUBCLASSED} to
+ * indicate that {@code ServiceException} has been subclassed.
  * 
  * <p>
  * This exception conforms to the general purpose exception chaining mechanism.
  * 
- * @version $Id: 453b6021eed4543f754e20696b9f8b33a7e121ee $
+ * @version $Id: 9f763412635f59585bb615cbc449fc7ab72b7103 $
  * @since 1.5
  */
 
@@ -67,7 +66,7 @@
 	/**
 	 * An error occurred invoking a remote service.
 	 */
-	public static final int REMOTE 				= 5;
+	public static final int	REMOTE				= 5;
 	/**
 	 * The service factory resulted in a recursive call to itself for the
 	 * requesting bundle.
@@ -97,8 +96,8 @@
 	}
 
 	/**
-	 * Creates a {@code ServiceException} with the specified message,
-	 * type and exception cause.
+	 * Creates a {@code ServiceException} with the specified message, type and
+	 * exception cause.
 	 * 
 	 * @param msg The associated message.
 	 * @param type The type for this exception.
@@ -110,8 +109,7 @@
 	}
 
 	/**
-	 * Creates a {@code ServiceException} with the specified message and
-	 * type.
+	 * Creates a {@code ServiceException} with the specified message and type.
 	 * 
 	 * @param msg The message.
 	 * @param type The type for this exception.
@@ -122,8 +120,8 @@
 	}
 
 	/**
-	 * Returns the type for this exception or {@code UNSPECIFIED} if the
-	 * type was unspecified or unknown.
+	 * Returns the type for this exception or {@code UNSPECIFIED} if the type
+	 * was unspecified or unknown.
 	 * 
 	 * @return The type of this exception.
 	 */
diff --git a/framework/src/main/java/org/osgi/framework/ServiceFactory.java b/framework/src/main/java/org/osgi/framework/ServiceFactory.java
index 6383b22..4b52fee 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceFactory.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -43,9 +43,9 @@
  * concurrently call a {@code ServiceFactory}.
  * 
  * @param <S> Type of Service
- * @see BundleContext#getService
+ * @see BundleContext#getService(ServiceReference)
  * @ThreadSafe
- * @version $Id: 94cd1a0127aaad9beb484f557342a8fbd0be2322 $
+ * @version $Id: 535776e702ec5ace54f577218ff8f7920741558b $
  */
 
 public interface ServiceFactory<S> {
@@ -85,7 +85,7 @@
 	 *        requested service.
 	 * @return A service object that <strong>must</strong> be an instance of all
 	 *         the classes named when the service was registered.
-	 * @see BundleContext#getService
+	 * @see BundleContext#getService(ServiceReference)
 	 */
 	public S getService(Bundle bundle, ServiceRegistration<S> registration);
 
@@ -108,8 +108,7 @@
 	 * @param service The service object returned by a previous call to the
 	 *        {@link #getService(Bundle, ServiceRegistration) getService}
 	 *        method.
-	 * @see BundleContext#ungetService
+	 * @see BundleContext#ungetService(ServiceReference)
 	 */
-	public void ungetService(Bundle bundle, ServiceRegistration<S> registration,
-			S service);
+	public void ungetService(Bundle bundle, ServiceRegistration<S> registration, S service);
 }
diff --git a/framework/src/main/java/org/osgi/framework/ServiceListener.java b/framework/src/main/java/org/osgi/framework/ServiceListener.java
index dc6a159..839c1bc 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceListener.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,39 +19,37 @@
 import java.util.EventListener;
 
 /**
- * A {@code ServiceEvent} listener. {@code ServiceListener} is a
- * listener interface that may be implemented by a bundle developer. When a
+ * A {@code ServiceEvent} listener. {@code ServiceListener} is a listener
+ * interface that may be implemented by a bundle developer. When a
  * {@code ServiceEvent} is fired, it is synchronously delivered to a
- * {@code ServiceListener}. The Framework may deliver
- * {@code ServiceEvent} objects to a {@code ServiceListener} out
- * of order and may concurrently call and/or reenter a
- * {@code ServiceListener}.
+ * {@code ServiceListener}. The Framework may deliver {@code ServiceEvent}
+ * objects to a {@code ServiceListener} out of order and may concurrently call
+ * and/or reenter a {@code ServiceListener}.
  * 
  * <p>
- * A {@code ServiceListener} object is registered with the Framework
- * using the {@code BundleContext.addServiceListener} method.
- * {@code ServiceListener} objects are called with a
- * {@code ServiceEvent} object when a service is registered, modified, or
- * is in the process of unregistering.
+ * A {@code ServiceListener} object is registered with the Framework using the
+ * {@code BundleContext.addServiceListener} method. {@code ServiceListener}
+ * objects are called with a {@code ServiceEvent} object when a service is
+ * registered, modified, or is in the process of unregistering.
  * 
  * <p>
- * {@code ServiceEvent} object delivery to {@code ServiceListener}
- * objects is filtered by the filter specified when the listener was registered.
- * If the Java Runtime Environment supports permissions, then additional
- * filtering is done. {@code ServiceEvent} objects are only delivered to
- * the listener if the bundle which defines the listener object's class has the
- * appropriate {@code ServicePermission} to get the service using at
- * least one of the named classes under which the service was registered.
+ * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
+ * filtered by the filter specified when the listener was registered. If the
+ * Java Runtime Environment supports permissions, then additional filtering is
+ * done. {@code ServiceEvent} objects are only delivered to the listener if the
+ * bundle which defines the listener object's class has the appropriate
+ * {@code ServicePermission} to get the service using at least one of the named
+ * classes under which the service was registered.
  * 
  * <p>
- * {@code ServiceEvent} object delivery to {@code ServiceListener}
- * objects is further filtered according to package sources as defined in
+ * {@code ServiceEvent} object delivery to {@code ServiceListener} objects is
+ * further filtered according to package sources as defined in
  * {@link ServiceReference#isAssignableTo(Bundle, String)}.
  * 
  * @see ServiceEvent
  * @see ServicePermission
  * @ThreadSafe
- * @version $Id: d73f8e9b4babc8b53b5d1cbe7b17b732f54bb2a3 $
+ * @version $Id: 601dfda6183ab7f18cd3916958a39734ea141c25 $
  */
 
 public interface ServiceListener extends EventListener {
diff --git a/framework/src/main/java/org/osgi/framework/ServicePermission.java b/framework/src/main/java/org/osgi/framework/ServicePermission.java
index b7a9956..23ecfba 100644
--- a/framework/src/main/java/org/osgi/framework/ServicePermission.java
+++ b/framework/src/main/java/org/osgi/framework/ServicePermission.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -41,66 +41,64 @@
 /**
  * A bundle's authority to register or get a service.
  * <ul>
- * <li>The {@code register} action allows a bundle to register a service on
- * the specified names.
- * <li>The {@code get} action allows a bundle to detect a service and get
- * it.
+ * <li>The {@code register} action allows a bundle to register a service on the
+ * specified names.
+ * <li>The {@code get} action allows a bundle to detect a service and get it.
  * </ul>
  * Permission to get a service is required in order to detect events regarding
  * the service. Untrusted bundles should not be able to detect the presence of
- * certain services unless they have the appropriate
- * {@code ServicePermission} to get the specific service.
+ * certain services unless they have the appropriate {@code ServicePermission}
+ * to get the specific service.
  * 
  * @ThreadSafe
- * @version $Id: 1b6ee9543f4cbc16add8dc8c40dfa9a6dfee7aa2 $
+ * @version $Id: 96438ad164d7f0f4273787226298bf8208cf0034 $
  */
 
 public final class ServicePermission extends BasicPermission {
-	static final long			serialVersionUID	= -7662148639076511574L;
+	static final long								serialVersionUID	= -7662148639076511574L;
 	/**
 	 * The action string {@code get}.
 	 */
-	public final static String	GET					= "get";
+	public final static String						GET					= "get";
 	/**
 	 * The action string {@code register}.
 	 */
-	public final static String	REGISTER			= "register";
+	public final static String						REGISTER			= "register";
 
-	private final static int	ACTION_GET			= 0x00000001;
-	private final static int	ACTION_REGISTER		= 0x00000002;
-	private final static int	ACTION_ALL			= ACTION_GET
-															| ACTION_REGISTER;
-	final static int						ACTION_NONE			= 0;
+	private final static int						ACTION_GET			= 0x00000001;
+	private final static int						ACTION_REGISTER		= 0x00000002;
+	private final static int						ACTION_ALL			= ACTION_GET | ACTION_REGISTER;
+	final static int								ACTION_NONE			= 0;
 
 	/**
 	 * The actions mask.
 	 */
-	transient int							action_mask;
+	transient int									action_mask;
 
 	/**
 	 * The actions in canonical form.
 	 * 
 	 * @serial
 	 */
-	private volatile String		actions				= null;
+	private volatile String							actions				= null;
 
 	/**
 	 * The service used by this ServicePermission. Must be null if not
 	 * constructed with a service.
 	 */
-	transient final ServiceReference< ? >					service;
+	transient final ServiceReference<?>				service;
 
 	/**
 	 * The object classes for this ServicePermission. Must be null if not
 	 * constructed with a service.
 	 */
-	transient final String[]				objectClass;
+	transient final String[]						objectClass;
 
 	/**
 	 * If this ServicePermission was constructed with a filter, this holds a
 	 * Filter matching object used to evaluate the filter in implies.
 	 */
-	transient Filter						filter;
+	transient Filter								filter;
 
 	/**
 	 * This map holds the properties of the permission, used to match a filter
@@ -112,13 +110,13 @@
 	/**
 	 * True if constructed with a name and the name is "*" or ends with ".*".
 	 */
-	private transient boolean				wildcard;
+	private transient boolean						wildcard;
 
 	/**
 	 * If constructed with a name and the name ends with ".*", this contains the
 	 * name without the final "*".
 	 */
-	private transient String				prefix;
+	private transient String						prefix;
 
 	/**
 	 * Create a new ServicePermission.
@@ -139,9 +137,9 @@
 	 * *
 	 * </pre>
 	 * 
-	 * For the {@code get} action, the name can also be a filter
-	 * expression. The filter gives access to the service properties as well as
-	 * the following attributes:
+	 * For the {@code get} action, the name can also be a filter expression. The
+	 * filter gives access to the service properties as well as the following
+	 * attributes:
 	 * <ul>
 	 * <li>signer - A Distinguished Name chain used to sign the bundle
 	 * publishing the service. Wildcards in a DN are not matched according to
@@ -159,33 +157,29 @@
 	 * Service properties names are case insensitive.
 	 * 
 	 * <p>
-	 * There are two possible actions: {@code get} and
-	 * {@code register}. The {@code get} permission allows the owner
-	 * of this permission to obtain a service with this name. The
-	 * {@code register} permission allows the bundle to register a service
-	 * under that name.
+	 * There are two possible actions: {@code get} and {@code register}. The
+	 * {@code get} permission allows the owner of this permission to obtain a
+	 * service with this name. The {@code register} permission allows the bundle
+	 * to register a service under that name.
 	 * 
 	 * @param name The service class name
 	 * @param actions {@code get},{@code register} (canonical order)
 	 * @throws IllegalArgumentException If the specified name is a filter
-	 *         expression and either the specified action is not
-	 *         {@code get} or the filter has an invalid syntax.
+	 *         expression and either the specified action is not {@code get} or
+	 *         the filter has an invalid syntax.
 	 */
 	public ServicePermission(String name, String actions) {
 		this(name, parseActions(actions));
-		if ((filter != null)
-				&& ((action_mask & ACTION_ALL) != ACTION_GET)) {
-			throw new IllegalArgumentException(
-					"invalid action string for filter expression");
+		if ((filter != null) && ((action_mask & ACTION_ALL) != ACTION_GET)) {
+			throw new IllegalArgumentException("invalid action string for filter expression");
 		}
 	}
 
 	/**
-	 * Creates a new requested {@code ServicePermission} object to be used
-	 * by code that must perform {@code checkPermission} for the
-	 * {@code get} action. {@code ServicePermission} objects created
-	 * with this constructor cannot be added to a {@code ServicePermission}
-	 * permission collection.
+	 * Creates a new requested {@code ServicePermission} object to be used by
+	 * code that must perform {@code checkPermission} for the {@code get}
+	 * action. {@code ServicePermission} objects created with this constructor
+	 * cannot be added to a {@code ServicePermission} permission collection.
 	 * 
 	 * @param reference The requested service.
 	 * @param actions The action {@code get}.
@@ -193,12 +187,11 @@
 	 *         {@code get} or reference is {@code null}.
 	 * @since 1.5
 	 */
-	public ServicePermission(ServiceReference< ? > reference, String actions) {
+	public ServicePermission(ServiceReference<?> reference, String actions) {
 		super(createName(reference));
 		setTransients(null, parseActions(actions));
 		this.service = reference;
-		this.objectClass = (String[]) reference
-				.getProperty(Constants.OBJECTCLASS);
+		this.objectClass = (String[]) reference.getProperty(Constants.OBJECTCLASS);
 		if ((action_mask & ACTION_ALL) != ACTION_GET) {
 			throw new IllegalArgumentException("invalid action string");
 		}
@@ -210,7 +203,7 @@
 	 * @param reference ServiceReference to use to create permission name.
 	 * @return permission name.
 	 */
-	private static String createName(ServiceReference< ? > reference) {
+	private static String createName(ServiceReference<?> reference) {
 		if (reference == null) {
 			throw new IllegalArgumentException("reference must not be null");
 		}
@@ -248,8 +241,7 @@
 			String name = getName();
 			int l = name.length();
 			/* if "*" or endsWith ".*" */
-			wildcard = ((name.charAt(l - 1) == '*') && ((l == 1) || (name
-					.charAt(l - 2) == '.')));
+			wildcard = ((name.charAt(l - 1) == '*') && ((l == 1) || (name.charAt(l - 2) == '.')));
 			if (wildcard && (l > 1)) {
 				prefix = name.substring(0, l - 1);
 			}
@@ -281,9 +273,7 @@
 			char c;
 
 			// skip whitespace
-			while ((i != -1)
-					&& ((c = a[i]) == ' ' || c == '\r' || c == '\n'
-							|| c == '\f' || c == '\t'))
+			while ((i != -1) && ((c = a[i]) == ' ' || c == '\r' || c == '\n' || c == '\f' || c == '\t'))
 				i--;
 
 			// check for the known strings
@@ -295,8 +285,7 @@
 				matchlen = 3;
 				mask |= ACTION_GET;
 
-			}
-			else
+			} else
 				if (i >= 7 && (a[i - 7] == 'r' || a[i - 7] == 'R')
 						&& (a[i - 6] == 'e' || a[i - 6] == 'E')
 						&& (a[i - 5] == 'g' || a[i - 5] == 'G')
@@ -308,11 +297,9 @@
 					matchlen = 8;
 					mask |= ACTION_REGISTER;
 
-				}
-				else {
+				} else {
 					// parse error
-					throw new IllegalArgumentException("invalid permission: "
-							+ actions);
+					throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 
 			// make sure we didn't just match the tail of a word
@@ -322,7 +309,7 @@
 				switch (a[i - matchlen]) {
 					case ',' :
 						seencomma = true;
-					/* FALLTHROUGH */
+						/* FALLTHROUGH */
 					case ' ' :
 					case '\r' :
 					case '\n' :
@@ -330,8 +317,7 @@
 					case '\t' :
 						break;
 					default :
-						throw new IllegalArgumentException(
-								"invalid permission: " + actions);
+						throw new IllegalArgumentException("invalid permission: " + actions);
 				}
 				i--;
 			}
@@ -363,18 +349,16 @@
 
 		try {
 			return FrameworkUtil.createFilter(filterString);
-		}
-		catch (InvalidSyntaxException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid filter");
+		} catch (InvalidSyntaxException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid filter");
 			iae.initCause(e);
 			throw iae;
 		}
 	}
 
 	/**
-	 * Determines if a {@code ServicePermission} object "implies" the
-	 * specified permission.
+	 * Determines if a {@code ServicePermission} object "implies" the specified
+	 * permission.
 	 * 
 	 * @param p The target permission to check.
 	 * @return {@code true} if the specified permission is implied by this
@@ -432,13 +416,11 @@
 			int pl = prefix.length();
 			for (int i = 0, l = requestedNames.length; i < l; i++) {
 				String requestedName = requestedNames[i];
-				if ((requestedName.length() > pl)
-						&& requestedName.startsWith(prefix)) {
+				if ((requestedName.length() > pl) && requestedName.startsWith(prefix)) {
 					return true;
 				}
 			}
-		}
-		else {
+		} else {
 			String name = getName();
 			for (int i = 0, l = requestedNames.length; i < l; i++) {
 				if (requestedNames[i].equals(name)) {
@@ -499,8 +481,8 @@
 	 * 
 	 * @param obj The object to test for equality.
 	 * @return true if obj is a {@code ServicePermission}, and has the same
-	 *         class name and actions as this {@code ServicePermission}
-	 *         object; {@code false} otherwise.
+	 *         class name and actions as this {@code ServicePermission} object;
+	 *         {@code false} otherwise.
 	 */
 	public boolean equals(Object obj) {
 		if (obj == this) {
@@ -513,10 +495,7 @@
 
 		ServicePermission sp = (ServicePermission) obj;
 
-		return (action_mask == sp.action_mask)
-				&& getName().equals(sp.getName())
-				&& ((service == sp.service) || ((service != null) && (service
-						.compareTo(sp.service) == 0)));
+		return (action_mask == sp.action_mask) && getName().equals(sp.getName()) && ((service == sp.service) || ((service != null) && (service.compareTo(sp.service) == 0)));
 	}
 
 	/**
@@ -537,8 +516,7 @@
 	 * WriteObject is called to save the state of this permission to a stream.
 	 * The actions are serialized, and the superclass takes care of the name.
 	 */
-	private synchronized void writeObject(java.io.ObjectOutputStream s)
-			throws IOException {
+	private synchronized void writeObject(java.io.ObjectOutputStream s) throws IOException {
 		if (service != null) {
 			throw new NotSerializableException("cannot serialize");
 		}
@@ -553,8 +531,7 @@
 	 * readObject is called to restore the state of this permission from a
 	 * stream.
 	 */
-	private synchronized void readObject(java.io.ObjectInputStream s)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream s) throws IOException, ClassNotFoundException {
 		// Read in the action, then initialize the rest
 		s.defaultReadObject();
 		setTransients(parseFilter(getName()), parseActions(actions));
@@ -598,13 +575,13 @@
 		}
 		return properties = new Properties(props, service);
 	}
-	
+
 	static private final class Properties extends AbstractMap<String, Object> {
-		private final Map<String, Object>	properties;
-		private final ServiceReference< ? >	service;
+		private final Map<String, Object>							properties;
+		private final ServiceReference<?>							service;
 		private transient volatile Set<Map.Entry<String, Object>>	entries;
 
-		Properties(Map<String, Object> properties, ServiceReference< ? > service) {
+		Properties(Map<String, Object> properties, ServiceReference<?> service) {
 			this.properties = properties;
 			this.service = service;
 			entries = null;
@@ -629,8 +606,7 @@
 			if (entries != null) {
 				return entries;
 			}
-			Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(
-					properties.entrySet());
+			Set<Map.Entry<String, Object>> all = new HashSet<Map.Entry<String, Object>>(properties.entrySet());
 			add: for (String key : service.getPropertyKeys()) {
 				for (String k : properties.keySet()) {
 					if (key.equalsIgnoreCase(k)) {
@@ -641,7 +617,7 @@
 			}
 			return entries = Collections.unmodifiableSet(all);
 		}
-		
+
 		static private final class Entry implements Map.Entry<String, Object> {
 			private final String	k;
 			private final Object	v;
@@ -650,22 +626,27 @@
 				this.k = key;
 				this.v = value;
 			}
+
 			public String getKey() {
 				return k;
 			}
+
 			public Object getValue() {
 				return v;
 			}
+
 			public Object setValue(Object value) {
 				throw new UnsupportedOperationException();
 			}
+
 			public String toString() {
 				return k + "=" + v;
 			}
+
 			public int hashCode() {
-				return ((k == null) ? 0 : k.hashCode())
-						^ ((v == null) ? 0 : v.hashCode());
+				return ((k == null) ? 0 : k.hashCode()) ^ ((v == null) ? 0 : v.hashCode());
 			}
+
 			public boolean equals(Object obj) {
 				if (obj == this) {
 					return true;
@@ -673,7 +654,7 @@
 				if (!(obj instanceof Map.Entry)) {
 					return false;
 				}
-				Map.Entry< ? , ? > e = (Map.Entry< ? , ? >) obj;
+				Map.Entry<?, ?> e = (Map.Entry<?, ?>) obj;
 				final Object key = e.getKey();
 				if ((k == key) || ((k != null) && k.equals(key))) {
 					final Object value = e.getValue();
@@ -695,7 +676,7 @@
  * @see java.security.PermissionCollection
  */
 final class ServicePermissionCollection extends PermissionCollection {
-	static final long	serialVersionUID	= 662615640374640621L;
+	static final long									serialVersionUID	= 662615640374640621L;
 	/**
 	 * Table of permissions.
 	 * 
@@ -709,7 +690,7 @@
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private boolean		all_allowed;
+	private boolean										all_allowed;
 
 	/**
 	 * Table of permissions with filter expressions.
@@ -733,26 +714,22 @@
 	 * @param permission The Permission object to add.
 	 * @throws IllegalArgumentException If the specified permission is not a
 	 *         ServicePermission object.
-	 * @throws SecurityException If this
-	 *         {@code ServicePermissionCollection} object has been marked
-	 *         read-only.
+	 * @throws SecurityException If this {@code ServicePermissionCollection}
+	 *         object has been marked read-only.
 	 */
 	public void add(final Permission permission) {
 		if (!(permission instanceof ServicePermission)) {
-			throw new IllegalArgumentException("invalid permission: "
-					+ permission);
+			throw new IllegalArgumentException("invalid permission: " + permission);
 		}
 		if (isReadOnly()) {
-			throw new SecurityException("attempt to add a Permission to a "
-					+ "readonly PermissionCollection");
+			throw new SecurityException("attempt to add a Permission to a " + "readonly PermissionCollection");
 		}
 
 		final ServicePermission sp = (ServicePermission) permission;
 		if (sp.service != null) {
-			throw new IllegalArgumentException("cannot add to collection: "
-					+ sp);
+			throw new IllegalArgumentException("cannot add to collection: " + sp);
 		}
-		
+
 		final String name = sp.getName();
 		final Filter f = sp.filter;
 		synchronized (this) {
@@ -763,25 +740,21 @@
 				if (pc == null) {
 					filterPermissions = pc = new HashMap<String, ServicePermission>();
 				}
-			}
-			else {
+			} else {
 				pc = permissions;
 			}
 			final ServicePermission existing = pc.get(name);
-			
+
 			if (existing != null) {
 				final int oldMask = existing.action_mask;
 				final int newMask = sp.action_mask;
 				if (oldMask != newMask) {
-					pc
-							.put(name, new ServicePermission(name, oldMask
-							| newMask));
+					pc.put(name, new ServicePermission(name, oldMask | newMask));
 				}
-			}
-			else {
+			} else {
 				pc.put(name, sp);
 			}
-			
+
 			if (!all_allowed) {
 				if (name.equals("*")) {
 					all_allowed = true;
@@ -795,9 +768,8 @@
 	 * {@code permission}.
 	 * 
 	 * @param permission The Permission object to compare.
-	 * @return {@code true} if {@code permission} is a proper
-	 *         subset of a permission in the set; {@code false}
-	 *         otherwise.
+	 * @return {@code true} if {@code permission} is a proper subset of a
+	 *         permission in the set; {@code false} otherwise.
 	 */
 	public boolean implies(final Permission permission) {
 		if (!(permission instanceof ServicePermission)) {
@@ -823,7 +795,7 @@
 					}
 				}
 			}
-			
+
 			String[] requestedNames = requested.objectClass;
 			/* if requested permission not created with ServiceReference */
 			if (requestedNames == null) {
@@ -846,7 +818,7 @@
 			}
 			perms = pc.values();
 		}
-		
+
 		/* iterate one by one over filteredPermissions */
 		for (ServicePermission perm : perms) {
 			if (perm.implies0(requested, effective)) {
@@ -865,8 +837,7 @@
 	 * @param effective The effective actions.
 	 * @return The new effective actions.
 	 */
-	private int effective(String requestedName, final int desired,
-			int effective) {
+	private int effective(String requestedName, final int desired, int effective) {
 		final Map<String, ServicePermission> pc = permissions;
 		ServicePermission sp = pc.get(requestedName);
 		// strategy:
@@ -899,10 +870,10 @@
 		 */
 		return effective;
 	}
-	
+
 	/**
-	 * Returns an enumeration of all the {@code ServicePermission}
-	 * objects in the container.
+	 * Returns an enumeration of all the {@code ServicePermission} objects in
+	 * the container.
 	 * 
 	 * @return Enumeration of all the ServicePermission objects.
 	 */
@@ -914,17 +885,13 @@
 		}
 		return Collections.enumeration(all);
 	}
-	
+
 	/* serialization logic */
-	private static final ObjectStreamField[]	serialPersistentFields	= {
-			new ObjectStreamField("permissions", Hashtable.class),
-			new ObjectStreamField("all_allowed", Boolean.TYPE),
+	private static final ObjectStreamField[]	serialPersistentFields	= {new ObjectStreamField("permissions", Hashtable.class), new ObjectStreamField("all_allowed", Boolean.TYPE),
 			new ObjectStreamField("filterPermissions", HashMap.class)	};
 
-	private synchronized void writeObject(ObjectOutputStream out)
-			throws IOException {
-		Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(
-				permissions);
+	private synchronized void writeObject(ObjectOutputStream out) throws IOException {
+		Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", hashtable);
 		pfields.put("all_allowed", all_allowed);
@@ -932,15 +899,12 @@
 		out.writeFields();
 	}
 
-	private synchronized void readObject(java.io.ObjectInputStream in)
-			throws IOException, ClassNotFoundException {
+	private synchronized void readObject(java.io.ObjectInputStream in) throws IOException, ClassNotFoundException {
 		ObjectInputStream.GetField gfields = in.readFields();
-		Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields
-				.get("permissions", null);
+		Hashtable<String, ServicePermission> hashtable = (Hashtable<String, ServicePermission>) gfields.get("permissions", null);
 		permissions = new HashMap<String, ServicePermission>(hashtable);
 		all_allowed = gfields.get("all_allowed", false);
-		HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields
-				.get("filterPermissions", null);
+		HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields.get("filterPermissions", null);
 		filterPermissions = fp;
 	}
 }
diff --git a/framework/src/main/java/org/osgi/framework/ServiceReference.java b/framework/src/main/java/org/osgi/framework/ServiceReference.java
index ad38df7..7541517 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceReference.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceReference.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). 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.
@@ -26,36 +26,36 @@
  * {@code BundleContext.getServiceReference} and
  * {@code BundleContext.getServiceReferences} methods.
  * <p>
- * A {@code ServiceReference} object may be shared between bundles and can
- * be used to examine the properties of the service and to get the service
- * object.
+ * A {@code ServiceReference} object may be shared between bundles and can be
+ * used to examine the properties of the service and to get the service object.
  * <p>
  * Every service registered in the Framework has a unique
  * {@code ServiceRegistration} object and may have multiple, distinct
- * {@code ServiceReference} objects referring to it.
- * {@code ServiceReference} objects associated with a
- * {@code ServiceRegistration} object have the same {@code hashCode}
- * and are considered equal (more specifically, their {@code equals()}
- * method will return {@code true} when compared).
+ * {@code ServiceReference} objects referring to it. {@code ServiceReference}
+ * objects associated with a {@code ServiceRegistration} object have the same
+ * {@code hashCode} and are considered equal (more specifically, their
+ * {@code equals()} method will return {@code true} when compared).
  * <p>
  * If the same service object is registered multiple times,
  * {@code ServiceReference} objects associated with different
  * {@code ServiceRegistration} objects are not equal.
  * 
  * @param <S> Type of Service.
- * @see BundleContext#getServiceReference
- * @see BundleContext#getServiceReferences
- * @see BundleContext#getService
+ * @see BundleContext#getServiceReference(Class)
+ * @see BundleContext#getServiceReference(String)
+ * @see BundleContext#getServiceReferences(Class, String)
+ * @see BundleContext#getServiceReferences(String, String)
+ * @see BundleContext#getService(ServiceReference)
  * @ThreadSafe
  * @noimplement
- * @version $Id: 771b9b4d4f65dbe593154d02912edba51a085b0c $
+ * @version $Id: 75352193f9f11a2c19692890153c6ff91611023b $
  */
 
 public interface ServiceReference<S> extends Comparable<Object> {
 	/**
 	 * Returns the property value to which the specified property key is mapped
-	 * in the properties {@code Dictionary} object of the service
-	 * referenced by this {@code ServiceReference} object.
+	 * in the properties {@code Dictionary} object of the service referenced by
+	 * this {@code ServiceReference} object.
 	 * 
 	 * <p>
 	 * Property keys are case-insensitive.
@@ -63,32 +63,31 @@
 	 * <p>
 	 * This method must continue to return property values after the service has
 	 * been unregistered. This is so references to unregistered services (for
-	 * example, {@code ServiceReference} objects stored in the log) can
-	 * still be interrogated.
+	 * example, {@code ServiceReference} objects stored in the log) can still be
+	 * interrogated.
 	 * 
 	 * @param key The property key.
-	 * @return The property value to which the key is mapped; {@code null}
-	 *         if there is no property named after the key.
+	 * @return The property value to which the key is mapped; {@code null} if
+	 *         there is no property named after the key.
 	 */
 	public Object getProperty(String key);
 
 	/**
-	 * Returns an array of the keys in the properties {@code Dictionary}
-	 * object of the service referenced by this {@code ServiceReference}
-	 * object.
+	 * Returns an array of the keys in the properties {@code Dictionary} object
+	 * of the service referenced by this {@code ServiceReference} object.
 	 * 
 	 * <p>
 	 * This method will continue to return the keys after the service has been
 	 * unregistered. This is so references to unregistered services (for
-	 * example, {@code ServiceReference} objects stored in the log) can
-	 * still be interrogated.
+	 * example, {@code ServiceReference} objects stored in the log) can still be
+	 * interrogated.
 	 * 
 	 * <p>
 	 * This method is <i>case-preserving </i>; this means that every key in the
 	 * returned array must have the same case as the corresponding key in the
 	 * properties {@code Dictionary} that was passed to the
 	 * {@link BundleContext#registerService(String[],Object,Dictionary)} or
-	 * {@link ServiceRegistration#setProperties} methods.
+	 * {@link ServiceRegistration#setProperties(Dictionary)} methods.
 	 * 
 	 * @return An array of property keys.
 	 */
@@ -104,21 +103,20 @@
 	 * unregistered.
 	 * 
 	 * @return The bundle that registered the service referenced by this
-	 *         {@code ServiceReference} object; {@code null} if that
-	 *         service has already been unregistered.
+	 *         {@code ServiceReference} object; {@code null} if that service has
+	 *         already been unregistered.
 	 * @see BundleContext#registerService(String[],Object,Dictionary)
 	 */
 	public Bundle getBundle();
 
 	/**
 	 * Returns the bundles that are using the service referenced by this
-	 * {@code ServiceReference} object. Specifically, this method returns
-	 * the bundles whose usage count for that service is greater than zero.
+	 * {@code ServiceReference} object. Specifically, this method returns the
+	 * bundles whose usage count for that service is greater than zero.
 	 * 
 	 * @return An array of bundles whose usage count for the service referenced
-	 *         by this {@code ServiceReference} object is greater than
-	 *         zero; {@code null} if no bundles are currently using that
-	 *         service.
+	 *         by this {@code ServiceReference} object is greater than zero;
+	 *         {@code null} if no bundles are currently using that service.
 	 * 
 	 * @since 1.1
 	 */
@@ -126,17 +124,16 @@
 
 	/**
 	 * Tests if the bundle that registered the service referenced by this
-	 * {@code ServiceReference} and the specified bundle use the same
-	 * source for the package of the specified class name.
+	 * {@code ServiceReference} and the specified bundle use the same source for
+	 * the package of the specified class name.
 	 * <p>
 	 * This method performs the following checks:
 	 * <ol>
 	 * <li>Get the package name from the specified class name.</li>
 	 * <li>For the bundle that registered the service referenced by this
-	 * {@code ServiceReference} (registrant bundle); find the source for
-	 * the package. If no source is found then return {@code true} if the
-	 * registrant bundle is equal to the specified bundle; otherwise return
-	 * {@code false}.</li>
+	 * {@code ServiceReference} (registrant bundle); find the source for the
+	 * package. If no source is found then return {@code true} if the registrant
+	 * bundle is equal to the specified bundle; otherwise return {@code false}.</li>
 	 * <li>If the package source of the registrant bundle is equal to the
 	 * package source of the specified bundle then return {@code true};
 	 * otherwise return {@code false}.</li>
@@ -145,11 +142,11 @@
 	 * @param bundle The {@code Bundle} object to check.
 	 * @param className The class name to check.
 	 * @return {@code true} if the bundle which registered the service
-	 *         referenced by this {@code ServiceReference} and the
-	 *         specified bundle use the same source for the package of the
-	 *         specified class name. Otherwise {@code false} is returned.
-	 * @throws IllegalArgumentException If the specified {@code Bundle} was
-	 *         not created by the same framework instance as this
+	 *         referenced by this {@code ServiceReference} and the specified
+	 *         bundle use the same source for the package of the specified class
+	 *         name. Otherwise {@code false} is returned.
+	 * @throws IllegalArgumentException If the specified {@code Bundle} was not
+	 *         created by the same framework instance as this
 	 *         {@code ServiceReference}.
 	 * @since 1.3
 	 */
@@ -162,24 +159,23 @@
 	 * <p>
 	 * If this {@code ServiceReference} and the specified
 	 * {@code ServiceReference} have the same {@link Constants#SERVICE_ID
-	 * service id} they are equal. This {@code ServiceReference} is less
-	 * than the specified {@code ServiceReference} if it has a lower
+	 * service id} they are equal. This {@code ServiceReference} is less than
+	 * the specified {@code ServiceReference} if it has a lower
 	 * {@link Constants#SERVICE_RANKING service ranking} and greater if it has a
-	 * higher service ranking. Otherwise, if this {@code ServiceReference}
-	 * and the specified {@code ServiceReference} have the same
+	 * higher service ranking. Otherwise, if this {@code ServiceReference} and
+	 * the specified {@code ServiceReference} have the same
 	 * {@link Constants#SERVICE_RANKING service ranking}, this
 	 * {@code ServiceReference} is less than the specified
-	 * {@code ServiceReference} if it has a higher
-	 * {@link Constants#SERVICE_ID service id} and greater if it has a lower
-	 * service id.
+	 * {@code ServiceReference} if it has a higher {@link Constants#SERVICE_ID
+	 * service id} and greater if it has a lower service id.
 	 * 
 	 * @param reference The {@code ServiceReference} to be compared.
 	 * @return Returns a negative integer, zero, or a positive integer if this
-	 *         {@code ServiceReference} is less than, equal to, or greater
-	 *         than the specified {@code ServiceReference}.
+	 *         {@code ServiceReference} is less than, equal to, or greater than
+	 *         the specified {@code ServiceReference}.
 	 * @throws IllegalArgumentException If the specified
-	 *         {@code ServiceReference} was not created by the same
-	 *         framework instance as this {@code ServiceReference}.
+	 *         {@code ServiceReference} was not created by the same framework
+	 *         instance as this {@code ServiceReference}.
 	 * @since 1.4
 	 */
 	public int compareTo(Object reference);
diff --git a/framework/src/main/java/org/osgi/framework/ServiceRegistration.java b/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
index e4cfc0e..702e918 100644
--- a/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
+++ b/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,31 +23,28 @@
  * 
  * <p>
  * The Framework returns a {@code ServiceRegistration} object when a
- * {@code BundleContext.registerService} method invocation is successful.
- * The {@code ServiceRegistration} object is for the private use of the
- * registering bundle and should not be shared with other bundles.
+ * {@code BundleContext.registerService} method invocation is successful. The
+ * {@code ServiceRegistration} object is for the private use of the registering
+ * bundle and should not be shared with other bundles.
  * <p>
- * The {@code ServiceRegistration} object may be used to update the
- * properties of the service or to unregister the service.
+ * The {@code ServiceRegistration} object may be used to update the properties
+ * of the service or to unregister the service.
  * 
  * @param <S> Type of Service.
  * @see BundleContext#registerService(String[],Object,Dictionary)
  * @ThreadSafe
  * @noimplement
- * @version $Id: dc742ff3749821529f9ae62e05d9bd5d8eca00d7 $
+ * @version $Id: a84248da0db0538708d2394a9478153e06b8afb9 $
  */
 
 public interface ServiceRegistration<S> {
 	/**
-	 * Returns a {@code ServiceReference} object for a service being
-	 * registered.
+	 * Returns a {@code ServiceReference} object for a service being registered.
 	 * <p>
-	 * The {@code ServiceReference} object may be shared with other
-	 * bundles.
+	 * The {@code ServiceReference} object may be shared with other bundles.
 	 * 
-	 * @throws IllegalStateException If this
-	 *         {@code ServiceRegistration} object has already been
-	 *         unregistered.
+	 * @throws IllegalStateException If this {@code ServiceRegistration} object
+	 *         has already been unregistered.
 	 * @return {@code ServiceReference} object.
 	 */
 	public ServiceReference<S> getReference();
@@ -72,43 +69,41 @@
 	 *        be made to this object after calling this method. To update the
 	 *        service's properties this method should be called again.
 	 * 
-	 * @throws IllegalStateException If this {@code ServiceRegistration}
-	 *         object has already been unregistered.
-	 * @throws IllegalArgumentException If {@code properties} contains
-	 *         case variants of the same key name.
+	 * @throws IllegalStateException If this {@code ServiceRegistration} object
+	 *         has already been unregistered.
+	 * @throws IllegalArgumentException If {@code properties} contains case
+	 *         variants of the same key name.
 	 */
-	public void setProperties(Dictionary<String, ? > properties);
+	public void setProperties(Dictionary<String, ?> properties);
 
 	/**
-	 * Unregisters a service. Remove a {@code ServiceRegistration} object
-	 * from the Framework service registry. All {@code ServiceReference}
-	 * objects associated with this {@code ServiceRegistration} object
-	 * can no longer be used to interact with the service once unregistration is
-	 * complete.
+	 * Unregisters a service. Remove a {@code ServiceRegistration} object from
+	 * the Framework service registry. All {@code ServiceReference} objects
+	 * associated with this {@code ServiceRegistration} object can no longer be
+	 * used to interact with the service once unregistration is complete.
 	 * 
 	 * <p>
 	 * The following steps are required to unregister a service:
 	 * <ol>
-	 * <li>The service is removed from the Framework service registry so that
-	 * it can no longer be obtained.
+	 * <li>The service is removed from the Framework service registry so that it
+	 * can no longer be obtained.
 	 * <li>A service event of type {@link ServiceEvent#UNREGISTERING} is fired
 	 * so that bundles using this service can release their use of the service.
 	 * Once delivery of the service event is complete, the
-	 * {@code ServiceReference} objects for the service may no longer be
-	 * used to get a service object for the service.
+	 * {@code ServiceReference} objects for the service may no longer be used to
+	 * get a service object for the service.
 	 * <li>For each bundle whose use count for this service is greater than
 	 * zero: <br>
 	 * The bundle's use count for this service is set to zero. <br>
 	 * If the service was registered with a {@link ServiceFactory} object, the
-	 * {@code ServiceFactory.ungetService} method is called to release
-	 * the service object for the bundle.
+	 * {@code ServiceFactory.ungetService} method is called to release the
+	 * service object for the bundle.
 	 * </ol>
 	 * 
-	 * @throws IllegalStateException If this
-	 *         {@code ServiceRegistration} object has already been
-	 *         unregistered.
-	 * @see BundleContext#ungetService
-	 * @see ServiceFactory#ungetService
+	 * @throws IllegalStateException If this {@code ServiceRegistration} object
+	 *         has already been unregistered.
+	 * @see BundleContext#ungetService(ServiceReference)
+	 * @see ServiceFactory#ungetService(Bundle, ServiceRegistration, Object)
 	 */
 	public void unregister();
 }
diff --git a/framework/src/main/java/org/osgi/framework/SignerProperty.java b/framework/src/main/java/org/osgi/framework/SignerProperty.java
index 8b357c1..9236dfa 100644
--- a/framework/src/main/java/org/osgi/framework/SignerProperty.java
+++ b/framework/src/main/java/org/osgi/framework/SignerProperty.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2012). 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.
@@ -26,7 +26,7 @@
  * during filter expression evaluation in the permission implies method.
  * 
  * @Immutable
- * @version $Id: 3589831a7594cf36e645a51ab9b9ae5ebfd80beb $
+ * @version $Id: 94eea19050b84907f1257d7a12ebf8ab404f4473 $
  */
 final class SignerProperty {
 	private final Bundle	bundle;
@@ -70,20 +70,17 @@
 		SignerProperty other = (SignerProperty) o;
 		Bundle matchBundle = bundle != null ? bundle : other.bundle;
 		String matchPattern = bundle != null ? other.pattern : pattern;
-		Map<X509Certificate, List<X509Certificate>> signers = matchBundle
-				.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
+		Map<X509Certificate, List<X509Certificate>> signers = matchBundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
 		for (List<X509Certificate> signerCerts : signers.values()) {
 			List<String> dnChain = new ArrayList<String>(signerCerts.size());
 			for (X509Certificate signerCert : signerCerts) {
 				dnChain.add(signerCert.getSubjectDN().getName());
 			}
 			try {
-				if (FrameworkUtil.matchDistinguishedNameChain(matchPattern,
-						dnChain)) {
+				if (FrameworkUtil.matchDistinguishedNameChain(matchPattern, dnChain)) {
 					return true;
 				}
-			}
-			catch (IllegalArgumentException e) {
+			} catch (IllegalArgumentException e) {
 				continue; // bad pattern
 			}
 		}
@@ -107,8 +104,7 @@
 		if (bundle == null) {
 			return false;
 		}
-		Map<X509Certificate, List<X509Certificate>> signers = bundle
-				.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
+		Map<X509Certificate, List<X509Certificate>> signers = bundle.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
 		return !signers.isEmpty();
 	}
 }
diff --git a/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java b/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
index 227dc59..ee8474c 100644
--- a/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
+++ b/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,38 +17,37 @@
 package org.osgi.framework;
 
 /**
- * A synchronous {@code BundleEvent} listener.
- * {@code SynchronousBundleListener} is a listener interface that may be
- * implemented by a bundle developer. When a {@code BundleEvent} is fired,
- * it is synchronously delivered to a {@code SynchronousBundleListener}.
- * The Framework may deliver {@code BundleEvent} objects to a
- * {@code SynchronousBundleListener} out of order and may concurrently call
- * and/or reenter a {@code SynchronousBundleListener}.
+ * A synchronous {@code BundleEvent} listener. {@code SynchronousBundleListener}
+ * is a listener interface that may be implemented by a bundle developer. When a
+ * {@code BundleEvent} is fired, it is synchronously delivered to a
+ * {@code SynchronousBundleListener}. The Framework may deliver
+ * {@code BundleEvent} objects to a {@code SynchronousBundleListener} out of
+ * order and may concurrently call and/or reenter a
+ * {@code SynchronousBundleListener}.
  * 
  * <p>
  * For {@code BundleEvent} types {@link BundleEvent#STARTED STARTED} and
  * {@link BundleEvent#LAZY_ACTIVATION LAZY_ACTIVATION}, the Framework must not
  * hold the referenced bundle's &quot;state change&quot; lock when the
- * {@code BundleEvent} is delivered to a
- * {@code SynchronousBundleListener}. For the other
- * {@code BundleEvent} types, the Framework must hold the referenced
+ * {@code BundleEvent} is delivered to a {@code SynchronousBundleListener}. For
+ * the other {@code BundleEvent} types, the Framework must hold the referenced
  * bundle's &quot;state change&quot; lock when the {@code BundleEvent} is
  * delivered to a {@code SynchronousBundleListener}. A
- * {@code SynchronousBundleListener} cannot directly call life cycle
- * methods on the referenced bundle when the Framework is holding the referenced
- * bundle's &quot;state change&quot; lock.
+ * {@code SynchronousBundleListener} cannot directly call life cycle methods on
+ * the referenced bundle when the Framework is holding the referenced bundle's
+ * &quot;state change&quot; lock.
  * 
  * <p>
- * A {@code SynchronousBundleListener} object is registered with the
- * Framework using the {@link BundleContext#addBundleListener} method.
+ * A {@code SynchronousBundleListener} object is registered with the Framework
+ * using the {@link BundleContext#addBundleListener(BundleListener)} method.
  * {@code SynchronousBundleListener} objects are called with a
  * {@code BundleEvent} object when a bundle has been installed, resolved,
  * starting, started, stopping, stopped, updated, unresolved, or uninstalled.
  * <p>
  * Unlike normal {@code BundleListener} objects,
- * {@code SynchronousBundleListener}s are synchronously called during
- * bundle lifecycle processing. The bundle lifecycle processing will not proceed
- * until all {@code SynchronousBundleListener}s have completed.
+ * {@code SynchronousBundleListener}s are synchronously called during bundle
+ * lifecycle processing. The bundle lifecycle processing will not proceed until
+ * all {@code SynchronousBundleListener}s have completed.
  * {@code SynchronousBundleListener} objects will be called prior to
  * {@code BundleListener} objects.
  * <p>
@@ -58,7 +57,7 @@
  * @since 1.1
  * @see BundleEvent
  * @ThreadSafe
- * @version $Id: b22484f48ebdcb2141da9bba9eb65f5c40e0f520 $
+ * @version $Id: 74246f4ceeba7f9a5ee198048522f93d4691c51a $
  */
 
 public interface SynchronousBundleListener extends BundleListener {
diff --git a/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java b/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
new file mode 100644
index 0000000..d712fcf
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/UnfilteredServiceListener.java
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.osgi.framework;
+
+import org.osgi.framework.hooks.service.ListenerHook;
+
+/**
+ * A {@code ServiceEvent} listener that does <i>not</i> filter based upon any
+ * filter string specified to
+ * {@link BundleContext#addServiceListener(ServiceListener, String)}. Using an
+ * {@code UnfilteredServiceListener} and specifying a filter string to
+ * {@link BundleContext#addServiceListener(ServiceListener, String)} allows the
+ * listener to receive all {@code ServiceEvent} objects while still advising
+ * {@link ListenerHook} implementation of the service interests in the filter
+ * string.
+ * 
+ * For example, an implementation of Declarative Services would add an
+ * {@code UnfilteredServiceListener} with a filter string listing all the
+ * services referenced by all the service components. The Declarative Services
+ * implementation would receive all {@code ServiceEvent} objects for internal
+ * processing and a Remote Services discovery service implementation can observe
+ * the service interests of the service components using a {@link ListenerHook}.
+ * When the set of service components being processed changes, the Declarative
+ * Services implementation would re-add the {@code UnfilteredServiceListener}
+ * with an updated filter string.
+ * 
+ * <p>
+ * When a {@code ServiceEvent} is fired, it is synchronously delivered to an
+ * {@code UnfilteredServiceListener}. The Framework may deliver
+ * {@code ServiceEvent} objects to an {@code UnfilteredServiceListener} out of
+ * order and may concurrently call and/or reenter an
+ * {@code UnfilteredServiceListener}.
+ * 
+ * <p>
+ * An {@code UnfilteredServiceListener} object is registered with the Framework
+ * using the {@code BundleContext.addServiceListener} method.
+ * {@code UnfilteredServiceListener} objects are called with a
+ * {@code ServiceEvent} object when a service is registered, modified, or is in
+ * the process of unregistering.
+ * 
+ * <p>
+ * {@code ServiceEvent} object delivery to {@code UnfilteredServiceListener}
+ * objects are <i>not</i> filtered by the filter specified when the listener was
+ * registered. If the Java Runtime Environment supports permissions, then some
+ * filtering is done. {@code ServiceEvent} objects are only delivered to the
+ * listener if the bundle which defines the listener object's class has the
+ * appropriate {@code ServicePermission} to get the service using at least one
+ * of the named classes under which the service was registered.
+ * 
+ * @see ServiceEvent
+ * @see ServicePermission
+ * @ThreadSafe
+ * @since 1.7
+ * @version $Id: 543a345802f8dc7a49d29e8fb7aee7004ee2b329 $
+ */
+
+public interface UnfilteredServiceListener extends ServiceListener {
+	// This is a marker interface
+}
diff --git a/framework/src/main/java/org/osgi/framework/Version.java b/framework/src/main/java/org/osgi/framework/Version.java
index fd2484e..02f6ddd 100644
--- a/framework/src/main/java/org/osgi/framework/Version.java
+++ b/framework/src/main/java/org/osgi/framework/Version.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2004, 2012). 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
@@ -20,7 +20,7 @@
 import java.util.StringTokenizer;
 
 /**
- * Version identifier for bundles and packages.
+ * Version identifier for capabilities such as bundles and packages.
  * 
  * <p>
  * Version identifiers have four components.
@@ -28,8 +28,8 @@
  * <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)} for the
- * format of the qualifier string.</li>
+ * <li>Qualifier. A text string. See {@code Version(String)} for the format of
+ * the qualifier string.</li>
  * </ol>
  * 
  * <p>
@@ -37,7 +37,7 @@
  * 
  * @since 1.3
  * @Immutable
- * @version $Id: a71e2e2d7685e65b5bbe375efdf97fda16eff0a5 $
+ * @version $Id: a0b5a865f7fbf2b3dcb77a13b2e99da0b64702bb $
  */
 
 public class Version implements Comparable<Version> {
@@ -46,7 +46,8 @@
 	private final int			micro;
 	private final String		qualifier;
 	private static final String	SEPARATOR		= ".";
-	private transient String	versionString;
+	private transient String	versionString /* default to null */;
+	private transient int		hash /* default to 0 */;
 
 	/**
 	 * The empty version "0.0.0".
@@ -76,8 +77,8 @@
 	 * @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} is specified, then the qualifier will be set to
-	 *        the empty string.
+	 *        {@code null} 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.
 	 */
@@ -90,15 +91,14 @@
 		this.minor = minor;
 		this.micro = micro;
 		this.qualifier = qualifier;
-		versionString = null;
 		validate();
 	}
 
 	/**
-	 * Created a version identifier from the specified string.
+	 * Creates a version identifier from the specified string.
 	 * 
 	 * <p>
-	 * Here is the grammar for version strings.
+	 * Version string grammar:
 	 * 
 	 * <pre>
 	 * version ::= major('.'minor('.'micro('.'qualifier)?)?)?
@@ -110,9 +110,8 @@
 	 * alpha ::= [a..zA..Z]
 	 * </pre>
 	 * 
-	 * There must be no whitespace in version.
-	 * 
-	 * @param version String representation of the version identifier.
+	 * @param version String representation of the version identifier. There
+	 *        must be no whitespace in the argument.
 	 * @throws IllegalArgumentException If {@code version} is improperly
 	 *         formatted.
 	 */
@@ -124,31 +123,28 @@
 
 		try {
 			StringTokenizer st = new StringTokenizer(version, SEPARATOR, true);
-			maj = Integer.parseInt(st.nextToken());
+			maj = parseInt(st.nextToken(), version);
 
 			if (st.hasMoreTokens()) { // minor
 				st.nextToken(); // consume delimiter
-				min = Integer.parseInt(st.nextToken());
+				min = parseInt(st.nextToken(), version);
 
 				if (st.hasMoreTokens()) { // micro
 					st.nextToken(); // consume delimiter
-					mic = Integer.parseInt(st.nextToken());
+					mic = parseInt(st.nextToken(), version);
 
-					if (st.hasMoreTokens()) { // qualifier
+					if (st.hasMoreTokens()) { // qualifier separator
 						st.nextToken(); // consume delimiter
 						qual = st.nextToken(""); // remaining string
 
 						if (st.hasMoreTokens()) { // fail safe
-							throw new IllegalArgumentException(
-									"invalid format: " + version);
+							throw new IllegalArgumentException("invalid version \"" + version + "\": invalid format");
 						}
 					}
 				}
 			}
-		}
-		catch (NoSuchElementException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid format: " + version);
+		} catch (NoSuchElementException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": invalid format");
 			iae.initCause(e);
 			throw iae;
 		}
@@ -157,11 +153,27 @@
 		minor = min;
 		micro = mic;
 		qualifier = qual;
-		versionString = null;
 		validate();
 	}
 
 	/**
+	 * Parse numeric component into an int.
+	 * 
+	 * @param value Numeric component
+	 * @param version Complete version string for exception message, if any
+	 * @return int value of numeric component
+	 */
+	private static int parseInt(String value, String version) {
+		try {
+			return Integer.parseInt(value);
+		} catch (NumberFormatException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid version \"" + version + "\": non-numeric \"" + value + "\"");
+			iae.initCause(e);
+			throw iae;
+		}
+	}
+
+	/**
 	 * Called by the Version constructors to validate the version components.
 	 * 
 	 * @throws IllegalArgumentException If the numerical components are negative
@@ -169,17 +181,15 @@
 	 */
 	private void validate() {
 		if (major < 0) {
-			throw new IllegalArgumentException("negative major");
+			throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + major + "\"");
 		}
 		if (minor < 0) {
-			throw new IllegalArgumentException("negative minor");
+			throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + minor + "\"");
 		}
 		if (micro < 0) {
-			throw new IllegalArgumentException("negative micro");
+			throw new IllegalArgumentException("invalid version \"" + toString0() + "\": negative number \"" + micro + "\"");
 		}
-		char[] chars = qualifier.toCharArray();
-		for (int i = 0, length = chars.length; i < length; i++) {
-	        char ch = chars[i];
+		for (char ch : qualifier.toCharArray()) {
 			if (('A' <= ch) && (ch <= 'Z')) {
 				continue;
 			}
@@ -192,8 +202,7 @@
 			if ((ch == '_') || (ch == '-')) {
 				continue;
 			}
-			throw new IllegalArgumentException("invalid qualifier: "
-					+ qualifier);
+			throw new IllegalArgumentException("invalid version \"" + toString0() + "\": invalid qualifier \"" + qualifier + "\"");
 		}
 	}
 
@@ -205,10 +214,9 @@
 	 * 
 	 * @param version String representation of the version identifier. Leading
 	 *        and trailing whitespace will be ignored.
-	 * @return A {@code Version} object representing the version
-	 *         identifier. If {@code version} is {@code null} or
-	 *         the empty string then {@code emptyVersion} will be
-	 *         returned.
+	 * @return A {@code Version} object representing the version identifier. If
+	 *         {@code version} is {@code null} or the empty string then
+	 *         {@code emptyVersion} will be returned.
 	 * @throws IllegalArgumentException If {@code version} is improperly
 	 *         formatted.
 	 */
@@ -265,13 +273,22 @@
 	 * Returns the string representation of this version identifier.
 	 * 
 	 * <p>
-	 * The format of the version string will be {@code major.minor.micro}
-	 * if qualifier is the empty string or
-	 * {@code major.minor.micro.qualifier} otherwise.
+	 * The format of the version string will be {@code major.minor.micro} if
+	 * qualifier is the empty string or {@code major.minor.micro.qualifier}
+	 * otherwise.
 	 * 
 	 * @return The string representation of this version identifier.
 	 */
 	public String toString() {
+		return toString0();
+	}
+
+	/**
+	 * Internal toString behavior
+	 * 
+	 * @return The string representation of this version identifier.
+	 */
+	String toString0() {
 		if (versionString != null) {
 			return versionString;
 		}
@@ -295,8 +312,15 @@
 	 * @return An integer which is a hash code value for this object.
 	 */
 	public int hashCode() {
-		return (major << 24) + (minor << 16) + (micro << 8)
-				+ qualifier.hashCode();
+		if (hash != 0) {
+			return hash;
+		}
+		int h = 31 * 17;
+		h = 31 * h + major;
+		h = 31 * h + minor;
+		h = 31 * h + micro;
+		h = 31 * h + qualifier.hashCode();
+		return hash = h;
 	}
 
 	/**
@@ -308,9 +332,8 @@
 	 * is equal (using {@code String.equals}).
 	 * 
 	 * @param object The {@code Version} object to be compared.
-	 * @return {@code true} if {@code object} is a
-	 *         {@code Version} and is equal to this object;
-	 *         {@code false} otherwise.
+	 * @return {@code true} if {@code object} is a {@code Version} and is equal
+	 *         to this object; {@code false} otherwise.
 	 */
 	public boolean equals(Object object) {
 		if (object == this) { // quicktest
@@ -322,15 +345,14 @@
 		}
 
 		Version other = (Version) object;
-		return (major == other.major) && (minor == other.minor)
-				&& (micro == other.micro) && qualifier.equals(other.qualifier);
+		return (major == other.major) && (minor == other.minor) && (micro == other.micro) && qualifier.equals(other.qualifier);
 	}
 
 	/**
 	 * Compares this {@code Version} object to another {@code Version}.
 	 * 
 	 * <p>
-	 * A version is considered to be <b>less than </b> another version if its
+	 * 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
diff --git a/framework/src/main/java/org/osgi/framework/VersionRange.java b/framework/src/main/java/org/osgi/framework/VersionRange.java
new file mode 100644
index 0000000..0589a75
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/VersionRange.java
@@ -0,0 +1,509 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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 range. A version range is an interval describing a set of
+ * {@link Version versions}.
+ * 
+ * <p>
+ * A range has a left (lower) endpoint and a right (upper) endpoint. Each
+ * endpoint can be open (excluded from the set) or closed (included in the set).
+ * 
+ * <p>
+ * {@code VersionRange} objects are immutable.
+ * 
+ * @since 1.7
+ * @Immutable
+ * @version $Id: d0c21e6a5015a7fa0b33179a29122ea7d137145a $
+ */
+
+public class VersionRange {
+	/**
+	 * The left endpoint is open and is excluded from the range.
+	 * <p>
+	 * The value of {@code LEFT_OPEN} is {@code '('}.
+	 */
+	public static final char	LEFT_OPEN				= '(';
+	/**
+	 * The left endpoint is closed and is included in the range.
+	 * <p>
+	 * The value of {@code LEFT_CLOSED} is {@code '['}.
+	 */
+	public static final char	LEFT_CLOSED				= '[';
+	/**
+	 * The right endpoint is open and is excluded from the range.
+	 * <p>
+	 * The value of {@code RIGHT_OPEN} is {@code ')'}.
+	 */
+	public static final char	RIGHT_OPEN				= ')';
+	/**
+	 * The right endpoint is closed and is included in the range.
+	 * <p>
+	 * The value of {@code RIGHT_CLOSED} is {@code ']'}.
+	 */
+	public static final char	RIGHT_CLOSED			= ']';
+
+	private final boolean		leftClosed;
+	private final Version		left;
+	private final Version		right;
+	private final boolean		rightClosed;
+	private final boolean		empty;
+
+	private transient String	versionRangeString /* default to null */;
+	private transient int		hash /* default to 0 */;
+
+	private static final String	LEFT_OPEN_DELIMITER		= "(";
+	private static final String	LEFT_CLOSED_DELIMITER	= "[";
+	private static final String	LEFT_DELIMITERS			= LEFT_CLOSED_DELIMITER + LEFT_OPEN_DELIMITER;
+	private static final String	RIGHT_OPEN_DELIMITER	= ")";
+	private static final String	RIGHT_CLOSED_DELIMITER	= "]";
+	private static final String	RIGHT_DELIMITERS		= RIGHT_OPEN_DELIMITER + RIGHT_CLOSED_DELIMITER;
+	private static final String	ENDPOINT_DELIMITER		= ",";
+
+	/**
+	 * Creates a version range from the specified versions.
+	 * 
+	 * @param leftType Must be either {@link #LEFT_CLOSED} or {@link #LEFT_OPEN}
+	 *        .
+	 * @param leftEndpoint Left endpoint of range. Must not be {@code null}.
+	 * @param rightEndpoint Right endpoint of range. May be {@code null} to
+	 *        indicate the right endpoint is <i>Infinity</i>.
+	 * @param rightType Must be either {@link #RIGHT_CLOSED} or
+	 *        {@link #RIGHT_OPEN}.
+	 * @throws IllegalArgumentException If the arguments are invalid.
+	 */
+	public VersionRange(char leftType, Version leftEndpoint, Version rightEndpoint, char rightType) {
+		if ((leftType != LEFT_CLOSED) && (leftType != LEFT_OPEN)) {
+			throw new IllegalArgumentException("invalid leftType \"" + leftType + "\"");
+		}
+		if ((rightType != RIGHT_OPEN) && (rightType != RIGHT_CLOSED)) {
+			throw new IllegalArgumentException("invalid rightType \"" + rightType + "\"");
+		}
+		if (leftEndpoint == null) {
+			throw new IllegalArgumentException("null leftEndpoint argument");
+		}
+		leftClosed = leftType == LEFT_CLOSED;
+		rightClosed = rightType == RIGHT_CLOSED;
+		left = leftEndpoint;
+		right = rightEndpoint;
+		empty = isEmpty0();
+	}
+
+	/**
+	 * Creates a version range from the specified string.
+	 * 
+	 * <p>
+	 * Version range string grammar:
+	 * 
+	 * <pre>
+	 * range ::= interval | atleast
+	 * interval ::= ( '[' | '(' ) left ',' right ( ']' | ')' )
+	 * left ::= version
+	 * right ::= version
+	 * atleast ::= version
+	 * </pre>
+	 * 
+	 * @param range String representation of the version range. The versions in
+	 *        the range must contain no whitespace. Other whitespace in the
+	 *        range string is ignored.
+	 * @throws IllegalArgumentException If {@code range} is improperly
+	 *         formatted.
+	 */
+	public VersionRange(String range) {
+		boolean closedLeft;
+		boolean closedRight;
+		Version endpointLeft;
+		Version endpointRight;
+
+		try {
+			StringTokenizer st = new StringTokenizer(range, LEFT_DELIMITERS, true);
+			String token = st.nextToken().trim(); // whitespace or left delim
+			if (token.length() == 0) { // leading whitespace
+				token = st.nextToken(); // left delim
+			}
+			closedLeft = LEFT_CLOSED_DELIMITER.equals(token);
+			if (!closedLeft && !LEFT_OPEN_DELIMITER.equals(token)) {
+				// first token is not a delimiter, so it must be "atleast"
+				if (st.hasMoreTokens()) { // there must be no more tokens
+					throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+				}
+				leftClosed = true;
+				rightClosed = false;
+				left = parseVersion(token, range);
+				right = null;
+				empty = false;
+				return;
+			}
+			String version = st.nextToken(ENDPOINT_DELIMITER);
+			endpointLeft = parseVersion(version, range);
+			token = st.nextToken(); // consume comma
+			version = st.nextToken(RIGHT_DELIMITERS);
+			token = st.nextToken(); // right delim
+			closedRight = RIGHT_CLOSED_DELIMITER.equals(token);
+			if (!closedRight && !RIGHT_OPEN_DELIMITER.equals(token)) {
+				throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+			}
+			endpointRight = parseVersion(version, range);
+
+			if (st.hasMoreTokens()) { // any more tokens have to be whitespace
+				token = st.nextToken("").trim();
+				if (token.length() != 0) { // trailing whitespace
+					throw new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+				}
+			}
+		} catch (NoSuchElementException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": invalid format");
+			iae.initCause(e);
+			throw iae;
+		}
+
+		leftClosed = closedLeft;
+		rightClosed = closedRight;
+		left = endpointLeft;
+		right = endpointRight;
+		empty = isEmpty0();
+	}
+
+	/**
+	 * Parse version component into a Version.
+	 * 
+	 * @param version version component string
+	 * @param range Complete range string for exception message, if any
+	 * @return Version
+	 */
+	private static Version parseVersion(String version, String range) {
+		try {
+			return Version.parseVersion(version);
+		} catch (IllegalArgumentException e) {
+			IllegalArgumentException iae = new IllegalArgumentException("invalid range \"" + range + "\": " + e.getMessage());
+			iae.initCause(e);
+			throw iae;
+		}
+	}
+
+	/**
+	 * Returns the left endpoint of this version range.
+	 * 
+	 * @return The left endpoint.
+	 */
+	public Version getLeft() {
+		return left;
+	}
+
+	/**
+	 * Returns the right endpoint of this version range.
+	 * 
+	 * @return The right endpoint. May be {@code null} which indicates the right
+	 *         endpoint is <i>Infinity</i>.
+	 */
+	public Version getRight() {
+		return right;
+	}
+
+	/**
+	 * Returns the type of the left endpoint of this version range.
+	 * 
+	 * @return {@link #LEFT_CLOSED} if the left endpoint is closed or
+	 *         {@link #LEFT_OPEN} if the left endpoint is open.
+	 */
+	public char getLeftType() {
+		return leftClosed ? LEFT_CLOSED : LEFT_OPEN;
+	}
+
+	/**
+	 * Returns the type of the right endpoint of this version range.
+	 * 
+	 * @return {@link #RIGHT_CLOSED} if the right endpoint is closed or
+	 *         {@link #RIGHT_OPEN} if the right endpoint is open.
+	 */
+	public char getRightType() {
+		return rightClosed ? RIGHT_CLOSED : RIGHT_OPEN;
+	}
+
+	/**
+	 * Returns whether this version range includes the specified version.
+	 * 
+	 * @param version The version to test for inclusion in this version range.
+	 * @return {@code true} if the specified version is included in this version
+	 *         range; {@code false} otherwise.
+	 */
+	public boolean includes(Version version) {
+		if (empty) {
+			return false;
+		}
+		if (left.compareTo(version) >= (leftClosed ? 1 : 0)) {
+			return false;
+		}
+		if (right == null) {
+			return true;
+		}
+		return right.compareTo(version) >= (rightClosed ? 0 : 1);
+	}
+
+	/**
+	 * Returns the intersection of this version range with the specified version
+	 * ranges.
+	 * 
+	 * @param ranges The version ranges to intersect with this version range.
+	 * @return A version range representing the intersection of this version
+	 *         range and the specified version ranges. If no version ranges are
+	 *         specified, then this version range is returned.
+	 */
+	public VersionRange intersection(VersionRange... ranges) {
+		if ((ranges == null) || (ranges.length == 0)) {
+			return this;
+		}
+		// prime with data from this version range
+		boolean closedLeft = leftClosed;
+		boolean closedRight = rightClosed;
+		Version endpointLeft = left;
+		Version endpointRight = right;
+
+		for (VersionRange range : ranges) {
+			int comparison = endpointLeft.compareTo(range.left);
+			if (comparison == 0) {
+				closedLeft = closedLeft && range.leftClosed;
+			} else {
+				if (comparison < 0) { // move endpointLeft to the right
+					endpointLeft = range.left;
+					closedLeft = range.leftClosed;
+				}
+			}
+			if (range.right != null) {
+				if (endpointRight == null) {
+					endpointRight = range.right;
+					closedRight = range.rightClosed;
+				} else {
+					comparison = endpointRight.compareTo(range.right);
+					if (comparison == 0) {
+						closedRight = closedRight && range.rightClosed;
+					} else {
+						if (comparison > 0) { // move endpointRight to the left
+							endpointRight = range.right;
+							closedRight = range.rightClosed;
+						}
+					}
+				}
+			}
+		}
+
+		return new VersionRange(closedLeft ? LEFT_CLOSED : LEFT_OPEN, endpointLeft, endpointRight, closedRight ? RIGHT_CLOSED : RIGHT_OPEN);
+	}
+
+	/**
+	 * Returns whether this version range is empty. A version range is empty if
+	 * the set of versions defined by the interval is empty.
+	 * 
+	 * @return {@code true} if this version range is empty; {@code false}
+	 *         otherwise.
+	 */
+	public boolean isEmpty() {
+		return empty;
+	}
+
+	/**
+	 * Internal isEmpty behavior.
+	 * 
+	 * @return {@code true} if this version range is empty; {@code false}
+	 *         otherwise.
+	 */
+	private boolean isEmpty0() {
+		if (right == null) { // infinity
+			return false;
+		}
+		int comparison = left.compareTo(right);
+		if (comparison == 0) { // endpoints equal
+			return !leftClosed || !rightClosed;
+		}
+		return comparison > 0; // true if left > right
+	}
+
+	/**
+	 * Returns whether this version range contains only a single version.
+	 * 
+	 * @return {@code true} if this version range contains only a single
+	 *         version; {@code false} otherwise.
+	 */
+	public boolean isExact() {
+		if (empty || (right == null)) {
+			return false;
+		}
+		if (leftClosed) {
+			if (rightClosed) {
+				// [l,r]: exact if l == r
+				return left.equals(right);
+			} else {
+				// [l,r): exact if l++ >= r
+				Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
+				return adjacent1.compareTo(right) >= 0;
+			}
+		} else {
+			if (rightClosed) {
+				// (l,r] is equivalent to [l++,r]: exact if l++ == r
+				Version adjacent1 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "-");
+				return adjacent1.equals(right);
+			} else {
+				// (l,r) is equivalent to [l++,r): exact if (l++)++ >=r
+				Version adjacent2 = new Version(left.getMajor(), left.getMinor(), left.getMicro(), left.getQualifier() + "--");
+				return adjacent2.compareTo(right) >= 0;
+			}
+		}
+	}
+
+	/**
+	 * Returns the string representation of this version range.
+	 * 
+	 * <p>
+	 * The format of the version range string will be a version string if the
+	 * right end point is <i>Infinity</i> ({@code null}) or an interval string.
+	 * 
+	 * @return The string representation of this version range.
+	 */
+	public String toString() {
+		if (versionRangeString != null) {
+			return versionRangeString;
+		}
+		String leftVersion = left.toString();
+		if (right == null) {
+			StringBuffer result = new StringBuffer(leftVersion.length() + 1);
+			result.append(left.toString0());
+			return versionRangeString = result.toString();
+		}
+		String rightVerion = right.toString();
+		StringBuffer result = new StringBuffer(leftVersion.length() + rightVerion.length() + 5);
+		result.append(leftClosed ? LEFT_CLOSED : LEFT_OPEN);
+		result.append(left.toString0());
+		result.append(ENDPOINT_DELIMITER);
+		result.append(right.toString0());
+		result.append(rightClosed ? RIGHT_CLOSED : RIGHT_OPEN);
+		return versionRangeString = 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() {
+		if (hash != 0) {
+			return hash;
+		}
+		if (empty) {
+			return hash = 31;
+		}
+		int h = 31 + (leftClosed ? 7 : 5);
+		h = 31 * h + left.hashCode();
+		if (right != null) {
+			h = 31 * h + right.hashCode();
+			h = 31 * h + (rightClosed ? 7 : 5);
+		}
+		return hash = h;
+	}
+
+	/**
+	 * Compares this {@code VersionRange} object to another object.
+	 * 
+	 * <p>
+	 * A version range is considered to be <b>equal to </b> another version
+	 * range if both the endpoints and their types are equal or if both version
+	 * ranges are {@link #isEmpty() empty}.
+	 * 
+	 * @param object The {@code VersionRange} object to be compared.
+	 * @return {@code true} if {@code object} is a {@code VersionRange} and is
+	 *         equal to this object; {@code false} otherwise.
+	 */
+	public boolean equals(Object object) {
+		if (object == this) { // quicktest
+			return true;
+		}
+		if (!(object instanceof VersionRange)) {
+			return false;
+		}
+		VersionRange other = (VersionRange) object;
+		if (empty && other.empty) {
+			return true;
+		}
+		if (right == null) {
+			return (leftClosed == other.leftClosed) && (other.right == null) && left.equals(other.left);
+		}
+		return (leftClosed == other.leftClosed) && (rightClosed == other.rightClosed) && left.equals(other.left) && right.equals(other.right);
+	}
+
+	/**
+	 * Returns the filter string for this version range using the specified
+	 * attribute name.
+	 * 
+	 * @param attributeName The attribute name to use in the returned filter
+	 *        string.
+	 * @return A filter string for this version range using the specified
+	 *         attribute name.
+	 * @throws IllegalArgumentException If the specified attribute name is not a
+	 *         valid attribute name.
+	 * 
+	 * @see "Core Specification, Filters, for a description of the filter string syntax."
+	 */
+	public String toFilterString(String attributeName) {
+		if (attributeName.length() == 0) {
+			throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
+		}
+		for (char ch : attributeName.toCharArray()) {
+			if ((ch == '=') || (ch == '>') || (ch == '<') || (ch == '~') || (ch == '(') || (ch == ')')) {
+				throw new IllegalArgumentException("invalid attributeName \"" + attributeName + "\"");
+			}
+		}
+
+		StringBuffer result = new StringBuffer(128);
+		if (right != null) {
+			result.append("(&");
+		}
+		if (leftClosed) {
+			result.append('(');
+			result.append(attributeName);
+			result.append(">=");
+			result.append(left.toString0());
+			result.append(')');
+		} else {
+			result.append("(!(");
+			result.append(attributeName);
+			result.append("<=");
+			result.append(left.toString0());
+			result.append("))");
+		}
+		if (right != null) {
+			if (rightClosed) {
+				result.append('(');
+				result.append(attributeName);
+				result.append("<=");
+				result.append(right.toString0());
+				result.append(')');
+			} else {
+				result.append("(!(");
+				result.append(attributeName);
+				result.append(">=");
+				result.append(right.toString0());
+				result.append("))");
+			}
+			result.append(')');
+		}
+
+		return result.toString();
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
new file mode 100644
index 0000000..37446ff
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/CollisionHook.java
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.bundle;
+
+import java.util.Collection;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+
+/**
+ * OSGi Framework Bundle Collision Hook Service.
+ * 
+ * <p>
+ * If the framework was launched with the {@link Constants#FRAMEWORK_BSNVERSION
+ * org.osgi.framework.bsnversion} framework launching property set to
+ * {@link Constants#FRAMEWORK_BSNVERSION_MANAGED managed}, then all registered
+ * collision hook services will be called during framework bundle install and
+ * update operations to determine if an install or update operation will result
+ * in a bundle symbolic name and version collision.
+ * 
+ * @ThreadSafe
+ * @version $Id: a1a25ee0432f210a56e911246f477f19edc28bc1 $
+ */
+public interface CollisionHook {
+
+	/**
+	 * Specifies a bundle install operation is being performed.
+	 */
+	int	INSTALLING	= 1;
+
+	/**
+	 * Specifies a bundle update operation is being performed.
+	 */
+	int	UPDATING	= 2;
+
+	/**
+	 * Filter bundle collisions hook method. This method is called during the
+	 * install or update operation. The operation type will be
+	 * {@link #INSTALLING installing} or {@link #UPDATING updating}. Depending
+	 * on the operation type the target bundle and the collision candidate
+	 * collection are the following:
+	 * <ul>
+	 * <li> {@link #INSTALLING installing} - The target is the bundle associated
+	 * with the {@link BundleContext} used to call one of the
+	 * {@link BundleContext#installBundle(String) install} methods. The
+	 * collision candidate collection contains the existing bundles installed
+	 * which have the same symbolic name and version as the bundle being
+	 * installed.
+	 * <li> {@link #UPDATING updating} - The target is the bundle used to call
+	 * one of the {@link Bundle#update() update} methods. The collision
+	 * candidate collection contains the existing bundles installed which have
+	 * the same symbolic name and version as the content the target bundle is
+	 * being updated to.
+	 * </ul>
+	 * This method can filter the collection of collision candidates by removing
+	 * potential collisions. For the specified operation to succeed, the
+	 * collection of collision candidates must be empty after all registered
+	 * collision hook services have been called.
+	 * 
+	 * @param operationType The operation type. Must be the value of
+	 *        {@link #INSTALLING installing} or {@link #UPDATING updating}.
+	 * @param target The target bundle used to determine what collision
+	 *        candidates to filter.
+	 * @param collisionCandidates The collection of collision candidates. The
+	 *        collection supports all the optional {@code Collection} operations
+	 *        except {@code add} and {@code addAll}. Attempting to add to the
+	 *        collection will result in an {@code UnsupportedOperationException}
+	 *        . The collection is not synchronized.
+	 */
+	void filterCollisions(int operationType, Bundle target, Collection<Bundle> collisionCandidates);
+}
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
index 4b50ab3..e66a20e 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/EventHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,11 +17,10 @@
 package org.osgi.framework.hooks.bundle;
 
 import java.util.Collection;
-
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 
-/** 
+/**
  * OSGi Framework Bundle Event Hook Service.
  * 
  * <p>
@@ -29,21 +28,23 @@
  * (install, start, stop, update, and uninstall bundle) operations.
  * 
  * @ThreadSafe
- * @version $Id: 18ea1ec1f14f47410a43e99be4da3b2583149722 $
+ * @version $Id: e1471b36491a02bd8598a30d05c889ee58edc760 $
  */
 public interface EventHook {
 
 	/**
-	 * Bundle event hook method.  This method is called prior to bundle event
-	 * delivery when a bundle is installed, resolved, started, stopped, unresolved, or
-	 * uninstalled.  This method can filter the bundles which receive the event.
+	 * Bundle event hook method. This method is called prior to bundle event
+	 * delivery when a bundle is installed, resolved, started, stopped,
+	 * unresolved, or uninstalled. This method can filter the bundles which
+	 * receive the event.
 	 * <p>
-	 * This method must be called by the framework one and only one time for each bundle 
-	 * event generated, this included bundle events which are generated when there are no 
-	 * bundle listeners registered.  This method must be called on the same thread that is 
-	 * performing the action which generated the specified event.  The specified 
-	 * collection includes bundle contexts with synchronous and asynchronous bundle 
-	 * listeners registered with them.
+	 * This method must be called by the framework one and only one time for
+	 * each bundle event generated, this included bundle events which are
+	 * generated when there are no bundle listeners registered. This method must
+	 * be called on the same thread that is performing the action which
+	 * generated the specified event. The specified collection includes bundle
+	 * contexts with synchronous and asynchronous bundle listeners registered
+	 * with them.
 	 * 
 	 * @param event The bundle event to be delivered
 	 * @param contexts A collection of Bundle Contexts for bundles which have
@@ -52,9 +53,9 @@
 	 *        collection to prevent the event from being delivered to the
 	 *        associated bundles. The collection supports all the optional
 	 *        {@code Collection} operations except {@code add} and
-	 *        {@code addAll}. Attempting to add to the collection will
-	 *        result in an {@code UnsupportedOperationException}. The
-	 *        collection is not synchronized.
+	 *        {@code addAll}. Attempting to add to the collection will result in
+	 *        an {@code UnsupportedOperationException}. The collection is not
+	 *        synchronized.
 	 */
 	void event(BundleEvent event, Collection<BundleContext> contexts);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java b/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
index e55ee3b..af556ea 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/bundle/FindHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.
@@ -13,10 +13,10 @@
  * See the License for the specific language governing permissions and
  * limitations under the License.
  */
+
 package org.osgi.framework.hooks.bundle;
 
 import java.util.Collection;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleException;
@@ -29,7 +29,7 @@
  * (get bundles) operations.
  * 
  * @ThreadSafe
- * @version $Id: 4492a677df650072fe6acaea9ea35571f31eb5a9 $
+ * @version $Id: ae6bf5fc5cf999ac39dfc195c99ef7e223e3b847 $
  */
 public interface FindHook {
 	/**
@@ -48,19 +48,16 @@
 	 * {@link BundleException#REJECTED_BY_HOOK} exception.</li>
 	 * </ul>
 	 * 
-	 * @param context
-	 *            The bundle context of the bundle performing the find
-	 *            operation.
-	 * @param bundles
-	 *            A collection of Bundles to be returned as a result of the find
-	 *            operation. The implementation of this method may remove
-	 *            bundles from the collection to prevent the bundles from being
-	 *            returned to the bundle performing the find operation. The
-	 *            collection supports all the optional {@code Collection}
-	 *            operations except {@code add} and {@code addAll}. Attempting
-	 *            to add to the collection will result in an
-	 *            {@code UnsupportedOperationException}. The collection is not
-	 *            synchronized.
+	 * @param context The bundle context of the bundle performing the find
+	 *        operation.
+	 * @param bundles A collection of Bundles to be returned as a result of the
+	 *        find operation. The implementation of this method may remove
+	 *        bundles from the collection to prevent the bundles from being
+	 *        returned to the bundle performing the find operation. The
+	 *        collection supports all the optional {@code Collection} operations
+	 *        except {@code add} and {@code addAll}. Attempting to add to the
+	 *        collection will result in an {@code UnsupportedOperationException}
+	 *        . The collection is not synchronized.
 	 */
 	void find(BundleContext context, Collection<Bundle> bundles);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
index bbde7ff..51c46ec 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,8 +17,9 @@
 package org.osgi.framework.hooks.resolver;
 
 import java.util.Collection;
-
 import org.osgi.framework.Bundle;
+import org.osgi.framework.namespace.BundleNamespace;
+import org.osgi.framework.namespace.IdentityNamespace;
 import org.osgi.framework.wiring.BundleCapability;
 import org.osgi.framework.wiring.BundleRequirement;
 import org.osgi.framework.wiring.BundleRevision;
@@ -51,62 +52,70 @@
  * must be thrown to the caller of the API which triggered the resolve process.
  * In cases where the the caller is not available a framework event of type
  * error should be fired.</li>
+ * 
  * <li>For each registered hook factory call the
  * {@link ResolverHookFactory#begin(Collection)} method to inform the hooks
  * about a resolve process beginning and to obtain a Resolver Hook instance that
  * will be used for the duration of the resolve process.</li>
+ * 
  * <li>Determine the collection of unresolved bundle revisions that may be
  * considered for resolution during the current resolution process and place
- * each of the bundle revisions in a shrinkable collection {@code R}. For each
- * resolver hook call the {@link #filterResolvable(Collection)} method with the
- * shrinkable collection {@code R}.</li>
- * <li>The shrinkable collection {@code R} now contains all the unresolved
- * bundle revisions that may end up as resolved at the end of the current
- * resolve process. Any other bundle revisions that got removed from the
- * shrinkable collection {@code R} must not end up as resolved at the end of the
- * current resolve process.</li>
+ * each of the bundle revisions in a shrinkable collection {@code Resolvable}.
+ * For each resolver hook call the {@link #filterResolvable(Collection)} method
+ * with the shrinkable collection {@code Resolvable}.</li>
+ * <li>The shrinkable collection {@code Resolvable} now contains all the
+ * unresolved bundle revisions that may end up as resolved at the end of the
+ * current resolve process. Any other bundle revisions that got removed from the
+ * shrinkable collection {@code Resolvable} must not end up as resolved at the
+ * end of the current resolve process.</li>
  * <li>For each bundle revision {@code B} left in the shrinkable collection
- * {@code R} that represents a singleton bundle do the following:<br/>
- * Determine the collection of available capabilities that have a name space of
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}, are singletons,
- * and have the same symbolic name as the singleton bundle revision {@code B}
- * and place each of the matching capabilities into a shrinkable collection
- * {@code S}.
- * 
- * Remove the {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}
- * capability provided by bundle revision {@code B} from shrinkable collection
- * {@code S}. A singleton bundle cannot collide with itself.
- * 
+ * {@code Resolvable} and any bundle revision {@code B} which is currently
+ * resolved that represents a singleton bundle do the following:
+ * <p/>
+ * Determine the collection of available capabilities that have a namespace of
+ * {@link IdentityNamespace osgi.identity}, are singletons, and have the same
+ * symbolic name as the singleton bundle revision {@code B} and place each of
+ * the matching capabilities into a shrinkable collection {@code Collisions}.
+ * <p/>
+ * Remove the {@link IdentityNamespace osgi.identity} capability provided by
+ * bundle revision {@code B} from shrinkable collection {@code Collisions}. A
+ * singleton bundle cannot collide with itself.
+ * <p/>
  * For each resolver hook call the
  * {@link #filterSingletonCollisions(BundleCapability, Collection)} with the
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} capability
- * provided by bundle revision {@code B} and the shrinkable collection {@code S}
- * 
- * The shrinkable collection {@code S} now contains all singleton
- * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} capabilities that
- * can influence the ability of bundle revision {@code B} to resolve.</li>
- * <li>During a resolve process a framework is free to attempt to resolve any or
- * all bundles contained in shrinkable collection {@code R}. For each bundle
- * revision {@code B} left in the shrinkable collection {@code R} which the
- * framework attempts to resolve the following steps must be followed:
+ * {@link IdentityNamespace osgi.identity} capability provided by bundle
+ * revision {@code B} and the shrinkable collection {@code Collisions}
  * <p/>
- * For each requirement {@code T} specified by bundle revision {@code B}
+ * The shrinkable collection {@code Collisions} now contains all singleton
+ * {@link IdentityNamespace osgi.identity} capabilities that can influence the
+ * ability of bundle revision {@code B} to resolve.
+ * <p/>
+ * If the bundle revision {@code B} is already resolved then any resolvable
+ * bundle revision contained in the collection {@code Collisions} is not allowed
+ * to resolve.</li>
+ * <li>During a resolve process a framework is free to attempt to resolve any or
+ * all bundles contained in shrinkable collection {@code Resolvable}. For each
+ * bundle revision {@code B} left in the shrinkable collection
+ * {@code Resolvable} which the framework attempts to resolve the following
+ * steps must be followed:
+ * <p/>
+ * For each requirement {@code R} specified by bundle revision {@code B}
  * determine the collection of capabilities that satisfy (or match) the
  * requirement and place each matching capability into a shrinkable collection
- * {@code C}. A capability is considered to match a particular requirement if
- * its attributes satisfy a specified requirement and the requirer bundle has
- * permission to access the capability.
+ * {@code Candidates}. A capability is considered to match a particular
+ * requirement if its attributes satisfy a specified requirement and the
+ * requirer bundle has permission to access the capability.
  * 
  * <p/>
  * For each resolver hook call the
  * {@link #filterMatches(BundleRequirement, Collection)} with the requirement
- * {@code T} and the shrinkable collection {@code C}.
+ * {@code R} and the shrinkable collection {@code Candidates}.
  * 
  * <p/>
- * The shrinkable collection {@code C} now contains all the capabilities that
- * may be used to satisfy the requirement {@code T}. Any other capabilities that
- * got removed from the shrinkable collection {@code C} must not be used to
- * satisfy requirement {@code T}.</li>
+ * The shrinkable collection {@code Candidates} now contains all the
+ * capabilities that may be used to satisfy the requirement {@code R}. Any other
+ * capabilities that got removed from the shrinkable collection
+ * {@code Candidates} must not be used to satisfy requirement {@code R}.</li>
  * <li>For each resolver hook call the {@link #end()} method to inform the hooks
  * about a resolve process ending.</li>
  * </ol>
@@ -125,18 +134,18 @@
  * 
  * @see ResolverHookFactory
  * @NotThreadSafe
- * @version $Id: ea23400257d780706250f8825ec886aaebb0e5d8 $
+ * @version $Id: 9d3ef6240aead0952b5a47b793780c1c0589089a $
  */
 public interface ResolverHook {
 	/**
-	 * Filter resolvable candidates hook method.  This method may be called
-	 * multiple times during a single resolve process.
-	 * This method can filter the collection of candidates by removing 
-	 * potential candidates.  Removing a candidate will prevent the candidate
-	 * from resolving during the current resolve process. 
+	 * Filter resolvable candidates hook method. This method may be called
+	 * multiple times during a single resolve process. This method can filter
+	 * the collection of candidates by removing potential candidates. Removing a
+	 * candidate will prevent the candidate from resolving during the current
+	 * resolve process.
 	 * 
-	 * @param candidates the collection of resolvable candidates available during
-	 * a resolve process. 
+	 * @param candidates the collection of resolvable candidates available
+	 *        during a resolve process.
 	 */
 	void filterResolvable(Collection<BundleRevision> candidates);
 
@@ -146,19 +155,18 @@
 	 * represents a singleton capability and the specified collection represent
 	 * a collection of singleton capabilities which are considered collision
 	 * candidates. The singleton capability and the collection of collision
-	 * candidates must all use the same name space.
+	 * candidates must all use the same namespace.
 	 * <p>
-	 * Currently only capabilities with the name space of
-	 * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle} can be
-	 * singletons. In that case all the collision candidates have the name space
-	 * of {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}, are
+	 * Currently only capabilities with the namespace of {@link BundleNamespace
+	 * osgi.wiring.bundle} and {@link IdentityNamespace osgi.identity} can be
+	 * singletons. The collision candidates will all have the same namespace, be
 	 * singletons, and have the same symbolic name as the specified singleton
 	 * capability.
 	 * <p>
-	 * In the future, capabilities in other name spaces may support the
-	 * singleton concept. Hook implementations should be prepared to receive
-	 * calls to this method for capabilities in name spaces other than
-	 * {@link BundleRevision#BUNDLE_NAMESPACE osgi.wiring.bundle}.
+	 * In the future, capabilities in other namespaces may support the singleton
+	 * concept. Hook implementations should be prepared to receive calls to this
+	 * method for capabilities in namespaces other than {@link BundleNamespace
+	 * osgi.wiring.bundle} or {@link IdentityNamespace osgi.identity}.
 	 * <p>
 	 * This method can filter the list of collision candidates by removing
 	 * potential collisions. Removing a collision candidate will allow the
@@ -171,28 +179,29 @@
 	void filterSingletonCollisions(BundleCapability singleton, Collection<BundleCapability> collisionCandidates);
 
 	/**
-	 * Filter matches hook method. This method is called during the resolve process for the 
-	 * specified requirement.  The collection of candidates match the specified requirement.
-	 * This method can filter the collection of matching candidates by removing candidates from 
-	 * the collection.  Removing a candidate will prevent the resolve process from choosing the 
-	 * removed candidate to satisfy the requirement.
+	 * Filter matches hook method. This method is called during the resolve
+	 * process for the specified requirement. The collection of candidates match
+	 * the specified requirement. This method can filter the collection of
+	 * matching candidates by removing candidates from the collection. Removing
+	 * a candidate will prevent the resolve process from choosing the removed
+	 * candidate to satisfy the requirement.
 	 * <p>
-	 * All of the candidates will have the same name space and will 
-	 * match the specified requirement.
+	 * All of the candidates will have the same namespace and will match the
+	 * specified requirement.
 	 * <p>
-	 * If the Java Runtime Environment supports permissions then the collection of 
-	 * candidates will only contain candidates for which the requirer has permission to
-	 * access.
+	 * If the Java Runtime Environment supports permissions then the collection
+	 * of candidates will only contain candidates for which the requirer has
+	 * permission to access.
+	 * 
 	 * @param requirement the requirement to filter candidates for
 	 * @param candidates a collection of candidates that match the requirement
 	 */
 	void filterMatches(BundleRequirement requirement, Collection<BundleCapability> candidates);
 
 	/**
-	 * This method is called once at the end of the resolve process.
-	 * After the end method is called the resolve process has ended.
-	 * The framework must not hold onto this resolver hook instance
-	 * after end has been called.
+	 * This method is called once at the end of the resolve process. After the
+	 * end method is called the resolve process has ended. The framework must
+	 * not hold onto this resolver hook instance after end has been called.
 	 */
 	void end();
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
index 1d4edd4..91ce5f7 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/resolver/ResolverHookFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,78 +17,88 @@
 package org.osgi.framework.hooks.resolver;
 
 import java.util.Collection;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.wiring.BundleRevision;
 import org.osgi.framework.wiring.FrameworkWiring;
 
-/** 
+/**
  * OSGi Framework Resolver Hook Factory Service.
  * 
  * <p>
- * Bundles registering this service will be called by the framework during 
- * a bundle resolver process to obtain a {@link ResolverHook resolver hook}
+ * Bundles registering this service will be called by the framework during a
+ * bundle resolver process to obtain a {@link ResolverHook resolver hook}
  * instance which will be used for the duration of a resolve process.
  * 
  * @ThreadSafe
  * @see ResolverHook
- * @version $Id: 4023566367435f07c047a7ba571f3bedc53aa37a $
+ * @version $Id: e0a2f3ad081c31bbb682fa366c15a3080bf6da2b $
  */
 public interface ResolverHookFactory {
 	/**
 	 * This method is called by the framework each time a resolve process begins
-	 * to obtain a {@link ResolverHook resolver hook} instance.  This resolver hook 
-	 * instance will be used for the duration of the resolve process.  At the end of 
-	 * the resolve process the method {@link ResolverHook#end()} must be called by 
-	 * the framework and the framework must not hold any references of the resolver 
-	 * hook instance.
+	 * to obtain a {@link ResolverHook resolver hook} instance. This resolver
+	 * hook instance will be used for the duration of the resolve process. At
+	 * the end of the resolve process the method {@link ResolverHook#end()} must
+	 * be called by the framework and the framework must not hold any references
+	 * of the resolver hook instance.
 	 * <p>
-	 * The triggers represent the collection of bundles which triggered
-	 * the resolve process.  This collection may be empty if the triggers
-	 * cannot be determined by the framework.  In most cases the triggers 
-	 * can easily be determined.  Calling certain methods on 
-	 * {@link Bundle bundle} when a bundle is in the {@link Bundle#INSTALLED INSTALLED} 
-	 * state will cause the framework to begin a resolve process in order to resolve the 
-	 * bundle.  The following methods will start a resolve process in this case:
+	 * The triggers represent the collection of bundles which triggered the
+	 * resolve process. This collection may be empty if the triggers cannot be
+	 * determined by the framework. In most cases the triggers can easily be
+	 * determined. Calling certain methods on {@link Bundle bundle} when a
+	 * bundle is in the {@link Bundle#INSTALLED INSTALLED} state will cause the
+	 * framework to begin a resolve process in order to resolve the bundle. The
+	 * following methods will start a resolve process in this case:
 	 * <ul>
-	 *   <li>{@link Bundle#start() start}</li>
-	 *   <li>{@link Bundle#loadClass(String) loadClass}</li>
-	 *   <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
-	 *   <li>{@link Bundle#getResource(String) getResource}</li>
-	 *   <li>{@link Bundle#getResources(String) getResources}</li>
-	 * </ul> 
+	 * <li>{@link Bundle#start() start}</li>
+	 * <li>{@link Bundle#loadClass(String) loadClass}</li>
+	 * <li>{@link Bundle#findEntries(String, String, boolean) findEntries}</li>
+	 * <li>{@link Bundle#getResource(String) getResource}</li>
+	 * <li>{@link Bundle#getResources(String) getResources}</li>
+	 * </ul>
 	 * In such cases the collection will contain the single bundle which the
-	 * framework is trying to resolve.  Other cases will cause multiple bundles to be
-	 * included in the trigger bundles collection.  When {@link FrameworkWiring#resolveBundles(Collection)
-	 * resolveBundles} is called the collection of triggers must include all the current bundle 
-	 * revisions for bundles passed to resolveBundles which are in the {@link Bundle#INSTALLED INSTALLED}
-	 * state.
+	 * framework is trying to resolve. Other cases will cause multiple bundles
+	 * to be included in the trigger bundles collection. When
+	 * {@link FrameworkWiring#resolveBundles(Collection) resolveBundles} is
+	 * called the collection of triggers must include all the current bundle
+	 * revisions for bundles passed to resolveBundles which are in the
+	 * {@link Bundle#INSTALLED INSTALLED} state.
 	 * <p>
-	 * When {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
-	 * is called the collection of triggers is determined with the following steps:
+	 * When
+	 * {@link FrameworkWiring#refreshBundles(Collection, org.osgi.framework.FrameworkListener...)}
+	 * is called the collection of triggers is determined with the following
+	 * steps:
 	 * <ul>
-	 *   <li>If the collection of bundles passed is null then {@link FrameworkWiring#getRemovalPendingBundles()}
-	 *   is called to get the initial collection of bundles.</li>
-	 *   <li>The equivalent of calling {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
-	 *   the initial collection of bundles to get the dependency closure collection of the bundles being refreshed.</li>
-	 *   <li>Remove any non-active bundles from the dependency closure collection.</li>
-	 *   <li>For each bundle remaining in the dependency closure collection get the current bundle revision
-	 *   and add it to the collection of triggers.</li> 
+	 * <li>If the collection of bundles passed is null then
+	 * {@link FrameworkWiring#getRemovalPendingBundles()} is called to get the
+	 * initial collection of bundles.</li>
+	 * <li>The equivalent of calling
+	 * {@link FrameworkWiring#getDependencyClosure(Collection)} is called with
+	 * the initial collection of bundles to get the dependency closure
+	 * collection of the bundles being refreshed.</li>
+	 * <li>Remove any non-active bundles from the dependency closure collection.
+	 * </li>
+	 * <li>For each bundle remaining in the dependency closure collection get
+	 * the current bundle revision and add it to the collection of triggers.</li>
 	 * </ul>
 	 * <p>
-	 * As described above, a resolve process is typically initiated as a result of calling API that causes the 
-	 * framework to attempt to resolve one or more bundles.  
-	 * The framework is free to start a resolve process at any time for reasons other than calls to framework API.
-	 * For example, a resolve process may be used by the framework for diagnostic purposes and result in no
-	 * bundles actually becoming resolved at the end of the process.
-	 * Resolver hook implementations must be prepared for resolve processes that are initiated for other reasons
-	 * besides calls to framework API.
-	 * @param triggers an unmodifiable collection of bundles which triggered the resolve process.
-	 * This collection may be empty if the collection of trigger bundles cannot be
-	 * determined.
-	 * @return a resolver hook instance to be used for the duration of the resolve process.
-	 * A {@code null} value may be returned which indicates this resolver hook factory abstains from
-	 * the resolve process.
+	 * As described above, a resolve process is typically initiated as a result
+	 * of calling API that causes the framework to attempt to resolve one or
+	 * more bundles. The framework is free to start a resolve process at any
+	 * time for reasons other than calls to framework API. For example, a
+	 * resolve process may be used by the framework for diagnostic purposes and
+	 * result in no bundles actually becoming resolved at the end of the
+	 * process. Resolver hook implementations must be prepared for resolve
+	 * processes that are initiated for other reasons besides calls to framework
+	 * API.
+	 * 
+	 * @param triggers an unmodifiable collection of bundles which triggered the
+	 *        resolve process. This collection may be empty if the collection of
+	 *        trigger bundles cannot be determined.
+	 * @return a resolver hook instance to be used for the duration of the
+	 *         resolve process. A {@code null} value may be returned which
+	 *         indicates this resolver hook factory abstains from the resolve
+	 *         process.
 	 */
 	ResolverHook begin(Collection<BundleRevision> triggers);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
index fb2ab09..03a84d4 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/EventHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.hooks.service;
 
 import java.util.Collection;
-
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceEvent;
 
@@ -30,7 +29,7 @@
  * 
  * @ThreadSafe
  * @deprecated As of 1.1. Replaced by {@link EventListenerHook}.
- * @version $Id: 8fb8cfa2c8847f99fd84711e12f02a57bf06932e $
+ * @version $Id: 84757a5f719db4d7671e81a76af2b320404ae0f5 $
  */
 
 public interface EventHook {
@@ -46,9 +45,9 @@
 	 *        collection to prevent the event from being delivered to the
 	 *        associated bundles. The collection supports all the optional
 	 *        {@code Collection} operations except {@code add} and
-	 *        {@code addAll}. Attempting to add to the collection will
-	 *        result in an {@code UnsupportedOperationException}. The
-	 *        collection is not synchronized.
+	 *        {@code addAll}. Attempting to add to the collection will result in
+	 *        an {@code UnsupportedOperationException}. The collection is not
+	 *        synchronized.
 	 */
 	void event(ServiceEvent event, Collection<BundleContext> contexts);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
index 6f25291..534efc5 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/EventListenerHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
 
 import java.util.Collection;
 import java.util.Map;
-
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.hooks.service.ListenerHook.ListenerInfo;
@@ -32,7 +31,7 @@
  * 
  * @ThreadSafe
  * @since 1.1
- * @version $Id: 61c6aa7e7d4c85b3e5a6a3a340155bcda0074505 $
+ * @version $Id: b0b99b29206f272ad479fa08ffcd5ef5fda909b8 $
  */
 
 public interface EventListenerHook {
@@ -56,6 +55,5 @@
 	 *        collection will result in an {@code UnsupportedOperationException}
 	 *        . The map and the collections are not synchronized.
 	 */
-	void event(ServiceEvent event,
-			Map<BundleContext, Collection<ListenerInfo>> listeners);
+	void event(ServiceEvent event, Map<BundleContext, Collection<ListenerInfo>> listeners);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
index cb334c5..4cd467c 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/FindHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.hooks.service;
 
 import java.util.Collection;
-
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceReference;
 
@@ -29,7 +28,7 @@
  * (get service references) operations.
  * 
  * @ThreadSafe
- * @version $Id: 4a939200fa6634a563379b057e11bd1b5d174b9d $
+ * @version $Id: 45612d6a10a25ca0b40ba695eb8dba21c2c78c24 $
  */
 
 public interface FindHook {
@@ -40,12 +39,12 @@
 	 * 
 	 * @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}
-	 *        to find all services.
-	 * @param filter The filter criteria of the services to find or
-	 *        {@code null} for no filter criteria.
-	 * @param allServices {@code true} if the find operation is the result
-	 *        of a call to
+	 * @param name The class name of the services to find or {@code null} to
+	 *        find all services.
+	 * @param filter The filter criteria of the services to find or {@code null}
+	 *        for no filter criteria.
+	 * @param allServices {@code true} if the find operation is the result of a
+	 *        call to
 	 *        {@link BundleContext#getAllServiceReferences(String, String)}
 	 * @param references A collection of Service References to be returned as a
 	 *        result of the find operation. The implementation of this method
@@ -53,10 +52,9 @@
 	 *        references from being returned to the bundle performing the find
 	 *        operation. The collection supports all the optional
 	 *        {@code Collection} operations except {@code add} and
-	 *        {@code addAll}. Attempting to add to the collection will
-	 *        result in an {@code UnsupportedOperationException}. The
-	 *        collection is not synchronized.
+	 *        {@code addAll}. Attempting to add to the collection will result in
+	 *        an {@code UnsupportedOperationException}. The collection is not
+	 *        synchronized.
 	 */
-	void find(BundleContext context, String name, String filter,
-			boolean allServices, Collection<ServiceReference< ? >> references);
+	void find(BundleContext context, String name, String filter, boolean allServices, Collection<ServiceReference<?>> references);
 }
diff --git a/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java b/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
index bdac7b5..ef933c3 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/service/ListenerHook.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.hooks.service;
 
 import java.util.Collection;
-
 import org.osgi.framework.BundleContext;
 
 /**
@@ -28,7 +27,7 @@
  * addition and removal.
  * 
  * @ThreadSafe
- * @version $Id: c1687e95e568589cf3e6d927b7d372c9f88c5d16 $
+ * @version $Id: 94029e2b70119793b3e7d77d6e1d5052d9ee1723 $
  */
 
 public interface ListenerHook {
@@ -43,8 +42,8 @@
 	 * @param listeners A collection 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}. The collection is
-	 *        not synchronized.
+	 *        an {@code UnsupportedOperationException}. The collection is not
+	 *        synchronized.
 	 */
 	void added(Collection<ListenerInfo> listeners);
 
@@ -57,8 +56,8 @@
 	 * @param listeners A collection 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}. The collection is
-	 *        not synchronized.
+	 *        an {@code UnsupportedOperationException}. The collection is not
+	 *        synchronized.
 	 */
 	void removed(Collection<ListenerInfo> listeners);
 
@@ -81,17 +80,15 @@
 		 * 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} if the listener was added without a
-		 *         filter.
+		 *         be {@code null} 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}
-		 * indicating the listener has been added but has not been removed.
-		 * After the listener has been removed, this method must always return
-		 * {@code true}.
+		 * cycle. Initially this method will return {@code false} indicating the
+		 * listener has been added but has not been removed. After the listener
+		 * has been removed, this method must always return {@code true}.
 		 * 
 		 * <p>
 		 * There is an extremely rare case in which removed notification to
@@ -109,19 +106,16 @@
 		boolean isRemoved();
 
 		/**
-		 * Compares this {@code ListenerInfo} to another
-		 * {@code ListenerInfo}. Two {@code ListenerInfo}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} which is not equal to this
-		 * {@code ListenerInfo}.
+		 * Compares this {@code ListenerInfo} to another {@code ListenerInfo}.
+		 * Two {@code ListenerInfo}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} which is not equal to this {@code ListenerInfo}.
 		 * 
-		 * @param obj The object to compare against this
-		 *        {@code ListenerInfo}.
-		 * @return {@code true} if the other object is a
-		 *         {@code ListenerInfo} object and both objects refer to
-		 *         the same listener for a given addition and removal life
-		 *         cycle.
+		 * @param obj The object to compare against this {@code ListenerInfo}.
+		 * @return {@code true} if the other object is a {@code ListenerInfo}
+		 *         object and both objects refer to the same listener for a
+		 *         given addition and removal life cycle.
 		 */
 		boolean equals(Object obj);
 
diff --git a/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
index 34aa6d2..697a435 100644
--- a/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
+++ b/framework/src/main/java/org/osgi/framework/hooks/weaving/WovenClass.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2010, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
 
 import java.security.ProtectionDomain;
 import java.util.List;
-
 import org.osgi.framework.wiring.BundleWiring;
 
 /**
@@ -35,7 +34,7 @@
  * 
  * @NotThreadSafe
  * @noimplement
- * @version $Id: c689a4c27dc39af1bf5f51338f1a8eaca1dddc1a $
+ * @version $Id: 549caef41027c8f0d0fdb4deae756eae6b69d1ee $
  */
 public interface WovenClass {
 
@@ -138,15 +137,16 @@
 	public ProtectionDomain getProtectionDomain();
 
 	/**
-	 * Returns the class associated with this woven class. When loading a class
-	 * for the first time this method will return {@code null} until weaving is
-	 * {@link #isWeavingComplete() complete}. Once weaving is complete, this
-	 * method will return the class object.
+	 * Returns the class defined by this woven class. During weaving, this
+	 * method will return {@code null}. Once weaving is
+	 * {@link #isWeavingComplete() complete}, this method will return the class
+	 * object if this woven class was used to define the class.
 	 * 
 	 * @return The class associated with this woven class, or {@code null} if
-	 *         weaving is not complete or the class definition failed.
+	 *         weaving is not complete, the class definition failed or this
+	 *         woven class was not used to define the class.
 	 */
-	public Class< ? > getDefinedClass();
+	public Class<?> getDefinedClass();
 
 	/**
 	 * Returns the bundle wiring whose class loader will define the woven class.
diff --git a/framework/src/main/java/org/osgi/framework/launch/Framework.java b/framework/src/main/java/org/osgi/framework/launch/Framework.java
index 672db44..54d599b 100644
--- a/framework/src/main/java/org/osgi/framework/launch/Framework.java
+++ b/framework/src/main/java/org/osgi/framework/launch/Framework.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2008, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2008, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,7 +19,6 @@
 import java.io.InputStream;
 import java.net.URL;
 import java.util.Enumeration;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleException;
 import org.osgi.framework.Constants;
@@ -35,7 +34,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 2be857d06f3605a04f701b59f11e127c0f8940dc $
+ * @version $Id: e76240d5de584d1666880d9bc358571a76cbd8fb $
  */
 public interface Framework extends Bundle {
 
@@ -76,13 +75,12 @@
 	void init() throws BundleException;
 
 	/**
-	 * Wait until this Framework has completely stopped. The {@code stop}
-	 * and {@code update} methods on a Framework performs an asynchronous
-	 * stop of the Framework. This method can be used to wait until the
-	 * asynchronous stop of this Framework has completed. This method will only
-	 * wait if called when this Framework is in the {@link #STARTING},
-	 * {@link #ACTIVE}, or {@link #STOPPING} states. Otherwise it will return
-	 * immediately.
+	 * Wait until this Framework has completely stopped. The {@code stop} and
+	 * {@code update} methods on a Framework performs an asynchronous stop of
+	 * the Framework. This method can be used to wait until the asynchronous
+	 * stop of this Framework has completed. This method will only wait if
+	 * called when this Framework is in the {@link #STARTING}, {@link #ACTIVE},
+	 * or {@link #STOPPING} states. Otherwise it will return immediately.
 	 * <p>
 	 * A Framework Event is returned to indicate why this Framework has stopped.
 	 * 
@@ -90,8 +88,8 @@
 	 *        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} types may be returned by
-	 *         this method.
+	 *         following {@code FrameworkEvent} types may be returned by this
+	 *         method.
 	 *         <ul>
 	 *         <li>{@link FrameworkEvent#STOPPED STOPPED} - This Framework has
 	 *         been stopped. </li>
@@ -230,8 +228,8 @@
 	 * 
 	 * @throws BundleException This Framework cannot be uninstalled.
 	 * @throws SecurityException If the caller does not have the appropriate
-	 *         {@code AdminPermission[this,LIFECYCLE]}, and the Java
-	 *         Runtime Environment supports permissions.
+	 *         {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+	 *         Environment supports permissions.
 	 */
 	void uninstall() throws BundleException;
 
@@ -251,8 +249,8 @@
 	 * @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]}, and the Java
-	 *         Runtime Environment supports permissions.
+	 *         {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+	 *         Environment supports permissions.
 	 */
 	void update() throws BundleException;
 
@@ -268,8 +266,8 @@
 	 * @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]}, and the Java
-	 *         Runtime Environment supports permissions.
+	 *         {@code AdminPermission[this,LIFECYCLE]}, and the Java Runtime
+	 *         Environment supports permissions.
 	 */
 	void update(InputStream in) throws BundleException;
 
@@ -284,8 +282,8 @@
 
 	/**
 	 * Returns the Framework location identifier. This Framework is assigned the
-	 * unique location &quot;{@code System Bundle}&quot; since this
-	 * Framework is also a System Bundle.
+	 * unique location &quot;{@code System Bundle}&quot; since this Framework is
+	 * also a System Bundle.
 	 * 
 	 * @return The string &quot;{@code System Bundle}&quot;.
 	 * @throws SecurityException If the caller does not have the appropriate
@@ -299,8 +297,8 @@
 	/**
 	 * 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}&quot; must be recognized as an alias to
-	 * the implementation-defined symbolic name since this Framework is also a
+	 * &quot;{@code system.bundle}&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.
@@ -310,22 +308,22 @@
 	String getSymbolicName();
 
 	/**
-	 * Returns {@code null} as a framework implementation does not have a
-	 * proper bundle from which to return entry paths.
+	 * Returns {@code null} as a framework implementation does not have a proper
+	 * bundle from which to return entry paths.
 	 * 
 	 * @param path Ignored.
-	 * @return {@code null} as a framework implementation does not have a
-	 *         proper bundle from which to return entry paths.
+	 * @return {@code null} as a framework implementation does not have a proper
+	 *         bundle from which to return entry paths.
 	 */
 	Enumeration<String> getEntryPaths(String path);
 
 	/**
-	 * Returns {@code null} as a framework implementation does not have a
-	 * proper bundle from which to return an entry.
+	 * Returns {@code null} as a framework implementation does not have a proper
+	 * bundle from which to return an entry.
 	 * 
 	 * @param path Ignored.
-	 * @return {@code null} as a framework implementation does not have a
-	 *         proper bundle from which to return an entry.
+	 * @return {@code null} as a framework implementation does not have a proper
+	 *         bundle from which to return an entry.
 	 */
 	URL getEntry(String path);
 
@@ -339,8 +337,7 @@
 	 * @return {@code null} as a framework implementation does not have a proper
 	 *         bundle from which to return entries.
 	 */
-	Enumeration<URL> findEntries(String path, String filePattern,
-			boolean recurse);
+	Enumeration<URL> findEntries(String path, String filePattern, boolean recurse);
 
 	/**
 	 * Adapt this Framework to the specified type.
diff --git a/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java b/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
index 649ef4b..bac0183 100644
--- a/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
+++ b/framework/src/main/java/org/osgi/framework/launch/FrameworkFactory.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.launch;
 
 import java.util.Map;
-
 import org.osgi.framework.Bundle;
 
 /**
@@ -33,20 +32,20 @@
  * 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.
+ * number sign ({@code '#'} &#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} class which can create a FrameworkFactory instance
- * from the resource.
+ * {@code ServiceLoader} class which can create a FrameworkFactory instance from
+ * the resource.
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: c370e19dba77231f0dbf1601218ad97b20391ea0 $
+ * @version $Id: 1684e14aa98a1f6e1ff3e0f3afa2c55982210f72 $
  */
 public interface FrameworkFactory {
 
@@ -59,15 +58,15 @@
 	 *        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}. 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.
+	 *        configuration argument may be {@code null}. The created framework
+	 *        instance must copy any information needed from the specified
+	 *        configuration argument since the configuration argument can be
+	 *        changed after the framework instance has been created.
 	 * @return A new, configured {@link Framework} instance. The framework
 	 *         instance must be in the {@link Bundle#INSTALLED} state.
 	 * @throws SecurityException If the caller does not have
-	 *         {@code AllPermission}, and the Java Runtime Environment
-	 *         supports permissions.
+	 *         {@code AllPermission}, and the Java Runtime Environment supports
+	 *         permissions.
 	 */
 	Framework newFramework(Map<String, String> configuration);
 }
diff --git a/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
new file mode 100644
index 0000000..52563e2
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/AbstractWiringNamespace.java
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Wiring Capability and Requirement Namespaces base class.
+ * 
+ * <p>
+ * This class is the common class shared by all OSGi defined wiring namespaces.
+ * It defines the names for the common attributes and directives for the OSGi
+ * specified wiring namespaces.
+ * 
+ * <p>
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
+ * 
+ * @Immutable
+ * @version $Id: 383e84df9190757ce6bb6fb722e80a3b7d6b68da $
+ */
+public abstract class AbstractWiringNamespace extends Namespace {
+
+	/**
+	 * The capability directive used to specify the comma separated list of
+	 * mandatory attributes which must be specified in the
+	 * {@link Namespace#REQUIREMENT_FILTER_DIRECTIVE filter} of a requirement in
+	 * order for the capability to match the requirement.
+	 */
+	public final static String	CAPABILITY_MANDATORY_DIRECTIVE		= "mandatory";
+
+	/**
+	 * The capability attribute contains the {@code Version} of the resource
+	 * providing the capability if one is specified or {@code 0.0.0} if not
+	 * specified. The value of this attribute must be of type {@code Version}.
+	 */
+	public static final String	CAPABILITY_BUNDLE_VERSION_ATTRIBUTE	= "bundle-version";
+
+	AbstractWiringNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
new file mode 100644
index 0000000..84b6700
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/BundleNamespace.java
@@ -0,0 +1,153 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Bundle Capability and Requirement Namespace.
+ * 
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * 
+ * <p>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Bundle-SymbolicName} header are visible in the capability and all
+ * directives specified on the {@code Require-Bundle} header are visible in the
+ * requirement.
+ * 
+ * <ul>
+ * <li>The {@link Namespace#CAPABILITY_USES_DIRECTIVE uses} directive must be
+ * ignored. A {@code uses} directive specified on the
+ * {@code Bundle-SymbolicName} header must be ignored. A {@code uses} directive
+ * must not be present in the capability.</li>
+ * <li>The {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE directives} must be ignored.
+ * This namespace is only effective at {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} time. An {@code effective} directive specified on the
+ * {@code Bundle-SymbolicName} or {@code Require-Bundle} headers must be
+ * ignored. An {@code effective} directive must not be present in a capability
+ * or requirement.</li>
+ * <li>The {@link Namespace#REQUIREMENT_CARDINALITY_DIRECTIVE cardinality}
+ * directive must be ignored. A {@code cardinality} directive specified on the
+ * {@code Require-Bundle} header must be ignored. A {@code cardinality}
+ * directive must not be present in a requirement.</li>
+ * </ul>
+ * 
+ * <p>
+ * A non-fragment resource with the {@link IdentityNamespace#TYPE_BUNDLE
+ * osgi.bundle} type {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE
+ * identity} provides exactly one<sup>&#8224;</sup> bundle capability (that is,
+ * the bundle can be required by another bundle). A fragment resource with the
+ * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare
+ * a bundle capability. A resource requires zero or more bundle requirements
+ * (that is, required bundles).
+ * <p>
+ * &#8224; A resource with no symbolic name must not provide a bundle
+ * capability.
+ * 
+ * @Immutable
+ * @version $Id: 339f1204725aa9d9c2463b1224b2e38e505024e9 $
+ */
+public final class BundleNamespace extends AbstractWiringNamespace {
+
+	/**
+	 * Namespace name for bundle capabilities and requirements.
+	 * 
+	 * <p>
+	 * Also, the capability attribute used to specify the symbolic name of the
+	 * bundle.
+	 */
+	public static final String	BUNDLE_NAMESPACE							= "osgi.wiring.bundle";
+
+	/**
+	 * The capability directive identifying if the resource is a singleton. A
+	 * {@code String} value of &quot;{@code true}&quot; indicates the resource
+	 * is a singleton; any other value or {@code null} indicates the resource is
+	 * not a singleton.
+	 * 
+	 * <p>
+	 * This directive should be examined using the {@link IdentityNamespace
+	 * identity} namespace.
+	 * 
+	 * @see IdentityNamespace#CAPABILITY_SINGLETON_DIRECTIVE
+	 */
+	public static final String	CAPABILITY_SINGLETON_DIRECTIVE				= "singleton";
+
+	/**
+	 * The capability directive identifying if and when a fragment may attach to
+	 * a host bundle.
+	 * 
+	 * <p>
+	 * This directive should be examined using the {@link HostNamespace host}
+	 * namespace.
+	 * 
+	 * @see HostNamespace#CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+	 */
+	public static final String	CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE	= "fragment-attachment";
+
+	/**
+	 * The requirement directive used to specify the type of the extension
+	 * fragment.
+	 * 
+	 * <p>
+	 * This directive should be examined using the {@link HostNamespace host}
+	 * namespace.
+	 * 
+	 * @see HostNamespace#REQUIREMENT_EXTENSION_DIRECTIVE
+	 */
+	public final static String	REQUIREMENT_EXTENSION_DIRECTIVE				= "extension";
+
+	/**
+	 * The requirement directive used to specify the visibility type for a
+	 * requirement. The default value is {@link #VISIBILITY_PRIVATE private}.
+	 * 
+	 * @see #VISIBILITY_PRIVATE private
+	 * @see #VISIBILITY_REEXPORT reexport
+	 */
+	public final static String	REQUIREMENT_VISIBILITY_DIRECTIVE			= "visibility";
+
+	/**
+	 * The directive value identifying a private
+	 * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A private
+	 * visibility type indicates that any {@link PackageNamespace packages} that
+	 * are exported by the required bundle are not made visible on the export
+	 * signature of the requiring bundle. .
+	 * 
+	 * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+	 */
+	public final static String	VISIBILITY_PRIVATE							= "private";
+
+	/**
+	 * The directive value identifying a reexport
+	 * {@link #REQUIREMENT_VISIBILITY_DIRECTIVE visibility} type. A reexport
+	 * visibility type indicates any {@link PackageNamespace packages} that are
+	 * exported by the required bundle are re-exported by the requiring bundle.
+	 * 
+	 * @see #REQUIREMENT_VISIBILITY_DIRECTIVE
+	 */
+	public final static String	VISIBILITY_REEXPORT							= "reexport";
+
+	private BundleNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
new file mode 100644
index 0000000..5328cae
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/ExecutionEnvironmentNamespace.java
@@ -0,0 +1,55 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Execution Environment Capability and Requirement Namespace.
+ * 
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * 
+ * @Immutable
+ * @version $Id: e1c30aac8efacc1b21ab20ffebcc1af30a1054a8 $
+ */
+public final class ExecutionEnvironmentNamespace extends Namespace {
+
+	/**
+	 * Namespace name for execution environment capabilities and requirements.
+	 * 
+	 * <p>
+	 * Also, the capability attribute used to specify the name of the execution
+	 * environment.
+	 */
+	public static final String	EXECUTION_ENVIRONMENT_NAMESPACE	= "osgi.ee";
+
+	/**
+	 * The capability attribute contains the versions of the execution
+	 * environment. The value of this attribute must be of type
+	 * {@code List<Version>}.
+	 */
+	public final static String	CAPABILITY_VERSION_ATTRIBUTE	= "version";
+
+	private ExecutionEnvironmentNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
new file mode 100644
index 0000000..5964cf5
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/HostNamespace.java
@@ -0,0 +1,174 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Host Capability and Requirement Namespace.
+ * 
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * 
+ * <p>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Bundle-SymbolicName} header are visible in the capability and all
+ * directives specified on the {@code Fragment-Host} header are visible in the
+ * requirement.
+ * 
+ * <ul>
+ * <li>The {@link Namespace#CAPABILITY_USES_DIRECTIVE uses} directive must be
+ * ignored. A {@code uses} directive specified on the
+ * {@code Bundle-SymbolicName} header must be ignored. A {@code uses} directive
+ * must not be present in the capability.</li>
+ * <li>The {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE directives} must be ignored.
+ * This namespace is only effective at {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} time. An {@code effective} directive specified on the
+ * {@code Bundle-SymbolicName} or {@code Fragment-Host} headers must be ignored.
+ * An {@code effective} directive must not be present in a capability or
+ * requirement.</li>
+ * <li>The {@link Namespace#REQUIREMENT_CARDINALITY_DIRECTIVE cardinality}
+ * directive has limited applicability to this namespace. A {@code cardinality}
+ * directive specified on the {@code Fragment-Host} header must be ignored. All
+ * requirements must have the {@code cardinality} directive set to
+ * {@link Namespace#CARDINALITY_MULTIPLE multiple}.</li>
+ * </ul>
+ * 
+ * <p>
+ * A non-fragment resource with the with the
+ * {@link IdentityNamespace#TYPE_BUNDLE osgi.bundle} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} provides zero or
+ * one<sup>&#8224;</sup> host capabilities. A fragment resource with the
+ * {@link IdentityNamespace#TYPE_FRAGMENT osgi.fragment} type
+ * {@link IdentityNamespace#CAPABILITY_TYPE_ATTRIBUTE identity} must not declare
+ * a host capability and must declare exactly one host requirement.
+ * <p>
+ * &#8224; A resource with no bundle symbolic name must not provide a host
+ * capability.
+ * 
+ * @Immutable
+ * @version $Id: aa3cc744c7b9c21d908260f456567ab8a6de1430 $
+ */
+public final class HostNamespace extends AbstractWiringNamespace {
+
+	/**
+	 * Namespace name for host capabilities and requirements.
+	 * 
+	 * <p>
+	 * Also, the capability attribute used to specify the symbolic name of the
+	 * host.
+	 * 
+	 */
+	public static final String	HOST_NAMESPACE								= "osgi.wiring.host";
+
+	/**
+	 * The capability directive identifying if the resource is a singleton. A
+	 * {@code String} value of &quot;{@code true}&quot; indicates the resource
+	 * is a singleton; any other value or {@code null} indicates the resource is
+	 * not a singleton.
+	 * 
+	 * <p>
+	 * This directive should be examined using the {@link IdentityNamespace
+	 * identity} namespace.
+	 * 
+	 * @see IdentityNamespace#CAPABILITY_SINGLETON_DIRECTIVE
+	 */
+	public static final String	CAPABILITY_SINGLETON_DIRECTIVE				= "singleton";
+
+	/**
+	 * The capability directive identifying if and when a fragment may attach to
+	 * a host bundle. The default value is {@link #FRAGMENT_ATTACHMENT_ALWAYS
+	 * always}.
+	 * 
+	 * @see #FRAGMENT_ATTACHMENT_ALWAYS
+	 * @see #FRAGMENT_ATTACHMENT_RESOLVETIME
+	 * @see #FRAGMENT_ATTACHMENT_NEVER
+	 */
+	public static final String	CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE	= "fragment-attachment";
+
+	/**
+	 * The directive value indicating that fragments are allowed to attach to
+	 * the host bundle at any time (while the host is resolved or during the
+	 * process of resolving the host bundle).
+	 * 
+	 * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+	 */
+	public static final String	FRAGMENT_ATTACHMENT_ALWAYS					= "always";
+
+	/**
+	 * The directive value indicating that fragments are allowed to attach to
+	 * the host bundle only during the process of resolving the host bundle.
+	 * 
+	 * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+	 */
+	public static final String	FRAGMENT_ATTACHMENT_RESOLVETIME				= "resolve-time";
+
+	/**
+	 * The directive value indicating that no fragments are allowed to attach to
+	 * the host bundle at any time.
+	 * 
+	 * @see #CAPABILITY_FRAGMENT_ATTACHMENT_DIRECTIVE
+	 */
+	public static final String	FRAGMENT_ATTACHMENT_NEVER					= "never";
+
+	/**
+	 * The requirement directive used to specify the type of the extension
+	 * fragment.
+	 * 
+	 * @see #EXTENSION_FRAMEWORK
+	 * @see #EXTENSION_BOOTCLASSPATH
+	 */
+	public final static String	REQUIREMENT_EXTENSION_DIRECTIVE				= "extension";
+
+	/**
+	 * The directive value indicating that the extension fragment is to be
+	 * loaded by the framework's class loader.
+	 * 
+	 * 
+	 * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+	 */
+	public final static String	EXTENSION_FRAMEWORK							= "framework";
+
+	/**
+	 * The directive value indicating that the extension fragment is to be
+	 * loaded by the boot class loader.
+	 * 
+	 * @see #REQUIREMENT_EXTENSION_DIRECTIVE
+	 */
+	public final static String	EXTENSION_BOOTCLASSPATH						= "bootclasspath";
+
+	/**
+	 * The requirement directive used to specify the visibility type for a
+	 * requirement.
+	 * 
+	 * <p>
+	 * This directive should be examined using the {@link BundleNamespace
+	 * bundle} namespace.
+	 * 
+	 * @see BundleNamespace#REQUIREMENT_VISIBILITY_DIRECTIVE
+	 */
+	public final static String	REQUIREMENT_VISIBILITY_DIRECTIVE			= "visibility";
+
+	private HostNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
new file mode 100644
index 0000000..c925e5a
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/IdentityNamespace.java
@@ -0,0 +1,162 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Identity Capability and Requirement Namespace.
+ * 
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * 
+ * <p>
+ * Each resource provides exactly one<sup>&#8224;</sup> identity capability that
+ * can be used to identify the resource.
+ * 
+ * <p>
+ * The bundle wiring for the bundle revision provides exactly
+ * one<sup>&#8224;</sup> identity capability.
+ * 
+ * <p>
+ * &#8224; A resource with no symbolic name must not provide an identity
+ * capability.
+ * 
+ * @Immutable
+ * @version $Id: e34dcaba1f828326a0db13b3d811b2d170ff97a5 $
+ */
+public final class IdentityNamespace extends Namespace {
+
+	/**
+	 * Namespace name for identity capabilities and requirements.
+	 * 
+	 * <p>
+	 * Also, the capability attribute used to specify the symbolic name of the
+	 * resource.
+	 */
+	public static final String	IDENTITY_NAMESPACE					= "osgi.identity";
+
+	/**
+	 * The capability directive identifying if the resource is a singleton. A
+	 * {@code String} value of &quot;true&quot; indicates the resource is a
+	 * singleton; any other value or {@code null} indicates the resource is not
+	 * a singleton.
+	 */
+	public static final String	CAPABILITY_SINGLETON_DIRECTIVE		= "singleton";
+
+	/**
+	 * The capability attribute identifying the {@code Version} of the resource
+	 * if one is specified or {@code 0.0.0} if not specified. The value of this
+	 * attribute must be of type {@code Version}.
+	 */
+	public static final String	CAPABILITY_VERSION_ATTRIBUTE		= "version";
+
+	/**
+	 * The capability attribute identifying the resource type. If the resource
+	 * has no type then the value {@link #TYPE_UNKNOWN unknown} must be used for
+	 * the attribute.
+	 * 
+	 * @see #TYPE_BUNDLE
+	 * @see #TYPE_FRAGMENT
+	 * @see #TYPE_UNKNOWN
+	 */
+	public static final String	CAPABILITY_TYPE_ATTRIBUTE			= "type";
+
+	/**
+	 * The attribute value identifying the resource
+	 * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi bundle.
+	 * 
+	 * @see #CAPABILITY_TYPE_ATTRIBUTE
+	 */
+	public static final String	TYPE_BUNDLE							= "osgi.bundle";
+
+	/**
+	 * The attribute value identifying the resource
+	 * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as an OSGi fragment.
+	 * 
+	 * @see #CAPABILITY_TYPE_ATTRIBUTE
+	 */
+	public static final String	TYPE_FRAGMENT						= "osgi.fragment";
+
+	/**
+	 * The attribute value identifying the resource
+	 * {@link #CAPABILITY_TYPE_ATTRIBUTE type} as unknown.
+	 * 
+	 * @see #CAPABILITY_TYPE_ATTRIBUTE
+	 */
+	public static final String	TYPE_UNKNOWN						= "unknown";
+
+	/**
+	 * The capability attribute that contains a human readable copyright notice
+	 * for the resource. See the {@code Bundle-Copyright} manifest header.
+	 */
+	public static final String	CAPABILITY_COPYRIGHT_ATTRIBUTE		= "copyright";
+
+	/**
+	 * The capability attribute that contains a human readable description for
+	 * the resource. See the {@code Bundle-Description} manifest header.
+	 */
+	public static final String	CAPABILITY_DESCRIPTION_ATTRIBUTE	= "description";
+
+	/**
+	 * The capability attribute that contains the URL to documentation for the
+	 * resource. See the {@code Bundle-DocURL} manifest header.
+	 */
+	public static final String	CAPABILITY_DOCUMENTATION_ATTRIBUTE	= "documentation";
+
+	/**
+	 * The capability attribute that contains the URL to the license for the
+	 * resource. See the {@code name} portion of the {@code Bundle-License}
+	 * manifest header.
+	 */
+	public static final String	CAPABILITY_LICENSE_ATTRIBUTE		= "license";
+
+	/**
+	 * The requirement directive that classifies the relationship with another
+	 * resource.
+	 * 
+	 * @see #CLASSIFIER_SOURCES
+	 * @see #CLASSIFIER_JAVADOC
+	 */
+	public static final String	REQUIREMENT_CLASSIFIER_DIRECTIVE	= "classifier";
+
+	/**
+	 * The attribute value identifying the resource
+	 * {@link #REQUIREMENT_CLASSIFIER_DIRECTIVE classifier} as an archive
+	 * containing the source code in the same directory layout as the resource.
+	 * 
+	 * @see #REQUIREMENT_CLASSIFIER_DIRECTIVE
+	 */
+
+	public static final String	CLASSIFIER_SOURCES					= "sources";
+	/**
+	 * The attribute value identifying the resource
+	 * {@link #REQUIREMENT_CLASSIFIER_DIRECTIVE classifier} as an archive
+	 * containing the javadoc in the same directory layout as the resource.
+	 * 
+	 * @see #REQUIREMENT_CLASSIFIER_DIRECTIVE
+	 */
+	public static final String	CLASSIFIER_JAVADOC					= "javadoc";
+
+	private IdentityNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java b/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
new file mode 100644
index 0000000..2d1cbc3
--- /dev/null
+++ b/framework/src/main/java/org/osgi/framework/namespace/PackageNamespace.java
@@ -0,0 +1,112 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.namespace;
+
+import org.osgi.resource.Namespace;
+
+/**
+ * Package Capability and Requirement Namespace.
+ * 
+ * <p>
+ * A resource provides zero or more package capabilities (this is, exported
+ * packages) and requires zero or more package requirements (that is, imported
+ * packages).
+ * 
+ * <p>
+ * This class defines the names for the attributes and directives for this
+ * namespace. All unspecified capability attributes are of type {@code String}
+ * and are used as arbitrary matching attributes for the capability. The values
+ * associated with the specified directive and attribute keys are of type
+ * {@code String}, unless otherwise indicated.
+ * 
+ * <p>
+ * Unless otherwise noted, all directives specified on the
+ * {@code Export-Package} header are visible in the capability and all
+ * directives specified on the {@code Import-Package} and
+ * {@code DynamicImport-Package} headers are visible in the requirement.
+ * 
+ * <ul>
+ * <li>The {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE effective}
+ * {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE directives} must be ignored.
+ * This namespace is only effective at {@link Namespace#EFFECTIVE_RESOLVE
+ * resolve} time. An {@code effective} directive specified on the
+ * {@code Export-Package}, {@code Import-Package} or
+ * {@code DynamicImport-Package} headers must be ignored. An {@code effective}
+ * directive must not be present in a capability or requirement.</li>
+ * <li>The {@link Namespace#REQUIREMENT_CARDINALITY_DIRECTIVE cardinality}
+ * directive has limited applicability to this namespace. A {@code cardinality}
+ * directive specified on the {@code Import-Package} or
+ * {@code DynamicImport-Package} headers must be ignored. Only requirements with
+ * {@link Namespace#REQUIREMENT_RESOLUTION_DIRECTIVE resolution} set to
+ * {@link #RESOLUTION_DYNAMIC dynamic} and the package name contains a wildcard
+ * must have the {@code cardinality} directive set to
+ * {@link Namespace#CARDINALITY_MULTIPLE multiple}. Otherwise, a
+ * {@code cardinality} directive must not be present in a requirement.</li>
+ * </ul>
+ * 
+ * @Immutable
+ * @version $Id: 5adc45bd1ae26120cbff3562c7c8cefc01e38bd3 $
+ */
+public final class PackageNamespace extends AbstractWiringNamespace {
+
+	/**
+	 * Namespace name for package capabilities and requirements.
+	 * 
+	 * <p>
+	 * Also, the capability attribute used to specify the name of the package.
+	 */
+	public static final String	PACKAGE_NAMESPACE							= "osgi.wiring.package";
+
+	/**
+	 * The capability directive used to specify the comma separated list of
+	 * classes which must be allowed to be exported.
+	 */
+	public final static String	CAPABILITY_INCLUDE_DIRECTIVE				= "include";
+
+	/**
+	 * The capability directive used to specify the comma separated list of
+	 * classes which must not be allowed to be exported.
+	 */
+	public final static String	CAPABILITY_EXCLUDE_DIRECTIVE				= "exclude";
+
+	/**
+	 * The capability attribute contains the {@code Version} of the package if
+	 * one is specified or {@code 0.0.0} if not specified. The value of this
+	 * attribute must be of type {@code Version}.
+	 */
+	public final static String	CAPABILITY_VERSION_ATTRIBUTE				= "version";
+
+	/**
+	 * The capability attribute contains the symbolic name of the resource
+	 * providing the package.
+	 */
+	public final static String	CAPABILITY_BUNDLE_SYMBOLICNAME_ATTRIBUTE	= "bundle-symbolic-name";
+
+	/**
+	 * The directive value identifying a dynamic requirement resolution type. A
+	 * dynamic resolution type indicates that the requirement is resolved
+	 * dynamically at runtime (such as a dynamically imported package) and the
+	 * resource will be resolved without the requirement being resolved.
+	 * 
+	 * @see Namespace#REQUIREMENT_RESOLUTION_DIRECTIVE
+	 */
+	public final static String	RESOLUTION_DYNAMIC							= "dynamic";
+
+	private PackageNamespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java b/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
index adb51ec..11a8049 100644
--- a/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
+++ b/framework/src/main/java/org/osgi/framework/startlevel/FrameworkStartLevel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -33,7 +33,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 2bca22671674ba50b8c6801d5d1df8e291fe2a9d $
+ * @version $Id: 12c6f60842df994c7de2cc3cfd02f791b95fc35b $
  */
 public interface FrameworkStartLevel extends BundleReference {
 	/**
@@ -126,7 +126,7 @@
 	 * is first installed.
 	 * 
 	 * @return The initial start level value for Bundles.
-	 * @see #setInitialBundleStartLevel
+	 * @see #setInitialBundleStartLevel(int)
 	 */
 	int getInitialBundleStartLevel();
 
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java b/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
index c49f0ac..19d7a67 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleCapability.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2010, 2012). 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
@@ -17,6 +17,8 @@
 package org.osgi.framework.wiring;
 
 import java.util.Map;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Capability;
 
 /**
  * A capability that has been declared from a {@link BundleRevision bundle
@@ -24,19 +26,32 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 0fde13c3228af1aa97872b37ccf0aa6e23123b11 $
+ * @version $Id: 39086f7e6086c2b3d83fbcb976a011cf69483ad8 $
  */
-public interface BundleCapability {
+public interface BundleCapability extends Capability {
+
 	/**
-	 * Returns the name space of this capability.
+	 * Returns the bundle revision declaring this capability.
 	 * 
-	 * @return The name space of this capability.
+	 * @return The bundle revision declaring this capability.
+	 */
+	BundleRevision getRevision();
+
+	/**
+	 * Returns the namespace of this capability.
+	 * 
+	 * @return The namespace of this capability.
 	 */
 	String getNamespace();
 
 	/**
 	 * Returns the directives of this capability.
 	 * 
+	 * <p>
+	 * All capability directives not specified by the
+	 * {@link AbstractWiringNamespace wiring namespaces} have no specified
+	 * semantics and are considered extra user defined information.
+	 * 
 	 * @return An unmodifiable map of directive names to directive values for
 	 *         this capability, or an empty map if this capability has no
 	 *         directives.
@@ -53,9 +68,13 @@
 	Map<String, Object> getAttributes();
 
 	/**
-	 * Returns the bundle revision declaring this capability.
+	 * Returns the resource declaring this capability.
 	 * 
-	 * @return The bundle revision declaring this capability.
+	 * <p>
+	 * This method returns the same value as {@link #getRevision()}.
+	 * 
+	 * @return The resource declaring this capability.
+	 * @since 1.1
 	 */
-	BundleRevision getRevision();
+	BundleRevision getResource();
 }
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
index bd637e6..bb26c5d 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRequirement.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2010, 2012). 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
@@ -17,6 +17,8 @@
 package org.osgi.framework.wiring;
 
 import java.util.Map;
+import org.osgi.framework.namespace.AbstractWiringNamespace;
+import org.osgi.resource.Requirement;
 
 /**
  * A requirement that has been declared from a {@link BundleRevision bundle
@@ -24,34 +26,9 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 659132c1fac7526240df377ead0e1bc8d4af2e77 $
+ * @version $Id: 212ffb64f724d982db86ff7e49ed64ea530e670a $
  */
-public interface BundleRequirement {
-	/**
-	 * Returns the name space of this requirement.
-	 * 
-	 * @return The name space of this requirement.
-	 */
-	String getNamespace();
-
-	/**
-	 * Returns the directives of this requirement.
-	 * 
-	 * @return An unmodifiable map of directive names to directive values for
-	 *         this requirement, or an empty map if this requirement has no
-	 *         directives.
-	 */
-	Map<String, String> getDirectives();
-
-	/**
-	 * Returns the attributes of this requirement.
-	 * 
-	 * @return An unmodifiable map of attribute names to attribute values for
-	 *         this requirement, or an empty map if this requirement has no
-	 *         attributes.
-	 */
-	Map<String, Object> getAttributes();
-
+public interface BundleRequirement extends Requirement {
 	/**
 	 * Returns the bundle revision declaring this requirement.
 	 * 
@@ -64,10 +41,56 @@
 	 * 
 	 * @param capability The capability to match to this requirement.
 	 * @return {@code true} if the specified capability has the same
-	 *         {@link #getNamespace() name space} as this requirement and the
+	 *         {@link #getNamespace() namespace} as this requirement and the
 	 *         filter for this requirement matches the
 	 *         {@link BundleCapability#getAttributes() attributes of the
 	 *         specified capability}; {@code false} otherwise.
 	 */
 	boolean matches(BundleCapability capability);
+
+	/**
+	 * Returns the namespace of this requirement.
+	 * 
+	 * @return The namespace of this requirement.
+	 */
+	String getNamespace();
+
+	/**
+	 * Returns the directives of this requirement.
+	 * 
+	 * <p>
+	 * All requirement directives not specified by the
+	 * {@link AbstractWiringNamespace wiring namespaces} have no specified
+	 * semantics and are considered extra user defined information.
+	 * 
+	 * @return An unmodifiable map of directive names to directive values for
+	 *         this requirement, or an empty map if this requirement has no
+	 *         directives.
+	 */
+	Map<String, String> getDirectives();
+
+	/**
+	 * Returns the attributes of this requirement.
+	 * 
+	 * <p>
+	 * Requirement attributes have no specified semantics and are considered
+	 * extra user defined information.
+	 * 
+	 * @return An unmodifiable map of attribute names to attribute values for
+	 *         this requirement, or an empty map if this requirement has no
+	 *         attributes.
+	 */
+	Map<String, Object> getAttributes();
+
+	/**
+	 * Returns the resource declaring this requirement.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getRevision()}.
+	 * 
+	 * @return The resource declaring this requirement. This can be {@code null}
+	 *         if this requirement is synthesized.
+	 * @since 1.1
+	 */
+	BundleRevision getResource();
 }
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
index 5924dc1..1ba9365 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRevision.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2010, 2012). 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
@@ -17,11 +17,16 @@
 package org.osgi.framework.wiring;
 
 import java.util.List;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleReference;
 import org.osgi.framework.Constants;
 import org.osgi.framework.Version;
+import org.osgi.framework.namespace.BundleNamespace;
+import org.osgi.framework.namespace.HostNamespace;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Resource;
 
 /**
  * Bundle Revision. When a bundle is installed and each time a bundle is
@@ -38,18 +43,18 @@
  * a current revision, adapting such a bundle returns {@code null}.
  * 
  * <p>
- * The framework defines name spaces for {@link #PACKAGE_NAMESPACE package},
- * {@link #BUNDLE_NAMESPACE bundle} and {@link #HOST_NAMESPACE host}
- * capabilities and requirements. These name spaces are defined only to express
- * wiring information by the framework. They must not be used in
+ * The framework defines namespaces for {@link PackageNamespace package},
+ * {@link BundleNamespace bundle} and {@link HostNamespace host} capabilities
+ * and requirements. These namespaces are defined only to express wiring
+ * information by the framework. They must not be used in
  * {@link Constants#PROVIDE_CAPABILITY Provide-Capability} and
  * {@link Constants#REQUIRE_CAPABILITY Require-Capability} manifest headers.
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 139b3046ebd46c48b03dda8d36f2f9d79e2e616d $
+ * @version $Id: e68e01a670f0ae9d6eb736414f875c8b216ed1bc $
  */
-public interface BundleRevision extends BundleReference {
+public interface BundleRevision extends BundleReference, Resource {
 	/**
 	 * Returns the symbolic name for this bundle revision.
 	 * 
@@ -71,41 +76,43 @@
 	/**
 	 * Returns the capabilities declared by this bundle revision.
 	 * 
-	 * @param namespace The name space of the declared capabilities to return or
-	 *        {@code null} to return the declared capabilities from all name
-	 *        spaces.
-	 * @return A list containing a snapshot of the declared
-	 *         {@link BundleCapability}s, or an empty list if this bundle
-	 *         revision declares no capabilities in the specified name space.
-	 *         The list contains the declared capabilities in the order they are
-	 *         specified in the manifest.
+	 * @param namespace The namespace of the declared capabilities to return or
+	 *        {@code null} to return the declared capabilities from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared
+	 *         {@link BundleCapability}s from the specified namespace. The
+	 *         returned list will be empty if this bundle revision declares no
+	 *         capabilities in the specified namespace. The list contains the
+	 *         declared capabilities in the order they are specified in the
+	 *         manifest.
 	 */
 	List<BundleCapability> getDeclaredCapabilities(String namespace);
 
 	/**
 	 * Returns the requirements declared by this bundle revision.
 	 * 
-	 * @param namespace The name space of the declared requirements to return or
-	 *        {@code null} to return the declared requirements from all name
-	 *        spaces.
-	 * @return A list containing a snapshot of the declared
-	 *         {@link BundleRequirement}s, or an empty list if this bundle
-	 *         revision declares no requirements in the specified name space.
-	 *         The list contains the declared requirements in the order they are
-	 *         specified in the manifest.
+	 * @param namespace The namespace of the declared requirements to return or
+	 *        {@code null} to return the declared requirements from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared
+	 *         {@link BundleRequirement}s from the specified namespace. The
+	 *         returned list will be empty if this bundle revision declares no
+	 *         requirements in the specified namespace. The list contains the
+	 *         declared requirements in the order they are specified in the
+	 *         manifest.
 	 */
 	List<BundleRequirement> getDeclaredRequirements(String namespace);
 
 	/**
-	 * Name space for package capabilities and requirements.
+	 * Namespace for package capabilities and requirements.
 	 * 
 	 * <p>
 	 * The name of the package is stored in the capability attribute of the same
-	 * name as this name space (osgi.wiring.package). The other
-	 * directives and attributes of the package, from the
-	 * {@link Constants#EXPORT_PACKAGE Export-Package} manifest header, can be
-	 * found in the cabability's {@link BundleCapability#getDirectives()
-	 * directives} and {@link BundleCapability#getAttributes() attributes}. The
+	 * name as this namespace (osgi.wiring.package). The other directives and
+	 * attributes of the package, from the {@link Constants#EXPORT_PACKAGE
+	 * Export-Package} manifest header, can be found in the cabability's
+	 * {@link BundleCapability#getDirectives() directives} and
+	 * {@link BundleCapability#getAttributes() attributes}. The
 	 * {@link Constants#VERSION_ATTRIBUTE version} capability attribute must
 	 * contain the {@link Version} of the package if one is specified or
 	 * {@link Version#emptyVersion} if not specified. The
@@ -136,16 +143,18 @@
 	 * resolved package requirements (that is, imported packages). The number of
 	 * package wires required by a bundle wiring may change as the bundle wiring
 	 * may dynamically import additional packages.
+	 * 
+	 * @see PackageNamespace
 	 */
-	String	PACKAGE_NAMESPACE	= "osgi.wiring.package";
+	String	PACKAGE_NAMESPACE	= PackageNamespace.PACKAGE_NAMESPACE;
 
 	/**
-	 * Name space for bundle capabilities and requirements.
+	 * Namespace for bundle capabilities and requirements.
 	 * 
 	 * <p>
 	 * The bundle symbolic name of the bundle is stored in the capability
-	 * attribute of the same name as this name space (osgi.wiring.bundle).
-	 * The other directives and attributes of the bundle, from the
+	 * attribute of the same name as this namespace (osgi.wiring.bundle). The
+	 * other directives and attributes of the bundle, from the
 	 * {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest
 	 * header, can be found in the cabability's
 	 * {@link BundleCapability#getDirectives() directives} and
@@ -174,16 +183,18 @@
 	 * &#8224; A bundle with no bundle symbolic name (that is, a bundle with
 	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
 	 * {@literal <} 2) must not provide a bundle capability.
+	 * 
+	 * @see BundleNamespace
 	 */
-	String	BUNDLE_NAMESPACE	= "osgi.wiring.bundle";
+	String	BUNDLE_NAMESPACE	= BundleNamespace.BUNDLE_NAMESPACE;
 
 	/**
-	 * Name space for host capabilities and requirements.
+	 * Namespace for host capabilities and requirements.
 	 * 
 	 * <p>
 	 * The bundle symbolic name of the bundle is stored in the capability
-	 * attribute of the same name as this name space (osgi.wiring.host).
-	 * The other directives and attributes of the bundle, from the
+	 * attribute of the same name as this namespace (osgi.wiring.host). The
+	 * other directives and attributes of the bundle, from the
 	 * {@link Constants#BUNDLE_SYMBOLICNAME Bundle-SymbolicName} manifest
 	 * header, can be found in the cabability's
 	 * {@link BundleCapability#getDirectives() directives} and
@@ -215,8 +226,10 @@
 	 * &#8224; A bundle with no bundle symbolic name (that is, a bundle with
 	 * {@link Constants#BUNDLE_MANIFESTVERSION Bundle-ManifestVersion}
 	 * {@literal <} 2) must not provide a host capability.
+	 * 
+	 * @see HostNamespace
 	 */
-	String	HOST_NAMESPACE		= "osgi.wiring.host";
+	String	HOST_NAMESPACE		= HostNamespace.HOST_NAMESPACE;
 
 	/**
 	 * Returns the special types of this bundle revision. The bundle revision
@@ -252,4 +265,40 @@
 	 * @see BundleWiring#getRevision()
 	 */
 	BundleWiring getWiring();
+
+	/**
+	 * Returns the capabilities declared by this resource.
+	 * 
+	 * <p>
+	 * This method returns the same value as
+	 * {@link #getDeclaredCapabilities(String)}.
+	 * 
+	 * @param namespace The namespace of the declared capabilities to return or
+	 *        {@code null} to return the declared capabilities from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared {@link Capability}s
+	 *         from the specified namespace. The returned list will be empty if
+	 *         this resource declares no capabilities in the specified
+	 *         namespace.
+	 * @since 1.1
+	 */
+	List<Capability> getCapabilities(String namespace);
+
+	/**
+	 * Returns the requirements declared by this bundle resource.
+	 * 
+	 * <p>
+	 * This method returns the same value as
+	 * {@link #getDeclaredRequirements(String)}.
+	 * 
+	 * @param namespace The namespace of the declared requirements to return or
+	 *        {@code null} to return the declared requirements from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared {@link Requirement}
+	 *         s from the specified namespace. The returned list will be empty
+	 *         if this resource declares no requirements in the specified
+	 *         namespace.
+	 * @since 1.1
+	 */
+	List<Requirement> getRequirements(String namespace);
 }
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java b/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
index a619dbb..f0d03ff 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleRevisions.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2011, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.wiring;
 
 import java.util.List;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleReference;
 
@@ -38,7 +37,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 1d95ad10f0f08b100f8ee2485bdd34120032c7af $
+ * @version $Id: 8423242078417873faf0f8979e153e3c1f3a0e4b $
  */
 public interface BundleRevisions extends BundleReference {
 	/**
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java b/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
index 1b19e4c..d14829a 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleWire.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2011, 2012). 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
@@ -16,14 +16,16 @@
 
 package org.osgi.framework.wiring;
 
+import org.osgi.resource.Wire;
+
 /**
  * A wire connecting a {@link BundleCapability} to a {@link BundleRequirement}.
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 4f936a84065762ec3267a44f86ae01b0150e44ce $
+ * @version $Id: 02e7cd6ec0fa9fdb73f782a6890984d5d4e7ca21 $
  */
-public interface BundleWire {
+public interface BundleWire extends Wire {
 	/**
 	 * Returns the {@link BundleCapability} for this wire.
 	 * 
@@ -44,7 +46,7 @@
 	 * 
 	 * <p>
 	 * The bundle revision referenced by the returned bundle wiring may differ
-	 * from the bundle revision reference by the {@link #getCapability()
+	 * from the bundle revision referenced by the {@link #getCapability()
 	 * capability}.
 	 * 
 	 * @return The bundle wiring providing the capability. If the bundle wiring
@@ -60,7 +62,7 @@
 	 * 
 	 * <p>
 	 * The bundle revision referenced by the returned bundle wiring may differ
-	 * from the bundle revision reference by the {@link #getRequirement()
+	 * from the bundle revision referenced by the {@link #getRequirement()
 	 * requirement}.
 	 * 
 	 * @return The bundle wiring whose requirement is wired to the capability.
@@ -69,4 +71,38 @@
 	 *         returned.
 	 */
 	BundleWiring getRequirerWiring();
+
+	/**
+	 * Returns the resource providing the {@link #getCapability() capability}.
+	 * 
+	 * <p>
+	 * The returned resource may differ from the resource referenced by the
+	 * {@link #getCapability() capability}.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getProviderWiring()}.
+	 * {@link BundleWiring#getRevision() getRevision()}.
+	 * 
+	 * @return The resource providing the capability.
+	 * @since 1.1
+	 */
+	BundleRevision getProvider();
+
+	/**
+	 * Returns the resource who {@link #getRequirement() requires} the
+	 * {@link #getCapability() capability}.
+	 * 
+	 * <p>
+	 * The returned resource may differ from the resource referenced by the
+	 * {@link #getRequirement() requirement}.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getRequirerWiring()}.
+	 * {@link BundleWiring#getRevision() getRevision()}.
+	 * 
+	 * @return The resource who requires the capability.
+	 * @since 1.1
+	 */
+	BundleRevision getRequirer();
+
 }
diff --git a/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java b/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
index 8d8956a..b234c38 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/BundleWiring.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2010, 2011). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2010, 2012). 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
@@ -19,9 +19,15 @@
 import java.net.URL;
 import java.util.Collection;
 import java.util.List;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleReference;
+import org.osgi.framework.namespace.IdentityNamespace;
+import org.osgi.framework.namespace.PackageNamespace;
+import org.osgi.resource.Capability;
+import org.osgi.resource.Namespace;
+import org.osgi.resource.Requirement;
+import org.osgi.resource.Wire;
+import org.osgi.resource.Wiring;
 
 /**
  * A wiring for a bundle. Each time a bundle is resolved, a new bundle wiring
@@ -47,9 +53,9 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: 58b8ec3bb9649387d4ccba1070f034f217d06ea2 $
+ * @version $Id: a3b3fd7ad7d289a5bfc6e4e02c875bc42a34df89 $
  */
-public interface BundleWiring extends BundleReference {
+public interface BundleWiring extends BundleReference, Wiring {
 	/**
 	 * Returns {@code true} if this bundle wiring is the current bundle wiring.
 	 * The bundle wiring for a bundle is the current bundle wiring if it is the
@@ -77,27 +83,41 @@
 	 * Returns the capabilities provided by this bundle wiring.
 	 * 
 	 * <p>
+	 * Only capabilities considered by the resolver are returned. For example,
+	 * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
 	 * A capability may not be required by any bundle wiring and thus there may
 	 * be no {@link #getProvidedWires(String) wires} for the capability.
 	 * 
 	 * <p>
 	 * A bundle wiring for a non-fragment revision provides a subset of the
 	 * declared capabilities from the bundle revision and all attached fragment
-	 * revisions. Not all declared capabilities may be provided since some may
-	 * be discarded. For example, if a package is declared to be exported and
-	 * import, only one is selected and the other is discarded.
+	 * revisions<sup>&#8224;</sup>. Not all declared capabilities may be
+	 * provided since some may be discarded. For example, if a package is
+	 * declared to be both exported and imported, only one is selected and the
+	 * other is discarded.
+	 * <p>
+	 * A bundle wiring for a fragment revision with a symbolic name must provide
+	 * exactly one {@link IdentityNamespace identity} capability.
+	 * <p>
+	 * &#8224; The {@link IdentityNamespace identity} capability provided by
+	 * attached fragment revisions must not be included in the capabilities of
+	 * the host bundle wiring.
 	 * 
-	 * @param namespace The name space of the capabilities to return or
-	 *        {@code null} to return the capabilities from all name spaces.
+	 * @param namespace The namespace of the capabilities to return or
+	 *        {@code null} to return the capabilities from all namespaces.
 	 * @return A list containing a snapshot of the {@link BundleCapability}s, or
 	 *         an empty list if this bundle wiring provides no capabilities in
-	 *         the specified name space. If this bundle wiring is not
+	 *         the specified namespace. If this bundle wiring is not
 	 *         {@link #isInUse() in use}, {@code null} will be returned. For a
-	 *         given name space, the list contains the wires in the order the
+	 *         given namespace, the list contains the wires in the order the
 	 *         capabilities were specified in the manifests of the
-	 *         {@link #getRevision() bundle revision} and the attached fragments
-	 *         of this bundle wiring. There is no ordering defined between
-	 *         capabilities in different name spaces.
+	 *         {@link #getRevision() bundle revision} and the attached
+	 *         fragments<sup>&#8224;</sup> of this bundle wiring. There is no
+	 *         ordering defined between capabilities in different namespaces.
 	 */
 	List<BundleCapability> getCapabilities(String namespace);
 
@@ -105,23 +125,29 @@
 	 * Returns the requirements of this bundle wiring.
 	 * 
 	 * <p>
+	 * Only requirements considered by the resolver are returned. For example,
+	 * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
 	 * A bundle wiring for a non-fragment revision has a subset of the declared
 	 * requirements from the bundle revision and all attached fragment
 	 * revisions. Not all declared requirements may be present since some may be
 	 * discarded. For example, if a package is declared to be optionally
 	 * imported and is not actually imported, the requirement must be discarded.
 	 * 
-	 * @param namespace The name space of the requirements to return or
-	 *        {@code null} to return the requirements from all name spaces.
+	 * @param namespace The namespace of the requirements to return or
+	 *        {@code null} to return the requirements from all namespaces.
 	 * @return A list containing a snapshot of the {@link BundleRequirement}s,
 	 *         or an empty list if this bundle wiring uses no requirements in
-	 *         the specified name space. If this bundle wiring is not
+	 *         the specified namespace. If this bundle wiring is not
 	 *         {@link #isInUse() in use}, {@code null} will be returned. For a
-	 *         given name space, the list contains the wires in the order the
+	 *         given namespace, the list contains the wires in the order the
 	 *         requirements were specified in the manifests of the
 	 *         {@link #getRevision() bundle revision} and the attached fragments
 	 *         of this bundle wiring. There is no ordering defined between
-	 *         requirements in different name spaces.
+	 *         requirements in different namespaces.
 	 */
 	List<BundleRequirement> getRequirements(String namespace);
 
@@ -129,19 +155,19 @@
 	 * Returns the {@link BundleWire}s to the provided {@link BundleCapability
 	 * capabilities} of this bundle wiring.
 	 * 
-	 * @param namespace The name space of the capabilities for which to return
+	 * @param namespace The namespace of the capabilities for which to return
 	 *        wires or {@code null} to return the wires for the capabilities in
-	 *        all name spaces.
+	 *        all namespaces.
 	 * @return A list containing a snapshot of the {@link BundleWire}s for the
 	 *         {@link BundleCapability capabilities} of this bundle wiring, or
 	 *         an empty list if this bundle wiring has no capabilities in the
-	 *         specified name space. If this bundle wiring is not
+	 *         specified namespace. If this bundle wiring is not
 	 *         {@link #isInUse() in use}, {@code null} will be returned. For a
-	 *         given name space, the list contains the wires in the order the
+	 *         given namespace, the list contains the wires in the order the
 	 *         capabilities were specified in the manifests of the
 	 *         {@link #getRevision() bundle revision} and the attached fragments
 	 *         of this bundle wiring. There is no ordering defined between
-	 *         capabilities in different name spaces.
+	 *         capabilities in different namespaces.
 	 */
 	List<BundleWire> getProvidedWires(String namespace);
 
@@ -154,19 +180,19 @@
 	 * to more requirements. For example, dynamically importing a package will
 	 * establish a new wire to the dynamically imported package.
 	 * 
-	 * @param namespace The name space of the requirements for which to return
+	 * @param namespace The namespace of the requirements for which to return
 	 *        wires or {@code null} to return the wires for the requirements in
-	 *        all name spaces.
+	 *        all namespaces.
 	 * @return A list containing a snapshot of the {@link BundleWire}s for the
 	 *         {@link BundleRequirement requirements} of this bundle wiring, or
 	 *         an empty list if this bundle wiring has no requirements in the
-	 *         specified name space. If this bundle wiring is not
+	 *         specified namespace. If this bundle wiring is not
 	 *         {@link #isInUse() in use}, {@code null} will be returned. For a
-	 *         given name space, the list contains the wires in the order the
+	 *         given namespace, the list contains the wires in the order the
 	 *         requirements were specified in the manifests of the
 	 *         {@link #getRevision() bundle revision} and the attached fragments
 	 *         of this bundle wiring. There is no ordering defined between
-	 *         requirements in different name spaces.
+	 *         requirements in different namespaces.
 	 */
 	List<BundleWire> getRequiredWires(String namespace);
 
@@ -210,7 +236,7 @@
 	 * <p>
 	 * This method takes into account that the &quot;contents&quot; of this
 	 * bundle wiring can have attached fragments. This &quot;bundle space&quot;
-	 * is not a name space with unique members; the same entry name can be
+	 * is not a namespace with unique members; the same entry name can be
 	 * present multiple times. This method therefore returns a list of URL
 	 * objects. These URLs can come from different JARs but have the same path
 	 * name. This method can either return only entries in the specified path or
@@ -218,6 +244,8 @@
 	 * beginning at the specified path.
 	 * 
 	 * <p>
+	 * URLs for directory entries must have their path end with &quot;/&quot;.
+	 * <p>
 	 * Note: Jar and zip files are not required to include directory entries.
 	 * URLs to directory entries will not be returned if the bundle contents do
 	 * not contain directory entries.
@@ -303,8 +331,7 @@
 	 *         must contain no duplicate resource names. If this bundle wiring
 	 *         is not {@link #isInUse() in use}, {@code null} must be returned.
 	 */
-	Collection<String> listResources(String path, String filePattern,
-			int options);
+	Collection<String> listResources(String path, String filePattern, int options);
 
 	/**
 	 * The list resource names operation must recurse into subdirectories.
@@ -325,7 +352,7 @@
 	 * matching resources contained in this bundle wiring's
 	 * {@link #getRevision() bundle revision} and its attached fragment
 	 * revisions. The result must not include resource names for resources in
-	 * {@link BundleRevision#PACKAGE_NAMESPACE package} names which are
+	 * {@link PackageNamespace package} names which are
 	 * {@link #getRequiredWires(String) imported} by this wiring.
 	 * 
 	 * <p>
@@ -341,4 +368,135 @@
 	 * @see #listResources(String, String, int)
 	 */
 	int	LISTRESOURCES_LOCAL		= 0x00000002;
+
+	/**
+	 * Returns the capabilities provided by this wiring.
+	 * 
+	 * <p>
+	 * Only capabilities considered by the resolver are returned. For example,
+	 * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
+	 * A capability may not be required by any wiring and thus there may be no
+	 * {@link #getProvidedResourceWires(String) wires} for the capability.
+	 * 
+	 * <p>
+	 * A wiring for a non-fragment resource provides a subset of the declared
+	 * capabilities from the resource and all attached fragment
+	 * resources<sup>&#8224;</sup>. Not all declared capabilities may be
+	 * provided since some may be discarded. For example, if a package is
+	 * declared to be both exported and imported, only one is selected and the
+	 * other is discarded.
+	 * <p>
+	 * A wiring for a fragment resource with a symbolic name must provide
+	 * exactly one {@code osgi.identity} capability.
+	 * <p>
+	 * &#8224; The {@code osgi.identity} capability provided by attached
+	 * fragment resource must not be included in the capabilities of the host
+	 * wiring.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getCapabilities(String)}.
+	 * 
+	 * @param namespace The namespace of the capabilities to return or
+	 *        {@code null} to return the capabilities from all namespaces.
+	 * @return A list containing a snapshot of the {@link Capability}s, or an
+	 *         empty list if this wiring provides no capabilities in the
+	 *         specified namespace. For a given namespace, the list contains the
+	 *         wires in the order the capabilities were specified in the
+	 *         manifests of the {@link #getResource() resource} and the attached
+	 *         fragment resources<sup>&#8224;</sup> of this wiring. There is no
+	 *         ordering defined between capabilities in different namespaces.
+	 * @since 1.1
+	 */
+	List<Capability> getResourceCapabilities(String namespace);
+
+	/**
+	 * Returns the requirements of this wiring.
+	 * 
+	 * <p>
+	 * Only requirements considered by the resolver are returned. For example,
+	 * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
+	 * A wiring for a non-fragment resource has a subset of the declared
+	 * requirements from the resource and all attached fragment resources. Not
+	 * all declared requirements may be present since some may be discarded. For
+	 * example, if a package is declared to be optionally imported and is not
+	 * actually imported, the requirement must be discarded.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getRequirements(String)}.
+	 * 
+	 * @param namespace The namespace of the requirements to return or
+	 *        {@code null} to return the requirements from all namespaces.
+	 * @return A list containing a snapshot of the {@link Requirement}s, or an
+	 *         empty list if this wiring uses no requirements in the specified
+	 *         namespace. For a given namespace, the list contains the wires in
+	 *         the order the requirements were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         requirements in different namespaces.
+	 * @since 1.1
+	 */
+	List<Requirement> getResourceRequirements(String namespace);
+
+	/**
+	 * Returns the {@link Wire}s to the provided {@link Capability capabilities}
+	 * of this wiring.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getProvidedWires(String)}.
+	 * 
+	 * @param namespace The namespace of the capabilities for which to return
+	 *        wires or {@code null} to return the wires for the capabilities in
+	 *        all namespaces.
+	 * @return A list containing a snapshot of the {@link Wire}s for the
+	 *         {@link Capability capabilities} of this wiring, or an empty list
+	 *         if this wiring has no capabilities in the specified namespace.
+	 *         For a given namespace, the list contains the wires in the order
+	 *         the capabilities were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         capabilities in different namespaces.
+	 * @since 1.1
+	 */
+	List<Wire> getProvidedResourceWires(String namespace);
+
+	/**
+	 * Returns the {@link Wire}s to the {@link Requirement requirements} in use
+	 * by this wiring.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getRequiredWires(String)}.
+	 * 
+	 * @param namespace The namespace of the requirements for which to return
+	 *        wires or {@code null} to return the wires for the requirements in
+	 *        all namespaces.
+	 * @return A list containing a snapshot of the {@link Wire}s for the
+	 *         {@link Requirement requirements} of this wiring, or an empty list
+	 *         if this wiring has no requirements in the specified namespace.
+	 *         For a given namespace, the list contains the wires in the order
+	 *         the requirements were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         requirements in different namespaces.
+	 * @since 1.1
+	 */
+	List<Wire> getRequiredResourceWires(String namespace);
+
+	/**
+	 * Returns the resource associated with this wiring.
+	 * 
+	 * <p>
+	 * This method returns the same value as {@link #getRevision()}.
+	 * 
+	 * @return The resource associated with this wiring.
+	 * @since 1.1
+	 */
+	BundleRevision getResource();
 }
diff --git a/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java b/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
index 046a6c2..ce9952c 100644
--- a/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
+++ b/framework/src/main/java/org/osgi/framework/wiring/FrameworkWiring.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,7 +17,6 @@
 package org.osgi.framework.wiring;
 
 import java.util.Collection;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleReference;
 import org.osgi.framework.FrameworkListener;
@@ -34,7 +33,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: f9f3f89b5b8d369453d645a52a482a385a2bd520 $
+ * @version $Id: bff4cdf85c632e2946e18c1640a86e80c069dd37 $
  */
 public interface FrameworkWiring extends BundleReference {
 	/**
@@ -110,8 +109,7 @@
 	 *         {@code AdminPermission[System Bundle,RESOLVE]} and the Java
 	 *         runtime environment supports permissions.
 	 */
-	void refreshBundles(Collection<Bundle> bundles,
-			FrameworkListener... listeners);
+	void refreshBundles(Collection<Bundle> bundles, FrameworkListener... listeners);
 
 	/**
 	 * Resolves the specified bundles. The Framework must attempt to resolve the
diff --git a/framework/src/main/java/org/osgi/resource/Capability.java b/framework/src/main/java/org/osgi/resource/Capability.java
new file mode 100644
index 0000000..bda0ce6
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Capability.java
@@ -0,0 +1,86 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.resource;
+
+import java.util.Map;
+
+/**
+ * A capability that has been declared from a {@link Resource}.
+ * 
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ * 
+ * @ThreadSafe
+ * @version $Id: 5f40514f7bf45f6dce59651e8812b0922580e77e $
+ */
+public interface Capability {
+
+	/**
+	 * Returns the namespace of this capability.
+	 * 
+	 * @return The namespace of this capability.
+	 */
+	String getNamespace();
+
+	/**
+	 * Returns the directives of this capability.
+	 * 
+	 * @return An unmodifiable map of directive names to directive values for
+	 *         this capability, or an empty map if this capability has no
+	 *         directives.
+	 */
+	Map<String, String> getDirectives();
+
+	/**
+	 * Returns the attributes of this capability.
+	 * 
+	 * @return An unmodifiable map of attribute names to attribute values for
+	 *         this capability, or an empty map if this capability has no
+	 *         attributes.
+	 */
+	Map<String, Object> getAttributes();
+
+	/**
+	 * Returns the resource declaring this capability.
+	 * 
+	 * @return The resource declaring this capability.
+	 */
+	Resource getResource();
+
+	/**
+	 * Compares this {@code Capability} to another {@code Capability}.
+	 * 
+	 * <p>
+	 * This {@code Capability} is equal to another {@code Capability} if they
+	 * have the same namespace, directives and attributes and are declared by
+	 * the same resource.
+	 * 
+	 * @param obj The object to compare against this {@code Capability}.
+	 * @return {@code true} if this {@code Capability} is equal to the other
+	 *         object; {@code false} otherwise.
+	 */
+	boolean equals(Object obj);
+
+	/**
+	 * Returns the hashCode of this {@code Capability}.
+	 * 
+	 * @return The hashCode of this {@code Capability}.
+	 */
+	int hashCode();
+}
diff --git a/framework/src/main/java/org/osgi/resource/Namespace.java b/framework/src/main/java/org/osgi/resource/Namespace.java
new file mode 100644
index 0000000..abda616
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Namespace.java
@@ -0,0 +1,154 @@
+/*
+ * Copyright (c) OSGi Alliance (2012). 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.resource;
+
+/**
+ * Capability and Requirement Namespaces base class.
+ * 
+ * <p>
+ * This class is the common class shared by all OSGi defined namespaces. It
+ * defines the names for the common attributes and directives for the OSGi
+ * specified namespaces.
+ * 
+ * <p>
+ * The OSGi Alliance reserves the right to extend the set of directives and
+ * attributes which have specified semantics for all of the specified
+ * namespaces.
+ * 
+ * <p>
+ * The values associated with these keys are of type {@code String}, unless
+ * otherwise indicated.
+ * 
+ * @Immutable
+ * @version $Id: 43c9ff5cea19546d71c4703db71a2b5070a3f2fa $
+ */
+public abstract class Namespace {
+
+	/**
+	 * The capability directive used to specify the comma separated list of
+	 * package names used by a capability.
+	 */
+	public final static String	CAPABILITY_USES_DIRECTIVE			= "uses";
+
+	/**
+	 * The capability directive used to specify the effective time for the
+	 * capability. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
+	 * 
+	 * @see #EFFECTIVE_RESOLVE resolve
+	 * @see #EFFECTIVE_ACTIVE active
+	 */
+	public final static String	CAPABILITY_EFFECTIVE_DIRECTIVE		= "effective";
+
+	/**
+	 * The requirement directive used to specify a capability filter. This
+	 * filter is used to match against a capability's attributes.
+	 */
+	public final static String	REQUIREMENT_FILTER_DIRECTIVE		= "filter";
+
+	/**
+	 * The requirement directive used to specify the resolution type for a
+	 * requirement. The default value is {@link #RESOLUTION_MANDATORY mandatory}
+	 * .
+	 * 
+	 * @see #RESOLUTION_MANDATORY mandatory
+	 * @see #RESOLUTION_OPTIONAL optional
+	 */
+	public final static String	REQUIREMENT_RESOLUTION_DIRECTIVE	= "resolution";
+
+	/**
+	 * The directive value identifying a mandatory requirement resolution type.
+	 * A mandatory resolution type indicates that the requirement must be
+	 * resolved when the resource is resolved. If such a requirement cannot be
+	 * resolved, the resource fails to resolve.
+	 * 
+	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+	 */
+	public final static String	RESOLUTION_MANDATORY				= "mandatory";
+
+	/**
+	 * The directive value identifying an optional requirement resolution type.
+	 * An optional resolution type indicates that the requirement is optional
+	 * and the resource may be resolved without the requirement being resolved.
+	 * 
+	 * @see #REQUIREMENT_RESOLUTION_DIRECTIVE
+	 */
+	public final static String	RESOLUTION_OPTIONAL					= "optional";
+
+	/**
+	 * The requirement directive used to specify the effective time for the
+	 * requirement. The default value is {@link #EFFECTIVE_RESOLVE resolve}.
+	 * 
+	 * @see #EFFECTIVE_RESOLVE resolve
+	 * @see #EFFECTIVE_ACTIVE active
+	 */
+	public final static String	REQUIREMENT_EFFECTIVE_DIRECTIVE		= "effective";
+
+	/**
+	 * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
+	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
+	 * is effective at resolve time. Capabilities and requirements with an
+	 * effective time of resolve are the only capabilities which are processed
+	 * while resolving a resource.
+	 * 
+	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
+	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
+	 */
+	public final static String	EFFECTIVE_RESOLVE					= "resolve";
+
+	/**
+	 * The directive value identifying a {@link #CAPABILITY_EFFECTIVE_DIRECTIVE
+	 * capability} or {@link #REQUIREMENT_EFFECTIVE_DIRECTIVE requirement} that
+	 * is effective at active time. Capabilities and requirements with an
+	 * effective time of active are ignored while resolving a resource.
+	 * 
+	 * @see #REQUIREMENT_EFFECTIVE_DIRECTIVE
+	 * @see #CAPABILITY_EFFECTIVE_DIRECTIVE
+	 */
+	public final static String	EFFECTIVE_ACTIVE					= "active";
+
+	/**
+	 * The requirement directive used to specify the cardinality for a
+	 * requirement. The default value is {@link #CARDINALITY_SINGLE single}.
+	 * 
+	 * @see #CARDINALITY_MULTIPLE multiple
+	 * @see #CARDINALITY_SINGLE single
+	 */
+	public final static String	REQUIREMENT_CARDINALITY_DIRECTIVE	= "cardinality";
+
+	/**
+	 * The directive value identifying a multiple
+	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type.
+	 * 
+	 * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+	 */
+	public final static String	CARDINALITY_MULTIPLE				= "multiple";
+
+	/**
+	 * The directive value identifying a
+	 * {@link #REQUIREMENT_CARDINALITY_DIRECTIVE cardinality} type of single.
+	 * 
+	 * @see #REQUIREMENT_CARDINALITY_DIRECTIVE
+	 */
+	public final static String	CARDINALITY_SINGLE					= "single";
+
+	/**
+	 * Protected constructor for Namespace sub-types.
+	 */
+	protected Namespace() {
+		// empty
+	}
+}
diff --git a/framework/src/main/java/org/osgi/resource/Requirement.java b/framework/src/main/java/org/osgi/resource/Requirement.java
new file mode 100644
index 0000000..cf931bf
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Requirement.java
@@ -0,0 +1,90 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.resource;
+
+import java.util.Map;
+
+/**
+ * A requirement that has been declared from a {@link Resource} .
+ * 
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ * 
+ * @ThreadSafe
+ * @version $Id: 212b26179910f98fd2c59c3e1e7dd0d086f42b5d $
+ */
+public interface Requirement {
+	/**
+	 * Returns the namespace of this requirement.
+	 * 
+	 * @return The namespace of this requirement.
+	 */
+	String getNamespace();
+
+	/**
+	 * Returns the directives of this requirement.
+	 * 
+	 * @return An unmodifiable map of directive names to directive values for
+	 *         this requirement, or an empty map if this requirement has no
+	 *         directives.
+	 */
+	Map<String, String> getDirectives();
+
+	/**
+	 * Returns the attributes of this requirement.
+	 * 
+	 * <p>
+	 * Requirement attributes have no specified semantics and are considered
+	 * extra user defined information.
+	 * 
+	 * @return An unmodifiable map of attribute names to attribute values for
+	 *         this requirement, or an empty map if this requirement has no
+	 *         attributes.
+	 */
+	Map<String, Object> getAttributes();
+
+	/**
+	 * Returns the resource declaring this requirement.
+	 * 
+	 * @return The resource declaring this requirement. This can be {@code null}
+	 *         if this requirement is synthesized.
+	 */
+	Resource getResource();
+
+	/**
+	 * Compares this {@code Requirement} to another {@code Requirement}.
+	 * 
+	 * <p>
+	 * This {@code Requirement} is equal to another {@code Requirement} if they
+	 * have the same namespace, directives and attributes and are declared by
+	 * the same resource.
+	 * 
+	 * @param obj The object to compare against this {@code Requirement}.
+	 * @return {@code true} if this {@code Requirement} is equal to the other
+	 *         object; {@code false} otherwise.
+	 */
+	boolean equals(Object obj);
+
+	/**
+	 * Returns the hashCode of this {@code Requirement}.
+	 * 
+	 * @return The hashCode of this {@code Requirement}.
+	 */
+	int hashCode();
+}
diff --git a/framework/src/main/java/org/osgi/resource/Resource.java b/framework/src/main/java/org/osgi/resource/Resource.java
new file mode 100644
index 0000000..455d891
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Resource.java
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.resource;
+
+import java.util.List;
+
+/**
+ * A resource is the representation of a uniquely identified and typed data. A
+ * resource declares requirements that need to be satisfied by capabilities
+ * before it can provide its capabilities.
+ * 
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ * 
+ * @ThreadSafe
+ * @version $Id: 40958d5777ee269d27d58e9f646a4c91bcc6daa4 $
+ */
+public interface Resource {
+	/**
+	 * Returns the capabilities declared by this resource.
+	 * 
+	 * @param namespace The namespace of the declared capabilities to return or
+	 *        {@code null} to return the declared capabilities from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared {@link Capability}s
+	 *         from the specified namespace. The returned list will be empty if
+	 *         this resource declares no capabilities in the specified
+	 *         namespace.
+	 */
+	List<Capability> getCapabilities(String namespace);
+
+	/**
+	 * Returns the requirements declared by this bundle resource.
+	 * 
+	 * @param namespace The namespace of the declared requirements to return or
+	 *        {@code null} to return the declared requirements from all
+	 *        namespaces.
+	 * @return An unmodifiable list containing the declared {@link Requirement}
+	 *         s from the specified namespace. The returned list will be empty
+	 *         if this resource declares no requirements in the specified
+	 *         namespace.
+	 */
+	List<Requirement> getRequirements(String namespace);
+
+	/**
+	 * Compares this {@code Resource} to another {@code Resource}.
+	 * 
+	 * <p>
+	 * This {@code Resource} is equal to another {@code Resource} if both have
+	 * the same content and come from the same location. Location may be defined
+	 * as the bundle location if the resource is an installed bundle or the
+	 * repository location if the resource is in a repository.
+	 * 
+	 * @param obj The object to compare against this {@code Resource}.
+	 * @return {@code true} if this {@code Resource} is equal to the other
+	 *         object; {@code false} otherwise.
+	 */
+	boolean equals(Object obj);
+
+	/**
+	 * Returns the hashCode of this {@code Resource}.
+	 * 
+	 * @return The hashCode of this {@code Resource}.
+	 */
+	int hashCode();
+}
diff --git a/framework/src/main/java/org/osgi/resource/Wire.java b/framework/src/main/java/org/osgi/resource/Wire.java
new file mode 100644
index 0000000..18feab8
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Wire.java
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.resource;
+
+/**
+ * A wire connecting a {@link Capability} to a {@link Requirement}.
+ * 
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ * 
+ * @ThreadSafe
+ * @version $Id: d7ca9a5d3e8dd2277f8243a750e40fbcf79185bd $
+ */
+public interface Wire {
+	/**
+	 * Returns the {@link Capability} for this wire.
+	 * 
+	 * @return The {@link Capability} for this wire.
+	 */
+	Capability getCapability();
+
+	/**
+	 * Returns the {@link Requirement} for this wire.
+	 * 
+	 * @return The {@link Requirement} for this wire.
+	 */
+	Requirement getRequirement();
+
+	/**
+	 * Returns the resource providing the {@link #getCapability() capability}.
+	 * 
+	 * <p>
+	 * The returned resource may differ from the resource referenced by the
+	 * {@link #getCapability() capability}.
+	 * 
+	 * @return The resource providing the capability.
+	 */
+	Resource getProvider();
+
+	/**
+	 * Returns the resource who {@link #getRequirement() requires} the
+	 * {@link #getCapability() capability}.
+	 * 
+	 * <p>
+	 * The returned resource may differ from the resource referenced by the
+	 * {@link #getRequirement() requirement}.
+	 * 
+	 * @return The resource who requires the capability.
+	 */
+	Resource getRequirer();
+
+	/**
+	 * Compares this {@code Wire} to another {@code Wire}.
+	 * 
+	 * <p>
+	 * This {@code Wire} is equal to another {@code Wire} if they have the same
+	 * capability, requirement, provider and requirer.
+	 * 
+	 * @param obj The object to compare against this {@code Wire}.
+	 * @return {@code true} if this {@code Wire} is equal to the other object;
+	 *         {@code false} otherwise.
+	 */
+	boolean equals(Object obj);
+
+	/**
+	 * Returns the hashCode of this {@code Wire}.
+	 * 
+	 * @return The hashCode of this {@code Wire}.
+	 */
+	int hashCode();
+}
diff --git a/framework/src/main/java/org/osgi/resource/Wiring.java b/framework/src/main/java/org/osgi/resource/Wiring.java
new file mode 100644
index 0000000..230fef0
--- /dev/null
+++ b/framework/src/main/java/org/osgi/resource/Wiring.java
@@ -0,0 +1,144 @@
+/*
+ * Copyright (c) OSGi Alliance (2011, 2012). 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.resource;
+
+import java.util.List;
+
+/**
+ * A wiring for a resource. A wiring is associated with a resource and
+ * represents the dependencies with other wirings.
+ * 
+ * <p>
+ * Instances of this type must be <i>effectively immutable</i>. That is, for a
+ * given instance of this interface, the methods defined by this interface must
+ * always return the same result.
+ * 
+ * @ThreadSafe
+ * @version $Id: b65dec3887cfa1d5731e860db558a01503c0f47d $
+ */
+public interface Wiring {
+	/**
+	 * Returns the capabilities provided by this wiring.
+	 * 
+	 * <p>
+	 * Only capabilities considered by the resolver are returned. For example,
+	 * capabilities with {@link Namespace#CAPABILITY_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
+	 * A capability may not be required by any wiring and thus there may be no
+	 * {@link #getProvidedResourceWires(String) wires} for the capability.
+	 * 
+	 * <p>
+	 * A wiring for a non-fragment resource provides a subset of the declared
+	 * capabilities from the resource and all attached fragment
+	 * resources<sup>&#8224;</sup>. Not all declared capabilities may be
+	 * provided since some may be discarded. For example, if a package is
+	 * declared to be both exported and imported, only one is selected and the
+	 * other is discarded.
+	 * <p>
+	 * A wiring for a fragment resource with a symbolic name must provide
+	 * exactly one {@code osgi.identity} capability.
+	 * <p>
+	 * &#8224; The {@code osgi.identity} capability provided by attached
+	 * fragment resource must not be included in the capabilities of the host
+	 * wiring.
+	 * 
+	 * @param namespace The namespace of the capabilities to return or
+	 *        {@code null} to return the capabilities from all namespaces.
+	 * @return A list containing a snapshot of the {@link Capability}s, or an
+	 *         empty list if this wiring provides no capabilities in the
+	 *         specified namespace. For a given namespace, the list contains the
+	 *         wires in the order the capabilities were specified in the
+	 *         manifests of the {@link #getResource() resource} and the attached
+	 *         fragment resources<sup>&#8224;</sup> of this wiring. There is no
+	 *         ordering defined between capabilities in different namespaces.
+	 */
+	List<Capability> getResourceCapabilities(String namespace);
+
+	/**
+	 * Returns the requirements of this wiring.
+	 * 
+	 * <p>
+	 * Only requirements considered by the resolver are returned. For example,
+	 * requirements with {@link Namespace#REQUIREMENT_EFFECTIVE_DIRECTIVE
+	 * effective} directive not equal to {@link Namespace#EFFECTIVE_RESOLVE
+	 * resolve} are not returned.
+	 * 
+	 * <p>
+	 * A wiring for a non-fragment resource has a subset of the declared
+	 * requirements from the resource and all attached fragment resources. Not
+	 * all declared requirements may be present since some may be discarded. For
+	 * example, if a package is declared to be optionally imported and is not
+	 * actually imported, the requirement must be discarded.
+	 * 
+	 * @param namespace The namespace of the requirements to return or
+	 *        {@code null} to return the requirements from all namespaces.
+	 * @return A list containing a snapshot of the {@link Requirement}s, or an
+	 *         empty list if this wiring uses no requirements in the specified
+	 *         namespace. For a given namespace, the list contains the wires in
+	 *         the order the requirements were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         requirements in different namespaces.
+	 */
+	List<Requirement> getResourceRequirements(String namespace);
+
+	/**
+	 * Returns the {@link Wire}s to the provided {@link Capability capabilities}
+	 * of this wiring.
+	 * 
+	 * @param namespace The namespace of the capabilities for which to return
+	 *        wires or {@code null} to return the wires for the capabilities in
+	 *        all namespaces.
+	 * @return A list containing a snapshot of the {@link Wire}s for the
+	 *         {@link Capability capabilities} of this wiring, or an empty list
+	 *         if this wiring has no capabilities in the specified namespace.
+	 *         For a given namespace, the list contains the wires in the order
+	 *         the capabilities were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         capabilities in different namespaces.
+	 */
+	List<Wire> getProvidedResourceWires(String namespace);
+
+	/**
+	 * Returns the {@link Wire}s to the {@link Requirement requirements} in use
+	 * by this wiring.
+	 * 
+	 * @param namespace The namespace of the requirements for which to return
+	 *        wires or {@code null} to return the wires for the requirements in
+	 *        all namespaces.
+	 * @return A list containing a snapshot of the {@link Wire}s for the
+	 *         {@link Requirement requirements} of this wiring, or an empty list
+	 *         if this wiring has no requirements in the specified namespace.
+	 *         For a given namespace, the list contains the wires in the order
+	 *         the requirements were specified in the manifests of the
+	 *         {@link #getResource() resource} and the attached fragment
+	 *         resources of this wiring. There is no ordering defined between
+	 *         requirements in different namespaces.
+	 */
+	List<Wire> getRequiredResourceWires(String namespace);
+
+	/**
+	 * Returns the resource associated with this wiring.
+	 * 
+	 * @return The resource associated with this wiring.
+	 */
+	Resource getResource();
+}
diff --git a/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java b/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
index abe1515..4dd3a3a 100644
--- a/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
+++ b/framework/src/main/java/org/osgi/service/packageadmin/ExportedPackage.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -45,7 +45,7 @@
  * @noimplement
  * @deprecated The PackageAdmin service has been replaced by the
  *             <code>org.osgi.framework.wiring</code> package.
- * @version $Id: c56b99465e3f62a9808297a47de8cb7edb802119 $
+ * @version $Id: 22ce5e8e388107b04edba3aea2f3036b8026798d $
  */
 public interface ExportedPackage {
 	/**
@@ -83,9 +83,9 @@
 	/**
 	 * Returns the version of this exported package.
 	 * 
-	 * @return The version of this exported package, or {@code null} if
-	 *         no version information is available.
-	 * @deprecated As of 1.2, replaced by {@link #getVersion}.
+	 * @return The version of this exported package, or {@code null} if no
+	 *         version information is available.
+	 * @deprecated As of 1.2, replaced by {@link #getVersion()}.
 	 */
 	public String getSpecificationVersion();
 
diff --git a/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java b/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
index 5efb41c..b4b8816 100644
--- a/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
+++ b/framework/src/main/java/org/osgi/service/startlevel/StartLevel.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2011). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -68,7 +68,7 @@
  * 
  * @ThreadSafe
  * @noimplement
- * @version $Id: bf1b71ed6c9f9d75785b26dccb34362017d93f4a $
+ * @version $Id: ec0295bdf246c0258261374b3ac0e4aef11f7315 $
  * @deprecated This service has been replaced by the
  *             <code>org.osgi.framework.startlevel</code> package.
  */
@@ -202,7 +202,7 @@
 	 * is first installed.
 	 * 
 	 * @return The initial start level value for Bundles.
-	 * @see #setInitialBundleStartLevel
+	 * @see #setInitialBundleStartLevel(int)
 	 */
 	public int getInitialBundleStartLevel();
 
diff --git a/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java b/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
index c20a051..679583c 100644
--- a/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
+++ b/framework/src/main/java/org/osgi/service/url/AbstractURLStreamHandlerService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,43 +19,38 @@
 import java.net.*;
 
 /**
- * Abstract implementation of the {@code URLStreamHandlerService}
- * interface. All the methods simply invoke the corresponding methods on
- * {@code java.net.URLStreamHandler} except for {@code parseURL}
- * and {@code setURL}, which use the {@code URLStreamHandlerSetter}
- * parameter. Subclasses of this abstract class should not need to override the
- * {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)}
- * methods.
+ * Abstract implementation of the {@code URLStreamHandlerService} interface. All
+ * the methods simply invoke the corresponding methods on
+ * {@code java.net.URLStreamHandler} except for {@code parseURL} and
+ * {@code setURL}, which use the {@code URLStreamHandlerSetter} parameter.
+ * Subclasses of this abstract class should not need to override the
+ * {@code setURL} and {@code parseURL(URLStreamHandlerSetter,...)} methods.
  * 
  * @ThreadSafe
- * @version $Id: 465a0ed86f5d49b338ffc6a13bb68f60f04e54d6 $
+ * @version $Id: b86572a4f13b7bb4a343ac4d6b6fb3487e01bd31 $
  */
-public abstract class AbstractURLStreamHandlerService extends URLStreamHandler
-		implements URLStreamHandlerService {
+public abstract class AbstractURLStreamHandlerService extends URLStreamHandler implements URLStreamHandlerService {
 	/**
 	 * @see "java.net.URLStreamHandler.openConnection"
 	 */
-	public abstract URLConnection openConnection(URL u)
-			throws java.io.IOException;
+	public abstract URLConnection openConnection(URL u) throws java.io.IOException;
 
 	/**
-	 * The {@code URLStreamHandlerSetter} object passed to the parseURL
-	 * method.
+	 * The {@code URLStreamHandlerSetter} object passed to the parseURL method.
 	 */
 	protected volatile URLStreamHandlerSetter	realHandler;
 
 	/**
-	 * Parse a URL using the {@code URLStreamHandlerSetter} object. This
-	 * method sets the {@code realHandler} field with the specified
+	 * Parse a URL using the {@code URLStreamHandlerSetter} object. This method
+	 * sets the {@code realHandler} field with the specified
 	 * {@code URLStreamHandlerSetter} object and then calls
 	 * {@code parseURL(URL,String,int,int)}.
 	 * 
-	 * @param realHandler The object on which the {@code setURL} method
-	 *        must be invoked for the specified URL.
+	 * @param realHandler The object on which the {@code setURL} 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) {
+	public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit) {
 		this.realHandler = realHandler;
 		parseURL(u, spec, start, limit);
 	}
@@ -131,19 +126,18 @@
 	 * @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) {
+	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 realHandler.setURL(URL,String,String,int,String,String,String,String)}
+	 * .
 	 * 
 	 * @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) {
+	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);
 	}
 }
diff --git a/framework/src/main/java/org/osgi/service/url/URLConstants.java b/framework/src/main/java/org/osgi/service/url/URLConstants.java
index fbf768b..493f352 100644
--- a/framework/src/main/java/org/osgi/service/url/URLConstants.java
+++ b/framework/src/main/java/org/osgi/service/url/URLConstants.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,16 +18,14 @@
 
 /**
  * Defines standard names for property keys associated with
- * {@link URLStreamHandlerService} and {@code java.net.ContentHandler}
- * services.
+ * {@link URLStreamHandlerService} and {@code java.net.ContentHandler} services.
  * 
  * <p>
- * The values associated with these keys are of type
- * {@code java.lang.String[]} or {@code java.lang.String}, unless
- * otherwise indicated.
+ * The values associated with these keys are of type {@code java.lang.String[]}
+ * or {@code java.lang.String}, unless otherwise indicated.
  * 
  * @noimplement
- * @version $Id: 5ec8db316249f4b956fe083b986c11153d0fa8fe $
+ * @version $Id: ac2b9670972d6e41d989c51067219ff7be459831 $
  */
 public interface URLConstants {
 	/**
diff --git a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
index 7cc5d6e..e6dd098 100644
--- a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
+++ b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerService.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -23,19 +23,17 @@
  * {@code java.net.URLStreamHandler} methods.
  * <p>
  * The important differences between this interface and the
- * {@code URLStreamHandler} class are that the {@code setURL}
- * method is absent and the {@code parseURL} method takes a
- * {@link URLStreamHandlerSetter} object as the first argument. Classes
- * implementing this interface must call the {@code setURL} method on the
- * {@code URLStreamHandlerSetter} object received in the
- * {@code parseURL} method instead of
- * {@code URLStreamHandler.setURL} to avoid a
- * {@code SecurityException}.
+ * {@code URLStreamHandler} class are that the {@code setURL} method is absent
+ * and the {@code parseURL} method takes a {@link URLStreamHandlerSetter} object
+ * as the first argument. Classes implementing this interface must call the
+ * {@code setURL} method on the {@code URLStreamHandlerSetter} object received
+ * in the {@code parseURL} method instead of {@code URLStreamHandler.setURL} to
+ * avoid a {@code SecurityException}.
  * 
  * @see AbstractURLStreamHandlerService
  * 
  * @ThreadSafe
- * @version $Id: 4982ef5b407669975afe2856a9702246d2d9c2ba $
+ * @version $Id: 4a453f61b9acdc6449df389b2a0538d0ccb33ed2 $
  */
 public interface URLStreamHandlerService {
 	/**
@@ -44,16 +42,15 @@
 	public URLConnection openConnection(URL u) throws java.io.IOException;
 
 	/**
-	 * Parse a URL. This method is called by the {@code URLStreamHandler}
-	 * proxy, instead of {@code java.net.URLStreamHandler.parseURL},
-	 * passing a {@code URLStreamHandlerSetter} object.
+	 * Parse a URL. This method is called by the {@code URLStreamHandler} proxy,
+	 * instead of {@code java.net.URLStreamHandler.parseURL}, passing a
+	 * {@code URLStreamHandlerSetter} object.
 	 * 
-	 * @param realHandler The object on which {@code setURL} must be
-	 *        invoked for this URL.
+	 * @param realHandler The object on which {@code setURL} must be invoked for
+	 *        this URL.
 	 * @see "java.net.URLStreamHandler.parseURL"
 	 */
-	public void parseURL(URLStreamHandlerSetter realHandler, URL u,
-			String spec, int start, int limit);
+	public void parseURL(URLStreamHandlerSetter realHandler, URL u, String spec, int start, int limit);
 
 	/**
 	 * @see "java.net.URLStreamHandler.toExternalForm"
diff --git a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
index dd2e0c2..90feae6 100644
--- a/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
+++ b/framework/src/main/java/org/osgi/service/url/URLStreamHandlerSetter.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2002, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2002, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,19 +20,18 @@
 
 /**
  * Interface used by {@code URLStreamHandlerService} objects to call the
- * {@code setURL} method on the proxy {@code URLStreamHandler}
- * object.
+ * {@code setURL} method on the proxy {@code URLStreamHandler} object.
  * 
  * <p>
  * Objects of this type are passed to the
- * {@link URLStreamHandlerService#parseURL} method. Invoking the
- * {@code setURL} method on the {@code URLStreamHandlerSetter}
- * object will invoke the {@code setURL} method on the proxy
- * {@code URLStreamHandler} object that is actually registered with
+ * {@link URLStreamHandlerService#parseURL(URLStreamHandlerSetter, URL, String, int, int)}
+ * method. Invoking the {@code setURL} method on the
+ * {@code URLStreamHandlerSetter} object will invoke the {@code setURL} method
+ * on the proxy {@code URLStreamHandler} object that is actually registered with
  * {@code java.net.URL} for the protocol.
  * 
  * @ThreadSafe
- * @version $Id: f55d4c29678503c244f56dcb2b5621b3be11cc8d $
+ * @version $Id: 90f25e3961fea2150cfd31117a2237304f1518f9 $
  */
 public interface URLStreamHandlerSetter {
 	/**
@@ -41,13 +40,10 @@
 	 * @deprecated This method is only for compatibility with handlers written
 	 *             for JDK 1.1.
 	 */
-	public void setURL(URL u, String protocol, String host, int port,
-			String file, String ref);
+	public void setURL(URL u, String protocol, String host, int port, String file, String ref);
 
 	/**
 	 * @see "java.net.URLStreamHandler.setURL(URL,String,String,int,String,String,String,String)"
 	 */
-	public void setURL(URL u, String protocol, String host, int port,
-			String authority, String userInfo, String path, String query,
-			String ref);
+	public void setURL(URL u, String protocol, String host, int port, String authority, String userInfo, String path, String query, String ref);
 }
diff --git a/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java b/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
index 64a271a..f3ddddc 100644
--- a/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
+++ b/framework/src/main/java/org/osgi/util/tracker/AbstractTracked.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2012). 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.
@@ -34,7 +34,7 @@
  * @param <T> The value mapped to the tracked item.
  * @param <R> The reason the tracked item is being tracked or untracked.
  * @ThreadSafe
- * @version $Id: 79452e6c28683021f2bcf11d3689ec75c6b5642f $
+ * @version $Id: 16340086b98d308c2d12f13bcd87fc6467a5a367 $
  * @since 1.4
  */
 abstract class AbstractTracked<S, T, R> {
@@ -117,8 +117,8 @@
 	 * This method must be called from Tracker's open method while synchronized
 	 * on this object in the same synchronized block as the add listener call.
 	 * 
-	 * @param list The initial list of items to be tracked. {@code null}
-	 *        entries in the list are ignored.
+	 * @param list The initial list of items to be tracked. {@code null} entries
+	 *        in the list are ignored.
 	 * @GuardedBy this
 	 */
 	void setInitial(S[] list) {
@@ -162,8 +162,7 @@
 				if (tracked.get(item) != null) {
 					/* if we are already tracking this item */
 					if (DEBUG) {
-						System.out
-								.println("AbstractTracked.trackInitial[already tracked]: " + item); //$NON-NLS-1$
+						System.out.println("AbstractTracked.trackInitial[already tracked]: " + item); //$NON-NLS-1$
 					}
 					continue; /* skip this item */
 				}
@@ -172,8 +171,7 @@
 					 * if this item is already in the process of being added.
 					 */
 					if (DEBUG) {
-						System.out
-								.println("AbstractTracked.trackInitial[already adding]: " + item); //$NON-NLS-1$
+						System.out.println("AbstractTracked.trackInitial[already adding]: " + item); //$NON-NLS-1$
 					}
 					continue; /* skip this item */
 				}
@@ -214,17 +212,14 @@
 				if (adding.contains(item)) {
 					/* if this item is already in the process of being added. */
 					if (DEBUG) {
-						System.out
-								.println("AbstractTracked.track[already adding]: " + item); //$NON-NLS-1$
+						System.out.println("AbstractTracked.track[already adding]: " + item); //$NON-NLS-1$
 					}
 					return;
 				}
 				adding.add(item); /* mark this item is being added */
-			}
-			else { /* we are currently tracking this item */
+			} else { /* we are currently tracking this item */
 				if (DEBUG) {
-					System.out
-							.println("AbstractTracked.track[modified]: " + item); //$NON-NLS-1$
+					System.out.println("AbstractTracked.track[modified]: " + item); //$NON-NLS-1$
 				}
 				modified(); /* increment modification count */
 			}
@@ -232,8 +227,7 @@
 
 		if (object == null) { /* we are not tracking the item */
 			trackAdding(item, related);
-		}
-		else {
+		} else {
 			/* Call customizer outside of synchronized region */
 			customizerModified(item, related, object);
 			/*
@@ -264,8 +258,7 @@
 			 * If the customizer throws an unchecked exception, it will
 			 * propagate after the finally
 			 */
-		}
-		finally {
+		} finally {
 			synchronized (this) {
 				if (adding.remove(item) && !closed) {
 					/*
@@ -277,8 +270,7 @@
 						modified(); /* increment modification count */
 						notifyAll(); /* notify any waiters */
 					}
-				}
-				else {
+				} else {
 					becameUntracked = true;
 				}
 			}
@@ -288,8 +280,7 @@
 		 */
 		if (becameUntracked && (object != null)) {
 			if (DEBUG) {
-				System.out
-						.println("AbstractTracked.trackAdding[removed]: " + item); //$NON-NLS-1$
+				System.out.println("AbstractTracked.trackAdding[removed]: " + item); //$NON-NLS-1$
 			}
 			/* Call customizer outside of synchronized region */
 			customizerRemoved(item, related, object);
@@ -314,8 +305,7 @@
 										 * of initial references to process
 										 */
 				if (DEBUG) {
-					System.out
-							.println("AbstractTracked.untrack[removed from initial]: " + item); //$NON-NLS-1$
+					System.out.println("AbstractTracked.untrack[removed from initial]: " + item); //$NON-NLS-1$
 				}
 				return; /*
 						 * we have removed it from the list and it will not be
@@ -328,8 +318,7 @@
 										 * being added
 										 */
 				if (DEBUG) {
-					System.out
-							.println("AbstractTracked.untrack[being added]: " + item); //$NON-NLS-1$
+					System.out.println("AbstractTracked.untrack[being added]: " + item); //$NON-NLS-1$
 				}
 				return; /*
 						 * in case the item is untracked while in the process of
@@ -430,8 +419,8 @@
 	/**
 	 * Copy the tracked items and associated values into the specified map.
 	 * 
-	 * @param <M> Type of {@code Map} to hold the tracked items and
-	 *        associated values.
+	 * @param <M> Type of {@code Map} to hold the tracked items and associated
+	 *        values.
 	 * @param map The map into which to copy the tracked items and associated
 	 *        values. This map must not be a user provided map so that user code
 	 *        is not executed while synchronized on this.
@@ -439,7 +428,7 @@
 	 * @GuardedBy this
 	 * @since 1.5
 	 */
-	<M extends Map< ? super S, ? super T>> M copyEntries(final M map) {
+	<M extends Map<? super S, ? super T>> M copyEntries(final M map) {
 		map.putAll(tracked);
 		return map;
 	}
@@ -450,8 +439,8 @@
 	 * 
 	 * @param item Item to be tracked.
 	 * @param related Action related object.
-	 * @return Customized object for the tracked item or {@code null} if
-	 *         the item is not to be tracked.
+	 * @return Customized object for the tracked item or {@code null} if the
+	 *         item is not to be tracked.
 	 */
 	abstract T customizerAdding(final S item, final R related);
 
@@ -463,8 +452,7 @@
 	 * @param related Action related object.
 	 * @param object Customized object for the tracked item.
 	 */
-	abstract void customizerModified(final S item, final R related,
-			final T object);
+	abstract void customizerModified(final S item, final R related, final T object);
 
 	/**
 	 * Call the specific customizer removed method. This method must not be
@@ -474,6 +462,5 @@
 	 * @param related Action related object.
 	 * @param object Customized object for the tracked item.
 	 */
-	abstract void customizerRemoved(final S item, final R related,
-			final T object);
+	abstract void customizerRemoved(final S item, final R related, final T object);
 }
diff --git a/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java b/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
index 4973503..7e1bb53 100644
--- a/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
+++ b/framework/src/main/java/org/osgi/util/tracker/BundleTracker.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,36 +18,33 @@
 
 import java.util.HashMap;
 import java.util.Map;
-
 import org.osgi.framework.Bundle;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.BundleEvent;
 import org.osgi.framework.SynchronousBundleListener;
 
 /**
- * The {@code BundleTracker} class simplifies tracking bundles much like
- * the {@code ServiceTracker} simplifies tracking services.
+ * The {@code BundleTracker} class simplifies tracking bundles much like the
+ * {@code ServiceTracker} simplifies tracking services.
  * <p>
  * A {@code BundleTracker} is constructed with state criteria and a
- * {@code BundleTrackerCustomizer} object. A {@code BundleTracker} can
- * use the {@code BundleTrackerCustomizer} to select which bundles are
- * tracked and to create a customized object to be tracked with the bundle. The
- * {@code BundleTracker} can then be opened to begin tracking all bundles
- * whose state matches the specified state criteria.
+ * {@code BundleTrackerCustomizer} object. A {@code BundleTracker} can use the
+ * {@code BundleTrackerCustomizer} to select which bundles are tracked and to
+ * create a customized object to be tracked with the bundle. The
+ * {@code BundleTracker} can then be opened to begin tracking all bundles whose
+ * state matches the specified state criteria.
  * <p>
- * The {@code getBundles} method can be called to get the
- * {@code Bundle} objects of the bundles being tracked. The
- * {@code getObject} method can be called to get the customized object for
- * a tracked bundle.
+ * The {@code getBundles} method can be called to get the {@code Bundle} objects
+ * of the bundles being tracked. The {@code getObject} method can be called to
+ * get the customized object for a tracked bundle.
  * <p>
  * The {@code BundleTracker} class is thread-safe. It does not call a
  * {@code BundleTrackerCustomizer} while holding any locks.
- * {@code BundleTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code BundleTrackerCustomizer} implementations must also be thread-safe.
  * 
  * @param <T> The type of the tracked object.
  * @ThreadSafe
- * @version $Id: ebfd73a4e19f025d6ad9029d99c17944ee8c420a $
+ * @version $Id: f21db4fe54284d4810bd9b5fa2528957804e3a21 $
  * @since 1.4
  */
 public class BundleTracker<T> implements BundleTrackerCustomizer<T> {
@@ -88,28 +85,25 @@
 	final int	mask;
 
 	/**
-	 * Create a {@code BundleTracker} for bundles whose state is present in
-	 * the specified state mask.
+	 * Create a {@code BundleTracker} for bundles whose state is present in the
+	 * specified state mask.
 	 * 
 	 * <p>
 	 * Bundles whose state is present on the specified state mask will be
 	 * tracked by this {@code BundleTracker}.
 	 * 
-	 * @param context The {@code BundleContext} against which the tracking
-	 *        is done.
-	 * @param stateMask The bit mask of the {@code OR}ing of the bundle
-	 *        states to be tracked.
+	 * @param context The {@code BundleContext} against which the tracking is
+	 *        done.
+	 * @param stateMask The bit mask of the {@code OR}ing of the bundle states
+	 *        to be tracked.
 	 * @param customizer The customizer object to call when bundles are added,
-	 *        modified, or removed in this {@code BundleTracker}. If
-	 *        customizer is {@code null}, then this
-	 *        {@code BundleTracker} will be used as the
-	 *        {@code BundleTrackerCustomizer} and this
-	 *        {@code BundleTracker} will call the
-	 *        {@code BundleTrackerCustomizer} methods on itself.
+	 *        modified, or removed in this {@code BundleTracker}. If customizer
+	 *        is {@code null}, then this {@code BundleTracker} will be used as
+	 *        the {@code BundleTrackerCustomizer} and this {@code BundleTracker}
+	 *        will call the {@code BundleTrackerCustomizer} methods on itself.
 	 * @see Bundle#getState()
 	 */
-	public BundleTracker(BundleContext context, int stateMask,
-			BundleTrackerCustomizer<T> customizer) {
+	public BundleTracker(BundleContext context, int stateMask, BundleTrackerCustomizer<T> customizer) {
 		this.context = context;
 		this.mask = stateMask;
 		this.customizer = (customizer == null) ? this : customizer;
@@ -123,13 +117,12 @@
 	 * {@code BundleTracker} was created are now tracked by this
 	 * {@code BundleTracker}.
 	 * 
-	 * @throws java.lang.IllegalStateException If the {@code BundleContext}
-	 *         with which this {@code BundleTracker} was created is no
-	 *         longer valid.
+	 * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+	 *         which this {@code BundleTracker} was created is no longer valid.
 	 * @throws java.lang.SecurityException If the caller and this class do not
 	 *         have the appropriate
-	 *         {@code AdminPermission[context bundle,LISTENER]}, and the
-	 *         Java Runtime Environment supports permissions.
+	 *         {@code AdminPermission[context bundle,LISTENER]}, and the Java
+	 *         Runtime Environment supports permissions.
 	 */
 	public void open() {
 		final Tracked t;
@@ -167,8 +160,8 @@
 	 * Close this {@code BundleTracker}.
 	 * 
 	 * <p>
-	 * This method should be called when this {@code BundleTracker} should
-	 * end the tracking of bundles.
+	 * This method should be called when this {@code BundleTracker} should end
+	 * the tracking of bundles.
 	 * 
 	 * <p>
 	 * This implementation calls {@link #getBundles()} to get the list of
@@ -190,8 +183,7 @@
 			tracked = null;
 			try {
 				context.removeBundleListener(outgoing);
-			}
-			catch (IllegalStateException e) {
+			} catch (IllegalStateException e) {
 				/* In case the context was stopped. */
 			}
 		}
@@ -220,8 +212,8 @@
 	 * @param bundle The {@code Bundle} being added to this
 	 *        {@code BundleTracker} object.
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
 	 * @return The specified bundle.
 	 * @see BundleTrackerCustomizer#addingBundle(Bundle, BundleEvent)
 	 */
@@ -243,8 +235,8 @@
 	 * 
 	 * @param bundle The {@code Bundle} whose state has been modified.
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
 	 * @param object The customized object for the specified Bundle.
 	 * @see BundleTrackerCustomizer#modifiedBundle(Bundle, BundleEvent, Object)
 	 */
@@ -265,8 +257,8 @@
 	 * 
 	 * @param bundle The {@code Bundle} being removed.
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
 	 * @param object The customized object for the specified bundle.
 	 * @see BundleTrackerCustomizer#removedBundle(Bundle, BundleEvent, Object)
 	 */
@@ -275,11 +267,11 @@
 	}
 
 	/**
-	 * Return an array of {@code Bundle}s for all bundles being tracked by
-	 * this {@code BundleTracker}.
+	 * Return an array of {@code Bundle}s for all bundles being tracked by this
+	 * {@code BundleTracker}.
 	 * 
-	 * @return An array of {@code Bundle}s or {@code null} if no
-	 *         bundles are being tracked.
+	 * @return An array of {@code Bundle}s or {@code null} if no bundles are
+	 *         being tracked.
 	 */
 	public Bundle[] getBundles() {
 		final Tracked t = tracked();
@@ -296,13 +288,13 @@
 	}
 
 	/**
-	 * Returns the customized object for the specified {@code Bundle} if
-	 * the specified bundle is being tracked by this {@code BundleTracker}.
+	 * Returns the customized object for the specified {@code Bundle} if the
+	 * specified bundle is being tracked by this {@code BundleTracker}.
 	 * 
 	 * @param bundle The {@code Bundle} being tracked.
 	 * @return The customized object for the specified {@code Bundle} or
-	 *         {@code null} if the specified {@code Bundle} is not
-	 *         being tracked.
+	 *         {@code null} if the specified {@code Bundle} is not being
+	 *         tracked.
 	 */
 	public T getObject(Bundle bundle) {
 		final Tracked t = tracked();
@@ -317,10 +309,10 @@
 	/**
 	 * Remove a bundle from this {@code BundleTracker}.
 	 * 
-	 * The specified bundle will be removed from this {@code BundleTracker}
-	 * . If the specified bundle was being tracked then the
-	 * {@code BundleTrackerCustomizer.removedBundle} method will be called
-	 * for that bundle.
+	 * The specified bundle will be removed from this {@code BundleTracker} . If
+	 * the specified bundle was being tracked then the
+	 * {@code BundleTrackerCustomizer.removedBundle} method will be called for
+	 * that bundle.
 	 * 
 	 * @param bundle The {@code Bundle} to be removed.
 	 */
@@ -333,8 +325,7 @@
 	}
 
 	/**
-	 * Return the number of bundles being tracked by this
-	 * {@code BundleTracker}.
+	 * Return the number of bundles being tracked by this {@code BundleTracker}.
 	 * 
 	 * @return The number of bundles being tracked.
 	 */
@@ -377,13 +368,12 @@
 	}
 
 	/**
-	 * Return a {@code Map} with the {@code Bundle}s and customized
-	 * objects for all bundles being tracked by this {@code BundleTracker}.
+	 * Return a {@code Map} with the {@code Bundle}s and customized objects for
+	 * all bundles being tracked by this {@code BundleTracker}.
 	 * 
-	 * @return A {@code Map} with the {@code Bundle}s and customized
-	 *         objects for all services being tracked by this
-	 *         {@code BundleTracker}. If no bundles are being tracked, then
-	 *         the returned map is empty.
+	 * @return A {@code Map} with the {@code Bundle}s and customized objects for
+	 *         all services being tracked by this {@code BundleTracker}. If no
+	 *         bundles are being tracked, then the returned map is empty.
 	 * @since 1.5
 	 */
 	public Map<Bundle, T> getTracked() {
@@ -421,9 +411,7 @@
 	 * @ThreadSafe
 	 * @since 1.4
 	 */
-	private final class Tracked extends AbstractTracked<Bundle, T, BundleEvent>
-			implements
-			SynchronousBundleListener {
+	private final class Tracked extends AbstractTracked<Bundle, T, BundleEvent> implements SynchronousBundleListener {
 		/**
 		 * Tracked constructor.
 		 */
@@ -432,9 +420,8 @@
 		}
 
 		/**
-		 * {@code BundleListener} method for the {@code BundleTracker}
-		 * class. This method must NOT be synchronized to avoid deadlock
-		 * potential.
+		 * {@code BundleListener} method for the {@code BundleTracker} class.
+		 * This method must NOT be synchronized to avoid deadlock potential.
 		 * 
 		 * @param event {@code BundleEvent} object from the framework.
 		 */
@@ -449,8 +436,7 @@
 			final Bundle bundle = event.getBundle();
 			final int state = bundle.getState();
 			if (DEBUG) {
-				System.out
-						.println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle); //$NON-NLS-1$ //$NON-NLS-2$
+				System.out.println("BundleTracker.Tracked.bundleChanged[" + state + "]: " + bundle); //$NON-NLS-1$ //$NON-NLS-2$
 			}
 
 			if ((state & mask) != 0) {
@@ -459,8 +445,7 @@
 				 * If the customizer throws an unchecked exception, it is safe
 				 * to let it propagate
 				 */
-			}
-			else {
+			} else {
 				untrack(bundle, event);
 				/*
 				 * If the customizer throws an unchecked exception, it is safe
@@ -475,8 +460,8 @@
 		 * 
 		 * @param item Item to be tracked.
 		 * @param related Action related object.
-		 * @return Customized object for the tracked item or {@code null}
-		 *         if the item is not to be tracked.
+		 * @return Customized object for the tracked item or {@code null} if the
+		 *         item is not to be tracked.
 		 */
 		T customizerAdding(final Bundle item, final BundleEvent related) {
 			return customizer.addingBundle(item, related);
@@ -490,8 +475,7 @@
 		 * @param related Action related object.
 		 * @param object Customized object for the tracked item.
 		 */
-		void customizerModified(final Bundle item, final BundleEvent related,
-				final T object) {
+		void customizerModified(final Bundle item, final BundleEvent related, final T object) {
 			customizer.modifiedBundle(item, related, object);
 		}
 
@@ -503,8 +487,7 @@
 		 * @param related Action related object.
 		 * @param object Customized object for the tracked item.
 		 */
-		void customizerRemoved(final Bundle item, final BundleEvent related,
-				final T object) {
+		void customizerRemoved(final Bundle item, final BundleEvent related, final T object) {
 			customizer.removedBundle(item, related, object);
 		}
 	}
diff --git a/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java b/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
index a7c9a23..b0bb297 100644
--- a/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
+++ b/framework/src/main/java/org/osgi/util/tracker/BundleTrackerCustomizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2007, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2007, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,32 +20,29 @@
 import org.osgi.framework.BundleEvent;
 
 /**
- * The {@code BundleTrackerCustomizer} interface allows a
- * {@code BundleTracker} to customize the {@code Bundle}s that are
- * tracked. A {@code BundleTrackerCustomizer} is called when a bundle is
- * being added to a {@code BundleTracker}. The
- * {@code BundleTrackerCustomizer} can then return an object for the
- * tracked bundle. A {@code BundleTrackerCustomizer} is also called when a
- * tracked bundle is modified or has been removed from a
+ * The {@code BundleTrackerCustomizer} interface allows a {@code BundleTracker}
+ * to customize the {@code Bundle}s that are tracked. A
+ * {@code BundleTrackerCustomizer} is called when a bundle is being added to a
+ * {@code BundleTracker}. The {@code BundleTrackerCustomizer} can then return an
+ * object for the tracked bundle. A {@code BundleTrackerCustomizer} is also
+ * called when a tracked bundle is modified or has been removed from a
  * {@code BundleTracker}.
  * 
  * <p>
  * The methods in this interface may be called as the result of a
- * {@code BundleEvent} being received by a {@code BundleTracker}.
- * Since {@code BundleEvent}s are received synchronously by the
- * {@code BundleTracker}, it is highly recommended that implementations of
- * these methods do not alter bundle states while being synchronized on any
- * object.
+ * {@code BundleEvent} being received by a {@code BundleTracker}. Since
+ * {@code BundleEvent}s are received synchronously by the {@code BundleTracker},
+ * it is highly recommended that implementations of these methods do not alter
+ * bundle states while being synchronized on any object.
  * 
  * <p>
  * The {@code BundleTracker} class is thread-safe. It does not call a
  * {@code BundleTrackerCustomizer} while holding any locks.
- * {@code BundleTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code BundleTrackerCustomizer} implementations must also be thread-safe.
  * 
  * @param <T> The type of the tracked object.
  * @ThreadSafe
- * @version $Id: 0e80f2555530b217faef57726a5938f0087a45c5 $
+ * @version $Id: 727e757d2fa2940c88c9b74c8d299de6b3a7d0d0 $
  * @since 1.4
  */
 public interface BundleTrackerCustomizer<T> {
@@ -54,20 +51,20 @@
 	 * 
 	 * <p>
 	 * This method is called before a bundle which matched the search parameters
-	 * of the {@code BundleTracker} is added to the
-	 * {@code BundleTracker}. This method should return the object to be
-	 * tracked for the specified {@code Bundle}. The returned object is
-	 * stored in the {@code BundleTracker} and is available from the
+	 * of the {@code BundleTracker} is added to the {@code BundleTracker}. This
+	 * method should return the object to be tracked for the specified
+	 * {@code Bundle}. The returned object is stored in the
+	 * {@code BundleTracker} and is available from the
 	 * {@link BundleTracker#getObject(Bundle) getObject} method.
 	 * 
-	 * @param bundle The {@code Bundle} being added to the
-	 *        {@code BundleTracker}.
+	 * @param bundle The {@code Bundle} being added to the {@code BundleTracker}
+	 *        .
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
-	 * @return The object to be tracked for the specified {@code Bundle}
-	 *         object or {@code null} if the specified {@code Bundle}
-	 *         object should not be tracked.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
+	 * @return The object to be tracked for the specified {@code Bundle} object
+	 *         or {@code null} if the specified {@code Bundle} object should not
+	 *         be tracked.
 	 */
 	public T addingBundle(Bundle bundle, BundleEvent event);
 
@@ -80,12 +77,11 @@
 	 * 
 	 * @param bundle The {@code Bundle} whose state has been modified.
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
 	 * @param object The tracked object for the specified bundle.
 	 */
-	public void modifiedBundle(Bundle bundle, BundleEvent event,
-			T object);
+	public void modifiedBundle(Bundle bundle, BundleEvent event, T object);
 
 	/**
 	 * A bundle tracked by the {@code BundleTracker} has been removed.
@@ -96,10 +92,9 @@
 	 * 
 	 * @param bundle The {@code Bundle} that has been removed.
 	 * @param event The bundle event which caused this customizer method to be
-	 *        called or {@code null} if there is no bundle event associated
-	 *        with the call to this method.
+	 *        called or {@code null} if there is no bundle event associated with
+	 *        the call to this method.
 	 * @param object The tracked object for the specified bundle.
 	 */
-	public void removedBundle(Bundle bundle, BundleEvent event,
-			T object);
+	public void removedBundle(Bundle bundle, BundleEvent event, T object);
 }
diff --git a/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java b/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
index f5cd086..0c8022d 100644
--- a/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
+++ b/framework/src/main/java/org/osgi/util/tracker/ServiceTracker.java
@@ -1,6 +1,6 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
- * 
+ * Copyright (c) OSGi Alliance (2000, 2012). 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
@@ -20,7 +20,6 @@
 import java.util.Collections;
 import java.util.SortedMap;
 import java.util.TreeMap;
-
 import org.osgi.framework.AllServiceListener;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.Constants;
@@ -34,29 +33,26 @@
  * The {@code ServiceTracker} class simplifies using services from the
  * Framework's service registry.
  * <p>
- * A {@code ServiceTracker} object is constructed with search criteria and
- * a {@code ServiceTrackerCustomizer} object. A {@code ServiceTracker}
- * can use a {@code ServiceTrackerCustomizer} to customize the service
- * objects to be tracked. The {@code ServiceTracker} can then be opened to
- * begin tracking all services in the Framework's service registry that match
- * the specified search criteria. The {@code ServiceTracker} correctly
- * handles all of the details of listening to {@code ServiceEvent}s and
- * getting and ungetting services.
+ * A {@code ServiceTracker} object is constructed with search criteria and a
+ * {@code ServiceTrackerCustomizer} object. A {@code ServiceTracker} can use a
+ * {@code ServiceTrackerCustomizer} to customize the service objects to be
+ * tracked. The {@code ServiceTracker} can then be opened to begin tracking all
+ * services in the Framework's service registry that match the specified search
+ * criteria. The {@code ServiceTracker} correctly handles all of the details of
+ * listening to {@code ServiceEvent}s and getting and ungetting services.
  * <p>
- * The {@code getServiceReferences} method can be called to get references
- * to the services being tracked. The {@code getService} and
- * {@code getServices} methods can be called to get the service objects for
- * the tracked service.
+ * The {@code getServiceReferences} method can be called to get references to
+ * the services being tracked. The {@code getService} and {@code getServices}
+ * methods can be called to get the service objects for the tracked service.
  * <p>
  * The {@code ServiceTracker} class is thread-safe. It does not call a
  * {@code ServiceTrackerCustomizer} while holding any locks.
- * {@code ServiceTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code ServiceTrackerCustomizer} implementations must also be thread-safe.
  * 
  * @param <S> The type of the service being tracked.
  * @param <T> The type of the tracked object.
  * @ThreadSafe
- * @version $Id: df62459c90f49d06e89ff8f20915a9eec401217e $
+ * @version $Id: 21926ad8717a91633face6bbf570febfcd23b1c7 $
  */
 public class ServiceTracker<S, T> implements ServiceTrackerCustomizer<S, T> {
 	/* set this to true to compile in debug messages */
@@ -66,8 +62,8 @@
 	 */
 	protected final BundleContext			context;
 	/**
-	 * The Filter used by this {@code ServiceTracker} which specifies the
-	 * search criteria for the services to track.
+	 * The Filter used by this {@code ServiceTracker} which specifies the search
+	 * criteria for the services to track.
 	 * 
 	 * @since 1.1
 	 */
@@ -123,44 +119,38 @@
 	private volatile T						cachedService;
 
 	/**
-	 * Create a {@code ServiceTracker} on the specified
-	 * {@code ServiceReference}.
+	 * Create a {@code ServiceTracker} on the specified {@code ServiceReference}
+	 * .
 	 * 
 	 * <p>
-	 * The service referenced by the specified {@code ServiceReference}
-	 * will be tracked by this {@code ServiceTracker}.
+	 * The service referenced by the specified {@code ServiceReference} will be
+	 * tracked by this {@code ServiceTracker}.
 	 * 
-	 * @param context The {@code BundleContext} against which the tracking
-	 *        is done.
+	 * @param context The {@code BundleContext} against which the tracking is
+	 *        done.
 	 * @param reference The {@code ServiceReference} for the service to be
 	 *        tracked.
 	 * @param customizer The customizer object to call when services are added,
-	 *        modified, or removed in this {@code ServiceTracker}. If
-	 *        customizer is {@code null}, then this
-	 *        {@code ServiceTracker} will be used as the
-	 *        {@code ServiceTrackerCustomizer} and this
+	 *        modified, or removed in this {@code ServiceTracker}. If customizer
+	 *        is {@code null}, then this {@code ServiceTracker} will be used as
+	 *        the {@code ServiceTrackerCustomizer} and this
 	 *        {@code ServiceTracker} will call the
 	 *        {@code ServiceTrackerCustomizer} methods on itself.
 	 */
-	public ServiceTracker(final BundleContext context,
-			final ServiceReference<S> reference,
-			final ServiceTrackerCustomizer<S, T> customizer) {
+	public ServiceTracker(final BundleContext context, final ServiceReference<S> reference, final ServiceTrackerCustomizer<S, T> customizer) {
 		this.context = context;
 		this.trackReference = reference;
 		this.trackClass = null;
 		this.customizer = (customizer == null) ? this : customizer;
-		this.listenerFilter = "(" + Constants.SERVICE_ID + "="
-				+ reference.getProperty(Constants.SERVICE_ID).toString() + ")";
+		this.listenerFilter = "(" + Constants.SERVICE_ID + "=" + reference.getProperty(Constants.SERVICE_ID).toString() + ")";
 		try {
 			this.filter = context.createFilter(listenerFilter);
-		}
-		catch (InvalidSyntaxException e) {
+		} catch (InvalidSyntaxException e) {
 			/*
 			 * we could only get this exception if the ServiceReference was
 			 * invalid
 			 */
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"unexpected InvalidSyntaxException: " + e.getMessage());
+			IllegalArgumentException iae = new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage());
 			iae.initCause(e);
 			throw iae;
 		}
@@ -173,63 +163,54 @@
 	 * Services registered under the specified class name will be tracked by
 	 * this {@code ServiceTracker}.
 	 * 
-	 * @param context The {@code BundleContext} against which the tracking
-	 *        is done.
+	 * @param context The {@code BundleContext} against which the tracking is
+	 *        done.
 	 * @param clazz The class name of the services to be tracked.
 	 * @param customizer The customizer object to call when services are added,
-	 *        modified, or removed in this {@code ServiceTracker}. If
-	 *        customizer is {@code null}, then this
-	 *        {@code ServiceTracker} will be used as the
-	 *        {@code ServiceTrackerCustomizer} and this
+	 *        modified, or removed in this {@code ServiceTracker}. If customizer
+	 *        is {@code null}, then this {@code ServiceTracker} will be used as
+	 *        the {@code ServiceTrackerCustomizer} and this
 	 *        {@code ServiceTracker} will call the
 	 *        {@code ServiceTrackerCustomizer} methods on itself.
 	 */
-	public ServiceTracker(final BundleContext context, final String clazz,
-			final ServiceTrackerCustomizer<S, T> customizer) {
+	public ServiceTracker(final BundleContext context, final String clazz, final ServiceTrackerCustomizer<S, T> customizer) {
 		this.context = context;
 		this.trackReference = null;
 		this.trackClass = clazz;
 		this.customizer = (customizer == null) ? this : customizer;
 		// we call clazz.toString to verify clazz is non-null!
-		this.listenerFilter = "(" + Constants.OBJECTCLASS + "="
-				+ clazz.toString() + ")";
+		this.listenerFilter = "(" + Constants.OBJECTCLASS + "=" + clazz.toString() + ")";
 		try {
 			this.filter = context.createFilter(listenerFilter);
-		}
-		catch (InvalidSyntaxException e) {
+		} catch (InvalidSyntaxException e) {
 			/*
 			 * we could only get this exception if the clazz argument was
 			 * malformed
 			 */
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"unexpected InvalidSyntaxException: " + e.getMessage());
+			IllegalArgumentException iae = new IllegalArgumentException("unexpected InvalidSyntaxException: " + e.getMessage());
 			iae.initCause(e);
 			throw iae;
 		}
 	}
 
 	/**
-	 * Create a {@code ServiceTracker} on the specified {@code Filter}
-	 * object.
+	 * Create a {@code ServiceTracker} on the specified {@code Filter} object.
 	 * 
 	 * <p>
-	 * Services which match the specified {@code Filter} object will be
-	 * tracked by this {@code ServiceTracker}.
+	 * Services which match the specified {@code Filter} object will be tracked
+	 * by this {@code ServiceTracker}.
 	 * 
-	 * @param context The {@code BundleContext} against which the tracking
-	 *        is done.
-	 * @param filter The {@code Filter} to select the services to be
-	 *        tracked.
+	 * @param context The {@code BundleContext} against which the tracking is
+	 *        done.
+	 * @param filter The {@code Filter} to select the services to be tracked.
 	 * @param customizer The customizer object to call when services are added,
-	 *        modified, or removed in this {@code ServiceTracker}. If
-	 *        customizer is null, then this {@code ServiceTracker} will be
-	 *        used as the {@code ServiceTrackerCustomizer} and this
-	 *        {@code ServiceTracker} will call the
-	 *        {@code ServiceTrackerCustomizer} methods on itself.
+	 *        modified, or removed in this {@code ServiceTracker}. If customizer
+	 *        is null, then this {@code ServiceTracker} will be used as the
+	 *        {@code ServiceTrackerCustomizer} and this {@code ServiceTracker}
+	 *        will call the {@code ServiceTrackerCustomizer} methods on itself.
 	 * @since 1.1
 	 */
-	public ServiceTracker(final BundleContext context, final Filter filter,
-			final ServiceTrackerCustomizer<S, T> customizer) {
+	public ServiceTracker(final BundleContext context, final Filter filter, final ServiceTrackerCustomizer<S, T> customizer) {
 		this.context = context;
 		this.trackReference = null;
 		this.trackClass = null;
@@ -251,20 +232,18 @@
 	 * Services registered under the name of the specified class will be tracked
 	 * by this {@code ServiceTracker}.
 	 * 
-	 * @param context The {@code BundleContext} against which the tracking
-	 *        is done.
+	 * @param context The {@code BundleContext} against which the tracking is
+	 *        done.
 	 * @param clazz The class of the services to be tracked.
 	 * @param customizer The customizer object to call when services are added,
-	 *        modified, or removed in this {@code ServiceTracker}. If
-	 *        customizer is {@code null}, then this
-	 *        {@code ServiceTracker} will be used as the
-	 *        {@code ServiceTrackerCustomizer} and this
+	 *        modified, or removed in this {@code ServiceTracker}. If customizer
+	 *        is {@code null}, then this {@code ServiceTracker} will be used as
+	 *        the {@code ServiceTrackerCustomizer} and this
 	 *        {@code ServiceTracker} will call the
 	 *        {@code ServiceTrackerCustomizer} methods on itself.
 	 * @since 1.5
 	 */
-	public ServiceTracker(final BundleContext context, final Class<S> clazz,
-			final ServiceTrackerCustomizer<S, T> customizer) {
+	public ServiceTracker(final BundleContext context, final Class<S> clazz, final ServiceTrackerCustomizer<S, T> customizer) {
 		this(context, clazz.getName(), customizer);
 	}
 
@@ -274,9 +253,8 @@
 	 * <p>
 	 * This implementation calls {@code open(false)}.
 	 * 
-	 * @throws java.lang.IllegalStateException If the {@code BundleContext}
-	 *         with which this {@code ServiceTracker} was created is no
-	 *         longer valid.
+	 * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+	 *         which this {@code ServiceTracker} was created is no longer valid.
 	 * @see #open(boolean)
 	 */
 	public void open() {
@@ -291,16 +269,14 @@
 	 * {@code ServiceTracker} was created are now tracked by this
 	 * {@code ServiceTracker}.
 	 * 
-	 * @param trackAllServices If {@code true}, then this
-	 *        {@code ServiceTracker} will track all matching services
-	 *        regardless of class loader accessibility. If {@code false},
-	 *        then this {@code ServiceTracker} will only track matching
-	 *        services which are class loader accessible to the bundle whose
-	 *        {@code BundleContext} is used by this
-	 *        {@code ServiceTracker}.
-	 * @throws java.lang.IllegalStateException If the {@code BundleContext}
-	 *         with which this {@code ServiceTracker} was created is no
-	 *         longer valid.
+	 * @param trackAllServices If {@code true}, then this {@code ServiceTracker}
+	 *        will track all matching services regardless of class loader
+	 *        accessibility. If {@code false}, then this {@code ServiceTracker}
+	 *        will only track matching services which are class loader
+	 *        accessible to the bundle whose {@code BundleContext} is used by
+	 *        this {@code ServiceTracker}.
+	 * @throws java.lang.IllegalStateException If the {@code BundleContext} with
+	 *         which this {@code ServiceTracker} was created is no longer valid.
 	 * @since 1.3
 	 */
 	public void open(boolean trackAllServices) {
@@ -318,28 +294,21 @@
 					context.addServiceListener(t, listenerFilter);
 					ServiceReference<S>[] references = null;
 					if (trackClass != null) {
-						references = getInitialReferences(trackAllServices,
-								trackClass, null);
-					}
-					else {
+						references = getInitialReferences(trackAllServices, trackClass, null);
+					} else {
 						if (trackReference != null) {
 							if (trackReference.getBundle() != null) {
 								ServiceReference<S>[] single = new ServiceReference[] {trackReference};
 								references = single;
 							}
-						}
-						else { /* user supplied filter */
-							references = getInitialReferences(trackAllServices,
-									null, listenerFilter);
+						} else { /* user supplied filter */
+							references = getInitialReferences(trackAllServices, null, listenerFilter);
 						}
 					}
 					/* set tracked with the initial references */
 					t.setInitial(references);
-				}
-				catch (InvalidSyntaxException e) {
-					throw new RuntimeException(
-							"unexpected InvalidSyntaxException: "
-									+ e.getMessage(), e);
+				} catch (InvalidSyntaxException e) {
+					throw new RuntimeException("unexpected InvalidSyntaxException: " + e.getMessage(), e);
 				}
 			}
 			tracked = t;
@@ -356,18 +325,13 @@
 	 *        {@code getAllServiceReferences}.
 	 * @param className The class name with which the service was registered, or
 	 *        {@code null} for all services.
-	 * @param filterString The filter criteria or {@code null} for all
-	 *        services.
+	 * @param filterString The filter criteria or {@code null} for all services.
 	 * @return The list of initial {@code ServiceReference}s.
 	 * @throws InvalidSyntaxException If the specified filterString has an
 	 *         invalid syntax.
 	 */
-	private ServiceReference<S>[] getInitialReferences(
-			boolean trackAllServices, String className, String filterString)
-			throws InvalidSyntaxException {
-		ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context
-				.getAllServiceReferences(className, filterString)
-				: context.getServiceReferences(className, filterString));
+	private ServiceReference<S>[] getInitialReferences(boolean trackAllServices, String className, String filterString) throws InvalidSyntaxException {
+		ServiceReference<S>[] result = (ServiceReference<S>[]) ((trackAllServices) ? context.getAllServiceReferences(className, filterString) : context.getServiceReferences(className, filterString));
 		return result;
 	}
 
@@ -375,8 +339,8 @@
 	 * Close this {@code ServiceTracker}.
 	 * 
 	 * <p>
-	 * This method should be called when this {@code ServiceTracker} should
-	 * end the tracking of services.
+	 * This method should be called when this {@code ServiceTracker} should end
+	 * the tracking of services.
 	 * 
 	 * <p>
 	 * This implementation calls {@link #getServiceReferences()} to get the list
@@ -398,8 +362,7 @@
 			tracked = null;
 			try {
 				context.removeServiceListener(outgoing);
-			}
-			catch (IllegalStateException e) {
+			} catch (IllegalStateException e) {
 				/* In case the context was stopped. */
 			}
 		}
@@ -414,8 +377,7 @@
 		}
 		if (DEBUG) {
 			if ((cachedReference == null) && (cachedService == null)) {
-				System.out.println("ServiceTracker.close[cached cleared]: "
-						+ filter);
+				System.out.println("ServiceTracker.close[cached cleared]: " + filter);
 			}
 		}
 	}
@@ -429,10 +391,9 @@
 	 * constructed with a {@code null ServiceTrackerCustomizer} argument.
 	 * 
 	 * <p>
-	 * This implementation returns the result of calling {@code getService}
-	 * on the {@code BundleContext} with which this
-	 * {@code ServiceTracker} was created passing the specified
-	 * {@code ServiceReference}.
+	 * This implementation returns the result of calling {@code getService} on
+	 * the {@code BundleContext} with which this {@code ServiceTracker} was
+	 * created passing the specified {@code ServiceReference}.
 	 * <p>
 	 * This method can be overridden in a subclass to customize the service
 	 * object to be tracked for the service being added. In that case, take care
@@ -480,8 +441,8 @@
 	 * 
 	 * <p>
 	 * This implementation calls {@code ungetService}, on the
-	 * {@code BundleContext} with which this {@code ServiceTracker}
-	 * was created, passing the specified {@code ServiceReference}.
+	 * {@code BundleContext} with which this {@code ServiceTracker} was created,
+	 * passing the specified {@code ServiceReference}.
 	 * <p>
 	 * This method can be overridden in a subclass. If the default
 	 * implementation of {@link #addingService(ServiceReference) addingService}
@@ -501,8 +462,8 @@
 	 * {@code ServiceTracker} is closed.
 	 * 
 	 * <p>
-	 * It is strongly recommended that {@code waitForService} is not used
-	 * during the calling of the {@code BundleActivator} methods.
+	 * It is strongly recommended that {@code waitForService} is not used during
+	 * the calling of the {@code BundleActivator} methods.
 	 * {@code BundleActivator} methods are expected to complete in a short
 	 * period of time.
 	 * 
@@ -521,8 +482,14 @@
 		if (timeout < 0) {
 			throw new IllegalArgumentException("timeout value is negative");
 		}
+
 		T object = getService();
-		while (object == null) {
+		if (object != null) {
+			return object;
+		}
+
+		final long endTime = (timeout == 0) ? 0 : (System.currentTimeMillis() + timeout);
+		do {
 			final Tracked t = tracked();
 			if (t == null) { /* if ServiceTracker is not open */
 				return null;
@@ -533,10 +500,13 @@
 				}
 			}
 			object = getService();
-			if (timeout > 0) {
-				return object;
+			if (endTime > 0) { // if we have a timeout
+				timeout = endTime - System.currentTimeMillis();
+				if (timeout <= 0) { // that has expired
+					break;
+				}
 			}
-		}
+		} while (object == null);
 		return object;
 	}
 
@@ -544,8 +514,8 @@
 	 * Return an array of {@code ServiceReference}s for all services being
 	 * tracked by this {@code ServiceTracker}.
 	 * 
-	 * @return Array of {@code ServiceReference}s or {@code null} if
-	 *         no services are being tracked.
+	 * @return Array of {@code ServiceReference}s or {@code null} if no services
+	 *         are being tracked.
 	 */
 	public ServiceReference<S>[] getServiceReferences() {
 		final Tracked t = tracked();
@@ -563,32 +533,30 @@
 	}
 
 	/**
-	 * Returns a {@code ServiceReference} for one of the services being
-	 * tracked by this {@code ServiceTracker}.
+	 * Returns a {@code ServiceReference} for one of the services being tracked
+	 * by this {@code ServiceTracker}.
 	 * 
 	 * <p>
 	 * If multiple services are being tracked, the service with the highest
 	 * ranking (as specified in its {@code service.ranking} property) is
 	 * returned. If there is a tie in ranking, the service with the lowest
-	 * service ID (as specified in its {@code service.id} property); that
-	 * is, the service that was registered first is returned. This is the same
+	 * service ID (as specified in its {@code service.id} property); that is,
+	 * the service that was registered first is returned. This is the same
 	 * algorithm used by {@code BundleContext.getServiceReference}.
 	 * 
 	 * <p>
 	 * This implementation calls {@link #getServiceReferences()} to get the list
 	 * of references for the tracked services.
 	 * 
-	 * @return A {@code ServiceReference} or {@code null} if no
-	 *         services are being tracked.
+	 * @return A {@code ServiceReference} or {@code null} if no services are
+	 *         being tracked.
 	 * @since 1.1
 	 */
 	public ServiceReference<S> getServiceReference() {
 		ServiceReference<S> reference = cachedReference;
 		if (reference != null) {
 			if (DEBUG) {
-				System.out
-						.println("ServiceTracker.getServiceReference[cached]: "
-								+ filter);
+				System.out.println("ServiceTracker.getServiceReference[cached]: " + filter);
 			}
 			return reference;
 		}
@@ -606,18 +574,14 @@
 			int count = 0;
 			int maxRanking = Integer.MIN_VALUE;
 			for (int i = 0; i < length; i++) {
-				Object property = references[i]
-						.getProperty(Constants.SERVICE_RANKING);
-				int ranking = (property instanceof Integer) ? ((Integer) property)
-						.intValue()
-						: 0;
+				Object property = references[i].getProperty(Constants.SERVICE_RANKING);
+				int ranking = (property instanceof Integer) ? ((Integer) property).intValue() : 0;
 				rankings[i] = ranking;
 				if (ranking > maxRanking) {
 					index = i;
 					maxRanking = ranking;
 					count = 1;
-				}
-				else {
+				} else {
 					if (ranking == maxRanking) {
 						count++;
 					}
@@ -627,9 +591,7 @@
 				long minId = Long.MAX_VALUE;
 				for (int i = 0; i < length; i++) {
 					if (rankings[i] == maxRanking) {
-						long id = ((Long) (references[i]
-								.getProperty(Constants.SERVICE_ID)))
-								.longValue();
+						long id = ((Long) (references[i].getProperty(Constants.SERVICE_ID))).longValue();
 						if (id < minId) {
 							index = i;
 							minId = id;
@@ -642,14 +604,13 @@
 	}
 
 	/**
-	 * Returns the service object for the specified
-	 * {@code ServiceReference} if the specified referenced service is
-	 * being tracked by this {@code ServiceTracker}.
+	 * Returns the service object for the specified {@code ServiceReference} if
+	 * the specified referenced service is being tracked by this
+	 * {@code ServiceTracker}.
 	 * 
 	 * @param reference The reference to the desired service.
-	 * @return A service object or {@code null} if the service referenced
-	 *         by the specified {@code ServiceReference} is not being
-	 *         tracked.
+	 * @return A service object or {@code null} if the service referenced by the
+	 *         specified {@code ServiceReference} is not being tracked.
 	 */
 	public T getService(ServiceReference<S> reference) {
 		final Tracked t = tracked();
@@ -671,8 +632,8 @@
 	 * {@link #getService(ServiceReference)} for each reference to get the
 	 * tracked service object.
 	 * 
-	 * @return An array of service objects or {@code null} if no services
-	 *         are being tracked.
+	 * @return An array of service objects or {@code null} if no services are
+	 *         being tracked.
 	 */
 	public Object[] getServices() {
 		final Tracked t = tracked();
@@ -708,8 +669,7 @@
 		T service = cachedService;
 		if (service != null) {
 			if (DEBUG) {
-				System.out.println("ServiceTracker.getService[cached]: "
-						+ filter);
+				System.out.println("ServiceTracker.getService[cached]: " + filter);
 			}
 			return service;
 		}
@@ -726,10 +686,10 @@
 	/**
 	 * Remove a service from this {@code ServiceTracker}.
 	 * 
-	 * The specified service will be removed from this
-	 * {@code ServiceTracker}. If the specified service was being tracked
-	 * then the {@code ServiceTrackerCustomizer.removedService} method will
-	 * be called for that service.
+	 * The specified service will be removed from this {@code ServiceTracker}.
+	 * If the specified service was being tracked then the
+	 * {@code ServiceTrackerCustomizer.removedService} method will be called for
+	 * that service.
 	 * 
 	 * @param reference The reference to the service to be removed.
 	 */
@@ -804,21 +764,20 @@
 	}
 
 	/**
-	 * Return a {@code SortedMap} of the {@code ServiceReference}s and
-	 * service objects for all services being tracked by this
-	 * {@code ServiceTracker}. The map is sorted in reverse natural order
-	 * of {@code ServiceReference}. That is, the first entry is the service
-	 * with the highest ranking and the lowest service id.
+	 * Return a {@code SortedMap} of the {@code ServiceReference}s and service
+	 * objects for all services being tracked by this {@code ServiceTracker}.
+	 * The map is sorted in reverse natural order of {@code ServiceReference}.
+	 * That is, the first entry is the service with the highest ranking and the
+	 * lowest service id.
 	 * 
-	 * @return A {@code SortedMap} with the {@code ServiceReference}s
-	 *         and service objects for all services being tracked by this
-	 *         {@code ServiceTracker}. If no services are being tracked,
-	 *         then the returned map is empty.
+	 * @return A {@code SortedMap} with the {@code ServiceReference}s and
+	 *         service objects for all services being tracked by this
+	 *         {@code ServiceTracker}. If no services are being tracked, then
+	 *         the returned map is empty.
 	 * @since 1.5
 	 */
 	public SortedMap<ServiceReference<S>, T> getTracked() {
-		SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(
-				Collections.reverseOrder());
+		SortedMap<ServiceReference<S>, T> map = new TreeMap<ServiceReference<S>, T>(Collections.reverseOrder());
 		final Tracked t = tracked();
 		if (t == null) { /* if ServiceTracker is not open */
 			return map;
@@ -884,8 +843,7 @@
 				return array;
 			}
 			if (length > array.length) {
-				array = (T[]) Array.newInstance(array.getClass()
-						.getComponentType(), length);
+				array = (T[]) Array.newInstance(array.getClass().getComponentType(), length);
 			}
 			for (int i = 0; i < length; i++) {
 				array[i] = getService(references[i]);
@@ -903,9 +861,7 @@
 	 * 
 	 * @ThreadSafe
 	 */
-	private class Tracked extends
-			AbstractTracked<ServiceReference<S>, T, ServiceEvent>
-			implements ServiceListener {
+	private class Tracked extends AbstractTracked<ServiceReference<S>, T, ServiceEvent> implements ServiceListener {
 		/**
 		 * Tracked constructor.
 		 */
@@ -914,9 +870,8 @@
 		}
 
 		/**
-		 * {@code ServiceListener} method for the
-		 * {@code ServiceTracker} class. This method must NOT be
-		 * synchronized to avoid deadlock potential.
+		 * {@code ServiceListener} method for the {@code ServiceTracker} class.
+		 * This method must NOT be synchronized to avoid deadlock potential.
 		 * 
 		 * @param event {@code ServiceEvent} object from the framework.
 		 */
@@ -928,11 +883,9 @@
 			if (closed) {
 				return;
 			}
-			final ServiceReference<S> reference = (ServiceReference<S>) event
-					.getServiceReference();
+			final ServiceReference<S> reference = (ServiceReference<S>) event.getServiceReference();
 			if (DEBUG) {
-				System.out.println("ServiceTracker.Tracked.serviceChanged["
-						+ event.getType() + "]: " + reference);
+				System.out.println("ServiceTracker.Tracked.serviceChanged[" + event.getType() + "]: " + reference);
 			}
 
 			switch (event.getType()) {
@@ -972,11 +925,10 @@
 		 * 
 		 * @param item Item to be tracked.
 		 * @param related Action related object.
-		 * @return Customized object for the tracked item or {@code null}
-		 *         if the item is not to be tracked.
+		 * @return Customized object for the tracked item or {@code null} if the
+		 *         item is not to be tracked.
 		 */
-		final T customizerAdding(final ServiceReference<S> item,
-				final ServiceEvent related) {
+		final T customizerAdding(final ServiceReference<S> item, final ServiceEvent related) {
 			return customizer.addingService(item);
 		}
 
@@ -988,8 +940,7 @@
 		 * @param related Action related object.
 		 * @param object Customized object for the tracked item.
 		 */
-		final void customizerModified(final ServiceReference<S> item,
-				final ServiceEvent related, final T object) {
+		final void customizerModified(final ServiceReference<S> item, final ServiceEvent related, final T object) {
 			customizer.modifiedService(item, object);
 		}
 
@@ -1001,8 +952,7 @@
 		 * @param related Action related object.
 		 * @param object Customized object for the tracked item.
 		 */
-		final void customizerRemoved(final ServiceReference<S> item,
-				final ServiceEvent related, final T object) {
+		final void customizerRemoved(final ServiceReference<S> item, final ServiceEvent related, final T object) {
 			customizer.removedService(item, object);
 		}
 	}
diff --git a/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java b/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
index b2caddc..72bec7a 100644
--- a/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
+++ b/framework/src/main/java/org/osgi/util/tracker/ServiceTrackerCustomizer.java
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2012). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -20,34 +20,32 @@
 
 /**
  * The {@code ServiceTrackerCustomizer} interface allows a
- * {@code ServiceTracker} to customize the service objects that are
- * tracked. A {@code ServiceTrackerCustomizer} is called when a service is
- * being added to a {@code ServiceTracker}. The
- * {@code ServiceTrackerCustomizer} can then return an object for the
- * tracked service. A {@code ServiceTrackerCustomizer} is also called when
- * a tracked service is modified or has been removed from a
+ * {@code ServiceTracker} to customize the service objects that are tracked. A
+ * {@code ServiceTrackerCustomizer} is called when a service is being added to a
+ * {@code ServiceTracker}. The {@code ServiceTrackerCustomizer} can then return
+ * an object for the tracked service. A {@code ServiceTrackerCustomizer} is also
+ * called when a tracked service is modified or has been removed from a
  * {@code ServiceTracker}.
  * 
  * <p>
  * The methods in this interface may be called as the result of a
- * {@code ServiceEvent} being received by a {@code ServiceTracker}.
- * Since {@code ServiceEvent}s are synchronously delivered by the
- * Framework, it is highly recommended that implementations of these methods do
- * not register ({@code BundleContext.registerService}), modify (
+ * {@code ServiceEvent} being received by a {@code ServiceTracker}. Since
+ * {@code ServiceEvent}s are synchronously delivered by the Framework, it is
+ * highly recommended that implementations of these methods do not register (
+ * {@code BundleContext.registerService}), modify (
  * {@code ServiceRegistration.setProperties}) or unregister (
- * {@code ServiceRegistration.unregister}) a service while being
- * synchronized on any object.
+ * {@code ServiceRegistration.unregister}) a service while being synchronized on
+ * any object.
  * 
  * <p>
  * The {@code ServiceTracker} class is thread-safe. It does not call a
  * {@code ServiceTrackerCustomizer} while holding any locks.
- * {@code ServiceTrackerCustomizer} implementations must also be
- * thread-safe.
+ * {@code ServiceTrackerCustomizer} implementations must also be thread-safe.
  * 
  * @param <S> The type of the service being tracked.
  * @param <T> The type of the tracked object.
  * @ThreadSafe
- * @version $Id: c654a963336cee74762b8f54c8cef8d5774f8b4d $
+ * @version $Id: c14b8d47026b6bd4ba1f2db7bf7e755d00fc6f6a $
  */
 public interface ServiceTrackerCustomizer<S, T> {
 	/**
@@ -56,11 +54,10 @@
 	 * <p>
 	 * This method is called before a service which matched the search
 	 * parameters of the {@code ServiceTracker} is added to the
-	 * {@code ServiceTracker}. This method should return the service object
-	 * to be tracked for the specified {@code ServiceReference}. The
-	 * returned service object is stored in the {@code ServiceTracker} and
-	 * is available from the {@code getService} and
-	 * {@code getServices} methods.
+	 * {@code ServiceTracker}. This method should return the service object to
+	 * be tracked for the specified {@code ServiceReference}. The returned
+	 * service object is stored in the {@code ServiceTracker} and is available
+	 * from the {@code getService} and {@code getServices} methods.
 	 * 
 	 * @param reference The reference to the service being added to the
 	 *        {@code ServiceTracker}.
diff --git a/framework/src/main/resources/default.properties b/framework/src/main/resources/default.properties
index 9d3b179..0131c89 100644
--- a/framework/src/main/resources/default.properties
+++ b/framework/src/main/resources/default.properties
@@ -53,18 +53,20 @@
 ee-1.2=J2SE-1.2,JRE-1.1,JRE-1.0,OSGi/Minimum-1.1,OSGi/Minimum-1.0
 
 # Default packages exported by system bundle.
-org.osgi.framework.system.packages=org.osgi.framework; version=1.6.0, \
- org.osgi.framework.launch; version=1.0.0, \
- org.osgi.framework.wiring; version=1.0.0, \
- org.osgi.framework.startlevel; version=1.0.0, \
- org.osgi.framework.hooks.bundle; version=1.0.0, \
+org.osgi.framework.system.packages=org.osgi.framework; version=1.7.0, \
+ org.osgi.framework.hooks.bundle; version=1.1.0, \
  org.osgi.framework.hooks.resolver; version=1.0.0, \
  org.osgi.framework.hooks.service; version=1.1.0, \
  org.osgi.framework.hooks.weaving; version=1.0.0, \
+ org.osgi.framework.launch; version=1.1.0, \
+ org.osgi.framework.namespace; version=1.0.0, \
+ org.osgi.framework.startlevel; version=1.0.0, \
+ org.osgi.framework.wiring; version=1.1.0, \
+ org.osgi.resource; version=1.0.0, \
  org.osgi.service.packageadmin; version=1.2.0, \
  org.osgi.service.startlevel; version=1.1.0, \
  org.osgi.service.url; version=1.0.0, \
- org.osgi.util.tracker; version=1.5.0 \
+ org.osgi.util.tracker; version=1.5.1 \
  ${dollar}{jre-${dollar}{java.specification.version}}
 
 #
diff --git a/framework/src/main/resources/org/osgi/framework/hooks/bundle/packageinfo b/framework/src/main/resources/org/osgi/framework/hooks/bundle/packageinfo
index 7c8de03..3987f9c 100644
--- a/framework/src/main/resources/org/osgi/framework/hooks/bundle/packageinfo
+++ b/framework/src/main/resources/org/osgi/framework/hooks/bundle/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1
diff --git a/framework/src/main/resources/org/osgi/framework/launch/packageinfo b/framework/src/main/resources/org/osgi/framework/launch/packageinfo
index 7c8de03..3987f9c 100644
--- a/framework/src/main/resources/org/osgi/framework/launch/packageinfo
+++ b/framework/src/main/resources/org/osgi/framework/launch/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1
diff --git a/framework/src/main/resources/org/osgi/framework/namespace/packageinfo b/framework/src/main/resources/org/osgi/framework/namespace/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/resources/org/osgi/framework/namespace/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/resources/org/osgi/framework/packageinfo b/framework/src/main/resources/org/osgi/framework/packageinfo
index fec6063..5d21e63 100644
--- a/framework/src/main/resources/org/osgi/framework/packageinfo
+++ b/framework/src/main/resources/org/osgi/framework/packageinfo
@@ -1 +1 @@
-version 1.6
+version 1.7
diff --git a/framework/src/main/resources/org/osgi/framework/wiring/packageinfo b/framework/src/main/resources/org/osgi/framework/wiring/packageinfo
index 7c8de03..3987f9c 100644
--- a/framework/src/main/resources/org/osgi/framework/wiring/packageinfo
+++ b/framework/src/main/resources/org/osgi/framework/wiring/packageinfo
@@ -1 +1 @@
-version 1.0
+version 1.1
diff --git a/framework/src/main/resources/org/osgi/resource/packageinfo b/framework/src/main/resources/org/osgi/resource/packageinfo
new file mode 100644
index 0000000..7c8de03
--- /dev/null
+++ b/framework/src/main/resources/org/osgi/resource/packageinfo
@@ -0,0 +1 @@
+version 1.0
diff --git a/framework/src/main/resources/org/osgi/util/tracker/packageinfo b/framework/src/main/resources/org/osgi/util/tracker/packageinfo
index ccee95e..1213efd 100644
--- a/framework/src/main/resources/org/osgi/util/tracker/packageinfo
+++ b/framework/src/main/resources/org/osgi/util/tracker/packageinfo
@@ -1 +1 @@
-version 1.5
+version 1.5.1