|
Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service 11g Release 1 (11.1.1.6) E20742-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object oracle.as.scheduler.substitution.SubstitutorImpl
public class SubstitutorImpl
Perform token substitutions on a string using a
set of SubstitutionHandler
s.
This class provides much of the functionality needed to create a
Substitutor
.
Substitution tokens can take any of the following forms:
${NAME} ${ID:NAME} ${ID1,ID2:NAME}
The NAME
portion of the token is passed to
SubstitutionHandler.containsKey(String)
and
SubstitutionHandler.get(String)
.
The ID
portion of the token is matched with the value of
SubstitutionHandler.getId()
. If no ID
is specified, the
first handler in the list that responds to NAME
is used.
If one or more ID
s are specified, then only handlers reporting
matching IDs will be queried for the given NAME
.
# see SubstitutionHandler
Constructor Summary | |
---|---|
SubstitutorImpl()
|
Method Summary | |
---|---|
void |
close()
Cleanup substitutor state and release all handlers. |
protected void |
closeHandlers()
Call close() on all instantiated handlers, and release the instances. |
protected SubstitutionHandler |
getMatchingHandler(java.lang.String subId,
java.lang.String name)
Find the first handler in the list that matches on substitution ID and name. |
protected boolean |
initializeHandler(SubstitutionHandler handler)
Implementations of SubstitutorImpl may override this
method to perform implementation specific initialization for each handler
instance. |
void |
setSubstitutionHandlers(java.util.List<SubstitutionHandler> handlers)
Set the list of SubstitutionHandler s to use. |
void |
setSubstitutionHandlers(java.lang.String subsHandlerNames)
Set the list of SubstitutionHandler s to use. |
protected java.util.List<SubstitutionHandler> |
stringToHandlers(java.lang.String subsHandlerNames)
Parse the subsHandlerNames string, instantiate the named
SubstitutionHandler classes, and return them in a list. |
java.lang.String |
substitute(java.lang.String original)
Recursively replaces all tokens in the string original
with the results from matching handlers. |
protected java.lang.String |
substituteTokens(java.lang.String valueTokens,
java.util.List<java.lang.String> tokenHistory)
Takes a string with tokens and returns the values; called recursively |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SubstitutorImpl()
Method Detail |
---|
public void setSubstitutionHandlers(java.lang.String subsHandlerNames)
SubstitutionHandler
s to use.
setSubstitutionHandlers
in interface Substitutor
subsHandlerNames
- Comma-separated list of class names that implement
SubstitutionHandler
public void setSubstitutionHandlers(java.util.List<SubstitutionHandler> handlers)
SubstitutionHandler
s to use.
setSubstitutionHandlers
in interface Substitutor
handlers
- List of SubstitutionHandler
spublic void close()
close
in interface Substitutor
protected void closeHandlers()
close()
on all instantiated handlers, and release the instances.
protected java.util.List<SubstitutionHandler> stringToHandlers(java.lang.String subsHandlerNames)
subsHandlerNames
string, instantiate the named
SubstitutionHandler
classes, and return them in a list.
Any names that cannot be instantiated as a valid
SubstitutionHandler
will be skipped.
subsHandlerNames
- Comma-separated list substitution handler class names.
protected boolean initializeHandler(SubstitutionHandler handler)
SubstitutorImpl
may override this
method to perform implementation specific initialization for each handler
instance.
public java.lang.String substitute(java.lang.String original) throws SubstitutionException
original
with the results from matching handlers. Any tokens that are not
recognized by any handlers will remain in the string.
substitute
in interface Substitutor
original
-
SubstitutionException
- if an error occurs during substitutionprotected java.lang.String substituteTokens(java.lang.String valueTokens, java.util.List<java.lang.String> tokenHistory) throws SubstitutionException
valueTokens
- Input string containing zero or more tokens to be
replacedtokenHistory
- List of substitutions that got us here; used for
circular reference detection.
Should be an empty (not null) list on first invocation.
SubstitutionException
protected SubstitutionHandler getMatchingHandler(java.lang.String subId, java.lang.String name) throws SubstitutionException
SubstitutionHandler
s passed to the Substitutor
,
and the first match is the one used. The order of the ID
s
in the token has no effect.
subId
- - Comma-separated list of IDs to match. If null,
match any handler.name
- - the name of to key to search for.
subId
and name
.
SubstitutionException
|
Oracle Fusion Applications Java API Reference for Oracle Enterprise Scheduler Service 11g Release 1 (11.1.1.6) E20742-04 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |