Class DependencyManagerCompat

java.lang.Object
org.apache.felix.dm.compat.DependencyManagerCompat
Direct Known Subclasses:
DependencyManager

public abstract class DependencyManagerCompat extends Object
This class contains some methods which have been deprecated from the DependencyManager class.
  • Constructor Details

    • DependencyManagerCompat

      public DependencyManagerCompat()
  • Method Details

    • createAspectComponent

      public abstract AspectComponent createAspectComponent()
      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.
      Returns:
      an aspect component
    • createAdapterComponent

      public abstract AdapterComponent createAdapterComponent()
      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.
      Returns:
      an adapter component
    • createFactoryComponent

      public abstract FactoryComponent createFactoryComponent()
      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 propagate 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.
      Returns:
      a factory pid component
    • createBundleComponent

      public abstract BundleComponent createBundleComponent()
      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.
      Returns:
      a service that acts as a factory for generating bundle adapters
    • createResourceComponent

      public abstract ResourceComponent createResourceComponent()
      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.
      Returns:
      a Resource Adapter Component
    • createAspectService

      public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String 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.

      Usage example:

       manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "m_service")
           .setImplementation(ExistingServiceAspect.class)
       );
       
      Parameters:
      serviceInterface - the service interface to apply the aspect to
      serviceFilter - the filter condition to use with the service interface
      ranking - the level used to organize the aspect chain ordering
      autoConfig - the aspect implementation field name where to inject original service. If null, any field matching the original service will be injected.
      Returns:
      a service that acts as a factory for generating aspects
    • createAspectService

      public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int 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.

      Usage example:

       manager.createAspectService(ExistingService.class, "(foo=bar)", 10)
           .setImplementation(ExistingServiceAspect.class)
       );
       
      Parameters:
      serviceInterface - the service interface to apply the aspect to
      serviceFilter - the filter condition to use with the service interface
      ranking - the level used to organize the aspect chain ordering
      Returns:
      a service that acts as a factory for generating aspects
    • createAspectService

      public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String add, String change, String remove)
      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.

      Usage example:

       manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
           .setImplementation(ExistingServiceAspect.class)
       );
       
      Parameters:
      serviceInterface - the service interface to apply the aspect to
      serviceFilter - the filter condition to use with the service interface
      ranking - the level used to organize the aspect chain ordering
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      Returns:
      a service that acts as a factory for generating aspects
    • createAspectService

      public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, String add, String change, String remove, String 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.

      Usage example:

       manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
           .setImplementation(ExistingServiceAspect.class)
       );
       
      Parameters:
      serviceInterface - the service interface to apply the aspect to
      serviceFilter - the filter condition to use with the service interface
      ranking - the level used to organize the aspect chain ordering
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      swap - name of the callback method to invoke on swap
      Returns:
      a service that acts as a factory for generating aspects
    • createAspectService

      public Component createAspectService(Class<?> serviceInterface, String serviceFilter, int ranking, Object callbackInstance, String add, String change, String remove, String 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.

      Usage example:

       manager.createAspectService(ExistingService.class, "(foo=bar)", 10, "add", "change", "remove")
           .setImplementation(ExistingServiceAspect.class)
       );
       
      Parameters:
      serviceInterface - the service interface to apply the aspect to
      serviceFilter - the filter condition to use with the service interface
      ranking - the level used to organize the aspect chain ordering
      callbackInstance - the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the aspect itself
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      swap - name of the callback method to invoke on swap
      Returns:
      a service that acts as a factory for generating aspects
    • createAdapterService

      public Component createAdapterService(Class<?> serviceInterface, String 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.

      Usage example:

       manager.createAdapterService(AdapteeService.class, "(foo=bar)")
           .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
           .setImplementation(AdapterImpl.class);
       
      Parameters:
      serviceInterface - the service interface to apply the adapter to
      serviceFilter - the filter condition to use with the service interface
      Returns:
      a service that acts as a factory for generating adapters
    • createAdapterService

      public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String 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.

      Usage example:

       manager.createAdapterService(AdapteeService.class, "(foo=bar)", "m_service")
           .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
           .setImplementation(AdapterImpl.class);
       
      Parameters:
      serviceInterface - the service interface to apply the adapter to
      serviceFilter - the filter condition to use with the service interface
      autoConfig - the name of the member to inject the service into
      Returns:
      a service that acts as a factory for generating adapters
    • createAdapterService

      public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String add, String change, String remove)
      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.

      Usage example:

       manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove")
           .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
           .setImplementation(AdapterImpl.class);
       
      Parameters:
      serviceInterface - the service interface to apply the adapter to
      serviceFilter - the filter condition to use with the service interface
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      Returns:
      a service that acts as a factory for generating adapters
    • createAdapterService

      public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String add, String change, String remove, String 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.

      Usage example:

       manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove", "swap")
           .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
           .setImplementation(AdapterImpl.class);
       
      Parameters:
      serviceInterface - the service interface to apply the adapter to
      serviceFilter - the filter condition to use with the service interface
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      swap - name of the callback method to invoke on swap
      Returns:
      a service that acts as a factory for generating adapters
    • createAdapterService

      public Component createAdapterService(Class<?> serviceInterface, String serviceFilter, String autoConfig, Object callbackInstance, String add, String change, String remove, String swap, boolean propagate)
      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.

      Usage example:

       manager.createAdapterService(AdapteeService.class, "(foo=bar)", "add", "change", "remove", "swap")
           .setInterface(AdapterService.class, new Hashtable() {{ put("extra", "property"); }})
           .setImplementation(AdapterImpl.class);
       
      Parameters:
      serviceInterface - the service interface to apply the adapter to
      serviceFilter - the filter condition to use with the service interface
      autoConfig - the name of the member to inject the service into, or null.
      callbackInstance - the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the adapter itself
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      swap - name of the callback method to invoke on swap
      propagate - true if the adaptee service properties should be propagated to the adapter service consumers
      Returns:
      a service that acts as a factory for generating adapters
    • createFactoryConfigurationAdapterService

      public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean 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 propagate 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.

      The callback you specify may accept the following method signatures:

      • updated(Dictionary)
      • updated(Component, Dictionary)

      Usage example:

        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);
       
      Parameters:
      factoryPid - the pid matching the factory configuration
      update - the adapter method name that will be notified when the factory configuration is created/updated.
      propagate - true if public factory configuration should be propagated to the adapter service properties
      Returns:
      a service that acts as a factory for generating the managed service factory configuration adapter
    • createFactoryConfigurationAdapterService

      public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Object callbackInstance)
      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 propagate 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.

      The callback you specify may accept the following method signatures:

      • updated(Dictionary)
      • updated(Component, Dictionary)
      Parameters:
      factoryPid - the pid matching the factory configuration
      update - the adapter method name that will be notified when the factory configuration is created/updated.
      propagate - true if public factory configuration should be propagated to the adapter service properties
      callbackInstance - the object on which the updated callback will be invoked.
      Returns:
      a service that acts as a factory for generating the managed service factory configuration adapter
    • createFactoryConfigurationAdapterService

      public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Class<?> configType)
      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 propagate 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.

      The callback you specify may accept the following method signatures:

      • updated(Dictionary)
      • updated(Component, Dictionary)
      • updated(ConfigurationType)
      • updated(Component, ConfigurationType)

      The ConfigurationType parameter is an implementation of the configType argument.

      Parameters:
      factoryPid - the pid matching the factory configuration
      update - the adapter method name that will be notified when the factory configuration is created/updated.

      propagate - true if public factory configuration should be propagated to the adapter service properties
      configType - the configuration type to use instead of a dictionary. See the javadoc from ConfigurationDependency for more informations about type-safe configuration.
      Returns:
      a service that acts as a factory for generating the managed service factory configuration adapter
      See Also:
    • createFactoryConfigurationAdapterService

      public Component createFactoryConfigurationAdapterService(String factoryPid, String update, boolean propagate, Object callbackInstance, Class<?> 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 propagate 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.

      The callback you specify may accept the following method signatures:

      • updated(Dictionary)
      • updated(Component, Dictionary)
      • updated(ConfigurationType)
      • updated(Component, ConfigurationType)

      The ConfigurationType parameter is an implementation of the configType argument.

      Parameters:
      factoryPid - the pid matching the factory configuration
      propagate - true if public factory configuration should be propagated to the adapter service properties
      callbackInstance - the object on which the updated callback will be invoked.
      configType - the configuration type to use instead of a dictionary. See the javadoc from ConfigurationDependency for more informations about type-safe configuration.
      Returns:
      a service that acts as a factory for generating the managed service factory configuration adapter
    • createAdapterFactoryConfigurationService

      public Component createAdapterFactoryConfigurationService(String factoryPid, String update, boolean propagate, String heading, String desc, String localization, PropertyMetaData[] propertiesMetaData)
      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 propagate 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.

      Usage example:

             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));
       
      Parameters:
      factoryPid - the pid matching the factory configuration
      update - the adapter method name that will be notified when the factory configuration is created/updated.

      The following signatures are supported:

      • updated(Dictionary)
      • updated(Component, Dictionary)
      propagate - true if public factory configuration should be propagated to the adapter service properties
      heading - The label used to display the tab name (or section) where the properties are displayed. Example: "Printer Service"
      desc - A human readable description of the factory PID this configuration is associated with. Example: "Configuration for the PrinterService bundle"
      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. "person" will match person_du_NL.properties in the root bundle directory).
      propertiesMetaData - Array of MetaData regarding configuration properties
      Returns:
      a service that acts as a factory for generating the managed service factory configuration adapter
    • createBundleAdapterService

      public Component createBundleAdapterService(int bundleStateMask, String bundleFilter, boolean propagate)
      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
      Parameters:
      bundleStateMask - the bundle state mask to apply
      bundleFilter - the filter to apply to the bundle manifest
      propagate - true if properties from the bundle should be propagated to the service
      Returns:
      a service that acts as a factory for generating bundle adapters
    • createBundleAdapterService

      public Component createBundleAdapterService(int bundleStateMask, String bundleFilter, boolean propagate, Object callbackInstance, String add, String change, String remove)
      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.
      Parameters:
      bundleStateMask - the bundle state mask to apply
      bundleFilter - the filter to apply to the bundle manifest
      propagate - true if properties from the bundle should be propagated to the service
      callbackInstance - the instance to invoke the callbacks on, or null if the callbacks have to be invoked on the adapter itself
      add - name of the callback method to invoke on add
      change - name of the callback method to invoke on change
      remove - name of the callback method to invoke on remove
      Returns:
      a service that acts as a factory for generating bundle adapters
    • createResourceAdapterService

      public Component createResourceAdapterService(String resourceFilter, boolean propagate, Object callbackInstance, String callbackChanged)
      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.
      Parameters:
      resourceFilter - the filter condition to use with the resource
      propagate - true if properties from the resource should be propagated to the service
      callbackInstance - instance to invoke the callback on
      callbackChanged - the name of the callback method
      Returns:
      a service that acts as a factory for generating resource adapters
    • createResourceAdapterService

      public Component createResourceAdapterService(String resourceFilter, boolean propagate, Object callbackInstance, String callbackSet, String callbackChanged)
      See Also:
    • createResourceAdapterService

      public Component createResourceAdapterService(String resourceFilter, Object propagateCallbackInstance, String propagateCallbackMethod, Object callbackInstance, String callbackChanged)
      See Also:
    • createResourceAdapterService

      public Component createResourceAdapterService(String resourceFilter, Object propagateCallbackInstance, String propagateCallbackMethod, Object callbackInstance, String callbackSet, String callbackChanged)
      See Also: