org.apache.felix.ipojo.api
Class Service

java.lang.Object
  extended by org.apache.felix.ipojo.api.Service
All Implemented Interfaces:
HandlerConfiguration

public class Service
extends Object
implements HandlerConfiguration

Allows configuring a provided service.

Author:
Felix Project Team

Field Summary
static int INSTANCE_STRATEGY
          Creation strategy : one service object per instance.
static int SERVICE_STRATEGY
          Creation strategy : one service object per bundle (OSGi service factory).
static int SINGLETON_STRATEGY
          Creation strategy : singleton (default).
static int STATIC_STRATEGY
          Creation strategy : delegate on the static factory method.
 
Constructor Summary
Service()
           
 
Method Summary
 Service addProperty(ServiceProperty ps)
          Adds a service property.
 Service addProperty(String key, Object obj)
          Adds a service property.
 Element getElement()
          Gets the provided service element.
 ProvidedServiceDescription getProvidedServiceDescription(ComponentInstance instance)
          Gets the provided service description associated with the current service.
 Service setCreationStrategy(int strategy)
          Sets the creation strategy.
 Service setCreationStrategy(String strategy)
          Sets the creation strategy.
 Service setServiceController(String field, boolean initialValue)
          Sets the service controller.
 Service setSpecification(String spec)
          Sets the provided service specification.
 Service setSpecifications(List specs)
          Sets the provided service specifications.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SINGLETON_STRATEGY

public static final int SINGLETON_STRATEGY
Creation strategy : singleton (default).

See Also:
Constant Field Values

STATIC_STRATEGY

public static final int STATIC_STRATEGY
Creation strategy : delegate on the static factory method.

See Also:
Constant Field Values

INSTANCE_STRATEGY

public static final int INSTANCE_STRATEGY
Creation strategy : one service object per instance.

See Also:
Constant Field Values

SERVICE_STRATEGY

public static final int SERVICE_STRATEGY
Creation strategy : one service object per bundle (OSGi service factory).

See Also:
Constant Field Values
Constructor Detail

Service

public Service()
Method Detail

getElement

public Element getElement()
Gets the provided service element.

Specified by:
getElement in interface HandlerConfiguration
Returns:
the 'provides' element.

getProvidedServiceDescription

public ProvidedServiceDescription getProvidedServiceDescription(ComponentInstance instance)
Gets the provided service description associated with the current service.

Parameters:
instance - the instance on which looking for the provided service description
Returns:
the provided service description or null if not found.

addProperty

public Service addProperty(ServiceProperty ps)
Adds a service property.

Parameters:
ps - the service property to add
Returns:
the current service object.

addProperty

public Service addProperty(String key,
                           Object obj)
Adds a service property.

Parameters:
key - the property key
obj - the initial value (can be null)
Returns:
the current service object.

setSpecification

public Service setSpecification(String spec)
Sets the provided service specification.

Parameters:
spec - the service specification
Returns:
the current service object.

setSpecifications

public Service setSpecifications(List specs)
Sets the provided service specifications.

Parameters:
specs - the service specifications
Returns:
the current service object.

setCreationStrategy

public Service setCreationStrategy(int strategy)
Sets the creation strategy.

Parameters:
strategy - the service strategy.
Returns:
the current service object

setCreationStrategy

public Service setCreationStrategy(String strategy)
Sets the creation strategy. This method allows using a customized service strategy.

Parameters:
strategy - the service strategy
Returns:
the current service object

setServiceController

public Service setServiceController(String field,
                                    boolean initialValue)
Sets the service controller.

Parameters:
field - the controller field
initialValue - the initial value
Returns:
the current servic object


Copyright © 2011 Apache Software Foundation. All Rights Reserved.