Interface BundleDependency

All Superinterfaces:
ComponentDependencyDeclaration, Dependency

public interface BundleDependency extends Dependency, ComponentDependencyDeclaration
Author:
Felix Project Team
  • Method Details

    • setCallbacks

      BundleDependency setCallbacks(String added, String removed)
      Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.
      Parameters:
      added - the method to call when a bundle was added
      removed - the method to call when a bundle was removed
      Returns:
      the bundle dependency
    • setCallbacks

      BundleDependency setCallbacks(String added, String changed, String removed)
      Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or removed. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.
      Parameters:
      added - the method to call when a bundle was added
      changed - the method to call when a bundle was changed
      removed - the method to call when a bundle was removed
      Returns:
      the bundle dependency
    • setCallbacks

      BundleDependency setCallbacks(Object instance, String added, String removed)
      Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added or removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.
      Parameters:
      instance - the instance to call the callbacks on
      added - the method to call when a bundle was added
      removed - the method to call when a bundle was removed
      Returns:
      the bundle dependency
    • setCallbacks

      BundleDependency setCallbacks(Object instance, String added, String changed, String removed)
      Sets the callbacks for this dependency. These callbacks can be used as hooks whenever a dependency is added, changed or removed. They are called on the instance you provide. When you specify callbacks, the auto configuration feature is automatically turned off, because we're assuming you don't need it in this case.
      Parameters:
      instance - the instance to call the callbacks on
      added - the method to call when a bundle was added
      changed - the method to call when a bundle was changed
      removed - the method to call when a bundle was removed
      Returns:
      the bundle dependency
    • setAutoConfig

      BundleDependency setAutoConfig(boolean autoConfig)
      Enables auto configuration for this dependency. This means the component implementation (composition) will be injected with this bundle dependency automatically.
      Parameters:
      autoConfig - true to enable auto configuration
      Returns:
      the bundle dependency
    • setRequired

      BundleDependency setRequired(boolean required)
      Sets the dependency to be required.
      Parameters:
      required - true if this bundle dependency is required
      Returns:
      the bundle dependency
    • setBundle

      BundleDependency setBundle(org.osgi.framework.Bundle bundle)
      Sets the bundle to depend on directly.
      Parameters:
      bundle - the bundle to depend on
      Returns:
      the bundle dependency
    • setFilter

      Sets the filter condition to depend on. Filters are matched against the full manifest of a bundle.
      Parameters:
      filter - the filter condition
      Returns:
      the bundle dependency
      Throws:
      IllegalArgumentException - if the filter is invalid
    • setStateMask

      BundleDependency setStateMask(int mask)
      Sets the bundle state mask to depend on. The OSGi BundleTracker explains this mask in more detail, but it is basically a mask with flags for each potential state a bundle can be in.
      Parameters:
      mask - the mask to use
      Returns:
      the bundle dependency
    • setPropagate

      BundleDependency setPropagate(boolean propagate)
      Sets property propagation. If set to true any bundle manifest properties will be added to the service properties of the component that has this dependency (if it registers as a service). The provided service properties take precedence over the propagated bundle manifest headers. It means a bundle manifest header won't override a component service property having the same name.
      Parameters:
      propagate - true to propagate the bundle manifest properties
      Returns:
      the bundle dependency
    • setPropagate

      BundleDependency setPropagate(Object instance, String method)
      Sets an Object instance and a callback method used to propagate some properties to the provided service properties. The method will be invoked on the specified object instance and must have one of the following signatures:
      • Dictionary callback(ServiceReference, Object service)
      • Dictionary callback(ServiceReference)
      The provided service properties take precedence over the propagated bundle manifest headers. It means a bundle manifest header won't override a component service property having the same name.
      Parameters:
      instance - the Object instance which is used to retrieve propagated service properties
      method - the method to invoke for retrieving the properties to be propagated to the service properties.
      Returns:
      this service dependency.