|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface ContextExtractor
Provides custom logic for extracting contextual information from a message.
An Instance of this plugin is invoked by Dynamic Assembler instances that have been wired to it.
Implementations should be thread safe.
Implementations should not maintain any state other than caches of stable results. State that has impact on subsequent usages' results should be persisted using J2EE principles.
A sample implementation:public class ExtractRequestorZipCode implements ContextExtractor { private static final String REQUESTOR_ZIPCODE_PROPERTY_URI = ...; public Context extractContext(PendingRequest request) throws UnexpectedContentException { DataObject message = request.Note that Contexts are of type com.ibm.websphere.fabric.da.context.Context.getFirstBodyElement()
; // perform xpath search on message.com.ibm.websphere.fabric.da.util.XPathSearchResult
zipCodeResult =com.ibm.websphere.fabric.da.util.SdoXPathUtil
.getViaXpath("//zipCode"); if (null == zipCodeResult) { return null; // null indicates no change to current context. } String zipCode = zipCodeResult.getValue(); if (5 != zipCode.length() && 9 != zipCode.length()) { throw new UnexpectedContentException("Zip Code should be exactly 5 or 9 digits"); } Context context = request.getContext()
; context.setSelectionProperty(REQUESTOR_ZIPCODE_PROPERTY_URI, zipCode); return context; } }
Context.setSelectionProperty(String, com.ibm.websphere.fabric.da.types.TypedValue)
Method Summary | |
---|---|
Context |
extractContext(PendingRequest request)
Invoked by Dynamic Assembler instances providing extractor opportunity to add data to current context. |
Method Detail |
---|
Context extractContext(PendingRequest request) throws UnexpectedContentException
request
- non-null pending request containing non-null context and message body.
UnexpectedContentException
- if the extractor detects inconsistent, incomplete
or incorrect data in the message. Any other (runtime) exception is considered
a plugin failure, as opposed to a mistake in the request.Context
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |