|
||||||||||
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
com.ibm.websphere.fabric.da.context.InContextServiceInvoker
public abstract class InContextServiceInvoker
A support class that combines ContextComponentSupport
and ServiceProxy
into
one. Designed to be instantiated for each new service invocation (see sample usage below).
public class CurrencyExchangeContextualizer { private class CurrencyExchangeInvoker extends InContextServiceInvoker { // The constructor should include the set of params needed to invoke the target service public CurrencyExchangeInvoker(DataObject exchangeRequest) { super(exchangeRequest, null); // Passing null for header. If WSDL declares an explicit header, then it // would be passed to this class's constructor, and be propagated to super. } public Object invoke() { // Get a reference to the target service using the auto-generated locateService_xxx method Service svc = locateService_CurrencyExchangePartner(); // Invoke the target service and return the response return svc.invoke("doExchange",getBody()
); } } // Other SCA Java component methods // ... public DataObject doExchange(DataObject exchangeRequest) { CurrencyExchangeInvoker invoker = new CurrencyExchangeInvoker(exchangeRequest); return (DataObject)invoker.invokeInContext()
; } }
Nested Class Summary |
---|
Nested classes/interfaces inherited from class com.ibm.websphere.fabric.da.context.ContextComponentSupport |
---|
ContextComponentSupport.InvocationParamBlock |
Constructor Summary | |
---|---|
InContextServiceInvoker()
Default constructor that assumes no header. |
|
InContextServiceInvoker(commonj.sdo.DataObject body,
commonj.sdo.DataObject header)
Constructor for supplying body, header. |
Method Summary | |
---|---|
commonj.sdo.DataObject |
getBody()
|
protected java.io.Serializable |
getExplicitParentId()
Subclasses capable of supplying explicit context parents can overide this null implementation. |
commonj.sdo.DataObject |
getHeader()
|
java.lang.Object |
invokeInContext()
Execute method decorates the actual service invocation with the creation and completion of a context that contains all the properties specified using setSelectionProperty(...) . |
java.lang.Object |
invokeInContext(long contextDurationInSeconds)
Similar to invokeInContext() except that it allows the user to
specify additionally the duration for which the Context should live. |
void |
setOtherProperty(java.lang.String name,
java.lang.String value)
Convenience for using new TypedValue(value) . |
void |
setOtherProperty(java.lang.String name,
TypedValue value)
Adds or replaces the value associated with the supplied context property (name). |
void |
setSelectionProperty(java.lang.String name,
java.lang.String value)
Convenience for using new TypedValue(value) . |
void |
setSelectionProperty(java.lang.String name,
TypedValue value)
Adds or replaces the value associated with the supplied endpoint selection context property (name). |
Methods inherited from class com.ibm.websphere.fabric.da.context.ContextComponentSupport |
---|
invokeInContext, invokeInContext |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ibm.websphere.fabric.da.context.ServiceProxy |
---|
invoke |
Constructor Detail |
---|
public InContextServiceInvoker()
public InContextServiceInvoker(commonj.sdo.DataObject body, commonj.sdo.DataObject header)
body
.
Method Detail |
---|
public commonj.sdo.DataObject getHeader()
public commonj.sdo.DataObject getBody()
protected java.io.Serializable getExplicitParentId()
ContextComponentSupport
getExplicitParentId
in class ContextComponentSupport
public void setSelectionProperty(java.lang.String name, java.lang.String value)
new TypedValue(value)
.
public void setSelectionProperty(java.lang.String name, TypedValue value)
public void setOtherProperty(java.lang.String name, java.lang.String value)
new TypedValue(value)
.
public void setOtherProperty(java.lang.String name, TypedValue value)
public java.lang.Object invokeInContext()
setSelectionProperty(...)
.
ServiceProxy.invoke()
.ServiceProxy.invoke()
,
setSelectionProperty(String, TypedValue)
public java.lang.Object invokeInContext(long contextDurationInSeconds)
invokeInContext()
except that it allows the user to
specify additionally the duration for which the Context should live.
This is especially useful when a downstream component is invoked
asynchronously and attempts to create a sub-context.
Note that as of 6.2.1, this method behaves exactly as invokeInContext()
.
Specifically, the value of contextDurationInSeconds
is
effectively ignored due to underlying changes to the Context management
system. Previously, Context data was stored using a centralized storage
mechanism; during one-way and/or asynchronous requests that do not have
a clear ending point, specifying a duration was essential so that Context
data could be removed from the system. However, with the 6.2.1 release,
Context management is handled on a per-invocation basis, and the Context
lifecycle is tied to the invocation itself. Once the invocation is
complete, the Context data ceases to exist, hence no duration value is
required to "clean up" abandoned Contexts.
For clarity, it is recommended that invokeInContext()
be used
instead of this method.
contextDurationInSeconds
- the number of seconds for which this
Context should exist.
ServiceProxy.invoke()
.invokeInContext()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |