Class JsltTransformService

java.lang.Object
com.adaptris.core.ServiceImp
com.adaptris.core.json.jslt.JsltTransformService
All Implemented Interfaces:
AdaptrisComponent, ComponentLifecycle, ComponentLifecycleExtension, ConfigComment, 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 ConnectedService
Execute a JSLT Transform, using the result as the payload

In 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.

  • Constructor Details

    • JsltTransformService

      public JsltTransformService()
  • Method Details

    • doService

      public void doService(AdaptrisMessage msg) throws ServiceException
      Specified by:
      doService in interface Service
      Throws:
      ServiceException
    • prepare

      public void prepare() throws CoreException
      Specified by:
      prepare in interface ComponentLifecycleExtension
      Throws:
      CoreException
    • initService

      protected void initService() throws CoreException
      Specified by:
      initService in class ServiceImp
      Throws:
      CoreException
    • start

      public void start() throws CoreException
      Specified by:
      start in interface ComponentLifecycle
      Overrides:
      start in class ServiceImp
      Throws:
      CoreException
    • stop

      public void stop()
      Specified by:
      stop in interface ComponentLifecycle
      Overrides:
      stop in class ServiceImp
    • closeService

      protected void closeService()
      Specified by:
      closeService in class ServiceImp
    • withUrl

      public JsltTransformService withUrl(String url)
    • withConnection

      public JsltTransformService withConnection(AdaptrisConnection c)
    • withVariables

      public JsltTransformService withVariables(JsltVariables v)
    • getUrl

      public 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:
    • setUrl

      public void setUrl(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:
    • 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 XmlTransformParameters if 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 XmlTransformParameters if 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 CacheConnection with a NullCacheImplementation if not explicit configured.

      Specified by:
      getConnection in interface ConnectedService
    • 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 CacheConnection with a NullCacheImplementation if not explicit configured.

      Specified by:
      setConnection in interface ConnectedService