@ComponentProfile(summary="Execute a JSR223 script stored on the filesystem", tag="service,scripting", branchSelector=true) public class ScriptingService extends ScriptingServiceImp
You should take care when configuring this class; it can present an audit trail issue when used in combination with
DynamicServiceLocator
or
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 scripting-service which is the preferred alternative to the fully qualified classname when building your configuration.
log
CONFIRMATION_ID_KEY
Constructor and Description |
---|
ScriptingService() |
ScriptingService(java.lang.String uniqueId) |
Modifier and Type | Method and Description |
---|---|
protected java.io.Reader |
createReader() |
java.lang.String |
getScriptFilename() |
protected void |
initService() |
void |
prepare()
Prepare for initialisation.
|
void |
setScriptFilename(java.lang.String s)
Set the contents of the script.
|
closeService, doService, getBranchingEnabled, getLanguage, isBranching, setBranchingEnabled, setLanguage, start, stop
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getLookupName, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setLookupName, 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
getLookupName
public ScriptingService()
public ScriptingService(java.lang.String uniqueId)
public java.lang.String getScriptFilename()
public void setScriptFilename(java.lang.String s)
s
- the scriptprotected void initService() throws CoreException
initService
in class ScriptingServiceImp
CoreException
protected java.io.Reader createReader() throws java.io.IOException
createReader
in class ScriptingServiceImp
java.io.IOException
public void prepare() throws CoreException
ComponentLifecycleExtension
prepare
in interface ComponentLifecycleExtension
prepare
in class ScriptingServiceImp
CoreException