|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ibm.websphere.fabric.da.context.ContextComponentSupport
public abstract class ContextComponentSupport
Support class that gives component developers a convenient mechanism for executing tasks using a context. A common task is to call one or more services using a context to pass context properties in a message header for downstream processing. A sample implementation:
public class CurrencyExchangeContextualizerImpl extends ContextComponentSupport { public CurrencyExchangeContextualizerImpl() { super(); } // Other SCA Java component methods // ... public DataObject doExchange(final DataObject exchangeRequest) { // Propagate the userId from the exchange request in the context String userId = exchangeRequest.getString("userId"); final Map props = new HashMap(); props.put("userId", userId); return (DataObject) invokeInContext(null, props, new ServiceProxy() { public Object invoke() { Service svc = locateService_CurrencyExchangePartner(); DataObject response = (DataObject) svc.invoke("doExchange", exchangeRequest); DataObject rv = (DataObject) response.get(0); trace("response from invoke: " + rv); return rv; } }); } }
Nested Class Summary | |
---|---|
static class |
ContextComponentSupport.InvocationParamBlock
Encapsulates parameters needed for invocations. |
Constructor Summary | |
---|---|
ContextComponentSupport()
|
Method Summary | |
---|---|
protected java.io.Serializable |
getExplicitParentId()
Subclasses capable of supplying explicit context parents can overide this null implementation. |
protected java.lang.Object |
invokeInContext(ContextComponentSupport.InvocationParamBlock paramBlock)
Runs the specified runnable ensuring that a new context is established before the task executes and closed after it completes. |
protected java.lang.Object |
invokeInContext(java.util.Map selectionProperties,
java.util.Map otherProperties,
ServiceProxy proxy)
Deprecated. Use invokeInContext(InvocationParamBlock) . |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ContextComponentSupport()
Method Detail |
---|
protected java.io.Serializable getExplicitParentId()
protected java.lang.Object invokeInContext(java.util.Map selectionProperties, java.util.Map otherProperties, ServiceProxy proxy)
invokeInContext(InvocationParamBlock)
.
selectionProperties
- the selection properties to add to the contextotherProperties
- the other (non-selection) properties to add to the contextproxy
- invokes a service using the established context
protected java.lang.Object invokeInContext(ContextComponentSupport.InvocationParamBlock paramBlock)
paramBlock
- properties under which this invocation is taking place.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |