Class XQueryBuilder
java.lang.Object
org.apache.camel.component.xquery.XQueryBuilder
- All Implemented Interfaces:
org.apache.camel.Expression,org.apache.camel.Predicate,org.apache.camel.Processor,org.apache.camel.spi.NamespaceAware
public abstract class XQueryBuilder
extends Object
implements org.apache.camel.Expression, org.apache.camel.Predicate, org.apache.camel.spi.NamespaceAware, org.apache.camel.Processor
Creates an XQuery builder.
The XQueryExpression, as you would expect, can be executed repeatedly, as often as you want, in the same or in
different threads.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidaddParameters(net.sf.saxon.query.DynamicQueryContext dynamicQueryContext, Map<String, Object> map) protected voidaddParameters(net.sf.saxon.query.DynamicQueryContext dynamicQueryContext, Map<String, Object> map, String parameterPrefix) Enables to allow using StAX.asBytes()asDOM()asList()voidassertMatches(String text, org.apache.camel.Exchange exchange) Deprecated.asString()protected voidconfigureQuery(net.sf.saxon.query.DynamicQueryContext dynamicQueryContext, org.apache.camel.Exchange exchange) Configures the dynamic context with exchange specific parametersprotected net.sf.saxon.query.DynamicQueryContextcreateDynamicContext(org.apache.camel.Exchange exchange) Creates a dynamic context for the given exchangeprotected abstract net.sf.saxon.query.XQueryExpressioncreateQueryExpression(net.sf.saxon.query.StaticQueryContext staticQueryContext) A factory method to create the XQuery expressionevaluate(org.apache.camel.Exchange exchange) <T> Tbyte[]evaluateAsBytes(org.apache.camel.Exchange exchange) evaluateAsBytesSource(org.apache.camel.Exchange exchange) evaluateAsDOM(org.apache.camel.Exchange exchange) List<?> evaluateAsList(org.apache.camel.Exchange exchange) evaluateAsString(org.apache.camel.Exchange exchange) evaluateAsStringSource(org.apache.camel.Exchange exchange) protected net.sf.saxon.om.ItemgetAsParameter(Object value) net.sf.saxon.Configurationnet.sf.saxon.query.XQueryExpressionnet.sf.saxon.lib.ModuleURIResolverClass<?> org.apache.camel.Expressionprotected Sourcenet.sf.saxon.query.StaticQueryContextvoidinit(org.apache.camel.CamelContext context) booleanprotected booleanisInputStreamNeeded(Object payload) Checks whether we need anInputStreamto access the message body.booleanprotected booleanbooleanmatches(org.apache.camel.Exchange exchange) voidprocess(org.apache.camel.Exchange exchange) resultType(Class<?> resultType) voidsetAllowStAX(boolean allowStAX) voidsetConfiguration(net.sf.saxon.Configuration configuration) voidsetConfigurationProperties(Map<String, Object> configurationProperties) voidsetModuleURIResolver(net.sf.saxon.lib.ModuleURIResolver moduleURIResolver) voidsetNamespaces(Map<String, String> namespaces) Configures the namespace context from the given DOM elementvoidsetParameters(Map<String, Object> parameters) voidsetProperties(Properties properties) voidsetResultsFormat(ResultFormat resultsFormat) voidsetResultType(Class<?> resultType) voidsetSource(org.apache.camel.Expression source) voidsetStaticQueryContext(net.sf.saxon.query.StaticQueryContext staticQueryContext) voidsetStripsAllWhiteSpace(boolean stripsAllWhiteSpace) toString()static XQueryBuilderxquery(InputStream in) Creates a newXQueryBuilderto evaluate against the expression loaded from the input stream.static XQueryBuilderxquery(InputStream in, String characterSet) Creates a newXQueryBuilderto evaluate against the expression loaded from the input stream.static XQueryBuilderCreates a newXQueryBuilderto evaluate against the expression loaded from the reader.static XQueryBuilderCreates a newXQueryBuilderto evaluate against the expression from the string.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.Predicate
initPredicate
-
Constructor Details
-
XQueryBuilder
public XQueryBuilder()
-
-
Method Details
-
toString
-
process
- Specified by:
processin interfaceorg.apache.camel.Processor- Throws:
Exception
-
init
public void init(org.apache.camel.CamelContext context) - Specified by:
initin interfaceorg.apache.camel.Expression- Specified by:
initin interfaceorg.apache.camel.Predicate
-
evaluate
- Specified by:
evaluatein interfaceorg.apache.camel.Expression
-
evaluate
-
evaluateAsList
- Throws:
Exception
-
evaluateAsStringSource
- Throws:
Exception
-
evaluateAsBytesSource
- Throws:
Exception
-
evaluateAsDOM
- Throws:
Exception
-
evaluateAsBytes
- Throws:
Exception
-
evaluateAsString
- Throws:
Exception
-
matches
public boolean matches(org.apache.camel.Exchange exchange) - Specified by:
matchesin interfaceorg.apache.camel.Predicate
-
assertMatches
@Deprecated public void assertMatches(String text, org.apache.camel.Exchange exchange) throws AssertionError Deprecated.- Throws:
AssertionError
-
xquery
Creates a newXQueryBuilderto evaluate against the expression from the string. Important: The builder must be initialized before use. -
xquery
Creates a newXQueryBuilderto evaluate against the expression loaded from the reader. Important: The builder must be initialized before use. -
xquery
Creates a newXQueryBuilderto evaluate against the expression loaded from the input stream. Important: The builder must be initialized before use. -
xquery
Creates a newXQueryBuilderto evaluate against the expression loaded from the input stream. Important: The builder must be initialized before use. -
parameter
-
namespace
-
resultType
-
asBytes
-
asBytesSource
-
asDOM
-
asDOMSource
-
asList
-
asString
-
asStringSource
-
stripsAllWhiteSpace
-
stripsIgnorableWhiteSpace
-
allowStAX
Enables to allow using StAX. When enabled StAX is preferred as the first choice asSource. -
setNamespaces
Configures the namespace context from the given DOM element- Specified by:
setNamespacesin interfaceorg.apache.camel.spi.NamespaceAware
-
getNamespaces
- Specified by:
getNamespacesin interfaceorg.apache.camel.spi.NamespaceAware
-
getExpression
public net.sf.saxon.query.XQueryExpression getExpression() -
getConfiguration
public net.sf.saxon.Configuration getConfiguration() -
setConfiguration
public void setConfiguration(net.sf.saxon.Configuration configuration) -
getConfigurationProperties
-
setConfigurationProperties
-
getStaticQueryContext
public net.sf.saxon.query.StaticQueryContext getStaticQueryContext() -
setStaticQueryContext
public void setStaticQueryContext(net.sf.saxon.query.StaticQueryContext staticQueryContext) -
getParameters
-
setParameters
-
getProperties
-
setProperties
-
getResultsFormat
-
setResultsFormat
-
getResultType
-
setResultType
-
getModuleURIResolver
public net.sf.saxon.lib.ModuleURIResolver getModuleURIResolver() -
setModuleURIResolver
public void setModuleURIResolver(net.sf.saxon.lib.ModuleURIResolver moduleURIResolver) -
isStripsAllWhiteSpace
public boolean isStripsAllWhiteSpace() -
setStripsAllWhiteSpace
public void setStripsAllWhiteSpace(boolean stripsAllWhiteSpace) -
isAllowStAX
public boolean isAllowStAX() -
setAllowStAX
public void setAllowStAX(boolean allowStAX) -
getSource
public org.apache.camel.Expression getSource() -
setSource
public void setSource(org.apache.camel.Expression source) -
createQueryExpression
protected abstract net.sf.saxon.query.XQueryExpression createQueryExpression(net.sf.saxon.query.StaticQueryContext staticQueryContext) throws net.sf.saxon.trans.XPathException, IOException A factory method to create the XQuery expression- Throws:
net.sf.saxon.trans.XPathExceptionIOException
-
createDynamicContext
protected net.sf.saxon.query.DynamicQueryContext createDynamicContext(org.apache.camel.Exchange exchange) throws Exception Creates a dynamic context for the given exchange- Throws:
Exception
-
isInputStreamNeeded
Checks whether we need anInputStreamto access the message body. Depending on the content in the message body, we may not need to convert toInputStream.- Returns:
- true to convert to
InputStreambeforehand converting toSourceafterwards.
-
getSource
-
configureQuery
protected void configureQuery(net.sf.saxon.query.DynamicQueryContext dynamicQueryContext, org.apache.camel.Exchange exchange) Configures the dynamic context with exchange specific parameters -
addParameters
-
addParameters
-
getAsParameter
-
matches
-