You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@felix.apache.org by pd...@apache.org on 2018/09/26 16:45:39 UTC

svn commit: r1842034 [9/11] - in /felix/trunk/dependencymanager: ./ .gradle-wrapper/ cnf/ cnf/buildrepo/ cnf/ext/ cnf/localrepo/ cnf/localrepo/org.apache.felix.gogo.command/ cnf/localrepo/org.apache.felix.gogo.jline/ cnf/localrepo/org.apache.felix.gogo...

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/DependencyManagerCompat.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/DependencyManagerCompat.java?rev=1842034&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/DependencyManagerCompat.java (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/DependencyManagerCompat.java Wed Sep 26 16:45:35 2018
@@ -0,0 +1,724 @@
+/*
+ * 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.compat;
+
+import org.apache.felix.dm.AdapterComponent;
+import org.apache.felix.dm.AspectComponent;
+import org.apache.felix.dm.BundleComponent;
+import org.apache.felix.dm.Component;
+import org.apache.felix.dm.ConfigurationDependency;
+import org.apache.felix.dm.DependencyManager;
+import org.apache.felix.dm.FactoryComponent;
+import org.apache.felix.dm.PropertyMetaData;
+import org.apache.felix.dm.ResourceComponent;
+
+/**
+ * This class contains some methods which have been deprecated from the DependencyManager class.
+ */
+public abstract class DependencyManagerCompat {
+
+    /**
+     * Creates a new aspect component. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * @return an aspect component
+     */
+    public abstract AspectComponent createAspectComponent();
+
+    /**
+     * Creates a new adapter component. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original service plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * @return an adapter component
+     */
+    public abstract AdapterComponent createAdapterComponent();
+
+    /**
+     * Creates a new Factory Component. For each new factory configuration matching
+     * the factoryPid, a component will be created based on the component implementation class.
+     * The component will be registered with the specified interface, and with the specified service properties.
+     * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * 
+     * @return a factory pid component
+     */    
+    public abstract FactoryComponent createFactoryComponent();
+    
+    /**
+     * Creates a new bundle adapter. The adapter will be applied to any bundle that
+     * matches the specified bundle state mask and filter condition. For each matching
+     * bundle an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface
+     * 
+     * TODO and existing properties from the original resource plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * @return a service that acts as a factory for generating bundle adapters
+     */
+    public abstract BundleComponent createBundleComponent();
+
+    /**
+     * Creates a new resource adapter component. The adapter will be applied to any resource that
+     * matches the specified filter condition. For each matching resource
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original resource plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * @return a Resource Adapter Component
+     */
+    public abstract ResourceComponent createResourceComponent();
+
+    /**
+     * Creates a new aspect. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "m_service")
+     *     .setImplementation(ExistingServiceAspect.class)
+     * );
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the aspect to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param ranking the level used to organize the aspect chain ordering
+     * @param autoConfig 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
+     * @deprecated use {@link DependencyManager#createAspectComponent()}
+     */
+    public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String autoConfig) {
+        return createAspectComponent()
+            .setAspect(serviceInterface, serviceFilter, ranking)
+            .setAspectField(autoConfig);
+    }
+
+    /**
+     * Creates a new aspect. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAspectService(ExistingService.class, "(foo=bar)", 10)
+     *     .setImplementation(ExistingServiceAspect.class)
+     * );
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the aspect to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param ranking the level used to organize the aspect chain ordering
+     * @return a service that acts as a factory for generating aspects
+     * @deprecated use {@link DependencyManager#createAspectComponent()}
+     */
+    public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking) {
+        return createAspectComponent()
+            .setAspect(serviceInterface, serviceFilter, ranking);
+    }
+
+    /**
+     * Creates a new aspect. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
+     *     .setImplementation(ExistingServiceAspect.class)
+     * );
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the aspect to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param ranking the level used to organize the aspect chain ordering
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @return a service that acts as a factory for generating aspects
+     * @deprecated use {@link DependencyManager#createAspectComponent()}
+     */
+    public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String add,
+        String change, String remove)
+    {
+        return createAspectComponent()
+            .setAspect(serviceInterface, serviceFilter, ranking)
+            .setAspectCallbacks(add, change, remove, null);
+    }
+
+    /**
+     * Creates a new aspect. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
+     *     .setImplementation(ExistingServiceAspect.class)
+     * );
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the aspect to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param ranking the level used to organize the aspect chain ordering
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @param swap name of the callback method to invoke on swap
+     * @return a service that acts as a factory for generating aspects
+     * @deprecated use {@link DependencyManager#createAspectComponent()}
+     */
+    public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String add, String change, String remove, String swap)
+    {
+        return createAspectComponent()
+            .setAspect(serviceInterface, serviceFilter, ranking)
+            .setAspectCallbacks(add, change, remove, swap);
+    }
+
+    /**
+     * Creates a new aspect. The aspect will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an aspect will be created based on the aspect implementation class.
+     * The aspect will be registered with the same interface and properties
+     * as the original service, plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
+     *     .setImplementation(ExistingServiceAspect.class)
+     * );
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the aspect to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param ranking the level used to organize the aspect chain ordering
+     * @param callbackInstance the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the aspect itself
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @param swap name of the callback method to invoke on swap
+     * @return a service that acts as a factory for generating aspects
+     * @deprecated use {@link DependencyManager#createAspectComponent()}
+     */
+    public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, Object callbackInstance, 
+        String add, String change, String remove, String swap)        
+    {
+        return createAspectComponent()
+            .setAspect(serviceInterface, serviceFilter, ranking)
+            .setAspectCallbackInstance(callbackInstance)
+            .setAspectCallbacks(add, change, remove, swap);
+    }
+    
+    /**
+     * Creates a new adapter. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original service plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAdapterService(AdapteeService.class, "(foo=bar)")
+     *     .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
+     *     .setImplementation(AdapterImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the adapter to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @return a service that acts as a factory for generating adapters
+     * @deprecated use {@link DependencyManager#createAdapterComponent()}
+     */
+    public Component createAdapterService(Class<?> serviceInterface, String serviceFilter) {
+    	return createAdapterComponent().setAdaptee(serviceInterface, serviceFilter);    			
+    }
+
+    /**
+     * Creates a new adapter. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original service plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAdapterService(AdapteeService.class, "(foo=bar)", "m_service")
+     *     .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
+     *     .setImplementation(AdapterImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the adapter to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param autoConfig the name of the member to inject the service into
+     * @return a service that acts as a factory for generating adapters
+     * @deprecated use {@link DependencyManager#createAdapterComponent()}
+     */
+    public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String autoConfig) {
+    	return createAdapterComponent()
+    			.setAdaptee(serviceInterface, serviceFilter)
+    			.setAdapteeField(autoConfig);
+    }
+
+    /**
+     * Creates a new adapter. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original service plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove")
+     *     .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
+     *     .setImplementation(AdapterImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the adapter to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @return a service that acts as a factory for generating adapters
+     * @deprecated use {@link DependencyManager#createAdapterComponent()}
+    */
+    public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String add, String change, String remove) {
+        return createAdapterComponent()
+            .setAdaptee(serviceInterface, serviceFilter)
+            .setAdapteeCallbacks(add, change, remove, null);
+    }
+
+    /**
+     * Creates a new adapter. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface and existing properties
+     * from the original service plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove", "swap")
+     *     .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
+     *     .setImplementation(AdapterImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the adapter to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @param swap name of the callback method to invoke on swap
+     * @return a service that acts as a factory for generating adapters
+     * @deprecated use {@link DependencyManager#createAdapterComponent()}
+     */
+    public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String add, String change, String remove, String swap) {
+        return createAdapterComponent()
+            .setAdaptee(serviceInterface, serviceFilter)
+            .setAdapteeCallbacks(add, change, remove, swap);
+    }
+
+    /**
+     * Creates a new adapter. The adapter will be applied to any service that
+     * matches the specified interface and filter. For each matching service
+     * an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface (and existing properties
+     * from the original service if you set the propagate flag) plus any extra properties you supply here.
+     * It will also inherit all dependencies, and if you declare the original
+     * service as a member it will be injected.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     * manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove", "swap")
+     *     .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
+     *     .setImplementation(AdapterImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param serviceInterface the service interface to apply the adapter to
+     * @param serviceFilter the filter condition to use with the service interface
+     * @param autoConfig the name of the member to inject the service into, or null.
+     * @param callbackInstance the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the adapter itself
+     * @param add name of the callback method to invoke on add
+     * @param change name of the callback method to invoke on change
+     * @param remove name of the callback method to invoke on remove
+     * @param swap name of the callback method to invoke on swap
+     * @param propagate true if the adaptee service properties should be propagated to the adapter service consumers
+     * @return a service that acts as a factory for generating adapters
+     * @deprecated use {@link DependencyManager#createAdapterComponent()}
+     */
+    public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String autoConfig, Object callbackInstance, String add, String change, String remove, String swap, boolean propagate) {
+        return createAdapterComponent()
+            .setAdaptee(serviceInterface, serviceFilter)
+            .setAdapteeField(autoConfig)
+            .setAdapteeCallbackInstance(callbackInstance)
+            .setAdapteeCallbacks(add, change, remove, swap)
+            .setPropagate(propagate);
+    }
+
+    /**
+     * Creates a new Factory Configuration Adapter. For each new factory configuration matching
+     * the factoryPid, an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface, and with the specified adapter service properties.
+     * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * <p> The callback you specify may accept the following method signatures:
+     * <ul><li> updated(Dictionary)
+     * <li> updated(Component, Dictionary)
+     * </ul>
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     *  manager.createFactoryConfigurationAdapterService("MyFactoryPid",  "update", true)
+     *         // The interface to use when registering adapter
+     *         .setInterface(AdapterService.class.getName(), new Hashtable() {{ put("foo", "bar"); }})
+     *         // the implementation of the adapter
+     *         .setImplementation(AdapterServiceImpl.class);
+     * </pre></blockquote>
+     * 
+     * @param factoryPid the pid matching the factory configuration
+     * @param update the adapter method name that will be notified when the factory configuration is created/updated.
+     * @param propagate true if public factory configuration should be propagated to the adapter service properties
+     * @return a service that acts as a factory for generating the managed service factory configuration adapter
+     * @deprecated use {@link DependencyManager#createFactoryComponent()}
+     */
+    public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate) {
+        return createFactoryComponent()
+            .setFactoryPid(factoryPid)
+            .setUpdated(update)
+            .setPropagate(propagate);
+    }
+
+    /**
+     * Creates a new Factory Configuration Adapter using a specific update callback instance. 
+     * For each new factory configuration matching the factoryPid, an adapter will be created 
+     * based on the adapter implementation class.
+     * The adapter will be registered with the specified interface, and with the specified adapter service properties.
+     * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * <p> The callback you specify may accept the following method signatures:
+     * <ul><li> updated(Dictionary)
+     * <li> updated(Component, Dictionary)
+     * </ul>
+     * 
+     * @param factoryPid the pid matching the factory configuration
+     * @param update the adapter method name that will be notified when the factory configuration is created/updated.
+     * @param propagate true if public factory configuration should be propagated to the adapter service properties
+     * @param callbackInstance the object on which the updated callback will be invoked.
+     * @return a service that acts as a factory for generating the managed service factory configuration adapter
+     * @deprecated use {@link DependencyManager#createFactoryComponent()}
+     */
+    public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Object callbackInstance) {
+         return createFactoryComponent()
+            .setFactoryPid(factoryPid)
+            .setUpdated(update)
+            .setPropagate(propagate)
+            .setUpdateInstance(callbackInstance);
+    }
+
+    /**
+     * Creates a new Factory Configuration Adapter. For each new factory configuration matching
+     * the factoryPid, an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface, and with the specified adapter service properties.
+     * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * <p> The callback you specify may accept the following method signatures:
+     * <ul><li> updated(Dictionary)
+     * <li> updated(Component, Dictionary)
+     * <li> updated(ConfigurationType)
+     * <li> updated(Component, ConfigurationType)
+     * </ul>
+     * <p>The ConfigurationType parameter is an implementation of the <code>configType</code> argument.
+     * 
+     * @param factoryPid the pid matching the factory configuration
+     * @param update the adapter method name that will be notified when the factory configuration is created/updated.<p>
+     * @param propagate true if public factory configuration should be propagated to the adapter service properties
+     * @param configType the configuration type to use instead of a dictionary. See the javadoc from {@link ConfigurationDependency} for
+     * more informations about type-safe configuration.
+     * @return a service that acts as a factory for generating the managed service factory configuration adapter
+     * @see ConfigurationDependency
+     * @deprecated use {@link DependencyManager#createFactoryComponent()}
+     */
+    public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Class<?> configType) {
+        return createFactoryComponent()
+            .setFactoryPid(factoryPid)
+            .setUpdated(update)
+            .setPropagate(propagate)
+            .setConfigType(configType);
+    }
+
+    /**
+     * Creates a new Factory Configuration Adapter using a specific update callback instance. 
+     * For each new factory configuration matching the factoryPid, an adapter will be created 
+     * based on the adapter implementation class.
+     * The adapter will be registered with the specified interface, and with the specified adapter service properties.
+     * Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * <p> The callback you specify may accept the following method signatures:
+     * <ul><li> updated(Dictionary)
+     * <li> updated(Component, Dictionary)
+     * <li> updated(ConfigurationType)
+     * <li> updated(Component, ConfigurationType)
+     * </ul>
+     * <p>The ConfigurationType parameter is an implementation of the <code>configType</code> argument.
+     * 
+     * @param factoryPid the pid matching the factory configuration
+     * @param propagate true if public factory configuration should be propagated to the adapter service properties
+     * @param callbackInstance the object on which the updated callback will be invoked.
+     * @param configType the configuration type to use instead of a dictionary.  See the javadoc from {@link ConfigurationDependency} for
+     * more informations about type-safe configuration.
+     * @return a service that acts as a factory for generating the managed service factory configuration adapter
+     * @deprecated use {@link DependencyManager#createFactoryComponent()}
+     */
+    public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Object callbackInstance, Class<?> configType) {
+        return createFactoryComponent()
+            .setFactoryPid(factoryPid)
+            .setUpdated(update)
+            .setPropagate(propagate)
+            .setUpdateInstance(callbackInstance)
+            .setConfigType(configType);
+    }
+
+   /**
+     * Creates a new Managed Service Factory Configuration Adapter with meta type support. For each new 
+     * factory configuration matching the factoryPid, an adapter will be created based on the adapter implementation 
+     * class. The adapter will be registered with the specified interface, and with the specified adapter service 
+     * properties. Depending on the <code>propagate</code> parameter, every public factory configuration properties 
+     * (which don't start with ".") will be propagated along with the adapter service properties. 
+     * It will also inherit all dependencies.
+     * 
+     * <p>Usage example:
+     * 
+     * <blockquote><pre>
+     *       PropertyMetaData[] propertiesMetaData = new PropertyMetaData[] {
+     *            manager.createPropertyMetaData()
+     *               .setCardinality(Integer.MAX_VALUE)
+     *               .setType(String.class)
+     *               .setHeading("English words")
+     *               .setDescription("Declare here some valid english words")
+     *               .setDefaults(new String[] {"hello", "world"})
+     *               .setId("words")
+     *       };
+     * 
+     *       manager.add(createFactoryConfigurationAdapterService("FactoryPid", 
+     *                                                            "updated",
+     *                                                            true, // propagate CM settings
+     *                                                            "EnglishDictionary",
+     *                                                            "English dictionary configuration properties",
+     *                                                            null,
+     *                                                            propertiesMetaData)
+     *               .setImplementation(Adapter.class));
+     * </pre></blockquote>
+     * 
+     * @param factoryPid the pid matching the factory configuration
+     * @param update the adapter method name that will be notified when the factory configuration is created/updated.<p>
+     *  The following signatures are supported:<p>
+     *        <ul><li> updated(Dictionary)
+     *        <li> updated(Component, Dictionary)
+     *        </ul>
+     * @param propagate true if public factory configuration should be propagated to the adapter service properties
+     * @param heading The label used to display the tab name (or section) where the properties are displayed. 
+     *        Example: "Printer Service"
+     * @param desc A human readable description of the factory PID this configuration is associated with. 
+     *        Example: "Configuration for the PrinterService bundle"
+     * @param localization Points to the basename of the Properties file that can localize the Meta Type informations.
+     *        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). You can specify a specific localization basename file using this parameter 
+     *        (e.g. <code>"person"</code> will match person_du_NL.properties in the root bundle directory).
+     * @param propertiesMetaData Array of MetaData regarding configuration properties
+     * @return a service that acts as a factory for generating the managed service factory configuration adapter
+     * @deprecated use {@link DependencyManager#createFactoryComponent()}
+     */
+    public Component createAdapterFactoryConfigurationService(String factoryPid, String update, boolean propagate,
+        String heading, String desc, String localization, PropertyMetaData[] propertiesMetaData)
+    {
+        return createFactoryComponent()
+            .setFactoryPid(factoryPid)
+            .setUpdated(update)
+            .setPropagate(propagate)
+            .setHeading(heading)
+            .setDesc(desc)
+            .setLocalization(localization)
+            .add(propertiesMetaData);
+    }
+    
+    /**
+     * Creates a new bundle adapter. The adapter will be applied to any bundle that
+     * matches the specified bundle state mask and filter condition. For each matching
+     * bundle an adapter will be created based on the adapter implementation class.
+     * The adapter will be registered with the specified interface
+     * 
+     * @param bundleStateMask the bundle state mask to apply
+     * @param bundleFilter the filter to apply to the bundle manifest
+     * @param propagate <code>true</code> if properties from the bundle should be propagated to the service
+     * @return a service that acts as a factory for generating bundle adapters
+     * @deprecated use {@link DependencyManager#createBundleComponent()}
+     */
+    public Component createBundleAdapterService(int bundleStateMask, String bundleFilter, boolean propagate) {
+        return createBundleComponent()
+        		.setBundleFilter(bundleStateMask, bundleFilter)
+        		.setPropagate(propagate);        		
+    }
+
+   /**
+    * Creates a new bundle adapter using specific callback instance. 
+    * The adapter will be applied to any bundle that matches the specified bundle state mask and filter condition. 
+    * For each matching bundle an adapter will be created based on the adapter implementation class, and
+    * The adapter will be registered with the specified interface.
+    * 
+    * @param bundleStateMask the bundle state mask to apply
+    * @param bundleFilter the filter to apply to the bundle manifest
+    * @param propagate <code>true</code> if properties from the bundle should be propagated to the service
+    * @param callbackInstance the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the adapter itself
+    * @param add name of the callback method to invoke on add
+    * @param change name of the callback method to invoke on change
+    * @param remove name of the callback method to invoke on remove
+    * @return a service that acts as a factory for generating bundle adapters
+    * @deprecated use {@link DependencyManager#createBundleComponent()}
+    */
+   public Component createBundleAdapterService(int bundleStateMask, String bundleFilter, boolean propagate,
+   		Object callbackInstance, String add, String change, String remove) {
+       return createBundleComponent()
+       		.setBundleFilter(bundleStateMask,  bundleFilter)
+       		.setPropagate(propagate)
+       		.setBundleCallbacks(add, change, remove)
+       		.setBundleCallbackInstance(callbackInstance);
+   }
+
+   /**
+    * Creates a new resource adapter. The adapter will be applied to any resource that
+    * matches the specified filter condition. For each matching resource
+    * an adapter will be created based on the adapter implementation class.
+    * The adapter will be registered with the specified interface and existing properties
+    * from the original resource plus any extra properties you supply here.
+    * It will also inherit all dependencies, and if you declare the original
+    * service as a member it will be injected.
+    * 
+    * @param resourceFilter the filter condition to use with the resource
+    * @param propagate <code>true</code> if properties from the resource should be propagated to the service
+    * @param callbackInstance instance to invoke the callback on
+    * @param callbackChanged the name of the callback method
+    * @return a service that acts as a factory for generating resource adapters
+    * @deprecated use {@link DependencyManager#createResourceComponent()} 
+    */
+   public Component createResourceAdapterService(String resourceFilter, boolean propagate, Object callbackInstance,
+       String callbackChanged)
+   {
+       return createResourceComponent()
+       		.setResourceFilter(resourceFilter)
+       		.setPropagate(propagate)
+       		.setBundleCallbackInstance( callbackInstance)
+       		.setBundleCallbacks(null, callbackChanged);
+   }
+
+   /**
+    * @see DependencyManager#createResourceAdapterService(String, boolean, Object, String)
+    * @deprecated use {@link DependencyManager#createResourceComponent()} 
+    **/
+   public Component createResourceAdapterService(String resourceFilter, boolean propagate, Object callbackInstance,
+       String callbackSet, String callbackChanged)
+   {
+       return createResourceComponent()
+       		.setResourceFilter(resourceFilter)
+       		.setPropagate(propagate)
+       		.setBundleCallbackInstance( callbackInstance)
+       		.setBundleCallbacks(callbackSet, callbackChanged);
+   }
+
+   /** 
+    * @see DependencyManager#createResourceAdapterService(String, boolean, Object, String)
+    * @deprecated use {@link DependencyManager#createResourceComponent()} 
+    * */
+   public Component createResourceAdapterService(String resourceFilter, Object propagateCallbackInstance,
+       String propagateCallbackMethod, Object callbackInstance, String callbackChanged)
+   {
+       return createResourceComponent()
+       		.setResourceFilter(resourceFilter)
+       		.setPropagate(propagateCallbackInstance, propagateCallbackMethod)
+       		.setBundleCallbackInstance( callbackInstance)
+       		.setBundleCallbacks(null, callbackChanged);
+   }
+
+   /** 
+    * @see DependencyManager#createResourceAdapterService(String, boolean, Object, String)
+    * @deprecated use {@link DependencyManager#createResourceComponent()} 
+    **/
+   public Component createResourceAdapterService(String resourceFilter, Object propagateCallbackInstance,
+       String propagateCallbackMethod, Object callbackInstance, String callbackSet, String callbackChanged)
+   {
+       return createResourceComponent()
+       		.setResourceFilter(resourceFilter)
+       		.setPropagate(propagateCallbackInstance, propagateCallbackMethod)
+       		.setBundleCallbackInstance( callbackInstance)
+       		.setBundleCallbacks(callbackSet, callbackChanged);
+   }
+
+}

Added: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/packageinfo?rev=1842034&view=auto
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/packageinfo (added)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/compat/packageinfo Wed Sep 26 16:45:35 2018
@@ -0,0 +1 @@
+version 1.0.0
\ No newline at end of file

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/AbstractDependency.java Wed Sep 26 16:45:35 2018
@@ -109,6 +109,11 @@ public abstract class AbstractDependency
      * Tells if the dependency service properties have to be propagated to the Component service properties.
      */
     protected volatile boolean m_propagate;
+    
+    /**
+      * Tells if the dependency service properties should override default component service properties (false by default).
+      */
+    protected volatile boolean m_propagateOverrides;
 
     /**
      * The propagate callback instance that is invoked in order to supply dynamically some dependency service properties.
@@ -149,6 +154,7 @@ public abstract class AbstractDependency
         m_propagate = prototype.m_propagate;
         m_propagateCallbackInstance = prototype.m_propagateCallbackInstance;
         m_propagateCallbackMethod = prototype.m_propagateCallbackMethod;
+        m_propagateOverrides = prototype.m_propagateOverrides;
     }
     
     @Override
@@ -198,6 +204,11 @@ public abstract class AbstractDependency
     public boolean isPropagated() {
         return m_propagate;
     }
+    
+    @Override
+    public boolean overrideServiceProperties() {
+    	return m_propagateOverrides;
+    }
 
     /**
      * Returns the dependency service properties (empty by default).
@@ -407,6 +418,14 @@ public abstract class AbstractDependency
         m_propagate = propagate;
         return (T) this;
     }
+    
+    @SuppressWarnings("unchecked")
+    public T setPropagate(boolean propagate, boolean overrideServiceProperties) {
+        ensureNotActive();
+        m_propagate = propagate;
+        m_propagateOverrides = overrideServiceProperties;
+        return (T) this;
+    }
 
     /**
      * Sets a callback instance which can ba invoked with the given method in order to dynamically retrieve the 
@@ -423,7 +442,7 @@ public abstract class AbstractDependency
         m_propagateCallbackMethod = method;
         return (T) this;
     }
-
+        
     /**
      * Sets the add/remove callbacks.
      * @param add the callback to invoke when a dependency is added

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/ComponentContext.java Wed Sep 26 16:45:35 2018
@@ -38,7 +38,7 @@ import org.osgi.framework.BundleContext;
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
 @ProviderType
-public interface ComponentContext extends Component {
+public interface ComponentContext<T extends Component<T>> extends Component<T> {
     /**
      * Returns the Component Executor gate that can be used to ensure proper component event serialization.
      * When you schedule a task in the component executor, your task is executed safely and you do not need
@@ -187,11 +187,16 @@ public interface ComponentContext extend
      * @param config the configuration to wrap, cannot be <code>null</code>.
      * @return an instance of the given type that wraps the given configuration.
      */
