@ComponentProfile(summary="Execute an embedded JSR223 script", tag="service,scripting", branchSelector=true) public class EmbeddedScriptingService extends ScriptingServiceImp
You should take care when configuring this class; it can present an audit trail issue when used
in combination with
DynamicServiceExecutor
if your script executes
arbitrary system commands. In that situation, all commands will be executed with the current
users permissions and may be subject to the virtual machines security manager.
The script is executed and the AdaptrisMessage that is due to be processed is bound against the key "message" and an instance of org.slf4j.Logger is also bound to key "log". These can be used as a standard variable within the script.
Note that this class can be used as the selector as part of a BranchingServiceCollection
.
If used as such, then you need to remember to invoke
AdaptrisMessage.setNextServiceId(String)
as part of the script and
ScriptingServiceImp.setBranchingEnabled(Boolean)
should be true.
In the adapter configuration file this class is aliased as embedded-scripting-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
Constructor and Description |
---|
EmbeddedScriptingService() |
EmbeddedScriptingService(java.lang.String uniqueId) |
Modifier and Type | Method and Description |
---|---|
protected java.io.Reader |
createReader() |
java.lang.String |
getScript() |
void |
setScript(java.lang.String s)
Set the contents of the script.
|
EmbeddedScriptingService |
withScript(java.lang.String lang,
java.lang.String script) |
closeService, doService, getBranchingEnabled, getLanguage, initService, isBranching, prepare, setBranchingEnabled, setLanguage, start, stop
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
continueOnFailure, setUniqueId
createName, createQualifier, isTrackingEndpoint
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
getUniqueId
close, init
public EmbeddedScriptingService()
public EmbeddedScriptingService(java.lang.String uniqueId)
public java.lang.String getScript()
public void setScript(java.lang.String s)
s
- the scriptprotected java.io.Reader createReader()
createReader
in class ScriptingServiceImp
public EmbeddedScriptingService withScript(java.lang.String lang, java.lang.String script)