|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.tuscany.core.wire.InvocationConfiguration
public abstract class InvocationConfiguration
Contains a source- or target-side invocation pipeline for a service operation. The runtime framework creates invocation chains
on a per-operation, per-service basis. Further, invocation chains are further distinguished by being part of the source or
target sides of a wire. Chains are "bridged" together by the runtime by a set of WireBuilder
s with the source-side holding references to the target.
InvocationChain
s are managed by WireConfiguration
s, which are used by WireFactory
s to buildSource wires and proxies.
Invocation configurations must contain at least one interceptor and may have 0 to N handlers. Handlers process a wire request
or response in a one-way fashion. A typical wire sequence where interceptors and handlers are configured for both the source
and target-side will proceed as follows:
The source-to-target bridge may be constructed in any of the following ways:
- The first source interceptor will be called with a message, which will in turn invoke the next interceptor in the chain
- The last source interceptor, which must be of type
RequestResponseInterceptor
if there are handlers present, will be invoked. The RR interceptor will in turn pass the message to aMessageChannel
which will invoke all source-side request handlers.- The RR interceptor will then invoke the target-side request
MessageChannel
.- The last source-side handler, an instance of
MessageDispatcher
, will invoke the first source-side interceptor, which in turn will pass the message down the target-side interceptor chain.- If the target is a component instance the last target-side interceptor, an instance of
InvokerInterceptor
will retrieve theTargetInvoker
from the message and call it to invoke the operation on a target instance. TargetInvokers are help by the source proxy to enable optimizations such as caching of target instances.- The response is returned up the wire stack until it reaches the source-side RequestResponseInterceptor, which invokes the target and source-side response channels respectively.
- The response is then passed back up the rest of the wire stack.
WireBuilder
,
WireFactory
,
TargetInvoker
,
MessageDispatcher
Field Summary | |
---|---|
protected Interceptor |
interceptorChainHead
|
protected Interceptor |
interceptorChainTail
|
protected java.lang.reflect.Method |
operation
|
protected java.util.List<MessageHandler> |
requestHandlers
|
protected java.util.List<MessageHandler> |
responseHandlers
|
protected TargetInvoker |
targetInvoker
|
Constructor Summary | |
---|---|
InvocationConfiguration(java.lang.reflect.Method operation)
|
Method Summary | |
---|---|
void |
addInterceptor(Interceptor interceptor)
Adds an interceptor to the chain |
void |
addRequestHandler(MessageHandler handler)
Adds an request handler to the invocation chain |
void |
addResponseHandler(MessageHandler handler)
Adds an response handler to the invocation chain |
abstract void |
build()
Signals to the chain that its configuration is complete. |
Interceptor |
getHeadInterceptor()
Returns the first interceptor in the chain |
java.lang.reflect.Method |
getMethod()
Returns the target operation for this invocation chain |
java.util.List<MessageHandler> |
getRequestHandlers()
Returns the request handler chain |
java.util.List<MessageHandler> |
getResponseHandlers()
Returns the response handler chain |
Interceptor |
getTailInterceptor()
Returns the last interceptor in the chain |
TargetInvoker |
getTargetInvoker()
Returns the target invoker that is passed down the chain |
void |
setTargetInvoker(TargetInvoker invoker)
Sets the target invoker to pass down the chain |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected java.lang.reflect.Method operation
protected TargetInvoker targetInvoker
protected Interceptor interceptorChainHead
protected Interceptor interceptorChainTail
protected java.util.List<MessageHandler> requestHandlers
protected java.util.List<MessageHandler> responseHandlers
Constructor Detail |
---|
public InvocationConfiguration(java.lang.reflect.Method operation)
Method Detail |
---|
public java.lang.reflect.Method getMethod()
public void addRequestHandler(MessageHandler handler)
public void addResponseHandler(MessageHandler handler)
public java.util.List<MessageHandler> getRequestHandlers()
public java.util.List<MessageHandler> getResponseHandlers()
public void setTargetInvoker(TargetInvoker invoker)
public TargetInvoker getTargetInvoker()
public void addInterceptor(Interceptor interceptor)
public Interceptor getTailInterceptor()
public Interceptor getHeadInterceptor()
public abstract void build()
|
Tuscany Core | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |