2016/05/28 - Apache Tuscany has been retired.

For more information, please explore the Attic.


org.osoa.sca
Interface ComponentContext


public interface ComponentContext

Interface providing programmatic access to a component's SCA context as an alternative to injection. It provides access to reference and property values for the component and provides a mechanism for obtaining a reference to a service that can be passed to other components.

SCA components obtain an instance of this interface through injection. Non-SCA client code may also obtain an instance through runtime-specific mechanisms.

Version:
$Rev: 512440 $ $Date: 2007-02-27 22:08:01 +0000 (Tue, 27 Feb 2007) $

Method Summary
<B,R extends CallableReference<B>>
R
cast(B target)
          Cast a type-safe reference to a CallableReference.
<B> ServiceReference<B>
createSelfReference(java.lang.Class<B> businessInterface)
          Returns a ServiceReference that can be used to invoke this component over the default service.
<B> ServiceReference<B>
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.
<B> B
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 context for the current SCA service request, or null if there is no current request or if the context is unavailable.
<B> B
getService(java.lang.Class<B> businessInterface, java.lang.String referenceName)
          Returns a proxy for a reference defined by this component.
<B> ServiceReference<B>
getServiceReference(java.lang.Class<B> businessInterface, java.lang.String referenceName)
          Returns a ServiceReference for a reference defined by this component.
 java.lang.String getURI()
          Returns the absolute URI of the component within the SCA Domain.
 

Method Detail

getURI

java.lang.String getURI()
Returns the absolute URI of the component within the SCA Domain.

Returns:
the absolute URI of the component

cast

<B,R extends CallableReference<B>> R cast(B target)
                                    throws java.lang.IllegalArgumentException
Cast a type-safe reference to a CallableReference. Converts a type-safe reference to an equivalent CallableReference; if the target refers to a service then a ServiceReference will be returned, if the target refers to a callback then a CallableReference will be returned.

Type Parameters:
B - the Java type of the business interface for the reference
R - the type of reference to be returned
Parameters:
target - a reference proxy provided by the SCA runtime
Returns:
a CallableReference equivalent for the proxy
Throws:
java.lang.IllegalArgumentException - if the supplied instance is not a reference supplied by the SCA runtime

getService

<B> B getService(java.lang.Class<B> businessInterface,
                 java.lang.String referenceName)
Returns a proxy for a reference defined by this component.

Type Parameters:
B - the Java type of the business interface for the reference
Parameters:
businessInterface - the interface that will be used to invoke the service
referenceName - the name of the reference
Returns:
an object that implements the business interface

getServiceReference

<B> ServiceReference<B> getServiceReference(java.lang.Class<B> businessInterface,
                                            java.lang.String referenceName)
Returns a ServiceReference for a reference defined by this component.

Type Parameters:
B - the Java type of the business interface for the reference
Parameters:
businessInterface - the interface that will be used to invoke the service
referenceName - the name of the reference
Returns:
a ServiceReference for the designated reference

getProperty

<B> B getProperty(java.lang.Class<B> type,
                  java.lang.String propertyName)
Returns the value of an SCA property defined by this component.

Type Parameters:
B - the Java type of the property
Parameters:
type - the Java type to be returned for the property
propertyName - the name of the property whose value should be returned
Returns:
the property value

createSelfReference

<B> ServiceReference<B> createSelfReference(java.lang.Class<B> businessInterface)
Returns a ServiceReference that can be used to invoke this component over the default service.

Type Parameters:
B - the Java type of the business interface for the reference
Parameters:
businessInterface - the interface that will be used to invoke the service
Returns:
a ServiceReference that will invoke this component

createSelfReference

<B> ServiceReference<B> 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.

Type Parameters:
B - the Java type of the business interface for the reference
Parameters:
businessInterface - the interface that will be used to invoke the service
serviceName - the name of the service to invoke
Returns:
a ServiceReference that will invoke this component

getRequestContext

RequestContext getRequestContext()
Returns the context for the current SCA service request, or null if there is no current request or if the context is unavailable.

Returns:
the SCA request context; may be null