Class JsltTransformService
- java.lang.Object
-
- com.adaptris.core.ServiceImp
-
- com.adaptris.core.json.jslt.JsltTransformService
-
- All Implemented Interfaces:
AdaptrisComponent,ComponentLifecycle,ComponentLifecycleExtension,ConnectedService,MessageEventGenerator,Service,StateManagedComponent
@ComponentProfile(summary="Execute a JSLT Transform, using the result as the payload", tag="jslt,transform,json", since="3.12.0", recommended=com.adaptris.core.services.cache.CacheConnection.class) public class JsltTransformService extends ServiceImp implements ConnectedServiceExecute a JSLT Transform, using the result as the payloadIn the adapter configuration file this class is aliased as jslt-transform-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 Constructor Description JsltTransformService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidcloseService()voiddoService(AdaptrisMessage msg)AdaptrisConnectiongetConnection()The connection that wraps any underlying caching required.java.lang.StringgetUrl()Set the URL that contains the transformation you wish to execute.@NonNull JsltVariablesgetVariables()Any additional variables you want to pass into the JSLT transformation.protected voidinitService()voidprepare()voidsetConnection(AdaptrisConnection connection)The connection that wraps any underlying caching required.voidsetUrl(java.lang.String url)Set the URL that contains the transformation you wish to execute.voidsetVariables(@NonNull JsltVariables variables)Any additional variables you want to pass into the JSLT transformation.voidstart()voidstop()JsltTransformServicewithConnection(AdaptrisConnection c)JsltTransformServicewithUrl(java.lang.String url)JsltTransformServicewithVariables(JsltVariables v)-
Methods inherited from class com.adaptris.core.ServiceImp
changeState, close, continueOnFailure, createName, createQualifier, getContinueOnFail, getIsTrackingEndpoint, getUniqueId, init, isBranching, isTrackingEndpoint, requestClose, requestInit, requestStart, requestStop, retrieveComponentState, setContinueOnFail, setIsTrackingEndpoint, setUniqueId
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.adaptris.core.AdaptrisComponent
getUniqueId
-
Methods inherited from interface com.adaptris.core.ComponentLifecycle
close, init
-
Methods inherited from interface com.adaptris.core.MessageEventGenerator
createName, createQualifier, isTrackingEndpoint
-
Methods inherited from interface com.adaptris.core.Service
continueOnFailure, isBranching, setUniqueId
-
Methods inherited from interface com.adaptris.core.StateManagedComponent
changeState, requestClose, requestInit, requestStart, requestStop, retrieveComponentState
-
-
-
-
Method Detail
-
doService
public void doService(AdaptrisMessage msg) throws ServiceException
- Specified by:
doServicein interfaceService- Throws:
ServiceException
-
prepare
public void prepare() throws CoreException- Specified by:
preparein interfaceComponentLifecycleExtension- Throws:
CoreException
-
initService
protected void initService() throws CoreException- Specified by:
initServicein classServiceImp- Throws:
CoreException
-
start
public void start() throws CoreException- Specified by:
startin interfaceComponentLifecycle- Overrides:
startin classServiceImp- Throws:
CoreException
-
stop
public void stop()
- Specified by:
stopin interfaceComponentLifecycle- Overrides:
stopin classServiceImp
-
closeService
protected void closeService()
- Specified by:
closeServicein classServiceImp
-
withUrl
public JsltTransformService withUrl(java.lang.String url)
-
withConnection
public JsltTransformService withConnection(AdaptrisConnection c)
-
withVariables
public JsltTransformService withVariables(JsltVariables v)
-
getUrl
public java.lang.String getUrl()
Set the URL that contains the transformation you wish to execute.Although named as a URL it can resolve the JSLT file from either the classpath or filesystem depending on the value here.
- /Users/interlok/work/runtime/my.jslt - either file or classpath
- my.jslt - either file or classpath
- file:////Users/interlok/path/to/my.jslt - considered an absolute local file URL, but classpath will be checked as a last resort for /Users/interlok/path/to/my.jslt
- file:///C:/Users/interlok/path/to/my.jslt - explicit absolute URL (windows style)
- https://myserver.com/path/to/my.jslt - explicit absolute URL supported by the JVM
This also supports the
%message{}syntax to resolve metadata.- See Also:
ResourceLocator
-
setUrl
public void setUrl(java.lang.String url)
Set the URL that contains the transformation you wish to execute.Although named as a URL it can resolve the JSLT file from either the classpath or filesystem depending on the value here.
- /Users/interlok/work/runtime/my.jslt - either file or classpath
- my.jslt - either file or classpath
- file:////Users/interlok/path/to/my.jslt - considered an absolute local file URL, but classpath will be checked as a last resort for /Users/interlok/path/to/my.jslt
- file:///C:/Users/interlok/path/to/my.jslt - explicit absolute URL (windows style)
- https://myserver.com/path/to/my.jslt - explicit absolute URL supported by the JVM
This also supports the
%message{}syntax to resolve metadata.- See Also:
ResourceLocator
-
getVariables
@NonNull public @NonNull JsltVariables getVariables()
Any additional variables you want to pass into the JSLT transformation.Check passing values to jslt for what this means. Conceptually it is very similar to
XmlTransformParametersif you have dynamic values that you need to provide to your JSLT mapping.
-
setVariables
public void setVariables(@NonNull @NonNull JsltVariables variables)Any additional variables you want to pass into the JSLT transformation.Check passing values to jslt for what this means. Conceptually it is very similar to
XmlTransformParametersif you have dynamic values that you need to provide to your JSLT mapping.
-
getConnection
public AdaptrisConnection getConnection()
The connection that wraps any underlying caching required.When using the cache note that the JSLT Expression is not serializable so distributed caches may not work as you expect; in this instance the cache key will be the URL as resolved during first execution.
This defaults to a normal
CacheConnectionwith aNullCacheImplementationif not explicit configured.- Specified by:
getConnectionin interfaceConnectedService
-
setConnection
public void setConnection(AdaptrisConnection connection)
The connection that wraps any underlying caching required.When using the cache note that the JSLT Expression is not serializable so distributed caches may not work as you expect; in this instance the cache key will be the URL as resolved during first execution.
This defaults to a normal
CacheConnectionwith aNullCacheImplementationif not explicit configured.- Specified by:
setConnectionin interfaceConnectedService
-
-