You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pa...@apache.org on 2011/05/16 23:49:05 UTC

svn commit: r1103918 [12/12] - in /felix/trunk/framework: ./ src/main/java/org/apache/felix/framework/ src/main/java/org/apache/felix/framework/cache/ src/main/java/org/apache/felix/framework/capabilityset/ src/main/java/org/apache/felix/framework/reso...

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceFactory.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -21,73 +21,65 @@ package org.osgi.framework;
  * environment.
  * 
  * <p>
- * When registering a service, a {@code ServiceFactory} object can be used
- * instead of a service object, so that the bundle developer can gain control of
- * the specific service object granted to a bundle that is using the service.
+ * When registering a service, a <code>ServiceFactory</code> object can be
+ * used instead of a service object, so that the bundle developer can gain
+ * control of the specific service object granted to a bundle that is using the
+ * service.
  * 
  * <p>
- * When this happens, the {@code BundleContext.getService(ServiceReference)}
- * method calls the {@code ServiceFactory.getService} method to create a service
- * object specifically for the requesting bundle. The service object returned by
- * the {@code ServiceFactory} is cached by the Framework until the bundle
+ * When this happens, the
+ * <code>BundleContext.getService(ServiceReference)</code> method calls the
+ * <code>ServiceFactory.getService</code> method to create a service object
+ * specifically for the requesting bundle. The service object returned by the
+ * <code>ServiceFactory</code> is cached by the Framework until the bundle
  * releases its use of the service.
  * 
  * <p>
- * When the bundle's use count for the service is decremented to zero (including
- * the bundle stopping or the service being unregistered), the
- * {@code ServiceFactory.ungetService} method is called.
+ * When the bundle's use count for the service equals zero (including the bundle
+ * stopping or the service being unregistered), the
+ * <code>ServiceFactory.ungetService</code> method is called.
  * 
  * <p>
- * {@code ServiceFactory} objects are only used by the Framework and are not
- * made available to other bundles in the OSGi environment. The Framework may
- * concurrently call a {@code ServiceFactory}.
+ * <code>ServiceFactory</code> objects are only used by the Framework and are
+ * not made available to other bundles in the OSGi environment. The Framework
+ * may concurrently call a <code>ServiceFactory</code>.
  * 
- * @param <S> Type of Service
  * @see BundleContext#getService
  * @ThreadSafe
- * @version $Id: 94cd1a0127aaad9beb484f557342a8fbd0be2322 $
+ * @version $Revision: 5967 $
  */
 
