Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service
11g Release 1 (11.1.1.5)
E20742-01


oracle.as.scheduler.substitution
Class ReqParamCtxtSubstitutor

java.lang.Object
  extended by oracle.as.scheduler.substitution.AbstractSubstitutor
      extended by oracle.as.scheduler.substitution.ReqParamCtxtSubstitutor
All Implemented Interfaces:
Substitutor

public class ReqParamCtxtSubstitutor
extends AbstractSubstitutor
implements Substitutor

Perform token substitutions on a RequestParameters object using a set of ReqParamCtxtSubstitutionHandlers. Typical usage is:

 RequestParameters rp = new RequestParameters();
 rp.add("COLOR", "red");
 rp.add("GARMENT", "sneaker");
 rp.add("CLOTHES", "Today I am wearing a ${COLOR} ${GARMENT} and a ${COLOR} ${REQ_PARAMS:GARMENT}.");
 rp.add(SystemProperty.SUBSITUTION_HANDLERS,
 "user.package.RandItemsHandler,user.package.FamousItemsHandler");

 ReqeustParametersSubstitution rpSub =  new ReqParamCtxtSubstitutor(context, rp);

 String todaysClothing = rpSub.getSubstitutedValue("CLOTHING");
 
 rpSub.close();
 
The above code assumes that the user-created SubstitutionHandler called RandItemsHandler. If RandItemsHandler returns "jacket" for GARMENT, then the value of todaysClothing would be "Today I am wearing a red jacket and a red sneaker".

For the first instance of GARMENT we don't specify which handler to use, so we get the value from the first handler that claims it; in this case, RandItemsHander provides the value. However, we qualify the second instance of GARMENT with REQ_PARAMS, meaning that we only ask handlers with the ID of REQ_PARAMS to provide the value.

A subsitution token can also specify a list of IDs to query, for example "The sky is ${MARS,EARTH,JUPITER:SKY_COLOR}.". The substitution handler determines the order in which they are evaluated; the order of IDs in the token does not matter.

The pre-built substitution handlers RequestParamSubstitutionHandler and RequestContextSubstitutionHandler are always included after the user-specified handlers.

Since:
release specific (what release of product did this appear in)
Version:
$Header: ess/src/oracle/as/scheduler/substitution/ReqParamCtxtSubstitutor.java /main/4 2008/07/18 10:05:03 chall Exp $
Author:
cfuentes
See Also:
ReqParamCtxtSubstitutionHandler, Substitutor, RequestParameters

Constructor Summary
ReqParamCtxtSubstitutor(RequestExecutionContext context, RequestParameters requestParams)
           
 
Method Summary
 java.lang.String getOriginalValue(java.lang.String name)
          Does not perform any substitutions on the requestParams values, but converts all values to String as does getSubstitutedValues()
 java.lang.String getSubstitutedValue(java.lang.String name)
          Recursively replaces all tokens in the RequestParameter name with the results from matching handlers.
 void initialize(RequestExecutionContext context, RequestParameters requestParams)
          Provide the source RequestParameters used for the handlers.
protected  boolean initializeHandler(SubstitutionHandler handlerSH)
          Implementations of AbstractSubstitutor may override this method to perform implementation specific initialization for each handler instance.
 void setSubstitutionHandlers(java.util.List<SubstitutionHandler> subsHandlers)
          Set the list of SubstitutionHandlers to use.
 
Methods inherited from class oracle.as.scheduler.substitution.AbstractSubstitutor
close, closeHandlers, getMatchingHandler, setSubstitutionHandlers, stringToHandlers, substitute, substituteTokens
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface oracle.as.scheduler.substitution.Substitutor
close, setSubstitutionHandlers, substitute
 

Constructor Detail

ReqParamCtxtSubstitutor

public ReqParamCtxtSubstitutor(RequestExecutionContext context,
                               RequestParameters requestParams)
Method Detail

initialize

public void initialize(RequestExecutionContext context,
                       RequestParameters requestParams)
Provide the source RequestParameters used for the handlers. The list of substitutionHandlers to use is extracted from requestParams.getValue(SystemProperty.SUBSTITUTION_HANDLERS).

Parameters:
requestParams - Parameters to use for substitution.

setSubstitutionHandlers

public void setSubstitutionHandlers(java.util.List<SubstitutionHandler> subsHandlers)
Description copied from class: AbstractSubstitutor
Set the list of SubstitutionHandlers to use.

Specified by:
setSubstitutionHandlers in interface Substitutor
Overrides:
setSubstitutionHandlers in class AbstractSubstitutor
Parameters:
subsHandlers - List of SubstitutionHandlers

initializeHandler

protected boolean initializeHandler(SubstitutionHandler handlerSH)
Description copied from class: AbstractSubstitutor
Implementations of AbstractSubstitutor may override this method to perform implementation specific initialization for each handler instance.

Overrides:
initializeHandler in class AbstractSubstitutor
Returns:
True if the initialization was successful, false if the handler should be skipped.

getOriginalValue

public java.lang.String getOriginalValue(java.lang.String name)
Does not perform any substitutions on the requestParams values, but converts all values to String as does getSubstitutedValues()

Parameters:
name - The parameter name
Returns:
String form of the Object in requestParams(name);

getSubstitutedValue

public java.lang.String getSubstitutedValue(java.lang.String name)
Recursively replaces all tokens in the RequestParameter name with the results from matching handlers. Any tokens that are not recognized by any handlers will remain in the string.

Parameters:
name - The parameter name
Returns:
String with substitutions performed.

Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service
11g Release 1 (11.1.1.5)
E20742-01


Copyright © 2008, 2011 Oracle. All rights reserved.