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
ConstructorsConstructorDescriptionXqjTransmogrifier(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.XQPreparedExpressioncreateResource(Object... params) Creates a ready-to-use resource (e.g. an XML Schema instance) for the given key.protected ConcurrentMap<String, AbstractCachingXmlProcessor.Loader<javax.xml.xquery.XQPreparedExpression>> getCache()protected javax.xml.xquery.XQPreparedExpressionThis method had to be overridden becauseXQPreparedExpressionobjects are not thread-safe, thus an additional replication step is necessary.voidsetStaticParams(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 benullglobalParams- static XQuery parameters
-
-
Method Details
-
getCache
protected ConcurrentMap<String,AbstractCachingXmlProcessor.Loader<javax.xml.xquery.XQPreparedExpression>> getCache()- Specified by:
getCachein 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:
zapin interfaceTransmogrifier<Source,T> - Parameters:
source- what goes inparams- parameters- Returns:
- what comes out
- See Also:
-
resource
This method had to be overridden becauseXQPreparedExpressionobjects are not thread-safe, thus an additional replication step is necessary.- Overrides:
resourcein classAbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>- Parameters:
params- validator/transmogrifier parameters.- Returns:
- resource instance.
- Throws:
Exception- exception
-
createResource
Description copied from class:AbstractCachingXmlProcessorCreates 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:
createResourcein classAbstractCachingXmlProcessor<javax.xml.xquery.XQPreparedExpression>- Parameters:
params- validator/transmogrifier parameters.- Returns:
- resource of the configured type.
-
getStaticParams
-
setStaticParams
-