|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
public interface ComponentContext
The ComponentContext interface is used to obtain contextual information about the SCA component which is executing at the time the API is invoked.
Note: An SCA component can obtain a service reference either through injection or programmatically through the ComponentContext API. Using reference injection is the recommended way to access a service, since it results in code with minimal use of middleware APIs. The ComponentContext API is provided for use in cases where reference injection is not possible.
| Method Summary | ||
|---|---|---|
|
cast(B target)
Casts a type-safe reference to a ServiceReference. |
|
|
createSelfReference(java.lang.Class<B> businessInterface)
Returns a ServiceReference that can be used to invoke this component over the designated service. |
|
|
createSelfReference(java.lang.Class<B> businessInterface,
java.lang.String serviceName)
Returns a ServiceReference that can be used to invoke this component over the designated service. |
|
|
getProperty(java.lang.Class<B> type,
java.lang.String propertyName)
Returns the value of an SCA property defined by this component. |
|
RequestContext |
getRequestContext()
Returns the RequestContext for the current SCA service request. |
|
|
getService(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
Returns a typed service proxy object for a reference defined by the current component, where the reference has multiplicity 0..1 or 1..1. |
|
|
getServiceReference(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
Returns a ServiceReference object for a reference defined by the current component, where the reference has multiplicity 0..1 or 1..1. |
|
|
getServiceReferences(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
Returns a list of typed ServiceReference objects for a reference defined by the current component, where the reference has multiplicity 0..n or 1..n. |
|
|
getServices(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
Returns a list of typed service proxies for a reference defined by the current component, where the reference has multiplicity 0..n or 1..n. |
|
java.lang.String |
getURI()
Returns the absolute URI of the component within the SCA domain. |
|
| Method Detail |
|---|
java.lang.String getURI()
<B> B getService(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
throws java.lang.IllegalArgumentException
B - the Java type that is implemented by the returned proxy
object.businessInterface - the Class object for the Java type that
is implemented by the returned proxy object.referenceName - the name of the service reference.
java.lang.IllegalArgumentException - if the reference has multiplicity
greater than one, or the component does not have the reference
named by referenceName, or the interface of the named
reference is not compatible with the interface supplied in
the businessInterface parameter.
<B> ServiceReference<B> getServiceReference(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
throws java.lang.IllegalArgumentException
B - the Java type of the reference that is associated with
the returned object.businessInterface - the Class object for the Java type that
is associated with the returned object.referenceName - the name of the service reference.
java.lang.IllegalArgumentException - if the reference has multiplicity
greater than one, or the component does not have the reference
named by referenceName, or the interface of the named
reference is not compatible with the interface supplied in
the businessInterface parameter.
<B> java.util.Collection<B> getServices(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
throws java.lang.IllegalArgumentException
B - the Java type that is implemented by the returned proxy
objects.businessInterface - the Class object for the Java type that
is implemented by the returned proxy objects.referenceName - the name of the service reference.
businessInterface parameter. The collection is empty if the
reference is not wired to any target services.
java.lang.IllegalArgumentException - if the reference has multiplicity
greater other than 0..1 or 1..1, or the component does not have the reference
named by referenceName, or the interface of the named
reference is not compatible with the interface supplied in
the businessInterface parameter.
<B> java.util.Collection<ServiceReference<B>> getServiceReferences(java.lang.Class<B> businessInterface,
java.lang.String referenceName)
throws java.lang.IllegalArgumentException
B - the Java type that is associated with returned proxy
objects.B - the Java type of the reference that is associated with
the returned object.referenceName - the name of the service reference.
businessInterface parameter.
The collection is empty if the reference is not wired to any target services.
java.lang.IllegalArgumentException - if the reference has multiplicity
greater other than 0..1 or 1..1, or the component does not have the reference
named by referenceName, or the interface of the named
reference is not compatible with the interface supplied in
the businessInterface parameter.
<B> ServiceReference<B> createSelfReference(java.lang.Class<B> businessInterface)
throws java.lang.IllegalArgumentException
B - the Java type of the reference that is associated with
the returned object.businessInterface - the Class object for the Java type that
is associated with the returned object.
java.lang.IllegalArgumentException - if the component does not have a service
which implements the interface identified by the
businessinterface parameter.
<B> ServiceReference<B> createSelfReference(java.lang.Class<B> businessInterface,
java.lang.String serviceName)
throws java.lang.IllegalArgumentException
serviceName parameter explicitly names
the service with which the returned ServiceReference is associated.
B - the Java type of the reference that is associated with
the returned object.businessInterface - the Class object for the Java type that
is associated with the returned object.serviceName - the service name with which the returned ServiceReference
is associated.
java.lang.IllegalArgumentException - if the component does not have a service
with the name identified by the serviceName parameter, or
if the named service does not implement the interface identified by the
businessinterface parameter.
<B> B getProperty(java.lang.Class<B> type,
java.lang.String propertyName)
throws java.lang.IllegalArgumentException
B - the property type.type - the Class object for the property type.propertyName - the property name.
java.lang.IllegalArgumentException - if the component does not have a property
with the name identified by the propertyName parameter, or
if the named property type is not compatible with the type
parameter.
<B> ServiceReference<B> cast(B target)
throws java.lang.IllegalArgumentException
B - the Java type of the reference that is associated with
the returned object.target - the type-safe reference proxy that implements interface .
java.lang.IllegalArgumentExceptionRequestContext getRequestContext()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||