-    public <T> T createConfigurationType(Class<T> type, Dictionary<?, ?> config);
+    public <U> U createConfigurationType(Class<U> type, Dictionary<?, ?> config);
                 
     /**
      * Instantiates the component instances.
      * @return this component context.
      */   
     public ComponentContext instantiateComponent();
+    
+    /**
+     * Indicates if the component fields and methods injections are disabled.
+     */
+    public boolean injectionDisabled();
 }

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/packageinfo
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/packageinfo?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/packageinfo (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/context/packageinfo Wed Sep 26 16:45:35 2018
@@ -1 +1 @@
-version 4.3.0
+version 4.4.0

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AdapterServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AdapterServiceImpl.java?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AdapterServiceImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AdapterServiceImpl.java Wed Sep 26 16:45:35 2018
@@ -23,6 +23,7 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
 
+import org.apache.felix.dm.AdapterComponent;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.DependencyManager;
@@ -37,57 +38,68 @@ import org.osgi.framework.ServiceReferen
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class AdapterServiceImpl extends FilterComponent {
+public class AdapterServiceImpl extends FilterComponent<AdapterComponent> implements AdapterComponent {
 	
+    private volatile Class<?> m_adapteeInterface;
+    private volatile String m_adapteeFilter;
+    private volatile String m_adapteeAutoConfig;
+    private volatile String m_adapteeAdd;
+    private volatile String m_adapteeChange;
+    private volatile String m_adapteeRemove;
+    private volatile String m_adapteeSwap;
+    private volatile boolean m_adapteePropage = true;
+    private volatile Object m_adapteeCallbackInstance;
+
 	/**
      * Creates a new Adapter Service implementation.
-     * 
-     * @param dm the dependency manager used to create our internal adapter service
-     * @param adapteeInterface the service interface to apply the adapter to
-     * @param adapteeFilter the filter condition to use with the service interface
-     * @param autoConfig the name of the member to inject the service into
-     * @param callbackInstance the instance to invoke the callback on, or null 
-     * @param add name of the callback method to invoke on add
-     * @param change name of the callback method to invoke on change
-     * @param remove name of the callback method to invoke on remove
-     * @param swap name of the callback method to invoke on swap
-     * @param propagate true if the adaptee service properties should be propagated to the adapter service consumers
      */
-    public AdapterServiceImpl(DependencyManager dm, Class<?> adapteeInterface, String adapteeFilter, String autoConfig, 
-        Object callbackInstance, String add, String change, String remove, String swap, boolean propagate)
-    {
-        super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.
-        m_component.setImplementation(new AdapterImpl(adapteeInterface, adapteeFilter, autoConfig, callbackInstance, add, change, remove, swap, propagate))            
-            .add(dm.createServiceDependency()
-                   .setService(adapteeInterface, adapteeFilter)
+    public AdapterServiceImpl(DependencyManager dm) {
+		super(dm.createComponent());
+    }
+    
+    @Override
+    public AdapterServiceImpl setAdaptee(Class<?> service, String filter) {
+        m_adapteeInterface = service;
+        m_adapteeFilter = filter;
+        return this;
+    }
+    @Override
+    public AdapterServiceImpl setAdapteeField(String autoConfig) {
+        m_adapteeAutoConfig = autoConfig;
+        return this;
+    }
+    @Override
+    public AdapterServiceImpl setAdapteeCallbacks(String add, String change, String remove, String swap) {
+        m_adapteeAdd = add;
+        m_adapteeChange = change;
+        m_adapteeRemove = remove;
+        m_adapteeSwap = swap;
+        return this;
+    }
+    @Override
+    public AdapterServiceImpl setPropagate(boolean propagate) {
+        m_adapteePropage = propagate;
+        return this;
+    }
+    @Override
+    public AdapterServiceImpl setAdapteeCallbackInstance(Object callbackInstance) {
+        m_adapteeCallbackInstance = callbackInstance;
+        return this;
+    }    
+    
+    @Override
+    protected void startInitial() {
+        DependencyManager dm = getDependencyManager();
+        m_component
+        	.setImplementation(new AdapterImpl())            
+        	.setCallbacks("init", null, "stop", null)
+        	.add(dm.createServiceDependency()
+                   .setService(m_adapteeInterface, m_adapteeFilter)
                    .setAutoConfig(false)
-                   .setCallbacks("added", null, "removed", "swapped"))
-            .setCallbacks("init", null, "stop", null);
+                   .setCallbacks("added", null, "removed", "swapped")); 
     }	
-	    
+    
     public class AdapterImpl extends AbstractDecorator {
-        private final Class<?> m_adapteeInterface;
-        private final String m_adapteeFilter;
-        private final Object m_dependencyCallbackInstance;
-        private final String m_add;
-        private final String m_change;
-        private final String m_remove;
-        private final String m_swap;
-        private final String m_autoConfig;
-        private final boolean m_propagate;
-        
-        public AdapterImpl(Class<?> adapteeInterface, String adapteeFilter, String autoConfig, Object callbackInstance, String add, 
-            String change, String remove, String swap, boolean propagate) {
-            m_adapteeInterface = adapteeInterface;
-            m_adapteeFilter = adapteeFilter;
-            m_autoConfig = autoConfig;
-            m_dependencyCallbackInstance = callbackInstance;
-            m_add = add;
-            m_change = change;
-            m_swap = swap;
-            m_remove = remove;
-            m_propagate = propagate;
-        }
         
         public Component createService(Object[] properties) {
             ServiceReference<?> ref = (ServiceReference<?>) properties[0]; 
@@ -100,14 +112,14 @@ public class AdapterServiceImpl extends
             	 .setService(m_adapteeInterface, "(|(" + Constants.SERVICE_ID + "=" + serviceIdToTrack 
             			 	+ ")(" + DependencyManager.ASPECT + "=" + serviceIdToTrack + "))")
                  .setRequired(true);
-            if (m_add != null || m_change != null || m_remove != null || m_swap != null) {
-                dependency.setCallbacks(m_dependencyCallbackInstance, m_add, m_change, m_remove, m_swap);
+            if (m_adapteeAdd != null || m_adapteeChange != null || m_adapteeRemove != null || m_adapteeSwap != null) {
+                dependency.setCallbacks(m_adapteeCallbackInstance, m_adapteeAdd, m_adapteeChange, m_adapteeRemove, m_adapteeSwap);
             }
-            if (m_autoConfig != null) {
-                dependency.setAutoConfig(m_autoConfig);
+            if (m_adapteeAutoConfig != null) {
+                dependency.setAutoConfig(m_adapteeAutoConfig);
             }
             
-            if (m_propagate) {
+            if (m_adapteePropage) {
                 dependency.setPropagate(this, "propagateAdapteeProperties");
             }
             
@@ -119,6 +131,7 @@ public class AdapterServiceImpl extends
                 .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
+                .setScope(m_scope)
                 .add(dependency);
             
             configureAutoConfigState(service, m_component);

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AspectServiceImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AspectServiceImpl.java?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AspectServiceImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/AspectServiceImpl.java Wed Sep 26 16:45:35 2018
@@ -23,6 +23,7 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
 
+import org.apache.felix.dm.AspectComponent;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.DependencyManager;
 import org.apache.felix.dm.ServiceDependency;
@@ -33,34 +34,56 @@ import org.osgi.framework.ServiceReferen
 /**
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class AspectServiceImpl extends FilterComponent {
+public class AspectServiceImpl extends FilterComponent<AspectComponent> implements AspectComponent {
 	
-	private final String m_add;
-	private final String m_change;
-	private final String m_remove;
-	private final String m_swap;
-	private final int m_ranking;
-    private final Object m_dependencyCallbackInstance;
-    
-	public AspectServiceImpl(DependencyManager dm, Class<?> aspectInterface, String aspectFilter, int ranking, String autoConfig, Object callbackInstance, String add, String change, String remove, String swap) {
+	private volatile String m_add;
+	private volatile String m_change;
+	private volatile String m_remove;
+	private volatile String m_swap;
+	private volatile int m_ranking;
+    private volatile Object m_dependencyCallbackInstance;
+	private volatile Class<?> m_serviceInterface;
+	private volatile String m_serviceFilter;
+	private volatile String m_aspectAutoConfig;
+        
+	public AspectServiceImpl(DependencyManager dm) {
 		super(dm.createComponent());
-		m_ranking = ranking;
-		m_add = add;
-		m_change = change;
-		m_remove = remove;
-		m_swap = swap;
-		m_dependencyCallbackInstance = callbackInstance;
-		
-		m_component.setImplementation(new AspectImpl(aspectInterface, autoConfig))
-			.add(dm.createServiceDependency()
-				   .setService(aspectInterface, createDependencyFilterForAspect(aspectFilter))
-				   .setAutoConfig(false)
-				   .setCallbacks("added", "removed"))
-				   .setCallbacks("init", null, "stop", null);
-		
-//		m_component.setDebug("aspectfactory-" + m_ranking);
 	}
 	
+    public AspectServiceImpl setAspect(Class<?> serviceInterface, String filter, int ranking) {
+        m_serviceInterface = serviceInterface;
+        m_serviceFilter = filter;
+        m_ranking = ranking;
+        return this;
+    }
+    public AspectServiceImpl setAspectField(String autoConfig) {
+        m_aspectAutoConfig = autoConfig;
+        return this;
+    }
+    public AspectServiceImpl setAspectCallbacks(String add, String change, String remove, String swap) {
+        m_add = add;
+        m_change = change;
+        m_remove = remove;
+        m_swap = swap;
+        return this;
+    }
+    public AspectServiceImpl setAspectCallbackInstance(Object callbackInstance) {
+        m_dependencyCallbackInstance = callbackInstance;
+        return this;
+    }
+    
+    @Override
+    protected void startInitial() {
+    	DependencyManager dm = getDependencyManager();
+		m_component
+		  	.setImplementation(new AspectImpl(m_serviceInterface, m_aspectAutoConfig))
+		  	.setCallbacks("init", null, "stop", null)
+			.add(dm.createServiceDependency()
+		  		   .setService(m_serviceInterface, createDependencyFilterForAspect(m_serviceFilter))
+	               .setAutoConfig(false)
+	               .setCallbacks("added", "removed"));		    
+    }
+	
 	private String createDependencyFilterForAspect(String aspectFilter) {
         // we only want to match services which are not themselves aspects
         if (aspectFilter == null || aspectFilter.length() == 0) {
@@ -133,6 +156,7 @@ public class AspectServiceImpl extends F
                 .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
+                .setScope(m_scope)
                 .add(aspectDependency);
             
             //service.setDebug("aspectimpl-" + m_ranking);

Modified: felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleAdapterImpl.java
URL: http://svn.apache.org/viewvc/felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleAdapterImpl.java?rev=1842034&r1=1842033&r2=1842034&view=diff
==============================================================================
--- felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleAdapterImpl.java (original)
+++ felix/trunk/dependencymanager/org.apache.felix.dependencymanager/src/org/apache/felix/dm/impl/BundleAdapterImpl.java Wed Sep 26 16:45:35 2018
@@ -22,6 +22,7 @@ import java.util.Enumeration;
 import java.util.Hashtable;
 import java.util.List;
 
+import org.apache.felix.dm.BundleComponent;
 import org.apache.felix.dm.Component;
 import org.apache.felix.dm.ComponentStateListener;
 import org.apache.felix.dm.DependencyManager;
@@ -34,49 +35,63 @@ import org.osgi.framework.Bundle;
  * 
  * @author <a href="mailto:dev@felix.apache.org">Felix Project Team</a>
  */
-public class BundleAdapterImpl extends FilterComponent
+public class BundleAdapterImpl extends FilterComponent<BundleComponent> implements BundleComponent
 {
+    private volatile boolean m_propagate;
+    private volatile int m_bundleStateMask;
+    private volatile String m_bundleFilter;
+    public volatile Object m_cbInstance;
+	public volatile String m_add;
+	public volatile String m_change;
+	public volatile String m_remove;
+
 	/**
      * Creates a new Bundle Adapter Service implementation.
      */
-    public BundleAdapterImpl(DependencyManager dm, int bundleStateMask, String bundleFilter, boolean propagate)
+    public BundleAdapterImpl(DependencyManager dm)
     {
-    	this(dm, bundleStateMask, bundleFilter, propagate, null, null, null, null);
+    	super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.  
+    }
+
+    public BundleComponent setBundleFilter(int bundleStateMask, String bundleFilter) {
+    	m_bundleStateMask = bundleStateMask;
+    	m_bundleFilter = bundleFilter;
+    	return this;
+    }
+            
+    public BundleComponent setBundleCallbacks(String add, String change, String remove) {
+    	m_add = add;
+    	m_change = change;
+    	m_remove = remove;
+    	return this;
+    }
+    
+    public BundleComponent setBundleCallbackInstance(Object callbackInstance) {
+    	m_cbInstance = callbackInstance;
+    	return this;
     }
 
-	public BundleAdapterImpl(DependencyManager dm, int stateMask, String filter, boolean propagate, Object cbInstance, String add, String change, String remove) {
-        super(dm.createComponent()); // This service will be filtered by our super class, allowing us to take control.
+    public BundleComponent setPropagate(boolean propagate) {
+    	m_propagate = propagate;
+    	return this;
+    }
+
+    @Override
+    protected void startInitial() {
+        DependencyManager dm = getDependencyManager();
         m_component
-        	.setImplementation(new BundleAdapterDecorator(stateMask, propagate, cbInstance, add, change, remove))
+        	.setImplementation(new BundleAdapterDecorator())
         	.add(dm.createBundleDependency()
-        		   .setFilter(filter)
-        		   .setStateMask(stateMask)
+        		   .setFilter(m_bundleFilter)
+        		   .setStateMask(m_bundleStateMask)
         		   .setCallbacks("added", "removed"))
         	.setCallbacks("init", null, "stop", null);
 	}
 
 	public class BundleAdapterDecorator extends AbstractDecorator {
-        private final boolean m_propagate;
-        private final int m_bundleStateMask;
-        public final Object m_cbInstance;
-    	public final String m_add;
-    	public final String m_change;
-    	public final String m_remove;
-
-        public BundleAdapterDecorator(int bundleStateMask, boolean propagate) {
-            this(bundleStateMask, propagate, null, null, null, null);
-        }
-        
-		public BundleAdapterDecorator(int bundleStateMask, boolean propagate, Object callbackInstance, String add, String change, String remove) {
-            m_bundleStateMask = bundleStateMask;
-            m_propagate = propagate;
-            m_cbInstance = callbackInstance;
-            m_add = add;
-            m_change = change;
-            m_remove = remove;
-        }
-
-		public Component createService(Object[] properties) {
+		
+		@SuppressWarnings("unchecked")
+		public Component<?> createService(Object[] properties) {
             Bundle bundle = (Bundle) properties[0];
             Hashtable<String, Object> props = new Hashtable<>();
             if (m_serviceProperties != null) {
@@ -90,12 +105,13 @@ public class BundleAdapterImpl extends F
             // the first dependency is always the dependency on the bundle, which
             // will be replaced with a more specific dependency below
             dependencies.remove(0);
-            Component service = m_manager.createComponent()
+            Component<?> service = m_manager.createComponent()
                 .setInterface(m_serviceInterfaces, props)
                 .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
+                .setScope(m_scope)
                 .add(m_manager.createBundleDependency()
                     .setBundle(bundle)
                     .setStateMask(m_bundleStateMask)
@@ -111,5 +127,6 @@ public class BundleAdapterImpl extends F
             configureAutoConfigState(service, m_component);
             return service;
         }
+		
     }
 }