-public interface ServiceFactory<S> {
+public interface ServiceFactory {
 	/**
 	 * Creates a new service object.
 	 * 
 	 * <p>
 	 * The Framework invokes this method the first time the specified
-	 * {@code bundle} requests a service object using the
-	 * {@code BundleContext.getService(ServiceReference)} method. The service
-	 * factory can then return a specific service object for each bundle.
+	 * <code>bundle</code> requests a service object using the
+	 * <code>BundleContext.getService(ServiceReference)</code> method. The
+	 * service factory can then return a specific service object for each
+	 * bundle.
 	 * 
 	 * <p>
-	 * The Framework must check that the returned service object is valid. If
-	 * the returned service object is {@code null} or is not an
-	 * {@code instanceof} all the classes named when the service was registered,
-	 * a framework event of type {@link FrameworkEvent#ERROR} is fired
-	 * containing a service exception of type
-	 * {@link ServiceException#FACTORY_ERROR} and {@code null} is returned to
-	 * the bundle. If this method throws an exception, a framework event of type
-	 * {@link FrameworkEvent#ERROR} is fired containing a service exception of
-	 * type {@link ServiceException#FACTORY_EXCEPTION} with the thrown exception
-	 * as the cause and {@code null} is returned to the bundle. If this method
-	 * is recursively called for the specified bundle, a framework event of type
-	 * {@link FrameworkEvent#ERROR} is fired containing a service exception of
-	 * type {@link ServiceException#FACTORY_RECURSION} and {@code null} is
-	 * returned to the bundle.
+	 * The Framework caches the value returned (unless it is <code>null</code>),
+	 * and will return the same service object on any future call to
+	 * <code>BundleContext.getService</code> for the same bundle. This means the
+	 * Framework must not allow this method to be concurrently called for the
+	 * same bundle.
 	 * 
 	 * <p>
-	 * The Framework caches the valid service object and will return the same
-	 * service object on any future call to {@code BundleContext.getService} for
-	 * the specified bundle. This means the Framework must not allow this method
-	 * to be concurrently called for the specified bundle.
-	 * 
-	 * @param bundle The bundle requesting the service.
-	 * @param registration The {@code ServiceRegistration} object for the
-	 *        requested service.
+	 * The Framework will check if the returned service object is an instance of
+	 * all the classes named when the service was registered. If not, then
+	 * <code>null</code> is returned to the bundle.
+	 * 
+	 * @param bundle The bundle using the service.
+	 * @param registration The <code>ServiceRegistration</code> object for the
+	 *        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
 	 */
-	public S getService(Bundle bundle, ServiceRegistration<S> registration);
+	public Object getService(Bundle bundle, ServiceRegistration registration);
 
 	/**
 	 * Releases a service object.
@@ -96,20 +88,13 @@ public interface ServiceFactory<S> {
 	 * The Framework invokes this method when a service has been released by a
 	 * bundle. The service object may then be destroyed.
 	 * 
-	 * <p>
-	 * If this method throws an exception, a framework event of type
-	 * {@link FrameworkEvent#ERROR} is fired containing a service exception of
-	 * type {@link ServiceException#FACTORY_EXCEPTION} with the thrown exception
-	 * as the cause.
-	 * 
 	 * @param bundle The bundle releasing the service.
-	 * @param registration The {@code ServiceRegistration} object for the
-	 *        service being released.
+	 * @param registration The <code>ServiceRegistration</code> object for the
+	 *        service.
 	 * @param service The service object returned by a previous call to the
-	 *        {@link #getService(Bundle, ServiceRegistration) getService}
-	 *        method.
+	 *        <code>ServiceFactory.getService</code> method.
 	 * @see BundleContext#ungetService
 	 */
-	public void ungetService(Bundle bundle, ServiceRegistration<S> registration,
-			S service);
+	public void ungetService(Bundle bundle, ServiceRegistration registration,
+			Object service);
 }

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceListener.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -19,46 +19,46 @@ package org.osgi.framework;
 import java.util.EventListener;
 
 /**
- * A {@code ServiceEvent} listener. {@code ServiceListener} is a
+ * A <code>ServiceEvent</code> listener. <code>ServiceListener</code> 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
+ * <code>ServiceEvent</code> is fired, it is synchronously delivered to a
+ * <code>ServiceListener</code>. The Framework may deliver
+ * <code>ServiceEvent</code> objects to a <code>ServiceListener</code> out
  * of order and may concurrently call and/or reenter a
- * {@code ServiceListener}.
+ * <code>ServiceListener</code>.
  * 
  * <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
+ * A <code>ServiceListener</code> object is registered with the Framework
+ * using the <code>BundleContext.addServiceListener</code> method.
+ * <code>ServiceListener</code> objects are called with a
+ * <code>ServiceEvent</code> object when a service is registered, modified, or
  * is in the process of unregistering.
  * 
  * <p>
- * {@code ServiceEvent} object delivery to {@code ServiceListener}
+ * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
  * 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
+ * filtering is done. <code>ServiceEvent</code> 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
+ * appropriate <code>ServicePermission</code> 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}
+ * <code>ServiceEvent</code> object delivery to <code>ServiceListener</code>
  * 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 $Revision: 5673 $
  */
 
 public interface ServiceListener extends EventListener {
 	/**
 	 * Receives notification that a service has had a lifecycle change.
 	 * 
-	 * @param event The {@code ServiceEvent} object.
+	 * @param event The <code>ServiceEvent</code> object.
 	 */
 	public void serviceChanged(ServiceEvent event);
 }

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServicePermission.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -26,43 +26,42 @@ import java.security.BasicPermission;
 import java.security.Permission;
 import java.security.PermissionCollection;
 import java.security.PrivilegedAction;
-import java.util.AbstractMap;
 import java.util.ArrayList;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.Dictionary;
 import java.util.Enumeration;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.Hashtable;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
-import java.util.Set;
 
 /**
  * A bundle's authority to register or get a service.
  * <ul>
- * <li>The {@code register} action allows a bundle to register a service on
+ * <li>The <code>register</code> 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
+ * <li>The <code>get</code> 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.
+ * <code>ServicePermission</code> to get the specific service.
  * 
  * @ThreadSafe
- * @version $Id: 1b6ee9543f4cbc16add8dc8c40dfa9a6dfee7aa2 $
+ * @version $Revision: 7189 $
  */
 
 public final class ServicePermission extends BasicPermission {
 	static final long			serialVersionUID	= -7662148639076511574L;
 	/**
-	 * The action string {@code get}.
+	 * The action string <code>get</code>.
 	 */
 	public final static String	GET					= "get";
 	/**
-	 * The action string {@code register}.
+	 * The action string <code>register</code>.
 	 */
 	public final static String	REGISTER			= "register";
 
@@ -88,7 +87,7 @@ public final class ServicePermission ext
 	 * 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
@@ -103,11 +102,11 @@ public final class ServicePermission ext
 	transient Filter						filter;
 
 	/**
-	 * This map holds the properties of the permission, used to match a filter
-	 * in implies. This is not initialized until necessary, and then cached in
-	 * this object.
+	 * This dictionary holds the properties of the permission, used to match a
+	 * filter in implies. This is not initialized until necessary, and then
+	 * cached in this object.
 	 */
-	private transient volatile Map<String, Object>	properties;
+	private transient volatile Dictionary	properties;
 
 	/**
 	 * True if constructed with a name and the name is "*" or ends with ".*".
@@ -139,7 +138,7 @@ public final class ServicePermission ext
 	 * *
 	 * </pre>
 	 * 
-	 * For the {@code get} action, the name can also be a filter
+	 * For the <code>get</code> action, the name can also be a filter
 	 * expression. The filter gives access to the service properties as well as
 	 * the following attributes:
 	 * <ul>
@@ -159,17 +158,17 @@ public final class ServicePermission ext
 	 * Service properties names are case insensitive.
 	 * 
 	 * <p>
-	 * There are two possible actions: {@code get} and
-	 * {@code register}. The {@code get} permission allows the owner
+	 * There are two possible actions: <code>get</code> and
+	 * <code>register</code>. The <code>get</code> 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
+	 * <code>register</code> 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)
+	 * @param actions <code>get</code>,<code>register</code> (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.
+	 *         <code>get</code> or the filter has an invalid syntax.
 	 */
 	public ServicePermission(String name, String actions) {
 		this(name, parseActions(actions));
@@ -181,19 +180,19 @@ public final class ServicePermission ext
 	}
 
 	/**
-	 * 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}
+	 * Creates a new requested <code>ServicePermission</code> object to be used
+	 * by code that must perform <code>checkPermission</code> for the
+	 * <code>get</code> action. <code>ServicePermission</code> objects created
+	 * with this constructor cannot be added to a <code>ServicePermission</code>
 	 * permission collection.
 	 * 
 	 * @param reference The requested service.
-	 * @param actions The action {@code get}.
+	 * @param actions The action <code>get</code>.
 	 * @throws IllegalArgumentException If the specified action is not
-	 *         {@code get} or reference is {@code null}.
+	 *         <code>get</code> or reference is <code>null</code>.
 	 * @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;
@@ -210,7 +209,7 @@ public final class ServicePermission ext
 	 * @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");
 		}
@@ -352,7 +351,7 @@ public final class ServicePermission ext
 	 * 
 	 * @param filterString The filter string to parse.
 	 * @return a Filter for this bundle. If the specified filterString is not a
-	 *         filter expression, then {@code null} is returned.
+	 *         filter expression, then <code>null</code> is returned.
 	 * @throws IllegalArgumentException If the filter syntax is invalid.
 	 */
 	private static Filter parseFilter(String filterString) {
@@ -373,12 +372,12 @@ public final class ServicePermission ext
 	}
 
 	/**
-	 * Determines if a {@code ServicePermission} object "implies" the
+	 * Determines if a <code>ServicePermission</code> object "implies" the
 	 * specified permission.
 	 * 
 	 * @param p The target permission to check.
-	 * @return {@code true} if the specified permission is implied by this
-	 *         object; {@code false} otherwise.
+	 * @return <code>true</code> if the specified permission is implied by this
+	 *         object; <code>false</code> otherwise.
 	 */
 	public boolean implies(Permission p) {
 		if (!(p instanceof ServicePermission)) {
@@ -403,8 +402,8 @@ public final class ServicePermission ext
 	 *        validated as a proper argument. The requested ServicePermission
 	 *        must not have a filter expression.
 	 * @param effective The effective actions with which to start.
-	 * @return {@code true} if the specified permission is implied by this
-	 *         object; {@code false} otherwise.
+	 * @return <code>true</code> if the specified permission is implied by this
+	 *         object; <code>false</code> otherwise.
 	 */
 	boolean implies0(ServicePermission requested, int effective) {
 		/* check actions first - much faster */
@@ -420,7 +419,7 @@ public final class ServicePermission ext
 		/* if we have a filter */
 		Filter f = filter;
 		if (f != null) {
-			return f.matches(requested.getProperties());
+			return f.matchCase(requested.getProperties());
 		}
 		/* if requested permission not created with ServiceReference */
 		String[] requestedNames = requested.objectClass;
@@ -451,8 +450,8 @@ public final class ServicePermission ext
 
 	/**
 	 * Returns the canonical string representation of the actions. Always
-	 * returns present actions in the following order: {@code get},
-	 * {@code register}.
+	 * returns present actions in the following order: <code>get</code>,
+	 * <code>register</code>.
 	 * 
 	 * @return The canonical string representation of the actions.
 	 */
@@ -481,11 +480,11 @@ public final class ServicePermission ext
 	}
 
 	/**
-	 * Returns a new {@code PermissionCollection} object for storing
-	 * {@code ServicePermission} objects.
-	 * 
-	 * @return A new {@code PermissionCollection} object suitable for storing
-	 *         {@code ServicePermission} objects.
+	 * Returns a new <code>PermissionCollection</code> object for storing
+	 * <code>ServicePermission<code> objects.
+	 *
+	 * @return A new <code>PermissionCollection</code> object suitable for storing
+	 * <code>ServicePermission</code> objects.
 	 */
 	public PermissionCollection newPermissionCollection() {
 		return new ServicePermissionCollection();
@@ -495,12 +494,12 @@ public final class ServicePermission ext
 	 * Determines the equality of two ServicePermission objects.
 	 * 
 	 * Checks that specified object has the same class name and action as this
-	 * {@code ServicePermission}.
+	 * <code>ServicePermission</code>.
 	 * 
 	 * @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.
+	 * @return true if obj is a <code>ServicePermission</code>, and has the same
+	 *         class name and actions as this <code>ServicePermission</code>
+	 *         object; <code>false</code> otherwise.
 	 */
 	public boolean equals(Object obj) {
 		if (obj == this) {
@@ -559,28 +558,27 @@ public final class ServicePermission ext
 		s.defaultReadObject();
 		setTransients(parseFilter(getName()), parseActions(actions));
 	}
-
 	/**
-	 * Called by {@code <@link ServicePermission#implies(Permission)>}. This
-	 * method is only called on a requested permission which cannot have a
-	 * filter set.
+	 * Called by <code><@link ServicePermission#implies(Permission)></code>.
 	 * 
-	 * @return a map of properties for this permission.
+	 * @return a dictionary of properties for this permission.
 	 */
-	private Map<String, Object> getProperties() {
-		Map<String, Object> result = properties;
+	private Dictionary getProperties() {
+		Dictionary result = properties;
 		if (result != null) {
 			return result;
 		}
 		if (service == null) {
-			result = new HashMap<String, Object>(1);
-			result.put(Constants.OBJECTCLASS, new String[] {getName()});
+			result = new Hashtable(1);
+			if (filter == null) {
+				result.put(Constants.OBJECTCLASS, new String[] {getName()});
+			}
 			return properties = result;
 		}
-		final Map<String, Object> props = new HashMap<String, Object>(4);
+		final Map props = new HashMap(4);
 		final Bundle bundle = service.getBundle();
 		if (bundle != null) {
-			AccessController.doPrivileged(new PrivilegedAction<Object>() {
+			AccessController.doPrivileged(new PrivilegedAction() {
 				public Object run() {
 					props.put("id", new Long(bundle.getBundleId()));
 					props.put("location", bundle.getLocation());
@@ -599,15 +597,13 @@ public final class ServicePermission ext
 		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 transient volatile Set<Map.Entry<String, Object>>	entries;
+	private static class Properties extends Dictionary {
+		private final Map				properties;
+		private final ServiceReference	service;
 
-		Properties(Map<String, Object> properties, ServiceReference< ? > service) {
+		Properties(Map properties, ServiceReference service) {
 			this.properties = properties;
 			this.service = service;
-			entries = null;
 		}
 
 		public Object get(Object k) {
@@ -625,64 +621,57 @@ public final class ServicePermission ext
 			return service.getProperty(key);
 		}
 
-		public Set<Map.Entry<String, Object>> entrySet() {
-			if (entries != null) {
-				return entries;
-			}
-			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)) {
+		public int size() {
+			return properties.size() + service.getPropertyKeys().length;
+		}
+
+		public boolean isEmpty() {
+			// we can return false because this must never be empty
+			return false;
+		}
+
+		public Enumeration keys() {
+			Collection pk = properties.keySet();
+			String spk[] = service.getPropertyKeys();
+			List all = new ArrayList(pk.size() + spk.length);
+			all.addAll(pk);
+			add:
+			for (int i = 0, length = spk.length; i < length; i++) {
+				String key = spk[i];
+				for (Iterator iter = pk.iterator(); iter.hasNext();) {
+					if (key.equalsIgnoreCase((String) iter.next())) {
 						continue add;
 					}
 				}
-				all.add(new Entry(key, service.getProperty(key)));
+				all.add(key);
 			}
-			return entries = Collections.unmodifiableSet(all);
+			return Collections.enumeration(all);
 		}
-		
-		static private final class Entry implements Map.Entry<String, Object> {
-			private final String	k;
-			private final Object	v;
 
-			Entry(String key, Object value) {
-				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());
-			}
-			public boolean equals(Object obj) {
-				if (obj == this) {
-					return true;
-				}
-				if (!(obj instanceof Map.Entry)) {
-					return false;
-				}
-				Map.Entry< ? , ? > e = (Map.Entry< ? , ? >) obj;
-				final Object key = e.getKey();
-				if ((k == key) || ((k != null) && k.equals(key))) {
-					final Object value = e.getValue();
-					if ((v == value) || ((v != null) && v.equals(value))) {
-						return true;
+		public Enumeration elements() {
+			Collection pk = properties.keySet();
+			String spk[] = service.getPropertyKeys();
+			List all = new ArrayList(pk.size() + spk.length);
+			all.addAll(properties.values());
+			add:
+			for (int i = 0, length = spk.length; i < length; i++) {
+				String key = spk[i];
+				for (Iterator iter = pk.iterator(); iter.hasNext();) {
+					if (key.equalsIgnoreCase((String) iter.next())) {
+						continue add;
 					}
 				}
-				return false;
+				all.add(service.getProperty(key));
 			}
+			return Collections.enumeration(all);
+		}
+
+		public Object put(Object key, Object value) {
+			throw new UnsupportedOperationException();
+		}
+
+		public Object remove(Object key) {
+			throw new UnsupportedOperationException();
 		}
 	}
 }
@@ -701,7 +690,7 @@ final class ServicePermissionCollection 
 	 * 
 	 * @GuardedBy this
 	 */
-	private transient Map<String, ServicePermission>	permissions;
+	private transient Map	permissions;
 
 	/**
 	 * Boolean saying if "*" is in the collection.
@@ -717,13 +706,13 @@ final class ServicePermissionCollection 
 	 * @serial
 	 * @GuardedBy this
 	 */
-	private Map<String, ServicePermission>				filterPermissions;
+	private Map				filterPermissions;
 
 	/**
 	 * Creates an empty ServicePermissions object.
 	 */
 	public ServicePermissionCollection() {
-		permissions = new HashMap<String, ServicePermission>();
+		permissions = new HashMap();
 		all_allowed = false;
 	}
 
@@ -734,7 +723,7 @@ final class ServicePermissionCollection 
 	 * @throws IllegalArgumentException If the specified permission is not a
 	 *         ServicePermission object.
 	 * @throws SecurityException If this
-	 *         {@code ServicePermissionCollection} object has been marked
+	 *         <code>ServicePermissionCollection</code> object has been marked
 	 *         read-only.
 	 */
 	public void add(final Permission permission) {
@@ -757,17 +746,17 @@ final class ServicePermissionCollection 
 		final Filter f = sp.filter;
 		synchronized (this) {
 			/* select the bucket for the permission */
-			Map<String, ServicePermission> pc;
+			Map pc;
 			if (f != null) {
 				pc = filterPermissions;
 				if (pc == null) {
-					filterPermissions = pc = new HashMap<String, ServicePermission>();
+					filterPermissions = pc = new HashMap();
 				}
 			}
 			else {
 				pc = permissions;
 			}
-			final ServicePermission existing = pc.get(name);
+			final ServicePermission existing = (ServicePermission) pc.get(name);
 			
 			if (existing != null) {
 				final int oldMask = existing.action_mask;
@@ -792,11 +781,11 @@ final class ServicePermissionCollection 
 
 	/**
 	 * Determines if a set of permissions implies the permissions expressed in
-	 * {@code permission}.
+	 * <code>permission</code>.
 	 * 
 	 * @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}
+	 * @return <code>true</code> if <code>permission</code> is a proper
+	 *         subset of a permission in the set; <code>false</code>
 	 *         otherwise.
 	 */
 	public boolean implies(final Permission permission) {
@@ -810,12 +799,12 @@ final class ServicePermissionCollection 
 		}
 
 		int effective = ServicePermission.ACTION_NONE;
-		Collection<ServicePermission> perms;
+		Collection perms;
 		synchronized (this) {
 			final int desired = requested.action_mask;
 			/* short circuit if the "*" Permission was added */
 			if (all_allowed) {
-				ServicePermission sp = permissions.get("*");
+				ServicePermission sp = (ServicePermission) permissions.get("*");
 				if (sp != null) {
 					effective |= sp.action_mask;
 					if ((effective & desired) == desired) {
@@ -840,7 +829,7 @@ final class ServicePermissionCollection 
 					}
 				}
 			}
-			Map<String, ServicePermission> pc = filterPermissions;
+			Map pc = filterPermissions;
 			if (pc == null) {
 				return false;
 			}
@@ -848,8 +837,9 @@ final class ServicePermissionCollection 
 		}
 		
 		/* iterate one by one over filteredPermissions */
-		for (ServicePermission perm : perms) {
-			if (perm.implies0(requested, effective)) {
+		for (Iterator iter = perms.iterator(); iter.hasNext();) {
+			if (((ServicePermission) iter.next())
+					.implies0(requested, effective)) {
 				return true;
 			}
 		}
@@ -867,8 +857,8 @@ final class ServicePermissionCollection 
 	 */
 	private int effective(String requestedName, final int desired,
 			int effective) {
-		final Map<String, ServicePermission> pc = permissions;
-		ServicePermission sp = pc.get(requestedName);
+		final Map pc = permissions;
+		ServicePermission sp = (ServicePermission) pc.get(requestedName);
 		// strategy:
 		// Check for full match first. Then work our way up the
 		// name looking for matches on a.b.*
@@ -884,7 +874,7 @@ final class ServicePermissionCollection 
 		int offset = requestedName.length() - 1;
 		while ((last = requestedName.lastIndexOf(".", offset)) != -1) {
 			requestedName = requestedName.substring(0, last + 1) + "*";
-			sp = pc.get(requestedName);
+			sp = (ServicePermission) pc.get(requestedName);
 			if (sp != null) {
 				effective |= sp.action_mask;
 				if ((effective & desired) == desired) {
@@ -901,14 +891,14 @@ final class ServicePermissionCollection 
 	}
 	
 	/**
-	 * Returns an enumeration of all the {@code ServicePermission}
+	 * Returns an enumeration of all the <code>ServicePermission</code>
 	 * objects in the container.
 	 * 
 	 * @return Enumeration of all the ServicePermission objects.
 	 */
-	public synchronized Enumeration<Permission> elements() {
-		List<Permission> all = new ArrayList<Permission>(permissions.values());
-		Map<String, ServicePermission> pc = filterPermissions;
+	public synchronized Enumeration elements() {
+		List all = new ArrayList(permissions.values());
+		Map pc = filterPermissions;
 		if (pc != null) {
 			all.addAll(pc.values());
 		}
@@ -923,8 +913,7 @@ final class ServicePermissionCollection 
 
 	private synchronized void writeObject(ObjectOutputStream out)
 			throws IOException {
-		Hashtable<String, ServicePermission> hashtable = new Hashtable<String, ServicePermission>(
-				permissions);
+		Hashtable hashtable = new Hashtable(permissions);
 		ObjectOutputStream.PutField pfields = out.putFields();
 		pfields.put("permissions", hashtable);
 		pfields.put("all_allowed", all_allowed);
@@ -935,12 +924,9 @@ final class ServicePermissionCollection 
 	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);
-		permissions = new HashMap<String, ServicePermission>(hashtable);
+		Hashtable hashtable = (Hashtable) gfields.get("permissions", null);
+		permissions = new HashMap(hashtable);
 		all_allowed = gfields.get("all_allowed", false);
-		HashMap<String, ServicePermission> fp = (HashMap<String, ServicePermission>) gfields
-				.get("filterPermissions", null);
-		filterPermissions = fp;
+		filterPermissions = (HashMap) gfields.get("filterPermissions", null);
 	}
 }

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceReference.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,40 +22,38 @@ import java.util.Dictionary;
  * A reference to a service.
  * 
  * <p>
- * The Framework returns {@code ServiceReference} objects from the
- * {@code BundleContext.getServiceReference} and
- * {@code BundleContext.getServiceReferences} methods.
+ * The Framework returns <code>ServiceReference</code> objects from the
+ * <code>BundleContext.getServiceReference</code> and
+ * <code>BundleContext.getServiceReferences</code> 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
+ * A <code>ServiceReference</code> 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>ServiceRegistration</code> object and may have multiple, distinct
+ * <code>ServiceReference</code> objects referring to it.
+ * <code>ServiceReference</code> objects associated with a
+ * <code>ServiceRegistration</code> object have the same <code>hashCode</code>
+ * and are considered equal (more specifically, their <code>equals()</code>
+ * method will return <code>true</code> when compared).
  * <p>
  * If the same service object is registered multiple times,
- * {@code ServiceReference} objects associated with different
- * {@code ServiceRegistration} objects are not equal.
+ * <code>ServiceReference</code> objects associated with different
+ * <code>ServiceRegistration</code> objects are not equal.
  * 
- * @param <S> Type of Service.
  * @see BundleContext#getServiceReference
  * @see BundleContext#getServiceReferences
  * @see BundleContext#getService
  * @ThreadSafe
- * @noimplement
- * @version $Id: 771b9b4d4f65dbe593154d02912edba51a085b0c $
+ * @version $Revision: 6374 $
  */
 
-public interface ServiceReference<S> extends Comparable<Object> {
+public interface ServiceReference extends Comparable {
 	/**
 	 * 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</code> object of the service
+	 * referenced by this <code>ServiceReference</code> object.
 	 * 
 	 * <p>
 	 * Property keys are case-insensitive.
@@ -63,30 +61,30 @@ public interface ServiceReference<S> ext
 	 * <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
+	 * example, <code>ServiceReference</code> 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}
+	 * @return The property value to which the key is mapped; <code>null</code>
 	 *         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}
+	 * Returns an array of the keys in the properties <code>Dictionary</code>
+	 * object of the service referenced by this <code>ServiceReference</code>
 	 * 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
+	 * example, <code>ServiceReference</code> 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
+	 * properties <code>Dictionary</code> that was passed to the
 	 * {@link BundleContext#registerService(String[],Object,Dictionary)} or
 	 * {@link ServiceRegistration#setProperties} methods.
 	 * 
@@ -96,15 +94,15 @@ public interface ServiceReference<S> ext
 
 	/**
 	 * Returns the bundle that registered the service referenced by this
-	 * {@code ServiceReference} object.
+	 * <code>ServiceReference</code> object.
 	 * 
 	 * <p>
-	 * This method must return {@code null} when the service has been
+	 * This method must return <code>null</code> when the service has been
 	 * unregistered. This can be used to determine if the service has been
 	 * unregistered.
 	 * 
 	 * @return The bundle that registered the service referenced by this
-	 *         {@code ServiceReference} object; {@code null} if that
+	 *         <code>ServiceReference</code> object; <code>null</code> if that
 	 *         service has already been unregistered.
 	 * @see BundleContext#registerService(String[],Object,Dictionary)
 	 */
@@ -112,12 +110,12 @@ public interface ServiceReference<S> ext
 
 	/**
 	 * Returns the bundles that are using the service referenced by this
-	 * {@code ServiceReference} object. Specifically, this method returns
+	 * <code>ServiceReference</code> 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
+	 *         by this <code>ServiceReference</code> object is greater than
+	 *         zero; <code>null</code> if no bundles are currently using that
 	 *         service.
 	 * 
 	 * @since 1.1
@@ -126,60 +124,60 @@ public interface ServiceReference<S> ext
 
 	/**
 	 * Tests if the bundle that registered the service referenced by this
-	 * {@code ServiceReference} and the specified bundle use the same
+	 * <code>ServiceReference</code> 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
+	 * <code>ServiceReference</code> (registrant bundle); find the source for
+	 * the package. If no source is found then return <code>true</code> if the
 	 * registrant bundle is equal to the specified bundle; otherwise return
-	 * {@code false}.</li>
+	 * <code>false</code>.</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>
+	 * package source of the specified bundle then return <code>true</code>;
+	 * otherwise return <code>false</code>.</li>
 	 * </ol>
 	 * 
-	 * @param bundle The {@code Bundle} object to check.
+	 * @param bundle The <code>Bundle</code> 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
+	 * @return <code>true</code> if the bundle which registered the service
+	 *         referenced by this <code>ServiceReference</code> 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
+	 *         specified class name. Otherwise <code>false</code> is returned.
+	 * @throws IllegalArgumentException If the specified <code>Bundle</code> was
 	 *         not created by the same framework instance as this
-	 *         {@code ServiceReference}.
+	 *         <code>ServiceReference</code>.
 	 * @since 1.3
 	 */
 	public boolean isAssignableTo(Bundle bundle, String className);
 
 	/**
-	 * Compares this {@code ServiceReference} with the specified
-	 * {@code ServiceReference} for order.
+	 * Compares this <code>ServiceReference</code> with the specified
+	 * <code>ServiceReference</code> for order.
 	 * 
 	 * <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
+	 * If this <code>ServiceReference</code> and the specified
+	 * <code>ServiceReference</code> have the same {@link Constants#SERVICE_ID
+	 * service id} they are equal. This <code>ServiceReference</code> is less
+	 * than the specified <code>ServiceReference</code> 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</code>
+	 * and the specified <code>ServiceReference</code> have the same
 	 * {@link Constants#SERVICE_RANKING service ranking}, this
-	 * {@code ServiceReference} is less than the specified
-	 * {@code ServiceReference} if it has a higher
+	 * <code>ServiceReference</code> is less than the specified
+	 * <code>ServiceReference</code> 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.
+	 * @param reference The <code>ServiceReference</code> 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</code> is less than, equal to, or greater
+	 *         than the specified <code>ServiceReference</code>.
 	 * @throws IllegalArgumentException If the specified
-	 *         {@code ServiceReference} was not created by the same
-	 *         framework instance as this {@code ServiceReference}.
+	 *         <code>ServiceReference</code> was not created by the same
+	 *         framework instance as this <code>ServiceReference</code>.
 	 * @since 1.4
 	 */
 	public int compareTo(Object reference);

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/ServiceRegistration.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2000, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2000, 2009). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -22,35 +22,33 @@ import java.util.Dictionary;
  * A registered service.
  * 
  * <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
+ * The Framework returns a <code>ServiceRegistration</code> object when a
+ * <code>BundleContext.registerService</code> method invocation is successful.
+ * The <code>ServiceRegistration</code> 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
+ * The <code>ServiceRegistration</code> 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 $Revision: 6361 $
  */
 
-public interface ServiceRegistration<S> {
+public interface ServiceRegistration {
 	/**
-	 * Returns a {@code ServiceReference} object for a service being
+	 * Returns a <code>ServiceReference</code> object for a service being
 	 * registered.
 	 * <p>
-	 * The {@code ServiceReference} object may be shared with other
+	 * The <code>ServiceReference</code> object may be shared with other
 	 * bundles.
 	 * 
 	 * @throws IllegalStateException If this
-	 *         {@code ServiceRegistration} object has already been
+	 *         <code>ServiceRegistration</code> object has already been
 	 *         unregistered.
-	 * @return {@code ServiceReference} object.
+	 * @return <code>ServiceReference</code> object.
 	 */
-	public ServiceReference<S> getReference();
+	public ServiceReference getReference();
 
 	/**
 	 * Updates the properties associated with a service.
@@ -72,17 +70,17 @@ public interface ServiceRegistration<S> 
 	 *        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}
+	 * @throws IllegalStateException If this <code>ServiceRegistration</code>
 	 *         object has already been unregistered.
-	 * @throws IllegalArgumentException If {@code properties} contains
+	 * @throws IllegalArgumentException If <code>properties</code> contains
 	 *         case variants of the same key name.
 	 */
-	public void setProperties(Dictionary<String, ? > properties);
+	public void setProperties(Dictionary properties);
 
 	/**
-	 * Unregisters a service. Remove a {@code ServiceRegistration} object
-	 * from the Framework service registry. All {@code ServiceReference}
-	 * objects associated with this {@code ServiceRegistration} object
+	 * Unregisters a service. Remove a <code>ServiceRegistration</code> object
+	 * from the Framework service registry. All <code>ServiceReference</code>
+	 * objects associated with this <code>ServiceRegistration</code> object
 	 * can no longer be used to interact with the service once unregistration is
 	 * complete.
 	 * 
@@ -94,18 +92,18 @@ public interface ServiceRegistration<S> 
 	 * <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
+	 * <code>ServiceReference</code> 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
+	 * <code>ServiceFactory.ungetService</code> method is called to release
 	 * the service object for the bundle.
 	 * </ol>
 	 * 
 	 * @throws IllegalStateException If this
-	 *         {@code ServiceRegistration} object has already been
+	 *         <code>ServiceRegistration</code> object has already been
 	 *         unregistered.
 	 * @see BundleContext#ungetService
 	 * @see ServiceFactory#ungetService

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/SignerProperty.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2009, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2009). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package org.osgi.framework;
 
 import java.security.cert.X509Certificate;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 import java.util.Map;
 
@@ -26,9 +27,9 @@ import java.util.Map;
  * during filter expression evaluation in the permission implies method.
  * 
  * @Immutable
- * @version $Id: 3589831a7594cf36e645a51ab9b9ae5ebfd80beb $
+ * @version $Revision: 6479 $
  */
-final class SignerProperty {
+class SignerProperty {
 	private final Bundle	bundle;
 	private final String	pattern;
 
@@ -70,21 +71,19 @@ final class SignerProperty {
 		SignerProperty other = (SignerProperty) o;
 		Bundle matchBundle = bundle != null ? bundle : other.bundle;
 		String matchPattern = bundle != null ? other.pattern : pattern;
-		Map<X509Certificate, List<X509Certificate>> signers = matchBundle
+		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());
+		for (Iterator iSigners = signers.values().iterator(); iSigners
+				.hasNext();) {
+			List/* <X509Certificate> */signerCerts = (List) iSigners.next();
+			List/* <String> */dnChain = new ArrayList(signerCerts.size());
+			for (Iterator iCerts = signerCerts.iterator(); iCerts.hasNext();) {
+				dnChain.add(((X509Certificate) iCerts.next()).getSubjectDN()
+						.getName());
 			}
-			try {
-				if (FrameworkUtil.matchDistinguishedNameChain(matchPattern,
-						dnChain)) {
-					return true;
-				}
-			}
-			catch (IllegalArgumentException e) {
-				continue; // bad pattern
+			if (FrameworkUtil
+					.matchDistinguishedNameChain(matchPattern, dnChain)) {
+				return true;
 			}
 		}
 		return false;
@@ -107,7 +106,7 @@ final class SignerProperty {
 		if (bundle == null) {
 			return false;
 		}
-		Map<X509Certificate, List<X509Certificate>> signers = bundle
+		Map/* <X509Certificate, List<X509Certificate>> */signers = bundle
 				.getSignerCertificates(Bundle.SIGNERS_TRUSTED);
 		return !signers.isEmpty();
 	}

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/SynchronousBundleListener.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2001, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2001, 2008). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -17,48 +17,35 @@
 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}.
- * 
- * <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
- * 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.
- * 
+ * A synchronous <code>BundleEvent</code> listener.
+ * <code>SynchronousBundleListener</code> is a listener interface that may be
+ * implemented by a bundle developer. When a <code>BundleEvent</code> is
+ * fired, it is synchronously delivered to a
+ * <code>SynchronousBundleListener</code>. The Framework may deliver
+ * <code>BundleEvent</code> objects to a
+ * <code>SynchronousBundleListener</code> out of order and may concurrently
+ * call and/or reenter a <code>SynchronousBundleListener</code>.
  * <p>
- * A {@code SynchronousBundleListener} object is registered with the
+ * A <code>SynchronousBundleListener</code> object is registered with the
  * Framework using the {@link BundleContext#addBundleListener} method.
- * {@code SynchronousBundleListener} objects are called with a
- * {@code BundleEvent} object when a bundle has been installed, resolved,
+ * <code>SynchronousBundleListener</code> objects are called with a
+ * <code>BundleEvent</code> object when a bundle has been installed, resolved,
  * starting, started, stopping, stopped, updated, unresolved, or uninstalled.
  * <p>
- * Unlike normal {@code BundleListener} objects,
- * {@code SynchronousBundleListener}s are synchronously called during
+ * Unlike normal <code>BundleListener</code> objects,
+ * <code>SynchronousBundleListener</code>s are synchronously called during
  * bundle lifecycle processing. The bundle lifecycle processing will not proceed
- * until all {@code SynchronousBundleListener}s have completed.
- * {@code SynchronousBundleListener} objects will be called prior to
- * {@code BundleListener} objects.
+ * until all <code>SynchronousBundleListener</code>s have completed.
+ * <code>SynchronousBundleListener</code> objects will be called prior to
+ * <code>BundleListener</code> objects.
  * <p>
- * {@code AdminPermission[bundle,LISTENER]} is required to add or remove a
- * {@code SynchronousBundleListener} object.
+ * <code>AdminPermission[bundle,LISTENER]</code> is required to add or remove
+ * a <code>SynchronousBundleListener</code> object.
  * 
  * @since 1.1
  * @see BundleEvent
  * @ThreadSafe
- * @version $Id: b22484f48ebdcb2141da9bba9eb65f5c40e0f520 $
+ * @version $Revision: 5673 $
  */
 
 public interface SynchronousBundleListener extends BundleListener {

Modified: felix/trunk/framework/src/main/java/org/osgi/framework/Version.java
URL: http://svn.apache.org/viewvc/felix/trunk/framework/src/main/java/org/osgi/framework/Version.java?rev=1103918&r1=1103917&r2=1103918&view=diff
==============================================================================
--- felix/trunk/framework/src/main/java/org/osgi/framework/Version.java (original)
+++ felix/trunk/framework/src/main/java/org/osgi/framework/Version.java Mon May 16 21:49:02 2011
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) OSGi Alliance (2004, 2010). All Rights Reserved.
+ * Copyright (c) OSGi Alliance (2004, 2009). All Rights Reserved.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
@@ -28,25 +28,24 @@ import java.util.StringTokenizer;
  * <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
+ * <li>Qualifier. A text string. See <code>Version(String)</code> for the
  * format of the qualifier string.</li>
  * </ol>
  * 
  * <p>
- * {@code Version} objects are immutable.
+ * <code>Version</code> objects are immutable.
  * 
  * @since 1.3
  * @Immutable
- * @version $Id: a71e2e2d7685e65b5bbe375efdf97fda16eff0a5 $
+ * @version $Revision: 6860 $
  */
 
-public class Version implements Comparable<Version> {
+public class Version implements Comparable {
 	private final int			major;
 	private final int			minor;
 	private final int			micro;
 	private final String		qualifier;
-	private static final String	SEPARATOR		= ".";
-	private transient String	versionString;
+	private static final String	SEPARATOR		= ".";					//$NON-NLS-1$
 
 	/**
 	 * The empty version "0.0.0".
@@ -76,21 +75,20 @@ public class Version implements Comparab
 	 * @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
+	 *        <code>null</code> is specified, then the qualifier will be set to
 	 *        the empty string.
 	 * @throws IllegalArgumentException If the numerical components are negative
 	 *         or the qualifier string is invalid.
 	 */
 	public Version(int major, int minor, int micro, String qualifier) {
 		if (qualifier == null) {
-			qualifier = "";
+			qualifier = ""; //$NON-NLS-1$
 		}
 
 		this.major = major;
 		this.minor = minor;
 		this.micro = micro;
 		this.qualifier = qualifier;
-		versionString = null;
 		validate();
 	}
 
@@ -113,51 +111,46 @@ public class Version implements Comparab
 	 * There must be no whitespace in version.
 	 * 
 	 * @param version String representation of the version identifier.
-	 * @throws IllegalArgumentException If {@code version} is improperly
+	 * @throws IllegalArgumentException If <code>version</code> is improperly
 	 *         formatted.
 	 */
 	public Version(String version) {
 		int maj = 0;
 		int min = 0;
 		int mic = 0;
-		String qual = "";
+		String qual = ""; //$NON-NLS-1$
 
 		try {
 			StringTokenizer st = new StringTokenizer(version, SEPARATOR, true);
 			maj = Integer.parseInt(st.nextToken());
 
-			if (st.hasMoreTokens()) { // minor
+			if (st.hasMoreTokens()) {
 				st.nextToken(); // consume delimiter
 				min = Integer.parseInt(st.nextToken());
 
-				if (st.hasMoreTokens()) { // micro
+				if (st.hasMoreTokens()) {
 					st.nextToken(); // consume delimiter
 					mic = Integer.parseInt(st.nextToken());
 
-					if (st.hasMoreTokens()) { // qualifier
+					if (st.hasMoreTokens()) {
 						st.nextToken(); // consume delimiter
-						qual = st.nextToken(""); // remaining string
+						qual = st.nextToken();
 
-						if (st.hasMoreTokens()) { // fail safe
-							throw new IllegalArgumentException(
-									"invalid format: " + version);
+						if (st.hasMoreTokens()) {
+							throw new IllegalArgumentException("invalid format"); //$NON-NLS-1$
 						}
 					}
 				}
 			}
 		}
 		catch (NoSuchElementException e) {
-			IllegalArgumentException iae = new IllegalArgumentException(
-					"invalid format: " + version);
-			iae.initCause(e);
-			throw iae;
+			throw new IllegalArgumentException("invalid format"); //$NON-NLS-1$
 		}
 
 		major = maj;
 		minor = min;
 		micro = mic;
 		qualifier = qual;
-		versionString = null;
 		validate();
 	}
 
@@ -169,13 +162,13 @@ public class Version implements Comparab
 	 */
 	private void validate() {
 		if (major < 0) {
-			throw new IllegalArgumentException("negative major");
+			throw new IllegalArgumentException("negative major"); //$NON-NLS-1$
 		}
 		if (minor < 0) {
-			throw new IllegalArgumentException("negative minor");
+			throw new IllegalArgumentException("negative minor"); //$NON-NLS-1$
 		}
 		if (micro < 0) {
-			throw new IllegalArgumentException("negative micro");
+			throw new IllegalArgumentException("negative micro"); //$NON-NLS-1$
 		}
 		char[] chars = qualifier.toCharArray();
 		for (int i = 0, length = chars.length; i < length; i++) {
@@ -192,8 +185,8 @@ public class Version implements Comparab
 			if ((ch == '_') || (ch == '-')) {
 				continue;
 			}
-			throw new IllegalArgumentException("invalid qualifier: "
-					+ qualifier);
+			throw new IllegalArgumentException(
+					"invalid qualifier: " + qualifier); //$NON-NLS-1$
 		}
 	}
 
@@ -201,15 +194,15 @@ public class Version implements Comparab
 	 * Parses a version identifier from the specified string.
 	 * 
 	 * <p>
-	 * See {@code Version(String)} for the format of the version string.
+	 * See <code>Version(String)</code> for the format of the version string.
 	 * 
 	 * @param version String representation of the version identifier. Leading
 	 *        and trailing whitespace will be ignored.
-	 * @return A {@code Version} object representing the version
-	 *         identifier. If {@code version} is {@code null} or
-	 *         the empty string then {@code emptyVersion} will be
+	 * @return A <code>Version</code> object representing the version
+	 *         identifier. If <code>version</code> is <code>null</code> or
+	 *         the empty string then <code>emptyVersion</code> will be
 	 *         returned.
-	 * @throws IllegalArgumentException If {@code version} is improperly
+	 * @throws IllegalArgumentException If <code>version</code> is improperly
 	 *         formatted.
 	 */
 	public static Version parseVersion(String version) {
@@ -265,16 +258,13 @@ public class Version implements Comparab
 	 * Returns the string representation of this version identifier.
 	 * 
 	 * <p>
-	 * The format of the version string will be {@code major.minor.micro}
+	 * The format of the version string will be <code>major.minor.micro</code>
 	 * if qualifier is the empty string or
-	 * {@code major.minor.micro.qualifier} otherwise.
+	 * <code>major.minor.micro.qualifier</code> otherwise.
 	 * 
 	 * @return The string representation of this version identifier.
 	 */
 	public String toString() {
-		if (versionString != null) {
-			return versionString;
-		}
 		int q = qualifier.length();
 		StringBuffer result = new StringBuffer(20 + q);
 		result.append(major);
@@ -286,7 +276,7 @@ public class Version implements Comparab
 			result.append(SEPARATOR);
 			result.append(qualifier);
 		}
-		return versionString = result.toString();
+		return result.toString();
 	}
 
 	/**
@@ -300,17 +290,17 @@ public class Version implements Comparab
 	}
 
 	/**
-	 * Compares this {@code Version} object to another object.
+	 * Compares this <code>Version</code> object to another object.
 	 * 
 	 * <p>
 	 * A version is considered to be <b>equal to </b> another version if the
 	 * major, minor and micro components are equal and the qualifier component
-	 * is equal (using {@code String.equals}).
+	 * is equal (using <code>String.equals</code>).
 	 * 
-	 * @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.
+	 * @param object The <code>Version</code> object to be compared.
+	 * @return <code>true</code> if <code>object</code> is a
+	 *         <code>Version</code> and is equal to this object;
+	 *         <code>false</code> otherwise.
 	 */
 	public boolean equals(Object object) {
 		if (object == this) { // quicktest
@@ -327,7 +317,7 @@ public class Version implements Comparab
 	}
 
 	/**
-	 * Compares this {@code Version} object to another {@code Version}.
+	 * Compares this <code>Version</code> object to another object.
 	 * 
 	 * <p>
 	 * A version is considered to be <b>less than </b> another version if its
@@ -337,25 +327,27 @@ public class Version implements Comparab
 	 * and its micro component is less than the other version's micro component,
 	 * or the major, minor and micro components are equal and it's qualifier
 	 * component is less than the other version's qualifier component (using
-	 * {@code String.compareTo}).
+	 * <code>String.compareTo</code>).
 	 * 
 	 * <p>
 	 * A version is considered to be <b>equal to</b> another version if the
 	 * major, minor and micro components are equal and the qualifier component
-	 * is equal (using {@code String.compareTo}).
+	 * is equal (using <code>String.compareTo</code>).
 	 * 
-	 * @param other The {@code Version} object to be compared.
-	 * @return A negative integer, zero, or a positive integer if this version
-	 *         is less than, equal to, or greater than the specified
-	 *         {@code Version} object.
+	 * @param object The <code>Version</code> object to be compared.
+	 * @return A negative integer, zero, or a positive integer if this object is
+	 *         less than, equal to, or greater than the specified
+	 *         <code>Version</code> object.
 	 * @throws ClassCastException If the specified object is not a
-	 *         {@code Version} object.
+	 *         <code>Version</code>.
 	 */
-	public int compareTo(Version other) {
-		if (other == this) { // quicktest
+	public int compareTo(Object object) {
+		if (object == this) { // quicktest
 			return 0;
 		}
 
+		Version other = (Version) object;
+
 		int result = major - other.major;
 		if (result != 0) {
 			return result;