|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.felix.scr.impl.manager.ComponentContextImpl
public class ComponentContextImpl
Implementation for the ComponentContext interface
Method Summary | |
---|---|
void |
disableComponent(String name)
Disables the specified component name. |
void |
dispose()
Dispose of the component configuration for this component instance. |
void |
enableComponent(String name)
Enables the specified component name. |
BundleContext |
getBundleContext()
Returns the BundleContext of the bundle which contains this
component. |
ComponentInstance |
getComponentInstance()
Returns the Component Instance object for the component instance associated with this Component Context. |
protected AbstractComponentManager |
getComponentManager()
|
Object |
getInstance()
Returns the component instance of the activated component configuration. |
Dictionary |
getProperties()
Returns the component properties for this Component Context. |
ServiceReference |
getServiceReference()
If the component instance is registered as a service using the service element, then this method returns the service
reference of the service provided by this component instance. |
Bundle |
getUsingBundle()
If the component instance is registered as a service using the servicefactory="true" attribute, then this method
returns the bundle using the service provided by the component instance. |
Object |
locateService(String name)
Returns the service object for the specified reference name. |
Object |
locateService(String name,
ServiceReference ref)
Returns the service object for the specified reference name and ServiceReference . |
Object[] |
locateServices(String name)
Returns the service objects for the specified reference name. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
---|
protected AbstractComponentManager getComponentManager()
public final Dictionary getProperties()
ComponentContext
getProperties
in interface ComponentContext
public Object locateService(String name)
ComponentContext
If the cardinality of the reference is 0..n
or
1..n
and multiple services are bound to the reference, the
service with the highest ranking (as specified in its
Constants.SERVICE_RANKING
property) is returned. If there is
a tie in ranking, the service with the lowest service ID (as specified in
its Constants.SERVICE_ID
property); that is, the service
that was registered first is returned.
locateService
in interface ComponentContext
name
- The name of a reference as specified in a
reference
element in this component's description.
null
if the reference cardinality is 0..1
or
0..n
and no bound service is available.public Object locateService(String name, ServiceReference ref)
ComponentContext
ServiceReference
.
locateService
in interface ComponentContext
name
- The name of a reference as specified in a
reference
element in this component's description.ref
- The ServiceReference
to a bound service.
This must be a ServiceReference
provided to the
component via the bind or unbind method for the specified
reference name.
null
if the specified ServiceReference
is not a bound
service for the specified reference name.public Object[] locateServices(String name)
ComponentContext
locateServices
in interface ComponentContext
name
- The name of a reference as specified in a
reference
element in this component's description.
null
if the reference cardinality is
0..1
or 0..n
and no bound service is
available. If the reference cardinality is 0..1
or
1..1
and a bound service is available, the array
will have exactly one element.public BundleContext getBundleContext()
ComponentContext
BundleContext
of the bundle which contains this
component.
getBundleContext
in interface ComponentContext
BundleContext
of the bundle containing this
component.public Bundle getUsingBundle()
ComponentContext
servicefactory="true"
attribute, then this method
returns the bundle using the service provided by the component instance.
This method will return null
if:
servicefactory="true"
attribute, then all bundles
using the service provided by the component instance will share the same
component instance.
getUsingBundle
in interface ComponentContext
null
.public ComponentInstance getComponentInstance()
ComponentContext
getComponentInstance
in interface ComponentContext
public void enableComponent(String name)
ComponentContext
enableComponent
in interface ComponentContext
name
- The name of a component or null
to indicate all
components in the bundle.public void disableComponent(String name)
ComponentContext
disableComponent
in interface ComponentContext
name
- The name of a component.public ServiceReference getServiceReference()
ComponentContext
service
element, then this method returns the service
reference of the service provided by this component instance.
This method will return null
if the component instance is
not registered as a service.
getServiceReference
in interface ComponentContext
ServiceReference
object for the component
instance or null
if the component instance is not
registered as a service.public Object getInstance()
ComponentInstance
getInstance
in interface ComponentInstance
null
if the component
configuration has been deactivated.public void dispose()
ComponentInstance
dispose
in interface ComponentInstance
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |