Interface ResourceDependency

All Superinterfaces:
ComponentDependencyDeclaration, Dependency, ResourceHandler

public interface ResourceDependency extends Dependency, ComponentDependencyDeclaration, ResourceHandler
A resource dependency is a dependency on a resource. A resource in this context is an object that is identified by a URL. Resources should somehow be provided by an external component, the resource provider. These dependencies then react on them becoming available or not. Use cases for such dependencies are resources that are embedded in bundles, in a workspace or some remote or local repository, etc. When a resource is injected using callbacks, the following method signatures are supported:


 (Component, URL, Dictionary)
 (Component, URL)
 (Component) 
 (URL, Dictionary)
 (URL)
 (Object)
 
Author:
Felix Project Team
  • Method Details

    • setCallbacks

      ResourceDependency setCallbacks(String added, String removed)
      Sets the callbacks for this service. 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 service was added
      removed - the method to call when a service was removed
      Returns:
      this service dependency
    • setCallbacks

      ResourceDependency setCallbacks(String added, String changed, String removed)
      Sets the callbacks for this service. 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 service was added
      changed - the method to call when a service was changed
      removed - the method to call when a service was removed
      Returns:
      this service dependency
    • setCallbacks

      ResourceDependency setCallbacks(Object instance, String added, String removed)
      Sets the callbacks for this service. 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 service was added
      removed - the method to call when a service was removed
      Returns:
      this service dependency
    • setCallbacks

      ResourceDependency setCallbacks(Object instance, String added, String changed, String removed)
      Sets the callbacks for this service. 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 service was added
      changed - the method to call when a service was changed
      removed - the method to call when a service was removed
      Returns:
      this service dependency
    • setAutoConfig

      ResourceDependency setAutoConfig(boolean autoConfig)
      Sets auto configuration for this service. Auto configuration allows the dependency to fill in any attributes in the service implementation that are of the same type as this dependency. Default is on.
      Parameters:
      autoConfig - the value of auto config
      Returns:
      this service dependency
    • setAutoConfig

      ResourceDependency setAutoConfig(String instanceName)
      Sets auto configuration for this service. Auto configuration allows the dependency to fill in the attribute in the service implementation that has the same type and instance name.
      Parameters:
      instanceName - the name of attribute to auto config
      Returns:
      this service dependency
    • setResource

      ResourceDependency setResource(URL resource)
      Sets the resource for this dependency.
      Parameters:
      resource - the URL of the resource
    • setRequired

      ResourceDependency setRequired(boolean required)
      Determines if this is a required dependency or not.
      Parameters:
      required - true if the dependency is required
    • setFilter

      ResourceDependency setFilter(String resourceFilter)
      Sets the filter condition for this resource dependency.
      Parameters:
      resourceFilter - the filter condition
    • setPropagate

      ResourceDependency setPropagate(boolean propagate)
      See Also:
    • setPropagate

      ResourceDependency 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 service dependency properties. It means a resource dependency property 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.