Package org.openehealth.ipf.commons.xml
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
-
Nested Class Summary
Nested classes/interfaces inherited from class org.openehealth.ipf.commons.xml.AbstractCachingXmlProcessor
AbstractCachingXmlProcessor.Loader<S>
-
Field Summary
Fields inherited from class org.openehealth.ipf.commons.xml.AbstractCachingXmlProcessor
RESOURCE_LOCATION
-
Constructor Summary
ConstructorDescriptionXqjTransmogrifier
(Class<T> outputFormat) XqjTransmogrifier
(Class<T> outputFormat, ClassLoader classLoader) XqjTransmogrifier
(Class<T> outputFormat, ClassLoader classLoader, Map<String, Object> globalParams) -
Method Summary
Modifier and TypeMethodDescriptionjavax.xml.xquery.XQPreparedExpression
createResource
(Object... params) Creates a ready-to-use resource (e.g.protected ConcurrentMap<String,
AbstractCachingXmlProcessor.Loader<javax.xml.xquery.XQPreparedExpression>> getCache()
protected javax.xml.xquery.XQPreparedExpression
This method had to be overridden becauseXQPreparedExpression
objects are not thread-safe, thus an additional replication step is necessary.void
setStaticParams
(Map<String, Object> staticParams) Converts a Source into a typed result using a XQuery processor.Methods inherited from class org.openehealth.ipf.commons.xml.AbstractCachingXmlProcessor
resourceCacheKey, resourceContent, resourceLocation, resourceParameters
-
Constructor Details
-
XqjTransmogrifier
public XqjTransmogrifier() -
XqjTransmogrifier
- Parameters:
outputFormat
- currently supported: String, Writer, OutputStream
-
XqjTransmogrifier
- Parameters:
outputFormat
- currently supported: String, Writer, OutputStreamclassLoader
- class loader for resource retrieval, may benull
-
XqjTransmogrifier
- Parameters:
outputFormat
- currently supported: String, Writer, OutputStreamglobalParams
- static XQuery parameters
-
XqjTransmogrifier
public XqjTransmogrifier(Class<T> outputFormat, ClassLoader classLoader, Map<String, Object> globalParams) - Parameters:
outputFormat
- currently supported: String, Writer, OutputStreamclassLoader
- class loader for resource retrieval, may benull
globalParams
- static XQuery parameters
-
-
Method Details
-
getCache
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<javax.xml.xquery.XQPreparedExpression>> getCache()- Specified by:
getCache
in classAbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
- Returns:
- static cache for the configured resource type. Note that the returned Map is not necessarily synchronized.
-
zap
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 interfaceTransmogrifier<Source,
T> - Parameters:
source
- what goes in- Returns:
- what comes out
- See Also:
-
resource
This method had to be overridden becauseXQPreparedExpression
objects are not thread-safe, thus an additional replication step is necessary.- Overrides:
resource
in classAbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
- Parameters:
params
- validator/transmogrifier parameters.- Returns:
- resource instance.
- Throws:
Exception
-
createResource
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 classAbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>
- Parameters:
params
- validator/transmogrifier parameters.- Returns:
- resource of the configured type.
-
getStaticParams
-
setStaticParams
-