Class EmbeddedScriptingService
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConfigComment,DynamicPollingTemplate.TemplateProvider,MessageEventGenerator,Service,StateManagedComponent
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.
-
Field Summary
Fields inherited from class com.adaptris.core.ServiceImp
log -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ReaderSet the contents of the script.voidSet the contents of the script.withScript(String lang, String script) Methods inherited from class com.adaptris.core.scripting.services.ScriptingServiceImp
closeService, doService, getBranchingEnabled, getLanguage, initService, isBranching, prepare, setBranchingEnabled, setLanguageMethods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, enabled, getComments, getContinueOnFail, getEnabled, getIsTrackingEndpoint, getUniqueId, init, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setComments, setContinueOnFail, setEnabled, setIsTrackingEndpoint, setUniqueId, start, stopMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueIdMethods inherited from interface com.adaptris.core.ComponentLifecycle
close, init, start, stopMethods inherited from interface com.adaptris.core.ConfigComment
getComments, setCommentsMethods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpointMethods inherited from interface com.adaptris.core.Service
continueOnFailure, enabled, setUniqueIdMethods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
Constructor Details
-
EmbeddedScriptingService
public EmbeddedScriptingService() -
EmbeddedScriptingService
-
-
Method Details
-
createReader
- Specified by:
createReaderin classScriptingServiceImp
-
withScript
-
getScript
Set the contents of the script. -
setScript
Set the contents of the script.- Parameters:
script- the script
-