Added an @author tag to all class comments.
Fixed a couple of missing license headers.
Implemented InvocationUtil to use a LRU method cache.
Reformatted and removed some dead code.


git-svn-id: https://svn.apache.org/repos/asf/felix/trunk@1096719 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/BundleDependency.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/BundleDependency.java
index 0299fc9..90787b4 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/BundleDependency.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/BundleDependency.java
@@ -20,6 +20,9 @@
 
 import org.osgi.framework.Bundle;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public interface BundleDependency extends Dependency, ComponentDependencyDeclaration {
     /**
      * Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed.
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/ComponentDeclaration.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/ComponentDeclaration.java
index 1a180f2..8795160 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/ComponentDeclaration.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/ComponentDeclaration.java
@@ -18,6 +18,8 @@
  */
 package org.apache.felix.dm;
 
+import org.osgi.framework.BundleContext;
+
 /**
  * Describes a component. Component declarations form descriptions of components
  * that are managed by the dependency manager. They can be used to query their state
@@ -39,4 +41,6 @@
     public String getName();
     /** Returns the state of this component. */
     public int getState();
+    /** Returns the bundle context associated with this component. */
+    public BundleContext getBundleContext();
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivation.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivation.java
index e15fd92..f0649ff 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivation.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivation.java
@@ -18,6 +18,9 @@
  */
 package org.apache.felix.dm;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public interface DependencyActivation {
   public void start(DependencyService service);
   public void stop(DependencyService service);
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
index 817388d..eaae36a 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyActivatorBase.java
@@ -296,7 +296,7 @@
      * @param manager the dependency manager
      */
     private void cleanup(DependencyManager manager) {
-        List services = manager.getServices();
+        List services = manager.getComponents();
         for (int i = services.size() - 1; i >= 0; i--) {
             Component service = (Component) services.get(i);
             manager.remove(service);
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
index 07ec03a..6826b6f 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyManager.java
@@ -18,9 +18,13 @@
  */
 package org.apache.felix.dm;
 
+import java.lang.ref.WeakReference;
 import java.util.ArrayList;
 import java.util.Collections;
+import java.util.HashSet;
+import java.util.Iterator;
 import java.util.List;
+import java.util.Set;
 
 import org.apache.felix.dm.impl.AdapterServiceImpl;
 import org.apache.felix.dm.impl.AspectServiceImpl;
@@ -56,7 +60,7 @@
     public static final String SERVICEREGISTRY_CACHE_INDICES = "dm.index"; // TODO rename
     private final BundleContext m_context;
     private final Logger m_logger;
-    private List m_services = Collections.synchronizedList(new ArrayList());
+    private List m_components = Collections.synchronizedList(new ArrayList());
 
     /**
      * Creates a new dependency manager. You need to supply the
@@ -73,10 +77,14 @@
     DependencyManager(BundleContext context, Logger logger) {
         m_context = createContext(context);
         m_logger = logger;
+        synchronized (m_dependencyManagers) {
+            m_dependencyManagers.add(new WeakReference(this));
+        }
     }
 
     // service registry cache
     private static ServiceRegistryCache m_serviceRegistryCache;
+    private static final Set /* WeakReference<DependencyManager> */ m_dependencyManagers = new HashSet();
     static {
         String index = System.getProperty(SERVICEREGISTRY_CACHE_INDICES);
         if (index != null) {
@@ -91,13 +99,26 @@
                     String[] propList = props[i].split(",");
                     m_serviceRegistryCache.addFilterIndex(new MultiPropertyExactFilter(propList));
                 }
-//                System.out.println("DM: Creating index on " + props[i]);
             }
         }
-        else {
-//            System.out.println("DM: Property 'dm.index' not found, not setting indices.");
+    }
+    
+    public static List getDependencyManagers() {
+        List /* DependencyManager */ result = new ArrayList();
+        synchronized (m_dependencyManagers) {
+            Iterator iterator = m_dependencyManagers.iterator();
+            while (iterator.hasNext()) {
+                WeakReference reference = (WeakReference) iterator.next();
+                DependencyManager manager = (DependencyManager) reference.get();
+                if (manager != null) {
+                    result.add(manager);
+                }
+                else {
+                    iterator.remove();
+                }
+            }
         }
-
+        return result;
     }
     
     private BundleContext createContext(BundleContext context) {
@@ -109,40 +130,10 @@
             return context;
         }
     }
-
-//    private BundleContext createContextX(BundleContext context) {
-//        System.out.println("DM: Enabling bundle context interceptor for bundle #" + context.getBundle().getBundleId());
-//        BundleContextInterceptor result = new BundleContextInterceptor(context);
-//        if (BundleContextInterceptor.indices() == 0) {
-//            String index = System.getProperty("dm.index");
-//            if (index != null) {
-//                String[] props = index.split(";");
-//                for (int i = 0; i < props.length; i++) {
-//                    String[] propList = props[i].split(",");
-//                    MultiPropertyExactFilter filter;
-//                    try {
-//                        filter = new MultiPropertyExactFilter(result, propList);
-//                        m_filterIndices.add(filter);
-//                        System.out.println("DM: Creating index on " + props[i]);
-//                    }
-//                    catch (InvalidSyntaxException e) {
-//                        // TODO Auto-generated catch block
-//                        e.printStackTrace();
-//                    }
-//                }
-//            }
-//            else {
-//                System.out.println("DM: Property 'dm.index' not found, not setting indices.");
-//            }
-//        }
-//        System.out.println("DM: Indices created, setting them on the interceptor.");
-//        Iterator iterator = m_filterIndices.iterator();
-//        while (iterator.hasNext()) {
-//            FilterIndex filter = (FilterIndex) iterator.next();
-//            result.addFilterIndex(filter);
-//        }
-//        return result;
-//    }
+    
+    public BundleContext getBundleContext() {
+        return m_context;
+    }
 
     /**
      * Adds a new service to the dependency manager. After the service was added
@@ -151,7 +142,7 @@
      * @param service the service to add
      */
     public void add(Component service) {
-        m_services.add(service);
+        m_components.add(service);
         service.start();
     }
 
@@ -163,7 +154,7 @@
      */
     public void remove(Component service) {
         service.stop();
-        m_services.remove(service);
+        m_components.remove(service);
     }
 
     /**
@@ -538,7 +529,7 @@
      * 
      * @return a list of services
      */
-    public List getServices() {
-        return Collections.unmodifiableList(m_services);
+    public List getComponents() {
+        return Collections.unmodifiableList(m_components);
     }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyService.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyService.java
index c4f6ee3..100b9a9 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyService.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/DependencyService.java
@@ -18,7 +18,9 @@
  */
 package org.apache.felix.dm;
 
-
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public interface DependencyService {
     /**
      * Will be called when the dependency becomes available.
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/InvocationUtil.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/InvocationUtil.java
index aae4cea..c32e8a4 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/InvocationUtil.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/InvocationUtil.java
@@ -1,3 +1,21 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.dm;
 
 import java.lang.reflect.InvocationTargetException;
@@ -5,10 +23,15 @@
 import java.lang.reflect.Modifier;
 import java.lang.reflect.Proxy;
 import java.util.Arrays;
-import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.Map;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class InvocationUtil {
-    private static final HashMap m_methodCache = new HashMap();
+    public static final int CACHE_SIZE = 2048;
+    private static final Map /* <Key, Method> */ m_methodCache = new LRUMap(CACHE_SIZE);
     
     public static Object invokeCallbackMethod(Object instance, String methodName, Class[][] signatures, Object[][] parameters) throws NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException {
         Class currentClazz = instance.getClass();
@@ -55,8 +78,8 @@
         Key key = new Key(clazz, name, signature);
         Method m = null;
         synchronized (m_methodCache) {
-            if (m_methodCache.containsKey(key)) {
-                m = (Method) m_methodCache.get(key);
+            m = (Method) m_methodCache.get(key);
+            if (m != null) {
                 return m;
             }
         }
@@ -121,4 +144,16 @@
             return true;
         }
     }
+    
+    public static class LRUMap extends LinkedHashMap {
+        private final int m_size;
+        
+        public LRUMap(int size) {
+            m_size = size;
+        }
+        
+        protected boolean removeEldestEntry(java.util.Map.Entry eldest) {
+            return size() > m_size;
+        }
+    }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/PropertyMetaData.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/PropertyMetaData.java
index e7c1296..5dbc675 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/PropertyMetaData.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/PropertyMetaData.java
@@ -13,6 +13,8 @@
 
 /**
  * This interface defines meta data regarding a given configuration property.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public interface PropertyMetaData {
     /**
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceDependency.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceDependency.java
index fb073a7..d5ab781 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceDependency.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceDependency.java
@@ -20,7 +20,9 @@
 
 import java.net.URL;
 
-
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public interface ResourceDependency extends Dependency, ComponentDependencyDeclaration, ResourceHandler {
     /**
      * Sets the callbacks for this service. These callbacks can be used as hooks whenever a
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceHandler.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceHandler.java
index ad83d39..cedb4e1 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceHandler.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceHandler.java
@@ -22,6 +22,8 @@
 
 /** 
  * Service interface for anybody wanting to be notified of changes to resources. 
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public interface ResourceHandler {
     /** Name of the property that's used to describe the filter condition for a resource. */
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceUtil.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceUtil.java
index ebb1c55..564ec52 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceUtil.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/ResourceUtil.java
@@ -22,6 +22,9 @@
 import java.util.Dictionary;
 import java.util.Properties;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class ResourceUtil {
     public static Dictionary createProperties(URL url) {
         Properties props = new Properties();
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/ServiceUtil.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/ServiceUtil.java
index d5bf333..ef6cecb 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/ServiceUtil.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/ServiceUtil.java
@@ -18,12 +18,16 @@
  */
 package org.apache.felix.dm;
 
+import java.util.List;
+
 import org.osgi.framework.Bundle;
 import org.osgi.framework.Constants;
 import org.osgi.framework.ServiceReference;
 
 /**
  * OSGi service utilities.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class ServiceUtil {
     /**
@@ -100,14 +104,30 @@
             else {
                 buf.append("ServiceReference[unregistered]{");
             }
-            String[] keys = ref.getPropertyKeys();
-            for (int i = 0; i < keys.length; i++) {
-                if (i > 0) { 
-                    buf.append(','); 
-                }
-                buf.append(keys[i]);
-                buf.append('=');
-                Object val = ref.getProperty(keys[i]);
+            buf.append(propertiesToString(ref, null));
+            buf.append("}");
+            return buf.toString();
+        }
+    }
+    
+    /**
+     * Converts the properties of a service reference to a string.
+     * 
+     * @param ref the service reference
+     * @param exclude a list of properties to exclude, or <code>null</code> to show everything
+     * @return a string representation of the service properties
+     */
+    public static String propertiesToString(ServiceReference ref, List /* <String> */ exclude) {
+        StringBuffer buf = new StringBuffer();
+        String[] keys = ref.getPropertyKeys();
+        for (int i = 0; i < keys.length; i++) {
+            if (i > 0) { 
+                buf.append(','); 
+            }
+            buf.append(keys[i]);
+            buf.append('=');
+            Object val = ref.getProperty(keys[i]);
+            if (exclude == null || !exclude.contains(val)) {
                 if (val instanceof String[]) {
                     String[] valArray = (String[]) val;
                     StringBuffer valBuf = new StringBuffer();
@@ -125,8 +145,7 @@
                     buf.append(val.toString());
                 }
             }
-            buf.append("}");
-            return buf.toString();
         }
+        return buf.toString();
     }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/TemporalServiceDependency.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/TemporalServiceDependency.java
index cdcb294..0e0310f 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/TemporalServiceDependency.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/TemporalServiceDependency.java
@@ -12,55 +12,55 @@
 package org.apache.felix.dm;
 
 /**
-* A Temporal Service dependency that can block the caller thread between service updates. Only
-* useful for required stateless dependencies that can be replaced transparently.
-* A Dynamic Proxy is used to wrap the actual service dependency. When the dependency goes 
-* away, an attempt is made to replace it with another one which satisfies the service dependency 
-* criteria. If no service replacement is available, then any method invocation (through the 
-* dynamic proxy) will block during a configurable timeout. On timeout, an unchecked 
-* <code>IllegalStateException</code> exception is raised (but the service is not deactivated).<p>
-* 
-* <b>This class only supports required dependencies, and temporal dependencies must be accessed outside
-* the Activator (OSGi) thread, because method invocations may block the caller thread when dependencies
-* are not satisfied.
-* </b>
-*
-* <p> Sample Code:<p>
-* <blockquote>
-* 
-* <pre>
-* import org.apache.felix.dependencymanager.*;
-* 
-* public class Activator extends DependencyActivatorBase {
-*   public void init(BundleContext ctx, DependencyManager dm) throws Exception {
-*     dm.add(createService()
-*            .setImplementation(MyServer.class)
-*            .add(createTemporalServiceDependency()
-*                .setTimeout(15000)
-*                .setService(MyDependency.class)));
-*   }
-* 
-*   public void destroy(BundleContext ctx, DependencyManager dm) throws Exception {
-*   }
-* }
-* 
-* class MyServer implements Runnable {
-*   MyDependency _dependency; // Auto-Injected by reflection.
-*   void start() {
-*     (new Thread(this)).start();
-*   }
-*   
-*   public void run() {
-*     try {
-*       _dependency.doWork();
-*     } catch (IllegalStateException e) {
-*       t.printStackTrace();
-*     }
-*   }   
-* </pre>
-* 
-* </blockquote>
-*/
+ * A Temporal Service dependency that can block the caller thread between service updates. Only useful for required stateless
+ * dependencies that can be replaced transparently. A Dynamic Proxy is used to wrap the actual service dependency. When the
+ * dependency goes away, an attempt is made to replace it with another one which satisfies the service dependency criteria. If
+ * no service replacement is available, then any method invocation (through the dynamic proxy) will block during a configurable
+ * timeout. On timeout, an unchecked <code>IllegalStateException</code> exception is raised (but the service is not
+ * deactivated).
+ * <p>
+ * <b>This class only supports required dependencies, and temporal dependencies must be accessed outside the Activator (OSGi)
+ * thread, because method invocations may block the caller thread when dependencies are not satisfied. </b>
+ * <p>
+ * Sample Code:
+ * <p>
+ * <blockquote>
+ * 
+ * <pre>
+ * import org.apache.felix.dependencymanager.*;
+ * 
+ * public class Activator extends DependencyActivatorBase {
+ *   public void init(BundleContext ctx, DependencyManager dm) throws Exception {
+ *     dm.add(createService()
+ *            .setImplementation(MyServer.class)
+ *            .add(createTemporalServiceDependency()
+ *                .setTimeout(15000)
+ *                .setService(MyDependency.class)));
+ *   }
+ * 
+ *   public void destroy(BundleContext ctx, DependencyManager dm) throws Exception {
+ *   }
+ * }
+ * 
+ * class MyServer implements Runnable {
+ *   MyDependency _dependency; // Auto-Injected by reflection.
+ *   void start() {
+ *     (new Thread(this)).start();
+ *   }
+ *   
+ *   public void run() {
+ *     try {
+ *       _dependency.doWork();
+ *     } catch (IllegalStateException e) {
+ *       t.printStackTrace();
+ *     }
+ *   }
+ * </pre>
+ * 
+ * </blockquote>
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public interface TemporalServiceDependency extends ServiceDependency {
     /**
      * Sets the timeout for this temporal dependency. Specifying a timeout value of zero means that there is no timeout period,
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
index 618a211..aac7e27 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AbstractDecorator.java
@@ -35,6 +35,9 @@
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.cm.ConfigurationException;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public abstract class AbstractDecorator  {
     protected volatile DependencyManager m_manager;
     private final Map m_services = new HashMap();
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterServiceImpl.java
index 4aebed3..89eba25 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AdapterServiceImpl.java
@@ -32,9 +32,10 @@
 /**
  * Adapter Service implementation. This class extends the FilterService in order to catch
  * some Service methods for configuring actual adapter service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class AdapterServiceImpl extends FilterService
-{
+public class AdapterServiceImpl extends FilterService {
     /**
      * Creates a new Adapter Service implementation.
      * 
@@ -45,8 +46,7 @@
      * @param change
      * @param remove
      */
-    public AdapterServiceImpl(DependencyManager dm, Class adapteeInterface, String adapteeFilter, String autoConfig, String add, String change, String remove)
-    {
+    public AdapterServiceImpl(DependencyManager dm, Class adapteeInterface, String adapteeFilter, String autoConfig, String add, String change, String remove) {
         super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.
         m_service.setImplementation(new AdapterImpl(adapteeInterface, adapteeFilter, autoConfig, add, change, remove))
                  .add(dm.createServiceDependency()
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectServiceImpl.java
index d1f2a92..fe1bdd0 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectServiceImpl.java
@@ -34,6 +34,8 @@
 /**
  * Aspect Service implementation. This class extends the FilterService in order to catch
  * some Service methods for configuring actual aspect service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class AspectServiceImpl extends FilterService {
     public AspectServiceImpl(DependencyManager dm, Class aspectInterface, String aspectFilter, int ranking, String autoConfig, String add, String change, String remove)
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
index 043afc1..f666a92 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/BundleAdapterServiceImpl.java
@@ -22,15 +22,17 @@
 import java.util.List;
 import java.util.Properties;
 
-import org.apache.felix.dm.Dependency;
-import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ComponentStateListener;
+import org.apache.felix.dm.Dependency;
+import org.apache.felix.dm.DependencyManager;
 import org.osgi.framework.Bundle;
 
 /**
  * Bundle Adapter Service implementation. This class extends the FilterService in order to catch
  * some Service methods for configuring actual adapter service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class BundleAdapterServiceImpl extends FilterService
 {
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ComponentImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ComponentImpl.java
index 1e38e45..5733254 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ComponentImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ComponentImpl.java
@@ -49,14 +49,16 @@
  *
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class ComponentImpl implements Component, DependencyService, ComponentDeclaration {
+public class ComponentImpl implements Component, DependencyService, ComponentDeclaration, Comparable {
     private static final Class[] VOID = new Class[] {};
 	private static final ServiceRegistration NULL_REGISTRATION;
     private static final ComponentStateListener[] SERVICE_STATE_LISTENER_TYPE = new ComponentStateListener[] {};
+    private static long HIGHEST_ID = 0;
 
     private final Object SYNC = new Object();
     private final BundleContext m_context;
     private final DependencyManager m_manager;
+    private final long m_id;
 
     // configuration (static)
     private String m_callbackInit;
@@ -99,11 +101,16 @@
 	
 	// internal logging
     private final Logger m_logger;
-    private ServiceRegistration m_serviceRegistration;
+    
     private Map m_autoConfig = new HashMap();
     private Map m_autoConfigInstance = new HashMap();
+    
+    private boolean m_isStarted = false;
 
     public ComponentImpl(BundleContext context, DependencyManager manager, Logger logger) {
+        synchronized (VOID) {
+            m_id = HIGHEST_ID++;
+        }
     	m_logger = logger;
         m_state = new State((List) m_dependencies.clone(), false, false, false);
         m_context = context;
@@ -159,11 +166,7 @@
             m_executor.enqueue(new Runnable() {
                 public void run() {
                     // TODO as far as I can see there is nothing left to do here
-                    
-                    
-                    //////////unbindService(newState);
-                    
-                    
+                    // unbindService(newState);
                 }});
         }
         if (oldState.isTrackingOptional() && newState.isWaitingForRequired()) {
@@ -236,22 +239,6 @@
             m_dependencies.add(dependency);
         }
         
-//        if (dependency.isInstanceBound()) {
-//            // At this point: this dependency is added from init(): but we don't want to start it now, 
-//            // because if we start it, and if the required dependency is available, then the service.start() 
-//            // method will be called, and this is a problem if a further
-//            // required (but unavailable) dependency is then added again from the init() method ...
-//            // Once the init() method will return, the activateService method will then calculate the state changes,
-//            // but at this point, all added extra-dependencies will be known.
-//            return this;
-//        } 
-        
-        ///
-        
-//        if (oldState.isAllRequiredAvailable() || (oldState.isWaitingForRequiredInstantiated() && dependency.isRequired()) || (oldState.isWaitingForRequired() && dependency.isRequired())) {
-//        	((DependencyActivation) dependency).start(this);
-//        }
-        
         // if we're inactive, don't do anything, otherwise we might want to start
         // the dependency
         if (!oldState.isInactive()) {
@@ -395,8 +382,8 @@
     }
 
     public synchronized void start() {
-    	if (m_serviceRegistration == null) {
-	        m_serviceRegistration = m_context.registerService(ComponentDeclaration.class.getName(), this, null);
+    	if (!m_isStarted) {
+    	    m_isStarted = true;
 	        State oldState, newState;
 	        synchronized (m_dependencies) {
 	            oldState = m_state;
@@ -408,9 +395,8 @@
     }
 
     public synchronized void stop() {
-    	if (m_serviceRegistration != null) {
-	        m_serviceRegistration.unregister();
-	        m_serviceRegistration = null;
+        if (m_isStarted) {
+            m_isStarted = false;
 	        State oldState, newState;
 	        synchronized (m_dependencies) {
 	            oldState = m_state;
@@ -454,8 +440,6 @@
         return this;
     }
 	
-	
-
 	public synchronized Component setImplementation(Object implementation) {
 	    ensureNotActive();
 	    m_implementation = implementation;
@@ -1099,10 +1083,13 @@
                 }
                 sb.append(names[i]);
             }
+            sb.append('(');
+            sb.append(propertiesToString());
+            sb.append(')');
             return sb.toString();
         }
         else if (serviceName instanceof String) {
-            return serviceName.toString();
+            return serviceName.toString() + "(" + propertiesToString() + ")";
         }
         else {
             Object implementation = m_implementation;
@@ -1114,6 +1101,38 @@
             }
         }
     }
+    
+    private String propertiesToString() {
+        StringBuffer result = new StringBuffer();
+        Dictionary properties = calculateServiceProperties();
+        if (properties != null) {
+            Enumeration enumeration = properties.keys();
+            while (enumeration.hasMoreElements()) {
+                String key = (String) enumeration.nextElement();
+                if (result.length() > 0) {
+                    result.append(',');
+                }
+                result.append(key);
+                result.append('=');
+                Object value = properties.get(key);
+                if (value instanceof String[]) {
+                    String[] values = (String[]) value;
+                    result.append('{');
+                    for (int i = 0; i < values.length; i++) {
+                        if (i > 0) {
+                            result.append(',');
+                        }
+                        result.append(values[i].toString());
+                    }
+                    result.append('}');
+                }
+                else {
+                    result.append(value.toString());
+                }
+            }
+        }
+        return result.toString();
+    }
 
     public int getState() {
         return (isRegistered() ? 1 : 0);
@@ -1126,4 +1145,21 @@
     static {
         NULL_REGISTRATION = (ServiceRegistration) Proxy.newProxyInstance(ComponentImpl.class.getClassLoader(), new Class[] {ServiceRegistration.class}, new DefaultNullObject());
     }
+
+    public BundleContext getBundleContext() {
+        return m_context;
+    }
+
+    public int compareTo(Object object) {
+        if (object instanceof ComponentImpl) {
+            ComponentImpl other = (ComponentImpl) object;
+            long id1 = this.getBundleContext().getBundle().getBundleId();
+            long id2 = ((ComponentImpl) other).getBundleContext().getBundle().getBundleId();
+            if (id1 == id2) {
+                return (int)(this.m_id - other.m_id);
+            }
+            return (int)(id1 - id2);
+        }
+        return -1;
+    }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
index 972aa25..f697500 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FactoryConfigurationAdapterServiceImpl.java
@@ -25,26 +25,26 @@
 import java.util.Hashtable;
 import java.util.List;
 
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.InvocationUtil;
 import org.apache.felix.dm.PropertyMetaData;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.ComponentStateListener;
-import org.osgi.framework.Constants;
-import org.osgi.service.cm.ManagedServiceFactory;
 import org.apache.felix.dm.impl.metatype.MetaTypeProviderImpl;
 import org.osgi.framework.BundleContext;
+import org.osgi.framework.Constants;
+import org.osgi.service.cm.ManagedServiceFactory;
 import org.osgi.service.metatype.MetaTypeProvider;
 import org.osgi.service.metatype.ObjectClassDefinition;
 
 /**
  * Factory configuration adapter service implementation. This class extends the FilterService in order to catch
  * some Service methods for configuring actual adapter service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class FactoryConfigurationAdapterServiceImpl extends FilterService
-{
-    public FactoryConfigurationAdapterServiceImpl(DependencyManager dm, String factoryPid, String update, boolean propagate)
-    {
+public class FactoryConfigurationAdapterServiceImpl extends FilterService {
+    public FactoryConfigurationAdapterServiceImpl(DependencyManager dm, String factoryPid, String update, boolean propagate) {
         super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.
         Hashtable props = new Hashtable();
         props.put(Constants.SERVICE_PID, factoryPid);
@@ -54,23 +54,21 @@
     }
     
     public FactoryConfigurationAdapterServiceImpl(DependencyManager dm, String factoryPid, String update, boolean propagate,
-                                                  BundleContext bctx, Logger logger, String heading, String description, String localization, PropertyMetaData[] properyMetaData)
-    {
+        BundleContext bctx, Logger logger, String heading, String description, String localization, PropertyMetaData[] properyMetaData) {
         super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.
         Hashtable props = new Hashtable();
         props.put(Constants.SERVICE_PID, factoryPid);
         m_service
             .setInterface(ManagedServiceFactory.class.getName(), props)
             .setImplementation(new MetaTypeAdapterImpl(factoryPid, update, propagate,
-                                                       bctx, logger, heading, description,
-                                                       localization, properyMetaData));
+                bctx, logger, heading, description,
+                localization, properyMetaData));
     }
     
     /**
      * Creates, updates, or removes a service, when a ConfigAdmin factory configuration is created/updated or deleted.
      */
-    public class AdapterImpl extends AbstractDecorator implements ManagedServiceFactory
-    {
+    public class AdapterImpl extends AbstractDecorator implements ManagedServiceFactory {
         // Our injected dependency manager
         protected volatile DependencyManager m_dm;
         
@@ -93,8 +91,7 @@
          * @param adapterProperties
          * @param propagate
          */
-        public AdapterImpl(String factoryPid, String updateMethod, boolean propagate)
-        {
+        public AdapterImpl(String factoryPid, String updateMethod, boolean propagate) {
             m_factoryPid = factoryPid;
             m_update = updateMethod;
             m_propagate = propagate;
@@ -103,8 +100,7 @@
         /**
          * Returns the managed service factory name.
          */
-        public String getName()
-        {
+        public String getName() {
             return m_factoryPid;
         }
       
@@ -118,9 +114,9 @@
             
             try {
                 if (m_serviceImpl != null) {
-                    impl = (m_serviceImpl instanceof Class) ? 
-                        ((Class) m_serviceImpl).newInstance() : m_serviceImpl;
-                } else {
+                    impl = (m_serviceImpl instanceof Class) ? ((Class) m_serviceImpl).newInstance() : m_serviceImpl;
+                }
+                else {
                     impl = instantiateFromFactory(m_factory, m_factoryCreateMethod);
                 }
                 InvocationUtil.invokeCallbackMethod(impl, m_update, 
@@ -128,8 +124,7 @@
                     new Object[][] {{ settings }, {}});
             }
             
-            catch (Throwable t)
-            {
+            catch (Throwable t) {
                handleException(t);
             }
 
@@ -144,7 +139,6 @@
             for (int i = 0; i < m_stateListeners.size(); i ++) {
                 newService.addStateListener((ComponentStateListener) m_stateListeners.get(i));
             }
-
             return newService;
         }
 
@@ -152,14 +146,12 @@
          * Method called from our superclass, when we need to update a Service, because 
          * the configuration has changed.
          */
-        public void updateService(Object[] properties) 
-        {
+        public void updateService(Object[] properties) {
             Dictionary settings = (Dictionary) properties[0];
             Component service = (Component) properties[1];
             Object impl = service.getService();
            
-            try
-            {
+            try {
                 InvocationUtil.invokeCallbackMethod(impl, m_update, 
                     new Class[][] {{ Dictionary.class }, {}}, 
                     new Object[][] {{ settings }, {}});
@@ -169,8 +161,7 @@
                 }
             }
             
-            catch (Throwable t)
-            {
+            catch (Throwable t) {
                 handleException(t);
             }
         }   
@@ -183,8 +174,7 @@
          * @param settings
          * @return
          */
-        private Dictionary mergeSettings(Dictionary adapterProperties, Dictionary settings)
-        {
+        private Dictionary mergeSettings(Dictionary adapterProperties, Dictionary settings) {
             Dictionary props = new Hashtable();
             
             if (adapterProperties != null) {
@@ -208,8 +198,7 @@
             return props;
         }
     
-        private Object instantiateFromFactory(Object mFactory, String mFactoryCreateMethod)
-        {
+        private Object instantiateFromFactory(Object mFactory, String mFactoryCreateMethod) {
             Object factory = null;
             if (m_factory instanceof Class) {
                 try {
@@ -224,8 +213,7 @@
             }
 
             try {
-                return InvocationUtil.invokeMethod(factory, factory.getClass(), m_factoryCreateMethod,
-                                                   new Class[][] {{}}, new Object[][] {{}}, false);
+                return InvocationUtil.invokeMethod(factory, factory.getClass(), m_factoryCreateMethod, new Class[][] { {} }, new Object[][] { {} }, false);
             }
             catch (Throwable t) {
                 handleException(t);
@@ -240,14 +228,15 @@
         }
     
         private void handleException(Throwable t) {
-            if (t instanceof InvocationTargetException)
-            {
+            if (t instanceof InvocationTargetException) {
                 // Our super class will check if the target exception is itself a ConfigurationException.
                 // In this case, it will simply re-thrown.
                 throw new RuntimeException(((InvocationTargetException) t).getTargetException());
-            } else if (t instanceof RuntimeException) {
+            }
+            else if (t instanceof RuntimeException) {
                 throw (RuntimeException) t;
-            } else {
+            }
+            else {
                 throw new RuntimeException(t);
             }
         }
@@ -264,29 +253,24 @@
         public MetaTypeAdapterImpl(String factoryPid, String updateMethod, boolean propagate,
                                    BundleContext bctx, Logger logger, String heading, 
                                    String description, String localization,
-                                   PropertyMetaData[] properyMetaData)
-        {
+                                   PropertyMetaData[] properyMetaData) {
             super(factoryPid, updateMethod, propagate);
             m_metaType = new MetaTypeProviderImpl(m_factoryPid, bctx, logger, null, this);
             m_metaType.setName(heading);
             m_metaType.setDescription(description);
-            if (localization != null) 
-            {
+            if (localization != null) {
                 m_metaType.setLocalization(localization);
             }
-            for (int i = 0; i < properyMetaData.length; i ++) 
-            {
+            for (int i = 0; i < properyMetaData.length; i++) {
                 m_metaType.add(properyMetaData[i]);
             }
         }
         
-        public String[] getLocales()
-        {
+        public String[] getLocales() {
             return m_metaType.getLocales();
         }
 
-        public ObjectClassDefinition getObjectClassDefinition(String id, String locale)
-        {
+        public ObjectClassDefinition getObjectClassDefinition(String id, String locale) {
             return m_metaType.getObjectClassDefinition(id, locale);
         }
     }    
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FilterService.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FilterService.java
index b3a14ac..9779290 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FilterService.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FilterService.java
@@ -32,9 +32,10 @@
 /**
  * This class allows to filter a Service interface. All Aspect/Adapters extends this class
  * in order to add functionality to the default Service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class FilterService implements Component
-{
+public class FilterService implements Component {
     protected ComponentImpl m_service;
     protected List m_stateListeners = new ArrayList();
     protected String m_init = "init";
@@ -50,13 +51,11 @@
     protected String m_factoryCreateMethod;
     protected Dictionary m_serviceProperties;
 
-    public FilterService(Component service)
-    {
+    public FilterService(Component service) {
         m_service = (ComponentImpl) service;
     }
 
-    public Component add(Dependency dependency)
-    {
+    public Component add(Dependency dependency) {
         m_service.add(dependency);
         // Add the dependency (if optional) to all already instantiated services.
         // If the dependency is required, our internal service will be stopped/restarted, so in this case
@@ -71,8 +70,7 @@
         return this;
     }
 
-    public Component add(List dependencies)
-    {
+    public Component add(List dependencies) {
         m_service.add(dependencies);
         // Add the dependencies to all already instantiated services.
         // If one dependency from the list is required, we have nothing to do, since our internal
@@ -86,49 +84,40 @@
         // Ok, the list contains no required dependencies: add optionals dependencies in already instantiated
         // services.
         AbstractDecorator ad = (AbstractDecorator) m_service.getService();
-        if (ad != null)
-        {
+        if (ad != null) {
             ad.addDependencies(dependencies);
         }
         return this;
     }
 
-    public void addStateListener(ComponentStateListener listener)
-    {
-        synchronized (this)
-        {
+    public void addStateListener(ComponentStateListener listener) {
+        synchronized (this) {
             m_stateListeners.add(listener);
         }
         // Add the listener to all already instantiated services.
         AbstractDecorator ad = (AbstractDecorator) m_service.getService();
-        if (ad != null)
-        {
+        if (ad != null) {
             ad.addStateListener(listener);
         }
     }
 
-    public List getDependencies()
-    {
+    public List getDependencies() {
         return m_service.getDependencies();
     }
 
-    public Object getService()
-    {
+    public Object getService() {
         return m_service.getService();
     }
 
-    public synchronized Dictionary getServiceProperties()
-    {
+    public synchronized Dictionary getServiceProperties() {
         return m_serviceProperties;
     }
 
-    public ServiceRegistration getServiceRegistration()
-    {
+    public ServiceRegistration getServiceRegistration() {
         return m_service.getServiceRegistration();
     }
 
-    public Component remove(Dependency dependency)
-    {
+    public Component remove(Dependency dependency) {
         m_service.remove(dependency);
         // Remove the dependency (if optional) from all already instantiated services.
         // If the dependency is required, our internal service will be stopped, so in this case
@@ -144,23 +133,18 @@
         return this;
     }
 
-    public void removeStateListener(ComponentStateListener listener)
-    {
-        synchronized (this)
-        {
+    public void removeStateListener(ComponentStateListener listener) {
+        synchronized (this) {
             m_stateListeners.remove(listener);
         }
         // Remove the listener from all already instantiated services.
         AbstractDecorator ad = (AbstractDecorator) m_service.getService();
-        if (ad != null)
-        {
+        if (ad != null) {
             ad.removeStateListener(listener);
         }
     }
 
-    public synchronized Component setCallbacks(Object instance, String init, String start, String stop,
-                                             String destroy)
-    {
+    public synchronized Component setCallbacks(Object instance, String init, String start, String stop, String destroy) {
         m_service.ensureNotActive();
         m_callbackObject = instance;
         m_init = init;
@@ -170,49 +154,42 @@
         return this;
     }
 
-    public Component setCallbacks(String init, String start, String stop, String destroy)
-    {
+    public Component setCallbacks(String init, String start, String stop, String destroy) {
         setCallbacks(null, init, start, stop, destroy);
         return this;
     }
 
-    public synchronized Component setComposition(Object instance, String getMethod)
-    {
+    public synchronized Component setComposition(Object instance, String getMethod) {
         m_service.ensureNotActive();
         m_compositionInstance = instance;
         m_compositionMethod = getMethod;
         return this;
     }
 
-    public synchronized Component setComposition(String getMethod)
-    {
+    public synchronized Component setComposition(String getMethod) {
         m_service.ensureNotActive();
         m_compositionMethod = getMethod;
         return this;
     }
 
-    public synchronized Component setFactory(Object factory, String createMethod)
-    {
+    public synchronized Component setFactory(Object factory, String createMethod) {
         m_service.ensureNotActive();
         m_factory = factory;
         m_factoryCreateMethod = createMethod;
         return this;
     }
 
-    public Component setFactory(String createMethod)
-    {
+    public Component setFactory(String createMethod) {
         return setFactory(null, createMethod);
     }
 
-    public synchronized Component setImplementation(Object implementation)
-    {
+    public synchronized Component setImplementation(Object implementation) {
         m_service.ensureNotActive();
         m_serviceImpl = implementation;
         return this;
     }
 
-    public Component setInterface(String serviceName, Dictionary properties)
-    {
+    public Component setInterface(String serviceName, Dictionary properties) {
         return setInterface(new String[] { serviceName }, properties);
     }
 
@@ -226,30 +203,25 @@
         return this;
     }
 
-    public Component setServiceProperties(Dictionary serviceProperties)
-    {
-        synchronized (this)
-        {
+    public Component setServiceProperties(Dictionary serviceProperties) {
+        synchronized (this) {
             m_serviceProperties = serviceProperties;
         }
         // Set the properties to all already instantiated services.
         if (serviceProperties != null) {
             AbstractDecorator ad = (AbstractDecorator) m_service.getService();
-            if (ad != null)
-            {
+            if (ad != null) {
                 ad.setServiceProperties(serviceProperties);
             }
         }
         return this;
     }
 
-    public void start()
-    {
+    public void start() {
         m_service.start();
     }
 
-    public void stop()
-    {
+    public void stop() {
         m_service.stop();
     }
     
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
index 0828b3f..ab45808 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ResourceAdapterServiceImpl.java
@@ -23,15 +23,17 @@
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.ResourceDependency;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.ComponentStateListener;
 
 /**
  * Resource adapter service implementation. This class extends the FilterService in order to catch
  * some Service methods for configuring actual resource adapter service implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public class ResourceAdapterServiceImpl extends FilterService {
     private Object m_callbackInstance = null;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
index 07d3d74..969356b 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/BundleDependencyImpl.java
@@ -25,9 +25,9 @@
 import java.util.List;
 
 import org.apache.felix.dm.BundleDependency;
+import org.apache.felix.dm.ComponentDependencyDeclaration;
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.DependencyService;
-import org.apache.felix.dm.ComponentDependencyDeclaration;
 import org.apache.felix.dm.InvocationUtil;
 import org.apache.felix.dm.impl.DefaultNullObject;
 import org.apache.felix.dm.impl.Logger;
@@ -40,6 +40,9 @@
 import org.osgi.framework.InvalidSyntaxException;
 import org.osgi.service.log.LogService;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class BundleDependencyImpl extends DependencyBase implements BundleDependency, BundleTrackerCustomizer, ComponentDependencyDeclaration {
 	private final BundleContext m_context;
 	private boolean m_isStarted;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/DependencyBase.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/DependencyBase.java
index a3a1f7a..c3bd124 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/DependencyBase.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/DependencyBase.java
@@ -1,9 +1,30 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.apache.felix.dm.impl.dependencies;
 
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.DependencyActivation;
 import org.apache.felix.dm.impl.Logger;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public abstract class DependencyBase implements Dependency, DependencyActivation {
     private boolean m_isRequired;
     private boolean m_isInstanceBound;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
index 4a652cb..f000c50 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/ResourceDependencyImpl.java
@@ -25,24 +25,25 @@
 import java.util.List;
 import java.util.Properties;
 
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ComponentDependencyDeclaration;
 import org.apache.felix.dm.Dependency;
 import org.apache.felix.dm.DependencyActivation;
 import org.apache.felix.dm.DependencyService;
 import org.apache.felix.dm.InvocationUtil;
 import org.apache.felix.dm.ResourceDependency;
 import org.apache.felix.dm.ResourceHandler;
-import org.apache.felix.dm.Component;
-import org.apache.felix.dm.ComponentDependencyDeclaration;
 import org.apache.felix.dm.impl.Logger;
 import org.osgi.framework.BundleContext;
 import org.osgi.framework.ServiceRegistration;
 import org.osgi.service.log.LogService;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class ResourceDependencyImpl extends DependencyBase implements ResourceDependency, ResourceHandler, DependencyActivation, ComponentDependencyDeclaration {
 	private volatile BundleContext m_context;
 	private volatile ServiceRegistration m_registration;
-//	private long m_resourceCounter;
-
     private Object m_callbackInstance;
     private String m_callbackAdded;
     private String m_callbackChanged;
@@ -313,63 +314,6 @@
         return this;
     }
     
-//    private void invokeCallbackMethod(Object[] instances, String methodName, Object service) {
-//        for (int i = 0; i < instances.length; i++) {
-//            try {
-//                invokeCallbackMethod(instances[i], methodName, service);
-//            }
-//            catch (NoSuchMethodException e) {
-//                m_logger.log(Logger.LOG_DEBUG, "Method '" + methodName + "' does not exist on " + instances[i] + ". Callback skipped.");
-//            }
-//        }
-//    }
-//
-//    private void invokeCallbackMethod(Object instance, String methodName, Object service) throws NoSuchMethodException {
-//        Class currentClazz = instance.getClass();
-//        boolean done = false;
-//        while (!done && currentClazz != null) {
-//            done = invokeMethod(instance, currentClazz, methodName,
-//                new Class[][] {{Resource.class}, {Object.class}, {}},
-//                new Object[][] {{service}, {service}, {}},
-//                false);
-//            if (!done) {
-//                currentClazz = currentClazz.getSuperclass();
-//            }
-//        }
-//        if (!done && currentClazz == null) {
-//            throw new NoSuchMethodException(methodName);
-//        }
-//    }
-//    
-//    private boolean invokeMethod(Object object, Class clazz, String name, Class[][] signatures, Object[][] parameters, boolean isSuper) {
-//        Method m = null;
-//        for (int i = 0; i < signatures.length; i++) {
-//            Class[] signature = signatures[i];
-//            try {
-//                m = clazz.getDeclaredMethod(name, signature);
-//                if (!(isSuper && Modifier.isPrivate(m.getModifiers()))) {
-//                    m.setAccessible(true);
-//                    try {
-//                        m.invoke(object, parameters[i]);
-//                    }
-//                    catch (InvocationTargetException e) {
-//                        m_logger.log(Logger.LOG_ERROR, "Exception while invoking method " + m + ".", e);
-//                    }
-//                    // we did find and invoke the method, so we return true
-//                    return true;
-//                }
-//            }
-//            catch (NoSuchMethodException e) {
-//                // ignore this and keep looking
-//            }
-//            catch (Exception e) {
-//                // could not even try to invoke the method
-//                m_logger.log(Logger.LOG_ERROR, "Exception while trying to invoke method " + m + ".", e);
-//            }
-//        }
-//        return false;
-//    }
-    
     private synchronized Object[] getCallbackInstances(DependencyService ds) {
         if (m_callbackInstance == null) {
             return ds.getCompositionInstances();
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/TemporalServiceDependencyImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/TemporalServiceDependencyImpl.java
index 7ae64f0..495bc22 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/TemporalServiceDependencyImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/dependencies/TemporalServiceDependencyImpl.java
@@ -25,10 +25,11 @@
 import org.osgi.framework.ServiceReference;
 
 /**
-* Temporal Service dependency implementation, used to hide temporary service dependency "outage".
-* Only works with required dependency.
-* (see javadoc in {@link TemporalServiceDependency}).
-*/
+ * Temporal Service dependency implementation, used to hide temporary service dependency "outage".
+ * Only works with a required dependency.
+ *
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class TemporalServiceDependencyImpl extends ServiceDependencyImpl implements TemporalServiceDependency, InvocationHandler {
     // Max millis to wait for service availability.
     private long m_timeout = 30000;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/AttributeDefinitionImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/AttributeDefinitionImpl.java
index 3d4711e..3a72c95 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/AttributeDefinitionImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/AttributeDefinitionImpl.java
@@ -20,67 +20,57 @@
 
 import org.osgi.service.metatype.AttributeDefinition;
 
-public class AttributeDefinitionImpl implements AttributeDefinition
-{
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
+public class AttributeDefinitionImpl implements AttributeDefinition {
     private PropertyMetaDataImpl m_propertyMetaData;
     private Resource m_resource;
 
-    public AttributeDefinitionImpl(PropertyMetaDataImpl propertyMetaData, Resource resource)
-    {
+    public AttributeDefinitionImpl(PropertyMetaDataImpl propertyMetaData, Resource resource) {
         m_propertyMetaData = propertyMetaData;
         m_resource = resource;
     }
 
-    public int getCardinality()
-    {
+    public int getCardinality() {
         return m_propertyMetaData.getCardinality();
     }
 
-    public String[] getDefaultValue()
-    {
+    public String[] getDefaultValue() {
         return m_propertyMetaData.getDefaults();
     }
 
-    public String getDescription()
-    {
+    public String getDescription() {
         return m_resource.localize(m_propertyMetaData.getDescription());
     }
 
-    public String getID()
-    {
+    public String getID() {
         return m_propertyMetaData.getId();
     }
 
-    public String getName()
-    {
+    public String getName() {
         return m_resource.localize(m_propertyMetaData.getHeading());
     }
 
-    public String[] getOptionLabels()
-    {
+    public String[] getOptionLabels() {
         String[] labels = m_propertyMetaData.getOptionLabels();
-        if (labels != null)
-        {
-            for (int i = 0; i < labels.length; i++)
-            {
+        if (labels != null) {
+            for (int i = 0; i < labels.length; i++) {
                 labels[i] = m_resource.localize(labels[i]);
             }
         }
         return labels;
     }
 
-    public String[] getOptionValues()
-    {
+    public String[] getOptionValues() {
         return m_propertyMetaData.getOptionValues();
     }
 
-    public int getType()
-    {
+    public int getType() {
         return m_propertyMetaData.getType();
     }
 
-    public String validate(String value)
-    {
+    public String validate(String value) {
         return null;
     }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java
index c6711b1..a3704a2 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/MetaTypeProviderImpl.java
@@ -47,9 +47,10 @@
  * When a ConfigurationDepdendency is configured with properties metadata, we provide
  * a specific ManagedService which also implements the MetaTypeProvider interface. This interface
  * allows the MetaTypeService to retrieve our properties metadata, which will then be handled by webconsole.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class MetaTypeProviderImpl implements MetaTypeProvider, ManagedService, ManagedServiceFactory
-{
+public class MetaTypeProviderImpl implements MetaTypeProvider, ManagedService, ManagedServiceFactory {
     private ManagedService m_managedServiceDelegate;
     private ManagedServiceFactory m_managedServiceFactoryDelegate;
     private List m_propertiesMetaData = new ArrayList();
@@ -61,8 +62,7 @@
     private BundleContext m_bctx;
     private String m_pid;
 
-    public MetaTypeProviderImpl(String pid, BundleContext ctx, Logger logger, ManagedService msDelegate, ManagedServiceFactory msfDelegate)
-    {
+    public MetaTypeProviderImpl(String pid, BundleContext ctx, Logger logger, ManagedService msDelegate, ManagedServiceFactory msfDelegate) {
         m_pid = pid;
         m_bctx = ctx;
         m_logger = logger;
@@ -72,10 +72,8 @@
         // By default, this file can be stored in OSGI-INF/l10n/bundle.properties (and corresponding localized version
         // in OSGI-INF/l10n/bundle_en_GB_welsh.properties,  OSGI-INF/l10n/bundle_en_GB.properties, etc ...
         // This default localization property file name can be overriden using the PropertyMetaData.setLocalization method.
-        m_localization = (String) m_bctx.getBundle().getHeaders().get(
-            Constants.BUNDLE_LOCALIZATION);
-        if (m_localization == null)
-        {
+        m_localization = (String) m_bctx.getBundle().getHeaders().get(Constants.BUNDLE_LOCALIZATION);
+        if (m_localization == null) {
             m_localization = Constants.BUNDLE_LOCALIZATION_DEFAULT_BASENAME;
         }
     }
@@ -84,8 +82,7 @@
      * Registers the metatype information of a given configuration property
      * @param property
      */
-    public void add(PropertyMetaData property)
-    {
+    public void add(PropertyMetaData property) {
         m_propertiesMetaData.add(property);
     }
 
@@ -93,8 +90,7 @@
      * A human readable description of the PID this annotation is associated with. Example: "Configuration for the PrinterService bundle".
      * @return A human readable description of the PID this annotation is associated with (may be localized)
      */
-    public void setDescription(String description)
-    {
+    public void setDescription(String description) {
         m_description = description;
     }
 
@@ -102,8 +98,7 @@
      * The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service".
      * @return The label used to display the tab name where the properties are displayed (may be localized)
      */
-    public void setName(String heading)
-    {
+    public void setName(String heading) {
         m_heading = heading;
     }
 
@@ -113,14 +108,12 @@
      * The default localization base name for the properties is OSGI-INF/l10n/bundle, but can
      * be overridden by the manifest Bundle-Localization header (see core specification, in section Localization on page 68).
      */
-    public void setLocalization(String path)
-    {
-        if (path.endsWith(".properties"))
-        {
+    public void setLocalization(String path) {
+        if (path.endsWith(".properties")) {
             throw new IllegalArgumentException(
                 "path must point to the base name of the propertie file, "
-                    + "excluding local suffixes. For example: "
-                    + "foo/bar/person is valid and matches the property file \"foo/bar/person_bundle_en_GB_welsh.properties\"");
+                + "excluding local suffixes. For example: "
+                + "foo/bar/person is valid and matches the property file \"foo/bar/person_bundle_en_GB_welsh.properties\"");
         }
         m_localization = path.startsWith("/") ? path.substring(1) : path;
     }
@@ -133,8 +126,7 @@
      * "en_GB", "en_GB_welsh" ...
      * @return the list of Locale supported by our bundle.
      */
-    public String[] getLocales()
-    {
+    public String[] getLocales() {
         int lastSlash = m_localization.lastIndexOf("/");
         String path = (lastSlash == -1) ? "/" : ("/" + m_localization.substring(0, lastSlash - 1));
         String base = (lastSlash == -1) ? m_localization : m_localization.substring(lastSlash + 1);
@@ -145,20 +137,17 @@
         }
         
         TreeSet set = new TreeSet();
-        while (e.hasMoreElements())
-        {
+        while (e.hasMoreElements()) {
             // We have found a locale property file in the form of "path/file[_language[_ country[_variation]].properties"
             // And now, we have to get the "language[_country[_variation]]" part ...
             URL url = (URL) e.nextElement();
             String name = url.getPath();
             name = name.substring(name.lastIndexOf("/") + 1);
             int underscore = name.indexOf("_");
-            if (underscore != -1)
-            {
+            if (underscore != -1) {
                 name = name.substring(underscore + 1, name.length() - ".properties".length());
             }
-            if (name.length() > 0)
-            {
+            if (name.length() > 0) {
                 set.add(name);
             }
         }
@@ -170,13 +159,10 @@
     /**
      * Returns the ObjectClassDefinition for a given Pid/Locale.
      */
-    public ObjectClassDefinition getObjectClassDefinition(String id, String locale)
-    {
-        try
-        {
+    public ObjectClassDefinition getObjectClassDefinition(String id, String locale) {
+        try {
             // Check if the id matches our PID
-            if (!id.equals(m_pid))
-            {
+            if (!id.equals(m_pid)) {
                 m_logger.log(LogService.LOG_ERROR, "id " + id + " does not match pid " + m_pid);
                 return null;
             }
@@ -186,8 +172,7 @@
                 m_description, m_propertiesMetaData, new Resource(localeProperties));
         }
 
-        catch (Throwable t)
-        {
+        catch (Throwable t) {
             m_logger.log(
                 Logger.LOG_ERROR,
                 "Unexpected exception while geting ObjectClassDefinition for " + id + " (locale="
@@ -200,8 +185,7 @@
      * We also implements the ManagedService and we just delegates the configuration handling to
      * our associated ConfigurationDependency.
      */
-    public void updated(Dictionary properties) throws ConfigurationException
-    {
+    public void updated(Dictionary properties) throws ConfigurationException {
         m_managedServiceDelegate.updated(properties);
     }
 
@@ -211,36 +195,28 @@
      * @return
      * @throws IOException
      */
-    private synchronized Properties getLocaleProperties(String locale) throws IOException
-    {
+    private synchronized Properties getLocaleProperties(String locale) throws IOException {
         locale = locale == null ? Locale.getDefault().toString() : locale;
         Properties properties = (Properties) m_localesProperties.get(locale);
-        if (properties == null)
-        {
+        if (properties == null) {
             properties = new Properties();
-            URL url = m_bctx.getBundle().getEntry(
-                m_localization + ".properties");
-            if (url != null)
-            {
+            URL url = m_bctx.getBundle().getEntry(m_localization + ".properties");
+            if (url != null) {
                 loadLocale(properties, url);
             }
 
             String path = m_localization;
             StringTokenizer tok = new StringTokenizer(locale, "_");
-            while (tok.hasMoreTokens())
-            {
+            while (tok.hasMoreTokens()) {
                 path += "_" + tok.nextToken();
                 url = m_bctx.getBundle().getEntry(path + ".properties");
-                if (url != null)
-                {
+                if (url != null) {
                     properties = new Properties(properties);
                     loadLocale(properties, url);
                 }
             }
-
             m_localesProperties.put(locale, properties);
         }
-
         return properties;
     }
 
@@ -250,43 +226,33 @@
      * @param url
      * @throws IOException
      */
-    private void loadLocale(Properties properties, URL url) throws IOException
-    {
+    private void loadLocale(Properties properties, URL url) throws IOException {
         InputStream in = null;
-        try
-        {
+        try {
             in = url.openStream();
             properties.load(in);
         }
-        finally
-        {
-            if (in != null)
-            {
-                try
-                {
+        finally {
+            if (in != null) {
+                try {
                     in.close();
                 }
-                catch (IOException ignored)
-                {
+                catch (IOException ignored) {
                 }
             }
         }
     }
 
     // ManagedServiceFactory implementation
-    
-    public void deleted(String pid)
-    {
+    public void deleted(String pid) {
         m_managedServiceFactoryDelegate.deleted(pid);
     }
 
-    public String getName()
-    {
+    public String getName() {
         return m_pid;
     }
 
-    public void updated(String pid, Dictionary properties) throws ConfigurationException
-    {
+    public void updated(String pid, Dictionary properties) throws ConfigurationException {
         m_managedServiceFactoryDelegate.updated(pid, properties);
     }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/ObjectClassDefinitionImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/ObjectClassDefinitionImpl.java
index 47e28ff..a5f66bf 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/ObjectClassDefinitionImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/ObjectClassDefinitionImpl.java
@@ -28,9 +28,10 @@
 
 /**
  * ObjectClassDefinition implementation.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class ObjectClassDefinitionImpl implements ObjectClassDefinition
-{
+public class ObjectClassDefinitionImpl implements ObjectClassDefinition {
     // Our OCD name (may be localized)
     private String m_name;
     
@@ -46,8 +47,7 @@
     // The localized resource that can be used when localizing some parameters
     private Resource m_resource;
 
-    public ObjectClassDefinitionImpl(String id, String name, String description, List propertiesMetaData, Resource resource)
-    {
+    public ObjectClassDefinitionImpl(String id, String name, String description, List propertiesMetaData, Resource resource) {
         m_id = id;
         m_name = name;
         m_description = description;
@@ -57,26 +57,21 @@
 
     // --------------------- ObjectClassDefinition ----------------------------------------
 
-    public AttributeDefinition[] getAttributeDefinitions(int filter)
-    {
+    public AttributeDefinition[] getAttributeDefinitions(int filter) {
         List attrs = new ArrayList();
-        for (int i = 0; i < m_propertiesMetaData.size(); i++)
-        {
+        for (int i = 0; i < m_propertiesMetaData.size(); i++) {
             PropertyMetaDataImpl metaData = (PropertyMetaDataImpl) m_propertiesMetaData.get(i);
-            switch (filter)
-            {
+            switch (filter) {
                 case ObjectClassDefinition.ALL:
                     attrs.add(new AttributeDefinitionImpl(metaData, m_resource));
                     break;
                 case ObjectClassDefinition.OPTIONAL:
-                    if (!metaData.isRequired())
-                    {
+                    if (!metaData.isRequired()) {
                         attrs.add(new AttributeDefinitionImpl(metaData, m_resource));
                     }
                     break;
                 case ObjectClassDefinition.REQUIRED:
-                    if (metaData.isRequired())
-                    {
+                    if (metaData.isRequired()) {
                         attrs.add(new AttributeDefinitionImpl(metaData, m_resource));
                     }
                     break;
@@ -87,24 +82,20 @@
         return (AttributeDefinition[]) attrs.toArray(array);
     }
 
-    public String getDescription()
-    {
+    public String getDescription() {
         return m_resource.localize(m_description);
     }
 
-    public String getID()
-    {
+    public String getID() {
         return m_id;
     }
 
-    public InputStream getIcon(int size) throws IOException
-    {
+    public InputStream getIcon(int size) throws IOException {
         // TODO Auto-generated method stub
         return null;
     }
 
-    public String getName()
-    {
+    public String getName() {
         return m_resource.localize(m_name);
     }
 }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/PropertyMetaDataImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/PropertyMetaDataImpl.java
index fc8cd61..50ba1bc 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/PropertyMetaDataImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/PropertyMetaDataImpl.java
@@ -29,9 +29,10 @@
 /**
  * DependencyManager PropertyMetaData Implementation. This class describes meta informations regarding
  * one given configuration property.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class PropertyMetaDataImpl implements PropertyMetaData
-{
+public class PropertyMetaDataImpl implements PropertyMetaData {
     /**
      * List of option labels (may be localized)
      */
@@ -83,68 +84,56 @@
      * Mapping between java types and valid MetaType types.
      * @see {@link AttributeDefinition#getType()}
      */
-    private final static Map m_typeMapping = new HashMap()
-    {
-        {
-            put(Boolean.class, new Integer(AttributeDefinition.BOOLEAN));
-            put(Byte.class, new Integer(AttributeDefinition.BYTE));
-            put(Character.class, new Integer(AttributeDefinition.CHARACTER));
-            put(Double.class, new Integer(AttributeDefinition.FLOAT));
-            put(Integer.class, new Integer(AttributeDefinition.INTEGER));
-            put(Long.class, new Integer(AttributeDefinition.LONG));
-            put(Short.class, new Integer(AttributeDefinition.SHORT));
-            put(String.class, new Integer(AttributeDefinition.STRING));
-        }
-    };
+    private final static Map m_typeMapping = new HashMap() {{
+        put(Boolean.class, new Integer(AttributeDefinition.BOOLEAN));
+        put(Byte.class, new Integer(AttributeDefinition.BYTE));
+        put(Character.class, new Integer(AttributeDefinition.CHARACTER));
+        put(Double.class, new Integer(AttributeDefinition.FLOAT));
+        put(Integer.class, new Integer(AttributeDefinition.INTEGER));
+        put(Long.class, new Integer(AttributeDefinition.LONG));
+        put(Short.class, new Integer(AttributeDefinition.SHORT));
+        put(String.class, new Integer(AttributeDefinition.STRING));
+    }};
 
-    public PropertyMetaData addOption(String optionLabel, String optionValue)
-    {
+    public PropertyMetaData addOption(String optionLabel, String optionValue) {
         m_optionsLabels.add(optionLabel);
         m_optionsValues.add(optionValue);
         return this;
     }
 
-    public PropertyMetaData setCardinality(int cardinality)
-    {
+    public PropertyMetaData setCardinality(int cardinality) {
         m_cardinality = cardinality;
         return this;
     }
 
-    public PropertyMetaData setDefaults(String[] defaults)
-    {
+    public PropertyMetaData setDefaults(String[] defaults) {
         m_defaults = defaults;
         return this;
     }
 
-    public PropertyMetaData setDescription(String description)
-    {
+    public PropertyMetaData setDescription(String description) {
         m_description = description;
         return this;
     }
 
-    public PropertyMetaData setHeading(String heading)
-    {
+    public PropertyMetaData setHeading(String heading) {
         m_heading = heading;
         return this;
     }
 
-    public PropertyMetaData setId(String id)
-    {
+    public PropertyMetaData setId(String id) {
         m_id = id;
         return this;
     }
 
-    public PropertyMetaData setRequired(boolean required)
-    {
+    public PropertyMetaData setRequired(boolean required) {
         m_required = required;
         return this;
     }
 
-    public PropertyMetaData setType(Class classType)
-    {
+    public PropertyMetaData setType(Class classType) {
         Integer type = (Integer) m_typeMapping.get(classType);
-        if (type == null)
-        {
+        if (type == null) {
             throw new IllegalArgumentException("Invalid type: " + classType + ". Valid types are "
                 + m_typeMapping.keySet());
         }
@@ -152,50 +141,41 @@
         return this;
     }
 
-    public String[] getOptionLabels()
-    {
+    public String[] getOptionLabels() {
         String[] optionLabels = new String[m_optionsLabels.size()];
         return (String[]) m_optionsLabels.toArray(optionLabels);
     }
 
-    public String[] getOptionValues()
-    {
+    public String[] getOptionValues() {
         String[] optionValues = new String[m_optionsValues.size()];
         return (String[]) m_optionsValues.toArray(optionValues);
     }
 
-    public int getCardinality()
-    {
+    public int getCardinality() {
         return m_cardinality;
     }
 
-    public String[] getDefaults()
-    {
+    public String[] getDefaults() {
         return m_defaults;
     }
 
-    public String getDescription()
-    {
+    public String getDescription() {
         return m_description;
     }
 
-    public String getHeading()
-    {
+    public String getHeading() {
         return m_heading;
     }
 
-    public String getId()
-    {
+    public String getId() {
         return m_id;
     }
 
-    public boolean isRequired()
-    {
+    public boolean isRequired() {
         return m_required;
     }
 
-    public int getType()
-    {
+    public int getType() {
         return m_type;
     }
     
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/Resource.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/Resource.java
index 529e494..c588a0c 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/Resource.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/metatype/Resource.java
@@ -22,19 +22,18 @@
 
 /**
  * Helper class used to localize a given Property Meta Data.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class Resource
-{
+public class Resource {
     private Properties m_properties;
 
     public Resource(Properties properties) {
         m_properties = properties;
     }
     
-    public String localize(String param)
-    {
-        if (m_properties != null && param != null && param.startsWith("%"))
-        {
+    public String localize(String param) {
+        if (m_properties != null && param != null && param.startsWith("%")) {
             param = param.substring(1);
             return m_properties.getProperty(param);
         }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/AspectFilterIndex.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/AspectFilterIndex.java
index 2223f7d..ffe5b7c 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/AspectFilterIndex.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/AspectFilterIndex.java
@@ -41,6 +41,9 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class AspectFilterIndex implements FilterIndex, ServiceTrackerCustomizer {
     private static final String FILTER_START = "(&(" + Constants.OBJECTCLASS + "=";
     private static final String FILTER_SUBSTRING_0 = ")(&(|(!(" + Constants.SERVICE_RANKING + "=*))(" + Constants.SERVICE_RANKING + "<=";
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptor.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptor.java
index 7f4281d..4246b67 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptor.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptor.java
@@ -29,6 +29,9 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class BundleContextInterceptor extends BundleContextInterceptorBase {
     private final ServiceRegistryCache m_cache;
 
@@ -43,6 +46,7 @@
             filterIndex.addServiceListener(listener, filter);
         }
         else {
+//            System.out.println("BCI:Listener " + listener.getClass().getName() + " filter " + filter);
             m_context.addServiceListener(listener, filter);
         }
     }
@@ -53,6 +57,7 @@
             filterIndex.addServiceListener(listener, null);
         }
         else {
+//            System.out.println("BCI:Listener " + listener.getClass().getName() + " without filter");
             m_context.addServiceListener(listener);
         }
     }
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptorBase.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptorBase.java
index 9ef292f..c32225c 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptorBase.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/BundleContextInterceptorBase.java
@@ -36,7 +36,11 @@
 import org.osgi.framework.ServiceReference;
 import org.osgi.framework.ServiceRegistration;
 
-/** Base class for bundle context interceptors that keep track of service listeners and delegate incoming changes to them. */
+/**
+ * Base class for bundle context interceptors that keep track of service listeners and delegate incoming changes to them.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public abstract class BundleContextInterceptorBase implements BundleContext, ServiceListener {
     protected final BundleContext m_context;
     /** Keeps track of all service listeners and their optional filters. */
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndex.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndex.java
index f77887e..cdc2b86 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndex.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndex.java
@@ -26,6 +26,8 @@
 
 /**
  * A filter index is an interface you can implement to create your own, optimized index for specific filter expressions.
+ * 
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 public interface FilterIndex {
     /** Opens this filter index. */
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndexBundleContext.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndexBundleContext.java
index 4b8d324..ab8f499 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndexBundleContext.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/FilterIndexBundleContext.java
@@ -25,6 +25,9 @@
 import org.osgi.framework.ServiceEvent;
 import org.osgi.framework.ServiceListener;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class FilterIndexBundleContext extends BundleContextInterceptorBase {
     public FilterIndexBundleContext(BundleContext context) {
         super(context);
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/MultiPropertyExactFilter.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/MultiPropertyExactFilter.java
index 5e10b77..422b328 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/MultiPropertyExactFilter.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/MultiPropertyExactFilter.java
@@ -37,6 +37,9 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceReference;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class MultiPropertyExactFilter implements FilterIndex, ServiceTrackerCustomizer {
     private final Object m_lock = new Object();
     private ServiceTracker m_tracker;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/ServiceRegistryCache.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/ServiceRegistryCache.java
index 052675e..29566bf 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/index/ServiceRegistryCache.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/index/ServiceRegistryCache.java
@@ -29,6 +29,9 @@
 import org.osgi.framework.ServiceListener;
 import org.osgi.framework.ServiceRegistration;
 
+/**
+ * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
+ */
 public class ServiceRegistryCache implements ServiceListener/*, CommandProvider*/ {
     private final List /* <FilterIndex> */ m_filterIndexList = new CopyOnWriteArrayList();
     private final BundleContext m_context;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/BundleTracker.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/BundleTracker.java
index 73c3a49..9343375 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/BundleTracker.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/BundleTracker.java
@@ -1,5 +1,4 @@
 package org.apache.felix.dm.tracker;
-
 /*
  * Copyright (c) OSGi Alliance (2007, 2008). All Rights Reserved.
  * 
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/ServiceTrackerCustomizer.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/ServiceTrackerCustomizer.java
index 1422062..857e34a 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/ServiceTrackerCustomizer.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/tracker/ServiceTrackerCustomizer.java
@@ -1,5 +1,4 @@
 package org.apache.felix.dm.tracker;
-
 /*
  * Copyright (c) OSGi Alliance (2000, 2008). All Rights Reserved.
  *