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 2685e87..57ee254 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
@@ -157,14 +157,8 @@
         return m_manager.createResourceDependency();
     }
 
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object aspectImplementation, Dictionary properties) {
-        return m_manager.createAspectService(serviceInterface, serviceFilter, ranking, aspectImplementation, properties);
-    }
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, Dictionary properties) {
-        return m_manager.createAspectService(serviceInterface, serviceFilter, ranking, factory, factoryCreateMethod, properties);
-    }
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, String attributeName, Dictionary properties) {
-        return m_manager.createAspectService(serviceInterface, serviceFilter, ranking, factory, factoryCreateMethod, attributeName, properties);
+    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, String attributeName) {
+        return m_manager.createAspectService(serviceInterface, serviceFilter, ranking, attributeName);
     }
     
     public Service createAdapterService(Class serviceInterface, String serviceFilter, String adapterInterface, Object adapterImplementation, Dictionary adapterProperties) {
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 c704526..aeb5e3e 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
@@ -31,7 +31,7 @@
 import org.apache.felix.dm.dependencies.ServiceDependency;
 import org.apache.felix.dm.dependencies.TemporalServiceDependency;
 import org.apache.felix.dm.impl.AdapterImpl;
-import org.apache.felix.dm.impl.AspectImpl;
+import org.apache.felix.dm.impl.AspectServiceImpl;
 import org.apache.felix.dm.impl.BundleAdapterImpl;
 import org.apache.felix.dm.impl.FactoryConfigurationAdapterImpl;
 import org.apache.felix.dm.impl.FactoryConfigurationAdapterMetaTypeImpl;
@@ -177,49 +177,29 @@
      * It will also inherit all dependencies, and if you declare the original
      * service as a member it will be injected.
      * 
+     * <h3>Usage Example</h3>
+     * 
+     * <blockquote>
+     *  manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "m_aspect")
+     *         .setImplementation(ExistingServiceAspect.class)
+     *         .setServiceProperties(new Hashtable() {{ put("additional", "properties"); }})
+     *         .setComposition("getComposition")
+     *         .setCallbacks(new Handler(), null, "mystart", "mystop", null);
+     * <pre>
+     * </pre>
+     * </blockquote>
+     * 
      * @param serviceInterface the service interface to apply the aspect to
      * @param serviceFilter the filter condition to use with the service interface
-     * @param aspectImplementation the implementation of the aspect
-     * @param aspectProperties additional properties to use with the aspect service registration
+     * @param ranking the level used to organize the aspect chain ordering
+     * @param attributeName, the aspect implementation field name where to inject original service. 
+     *                  If null, any field matching the original service will be injected.
      * @return a service that acts as a factory for generating aspects
      */
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object aspectImplementation, Dictionary aspectProperties) {
-        return createService()
-            .setImplementation(new AspectImpl(serviceInterface, serviceFilter, ranking, aspectImplementation, aspectProperties))
-            .add(createServiceDependency()
-                .setService(serviceInterface, createAspectFilter(serviceFilter))
-                .setAutoConfig(false)
-                .setCallbacks("added", "removed")
-            );
+    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, String attributeName) {
+        return new AspectServiceImpl(this, serviceInterface, serviceFilter, ranking, attributeName);
     }
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, Dictionary aspectProperties) {
-        return createService()
-            .setImplementation(new AspectImpl(serviceInterface, serviceFilter, ranking, factory, factoryCreateMethod, aspectProperties))
-            .add(createServiceDependency()
-                .setService(serviceInterface, createAspectFilter(serviceFilter))
-                .setAutoConfig(false)
-                .setCallbacks("added", "removed")
-            );
-    }
-    public Service createAspectService(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, String attributeName, Dictionary aspectProperties) {
-        return createService()
-            .setImplementation(new AspectImpl(serviceInterface, serviceFilter, ranking, factory, factoryCreateMethod, attributeName, aspectProperties))
-            .add(createServiceDependency()
-                .setService(serviceInterface, createAspectFilter(serviceFilter))
-                .setAutoConfig(false)
-                .setCallbacks("added", "removed")
-            );
-    }
-    private String createAspectFilter(String filter) {
-        // we only want to match services which are not themselves aspects
-        if (filter == null || filter.length() == 0) {
-            return "(!(" + ASPECT + "=*))";
-        }
-        else {
-            return "(&(!(" + ASPECT + "=*))" + filter + ")";
-        }        
-    }
-    
+
     /**
      * Creates a new adapter. The adapter will be applied to any service that
      * matches the specified interface and filter. For each matching service
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 16f23d6..cb9803e 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
@@ -21,11 +21,14 @@
 import java.util.Dictionary;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.dependencies.Dependency;
 import org.apache.felix.dm.resources.Resource;
 import org.apache.felix.dm.service.Service;
+import org.apache.felix.dm.service.ServiceStateListener;
 import org.osgi.framework.Bundle;
 import org.osgi.framework.ServiceReference;
 import org.osgi.service.cm.ConfigurationException;
@@ -45,6 +48,90 @@
         throw new NoSuchMethodError("Method updateService not implemented");
     }
     
+    /**
+     * Set some service properties to all already instantiated services.
+     */
+    public void setServiceProperties(Dictionary serviceProperties) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).setServiceProperties(serviceProperties);
+        }
+    }
+    
+    /**
+     * Remove a StateListener from all already instantiated services.
+     */
+    public void addStateListener(ServiceStateListener listener) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).addStateListener(listener);
+        } 
+    }
+
+    /**
+     * Remove a StateListener from all already instantiated services.
+     */
+    public void removeStateListener(ServiceStateListener listener) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).removeStateListener(listener);
+        } 
+    }
+    
+    /**
+     * Add a Dependency to all already instantiated services.
+     */
+    public void addDependency(Dependency d) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).add(d);
+        } 
+    }
+    
+    /**
+     * Add a Dependency to all already instantiated services.
+     */
+    public void addDependencies(List dependencies) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).add(dependencies);
+        } 
+    }
+
+    /**
+     * Remove a Dependency from all instantiated services.
+     */
+    public void removeDependency(Dependency d) {
+        Map services = new HashMap();
+        synchronized (this) {
+            services.putAll(m_services);
+        }
+        Iterator i = services.values().iterator();
+        while (i.hasNext()) {
+            ((Service) i.next()).remove(d);
+        } 
+    }
+    
     // callbacks for FactoryConfigurationAdapterImpl
     public void updated(String pid, Dictionary properties) throws ConfigurationException {
         try {
@@ -74,8 +161,7 @@
         }
     }
 
-    public synchronized void deleted(String pid)
-    {
+    public void deleted(String pid) {
         Service service = null;
         synchronized (this) {
             service = (Service) m_services.remove(pid);
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectImpl.java
deleted file mode 100644
index 72c1436..0000000
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectImpl.java
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * 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;
-
-import java.util.Dictionary;
-import java.util.Enumeration;
-import java.util.List;
-import java.util.Properties;
-
-import org.apache.felix.dm.DependencyManager;
-import org.apache.felix.dm.service.Service;
-import org.osgi.framework.Constants;
-import org.osgi.framework.ServiceReference;
-
-public class AspectImpl extends AbstractDecorator {
-	private volatile Service m_service;
-	private final Class m_serviceInterface;
-	private final String m_serviceFilter;
-	private final Object m_aspectImplementation;
-    private final Dictionary m_aspectProperties;
-    private final Object m_factory;
-    private final String m_factoryCreateMethod;
-    private final int m_ranking;
-    private final String m_attributeName;
-	
-	public AspectImpl(Class serviceInterface, String serviceFilter, int ranking, Object aspectImplementation, Dictionary properties) {
-		m_serviceInterface = serviceInterface;
-		m_serviceFilter = serviceFilter;
-		m_aspectImplementation = aspectImplementation;
-		m_aspectProperties = properties;
-		m_factory = null;
-		m_factoryCreateMethod = null;
-		m_ranking = ranking;
-        m_attributeName = null;
-	}
-	
-    public AspectImpl(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, Dictionary properties) {
-        m_serviceInterface = serviceInterface;
-        m_serviceFilter = serviceFilter;
-        m_factory = factory;
-        m_factoryCreateMethod = factoryCreateMethod;
-        m_aspectProperties = properties;
-        m_aspectImplementation = null;
-        m_ranking = ranking;
-        m_attributeName = null;
-    }
-    
-    public AspectImpl(Class serviceInterface, String serviceFilter, int ranking, Object factory, String factoryCreateMethod, String attributeName, Dictionary properties) {
-        m_serviceInterface = serviceInterface;
-        m_serviceFilter = serviceFilter;
-        m_factory = factory;
-        m_factoryCreateMethod = factoryCreateMethod;
-        m_attributeName = attributeName;
-        m_aspectProperties = properties;
-        m_aspectImplementation = null;
-        m_ranking = ranking;
-    }
-
-    public Service createService(Object[] properties) {
-        ServiceReference ref = (ServiceReference) properties[0]; 
-        Object service = properties[1];
-        Properties props = new Properties();
-        // first add our aspect property
-        props.put(DependencyManager.ASPECT, ref.getProperty(Constants.SERVICE_ID));
-        // and the ranking
-        props.put(Constants.SERVICE_RANKING, Integer.valueOf(m_ranking));
-        String[] keys = ref.getPropertyKeys();
-        for (int i = 0; i < keys.length; i++) {
-            props.put(keys[i], ref.getProperty(keys[i]));
-        }
-        if (m_aspectProperties != null) {
-            Enumeration e = m_aspectProperties.keys();
-            while (e.hasMoreElements()) {
-                Object key = e.nextElement();
-                props.put(key, m_aspectProperties.get(key));
-            }
-        }
-        List dependencies = m_service.getDependencies();
-        dependencies.remove(0);
-        if (m_aspectImplementation == null) {
-            if (m_attributeName == null) {
-                return m_manager.createService()
-                .setInterface(m_serviceInterface.getName(), props)
-                .setFactory(m_factory, m_factoryCreateMethod)
-                .add(dependencies)
-                .add(m_manager.createServiceDependency()
-                    .setService(m_serviceInterface, createAspectFilter(m_serviceFilter))
-                    .setRequired(true));
-            }
-            else {
-                return m_manager.createService()
-                .setInterface(m_serviceInterface.getName(), props)
-                .setFactory(m_factory, m_factoryCreateMethod)
-                .add(dependencies)
-                .add(m_manager.createServiceDependency()
-                    .setService(m_serviceInterface, createAspectFilter(m_serviceFilter))
-                    .setAutoConfig(m_attributeName)
-                    .setRequired(true));
-            }
-        }
-        else {
-            return m_manager.createService()
-                .setInterface(m_serviceInterface.getName(), props)
-                .setImplementation(m_aspectImplementation)
-                .add(dependencies)
-                .add(m_manager.createServiceDependency()
-                    .setService(m_serviceInterface, createAspectFilter(m_serviceFilter))
-                    .setRequired(true));
-        }
-    }
-    private String createAspectFilter(String filter) {
-        if (filter == null || filter.length() == 0) {
-            return "(|(!(" + Constants.SERVICE_RANKING + "=*))(" + Constants.SERVICE_RANKING + "<=" + (m_ranking - 1) + "))";
-        }
-        else {
-            return "(&(|(!(" + Constants.SERVICE_RANKING + "=*))(" + Constants.SERVICE_RANKING + "<=" + (m_ranking - 1) + "))" + filter + ")";
-        }
-    }
-}
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
new file mode 100644
index 0000000..b298e68
--- /dev/null
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/AspectServiceImpl.java
@@ -0,0 +1,155 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.dependencies.Dependency;
+import org.apache.felix.dm.dependencies.ServiceDependency;
+import org.apache.felix.dm.service.Service;
+import org.apache.felix.dm.service.ServiceStateListener;
+import org.osgi.framework.Constants;
+import org.osgi.framework.ServiceReference;
+
+/**
+ * Aspect Service implementation. This class extends the FilterService in order to catch
+ * some Service methods for configuring actual aspect service implementation.
+ */
+public class AspectServiceImpl extends FilterService
+{
+    public AspectServiceImpl(DependencyManager dm, Class aspectInterface, String aspectFilter, int ranking, String autoConfig)
+    { 
+        super(dm.createService()); // This service will be filtered by our super class, allowing us to take control.
+        m_service.setImplementation(new AspectImpl(aspectInterface, aspectFilter, ranking, autoConfig))
+                 .add(dm.createServiceDependency()
+                      .setService(aspectInterface, createAspectFilter(aspectFilter))
+                      .setAutoConfig(false)
+                      .setCallbacks("added", "removed"));
+    }
+
+    private String createAspectFilter(String filter) {
+        // we only want to match services which are not themselves aspects
+        if (filter == null || filter.length() == 0) {
+            return "(!(" + DependencyManager.ASPECT + "=*))";
+        }
+        else {
+            return "(&(!(" + DependencyManager.ASPECT + "=*))" + filter + ")";
+        }        
+    }
+    
+    /**
+     * This class is the Aspect Implementation. It will create the actual Aspect Service, and
+     * will use the Aspect Service parameters provided by our enclosing class.
+     */
+    class AspectImpl extends AbstractDecorator {
+        private final Class m_aspectInterface; // the service decorated by this aspect
+        private final String m_aspectFilter; // the service filter decorated by this aspect
+        private final int m_ranking; // the aspect ranking
+        private final String m_field; // the aspect impl field name where to inject decorated service
+      
+        public AspectImpl(Class aspectInterface, String aspectFilter, int ranking, String field) {
+            m_aspectInterface = aspectInterface;
+            m_aspectFilter = aspectFilter;
+            m_ranking = ranking;
+            m_field = field;
+        }
+        
+        public Service createService(Object[] params) {
+            List dependencies = m_service.getDependencies();
+            // remove our internal dependency
+            dependencies.remove(0);
+            Properties serviceProperties = getServiceProperties(params);
+            String[] serviceInterfaces = getServiceInterfaces();
+            Service service = m_manager.createService()
+                .setInterface(serviceInterfaces, serviceProperties)
+                .setImplementation(m_serviceImpl)
+                .setFactory(m_factory, m_factoryCreateMethod) // if not set, no effect
+                .setComposition(m_compositionInstance, m_compositionMethod) // if not set, no effect
+                .setCallbacks(m_callbackObject, m_init, m_start, m_stop, m_destroy) // if not set, no effect
+                .add(dependencies)
+                .add(getAspectDependency());
+            for (int i = 0; i < m_stateListeners.size(); i ++) {
+                service.addStateListener((ServiceStateListener) m_stateListeners.get(i));
+            }
+            return service;                
+        }
+        
+        private Properties getServiceProperties(Object[] params) {
+            ServiceReference ref = (ServiceReference) params[0]; 
+            Object service = params[1];
+            Properties props = new Properties();
+            // first add our aspect property
+            props.put(DependencyManager.ASPECT, ref.getProperty(Constants.SERVICE_ID));
+            // and the ranking
+            props.put(Constants.SERVICE_RANKING, Integer.valueOf(m_ranking));
+            String[] keys = ref.getPropertyKeys();
+            for (int i = 0; i < keys.length; i++) {
+                props.put(keys[i], ref.getProperty(keys[i]));
+            }
+            if (m_serviceProperties != null) {
+                Enumeration e = m_serviceProperties.keys();
+                while (e.hasMoreElements()) {
+                    Object key = e.nextElement();
+                    props.put(key, m_serviceProperties.get(key));
+                }
+            }
+            return props;
+        }
+        
+        private String[] getServiceInterfaces()
+        {
+            List serviceNames = new ArrayList();
+            // Of course, we provide the aspect interface.
+            serviceNames.add(m_aspectInterface.getName());
+            // But also append additional aspect implementation interfaces.
+            if (m_serviceInterfaces != null) {
+                for (int i = 0; i < m_serviceInterfaces.length; i ++) {
+                    if (! m_serviceInterfaces[i].equals(m_aspectInterface.getName())) {
+                        serviceNames.add(m_serviceInterfaces[i]);
+                    }
+                }
+            }
+            return (String[]) serviceNames.toArray(new String[serviceNames.size()]);
+        }
+
+       private Dependency getAspectDependency() {
+           ServiceDependency sd = 
+               m_manager.createServiceDependency()
+                        .setService(m_aspectInterface, createAspectFilter(m_aspectFilter))
+                        .setRequired(true);
+        
+           if (m_field != null) {
+               sd.setAutoConfig(m_field);
+           }
+           return sd;
+        }
+
+       private String createAspectFilter(String filter) {
+           if (filter == null || filter.length() == 0) {
+               return "(|(!(" + Constants.SERVICE_RANKING + "=*))(" + Constants.SERVICE_RANKING + "<=" + (m_ranking - 1) + "))";
+           } else {
+               return "(&(|(!(" + Constants.SERVICE_RANKING + "=*))(" + Constants.SERVICE_RANKING + "<=" + (m_ranking - 1) + "))" + filter + ")";
+           }
+       }
+    }
+}
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
new file mode 100644
index 0000000..26719b5
--- /dev/null
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/FilterService.java
@@ -0,0 +1,254 @@
+/*
+ * 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;
+
+import java.util.ArrayList;
+import java.util.Dictionary;
+import java.util.Iterator;
+import java.util.List;
+
+import org.apache.felix.dm.dependencies.Dependency;
+import org.apache.felix.dm.service.Service;
+import org.apache.felix.dm.service.ServiceStateListener;
+import org.osgi.framework.ServiceRegistration;
+
+/**
+ * This class allows to filter a Service interface. All Aspect/Adapters extends this class
+ * in order to add functionality to the default Service implementation.
+ */
+public class FilterService implements Service
+{
+    protected ServiceImpl m_service;
+    protected List m_stateListeners = new ArrayList();
+    protected String m_init = "init";
+    protected String m_start = "start";
+    protected String m_stop = "stop";
+    protected String m_destroy = "destroy";
+    protected Object m_callbackObject;
+    protected Object m_compositionInstance;
+    protected String m_compositionMethod;
+    protected String[] m_serviceInterfaces;
+    protected Object m_serviceImpl;
+    protected Object m_factory;
+    protected String m_factoryCreateMethod;
+    protected Dictionary m_serviceProperties;
+
+    public FilterService(Service service)
+    {
+        m_service = (ServiceImpl) service;
+    }
+
+    public Service 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
+        // we have nothing to do.
+        if (! dependency.isRequired()) {
+            AbstractDecorator ad = (AbstractDecorator) m_service.getService();
+            if (ad != null)
+            {
+                ad.addDependency(dependency);
+            }
+        }
+        return this;
+    }
+
+    public Service 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
+        // service will be stopped/restarted.
+        Iterator it = dependencies.iterator();
+        while (it.hasNext()) {
+            if (((Dependency) it.next()).isRequired()) {
+                return this;
+            }
+        }
+        // Ok, the list contains no required dependencies: add optionals dependencies in already instantiated
+        // services.
+        AbstractDecorator ad = (AbstractDecorator) m_service.getService();
+        if (ad != null)
+        {
+            ad.addDependencies(dependencies);
+        }
+        return this;
+    }
+
+    public void addStateListener(ServiceStateListener listener)
+    {
+        synchronized (this)
+        {
+            m_stateListeners.add(listener);
+        }
+        // Add the listener to all already instantiated services.
+        AbstractDecorator ad = (AbstractDecorator) m_service.getService();
+        if (ad != null)
+        {
+            ad.addStateListener(listener);
+        }
+    }
+
+    public List getDependencies()
+    {
+        return m_service.getDependencies();
+    }
+
+    public Object getService()
+    {
+        return m_service.getService();
+    }
+
+    public synchronized Dictionary getServiceProperties()
+    {
+        return m_serviceProperties;
+    }
+
+    public ServiceRegistration getServiceRegistration()
+    {
+        return m_service.getServiceRegistration();
+    }
+
+    public Service 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
+        // we have nothing to do.
+        if (!dependency.isRequired())
+        {
+            AbstractDecorator ad = (AbstractDecorator) m_service.getService();
+            if (ad != null)
+            {
+                ad.removeDependency(dependency);
+            }
+        }
+        return this;
+    }
+
+    public void removeStateListener(ServiceStateListener listener)
+    {
+        synchronized (this)
+        {
+            m_stateListeners.remove(listener);
+        }
+        // Remove the listener from all already instantiated services.
+        AbstractDecorator ad = (AbstractDecorator) m_service.getService();
+        if (ad != null)
+        {
+            ad.removeStateListener(listener);
+        }
+    }
+
+    public synchronized Service setCallbacks(Object instance, String init, String start, String stop,
+                                             String destroy)
+    {
+        m_service.ensureNotActive();
+        m_callbackObject = instance;
+        m_init = init;
+        m_start = start;
+        m_stop = stop;
+        m_destroy = destroy;
+        return this;
+    }
+
+    public Service setCallbacks(String init, String start, String stop, String destroy)
+    {
+        setCallbacks(null, init, start, stop, destroy);
+        return this;
+    }
+
+    public synchronized Service setComposition(Object instance, String getMethod)
+    {
+        m_service.ensureNotActive();
+        m_compositionInstance = instance;
+        m_compositionMethod = getMethod;
+        return this;
+    }
+
+    public synchronized Service setComposition(String getMethod)
+    {
+        m_service.ensureNotActive();
+        m_compositionMethod = getMethod;
+        return this;
+    }
+
+    public synchronized Service setFactory(Object factory, String createMethod)
+    {
+        m_service.ensureNotActive();
+        m_factory = factory;
+        m_factoryCreateMethod = createMethod;
+        return this;
+    }
+
+    public Service setFactory(String createMethod)
+    {
+        return setFactory(null, createMethod);
+    }
+
+    public synchronized Service setImplementation(Object implementation)
+    {
+        m_service.ensureNotActive();
+        m_serviceImpl = implementation;
+        return this;
+    }
+
+    public Service setInterface(String serviceName, Dictionary properties)
+    {
+        return setInterface(new String[] { serviceName }, properties);
+    }
+
+    public synchronized Service setInterface(String[] serviceInterfaces, Dictionary properties) {
+        m_service.ensureNotActive();
+        if (serviceInterfaces != null) {
+            m_serviceInterfaces = new String[serviceInterfaces.length];
+            System.arraycopy(serviceInterfaces, 0, m_serviceInterfaces, 0, serviceInterfaces.length);
+            m_serviceProperties = properties;
+        }
+        return this;
+    }
+
+    public Service 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)
+            {
+                ad.setServiceProperties(serviceProperties);
+            }
+        }
+        return this;
+    }
+
+    public void start()
+    {
+        m_service.start();
+    }
+
+    public void stop()
+    {
+        m_service.stop();
+    }
+}
\ No newline at end of file
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
index 36381c4..88fe9f1 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/impl/ServiceImpl.java
@@ -422,11 +422,12 @@
 	    return null;
 	}
 
-	public synchronized void setServiceProperties(Dictionary serviceProperties) {
+	public synchronized Service setServiceProperties(Dictionary serviceProperties) {
 	    m_serviceProperties = serviceProperties;
 	    if ((m_registration != null) && (m_serviceName != null)) {
 	        m_registration.setProperties(calculateServiceProperties());
 	    }
+	    return this;
 	}
 
 	// service state listener methods
@@ -991,7 +992,7 @@
         }
     }
 
-    private void ensureNotActive() {
+    protected void ensureNotActive() {
     	State state;
     	synchronized (m_dependencies) {
     		state = m_state;
diff --git a/dependencymanager/core/src/main/java/org/apache/felix/dm/service/Service.java b/dependencymanager/core/src/main/java/org/apache/felix/dm/service/Service.java
index c84fdff..8c06db6 100644
--- a/dependencymanager/core/src/main/java/org/apache/felix/dm/service/Service.java
+++ b/dependencymanager/core/src/main/java/org/apache/felix/dm/service/Service.java
@@ -136,7 +136,7 @@
      * 
      * @param serviceProperties the properties
      */
-    public void setServiceProperties(Dictionary serviceProperties);
+    public Service setServiceProperties(Dictionary serviceProperties);
     
     /**
      * Sets the names of the methods used as callbacks. These methods, when found, are
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectChainTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectChainTest.java
index 1ce3336..f4c9ed9 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectChainTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectChainTest.java
@@ -51,9 +51,9 @@
         // create a service provider and consumer
         Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
         Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
-        Service sa2 = m.createAspectService(ServiceInterface.class, null, 20, new ServiceAspect(e, 3), null);
-        Service sa3 = m.createAspectService(ServiceInterface.class, null, 30, new ServiceAspect(e, 2), null);
-        Service sa1 = m.createAspectService(ServiceInterface.class, null, 10, new ServiceAspect(e, 4), null);
+        Service sa2 = m.createAspectService(ServiceInterface.class, null, 20, null).setImplementation(new ServiceAspect(e, 3));
+        Service sa3 = m.createAspectService(ServiceInterface.class, null, 30, null).setImplementation(new ServiceAspect(e, 2));
+        Service sa1 = m.createAspectService(ServiceInterface.class, null, 10, null).setImplementation(new ServiceAspect(e, 4));
         m.add(sc);
 
         m.add(sp);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
index c3f8f26..9737866 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectTest.java
@@ -52,7 +52,7 @@
         Service sp = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
         Service sp2 = m.createService().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface2.class.getName(), null);
         Service sc = m.createService().setImplementation(new ServiceConsumer(e)).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(true));
-        Service sa = m.createAspectService(ServiceInterface.class, null, 1, new ServiceAspect(e), null);
+        Service sa = m.createAspectService(ServiceInterface.class, null, 1, null).setImplementation(new ServiceAspect(e));
         m.add(sc);
         m.add(sp);
         e.waitForStep(3, 15000);
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectWhiteboardTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectWhiteboardTest.java
index 3aaae5f..0252346 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectWhiteboardTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/AspectWhiteboardTest.java
@@ -61,8 +61,8 @@
         Service sp2 = m.createService().setImplementation(new ServiceProvider(e)).setInterface(ServiceInterface.class.getName(), null);
         ServiceConsumer sci = new ServiceConsumer(e);
         Service sc = m.createService().setImplementation(sci).add(m.createServiceDependency().setService(ServiceInterface.class).setRequired(false).setCallbacks("add", "remove"));
-        Service sa2 = m.createAspectService(ServiceInterface.class, null, 20, new ServiceAspect(e, 3), null);
-        Service sa1 = m.createAspectService(ServiceInterface.class, null, 10, new ServiceAspect(e, 4), null);
+        Service sa2 = m.createAspectService(ServiceInterface.class, null, 20, null).setImplementation(new ServiceAspect(e, 3));
+        Service sa1 = m.createAspectService(ServiceInterface.class, null, 10, null).setImplementation(new ServiceAspect(e, 4));
         
         // start with a service consumer
         System.out.println("Adding consumer");
diff --git a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/DynamicProxyAspectTest.java b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/DynamicProxyAspectTest.java
index 6728239..7740268 100644
--- a/dependencymanager/test/src/test/java/org/apache/felix/dm/test/DynamicProxyAspectTest.java
+++ b/dependencymanager/test/src/test/java/org/apache/felix/dm/test/DynamicProxyAspectTest.java
@@ -60,8 +60,10 @@
         Service sp2 = m.createService().setImplementation(new ServiceProvider2(e)).setInterface(ServiceInterface2.class.getName(), null);
         
         // create a dynamic proxy based aspect and hook it up to both services
-        Service a1 = m.createAspectService(ServiceInterface.class, null, 10, new Factory(e, ServiceInterface.class, "ServiceInterfaceProxy"), "create", "m_service", null);
-        Service a2 = m.createAspectService(ServiceInterface2.class, null, 10, new Factory(e, ServiceInterface2.class, "ServiceInterfaceProxy2"), "create", "m_service", null);
+        Service a1 = m.createAspectService(ServiceInterface.class, null, 10, "m_service")
+            .setFactory(new Factory(e, ServiceInterface.class, "ServiceInterfaceProxy"), "create");
+        Service a2 = m.createAspectService(ServiceInterface2.class, null, 10, "m_service")
+            .setFactory(new Factory(e, ServiceInterface2.class, "ServiceInterfaceProxy2"), "create");
 
         // create a client that invokes a method on boths services, validate that it goes
         // through the proxy twice
