Class XqjTransmogrifier<T>

java.lang.Object
org.openehealth.ipf.commons.xml.AbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
org.openehealth.ipf.commons.xml.XqjTransmogrifier<T>
Type Parameters:
T - output type
All Implemented Interfaces:
Transmogrifier<Source,T>

public class XqjTransmogrifier<T> extends AbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression> implements Transmogrifier<Source,T>
XQuery transformer similar to the XsltTransmogrifier
Author:
Stefan Ivanov
  • Constructor Details

    • XqjTransmogrifier

      public XqjTransmogrifier()
    • XqjTransmogrifier

      public XqjTransmogrifier(Class<T> outputFormat)
      Parameters:
      outputFormat - currently supported: String, Writer, OutputStream
    • XqjTransmogrifier

      public XqjTransmogrifier(Class<T> outputFormat, ClassLoader classLoader)
      Parameters:
      outputFormat - currently supported: String, Writer, OutputStream
      classLoader - class loader for resource retrieval, may be null
    • XqjTransmogrifier

      public XqjTransmogrifier(Class<T> outputFormat, Map<String,Object> globalParams)
      Parameters:
      outputFormat - currently supported: String, Writer, OutputStream
      globalParams - static XQuery parameters
    • XqjTransmogrifier

      public XqjTransmogrifier(Class<T> outputFormat, ClassLoader classLoader, Map<String,Object> globalParams)
      Parameters:
      outputFormat - currently supported: String, Writer, OutputStream
      classLoader - class loader for resource retrieval, may be null
      globalParams - static XQuery parameters
  • Method Details

    • getCache

      protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<javax.xml.xquery.XQPreparedExpression>> getCache()
      Specified by:
      getCache in class AbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
      Returns:
      static cache for the configured resource type. Note that the returned Map is not necessarily synchronized.
    • zap

      public T zap(Source source, Object... params)
      Converts a Source into a typed result using a XQuery processor.

      The XQ resource location is mandatory in the first extra parameter. Other parameters may be passed as a Map in the second parameter.

      Specified by:
      zap in interface Transmogrifier<Source,T>
      Parameters:
      source - what goes in
      Returns:
      what comes out
      See Also:
    • resource

      protected javax.xml.xquery.XQPreparedExpression resource(Object... params) throws Exception
      This method had to be overridden because XQPreparedExpression objects are not thread-safe, thus an additional replication step is necessary.
      Overrides:
      resource in class AbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
      Parameters:
      params - validator/transmogrifier parameters.
      Returns:
      resource instance.
      Throws:
      Exception
    • createResource

      public javax.xml.xquery.XQPreparedExpression createResource(Object... params)
      Description copied from class: AbstractCachingXmlProcessor
      Creates a ready-to-use resource (e.g. an XML Schema instance) for the given key. Insertion into the cache will happen externally, this method's purpose is only to instantiate the resource to be cached.

      This method does not need to be re-entrant, but its result MUST be thread-safe.

      Specified by:
      createResource in class AbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
      Parameters:
      params - validator/transmogrifier parameters.
      Returns:
      resource of the configured type.
    • getStaticParams

      public Map<String,Object> getStaticParams()
    • setStaticParams

      public void setStaticParams(Map<String,Object> staticParams)