|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.exist.xmldb.LocalXPathQueryService
| Field Summary | |
protected AccessContext |
accessCtx
|
protected BrokerPool |
brokerPool
|
protected LocalCollection |
collection
|
protected boolean |
lockDocuments
|
protected DocumentSet |
lockedDocuments
|
protected java.lang.String |
moduleLoadPath
|
protected java.util.TreeMap |
namespaceDecls
|
protected java.util.Properties |
properties
|
protected User |
user
|
protected java.util.TreeMap |
variableDecls
|
protected boolean |
xpathCompatible
|
| Constructor Summary | |
LocalXPathQueryService(User user,
BrokerPool pool,
LocalCollection collection,
AccessContext accessCtx)
|
|
| Method Summary | |
void |
beginProtected()
Execute all following queries in a protected environment. |
void |
clearNamespaces()
|
CompiledExpression |
compile(java.lang.String query)
Compiles the specified XQuery and returns a handle to the compiled code, which can then be passed to execute(CompiledExpression). |
CompiledExpression |
compileAndCheck(java.lang.String query)
Tries to compile the specified XQuery and returns a handle to the compiled code, which can then be passed to execute(CompiledExpression). |
void |
declareVariable(java.lang.String qname,
java.lang.Object initialValue)
Declare an external XPath variable and assign a value to it. |
void |
dump(CompiledExpression expression,
java.io.Writer writer)
Return a diagnostic dump of the query. |
void |
endProtected()
Close the protected environment. |
ResourceSet |
execute(CompiledExpression expression)
|
ResourceSet |
execute(XMLResource res,
CompiledExpression expression)
|
java.lang.String |
getName()
|
java.lang.String |
getNamespace(java.lang.String prefix)
Returns the URI string associated with prefix from
the internal namespace map. |
java.lang.String |
getProperty(java.lang.String property)
|
java.lang.String |
getVersion()
|
ResourceSet |
query(java.lang.String query)
Execute the specified query and return the results as a ResourceSet. |
ResourceSet |
query(XMLResource res,
java.lang.String query)
Process an XPath query based on the result of a previous query. |
ResourceSet |
query(XMLResource res,
java.lang.String query,
java.lang.String sortBy)
Process an XPath query based on the result of a previous query and sort the results using the second XPath expression. |
ResourceSet |
queryResource(java.lang.String resource,
java.lang.String query)
|
void |
removeNamespace(java.lang.String ns)
Removes the namespace mapping associated with prefix from
the internal namespace map. |
void |
setCollection(Collection col)
|
void |
setModuleLoadPath(java.lang.String path)
|
void |
setNamespace(java.lang.String prefix,
java.lang.String namespace)
Sets a namespace mapping in the internal namespace map used to evaluate queries. |
void |
setProperty(java.lang.String property,
java.lang.String value)
|
protected void |
setupContext(XQueryContext context)
|
void |
setXPathCompatibility(boolean backwardsCompatible)
Enable or disable XPath 1.0 compatibility mode. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.exist.xmldb.XQueryService |
execute |
| Field Detail |
protected BrokerPool brokerPool
protected LocalCollection collection
protected User user
protected java.util.TreeMap namespaceDecls
protected java.util.TreeMap variableDecls
protected boolean xpathCompatible
protected java.lang.String moduleLoadPath
protected java.util.Properties properties
protected boolean lockDocuments
protected DocumentSet lockedDocuments
protected AccessContext accessCtx
| Constructor Detail |
public LocalXPathQueryService(User user,
BrokerPool pool,
LocalCollection collection,
AccessContext accessCtx)
| Method Detail |
public void clearNamespaces()
throws XMLDBException
XMLDBException
public java.lang.String getName()
throws XMLDBException
XMLDBException
public java.lang.String getNamespace(java.lang.String prefix)
throws XMLDBException
XQueryServiceprefix from
the internal namespace map. If prefix is null or empty the
URI for the default namespace will be returned. If a mapping for the
prefix can not be found null is returned.
getNamespace in interface XQueryServiceprefix - The prefix to retrieve from the namespace map.
prefix
XMLDBException
public java.lang.String getProperty(java.lang.String property)
throws XMLDBException
XMLDBException
public java.lang.String getVersion()
throws XMLDBException
XMLDBException
public ResourceSet query(java.lang.String query)
throws XMLDBException
XQueryServiceResourceSet.
query in interface XQueryServicequery -
XMLDBException
public ResourceSet query(XMLResource res,
java.lang.String query)
throws XMLDBException
XPathQueryServiceImpl
query in interface XPathQueryServiceImplres - an XMLResource as obtained from a previous query.query - the XPath query
XMLDBException
public ResourceSet query(XMLResource res,
java.lang.String query,
java.lang.String sortBy)
throws XMLDBException
XPathQueryServiceImpl
query in interface XPathQueryServiceImplres - an XMLResource as obtained from a previous queryquery - the XPath querysortBy - another XPath expression, which is executed relative to
the results of the primary expression. The result of applying sortExpr is converted
to a string value, which is then used to sort the results.
XMLDBException
public ResourceSet execute(CompiledExpression expression)
throws XMLDBException
XMLDBException
public ResourceSet execute(XMLResource res,
CompiledExpression expression)
throws XMLDBException
execute in interface XQueryServiceXMLDBException
public CompiledExpression compile(java.lang.String query)
throws XMLDBException
XQueryService#execute(CompiledExpression).
compile in interface XQueryServicequery -
XMLDBException
public CompiledExpression compileAndCheck(java.lang.String query)
throws XMLDBException,
XPathException
XQueryService#execute(CompiledExpression).
If a static error is detected, an XPathException will be thrown.
compileAndCheck in interface XQueryServicequery -
XMLDBException
XPathException
public ResourceSet queryResource(java.lang.String resource,
java.lang.String query)
throws XMLDBException
XMLDBException
protected void setupContext(XQueryContext context)
throws XMLDBException,
XPathException
XMLDBException
XPathExceptionpublic void beginProtected()
endProtected() is called.
beginProtected in interface XPathQueryServiceImplpublic void endProtected()
endProtected in interface XPathQueryServiceImpl
public void removeNamespace(java.lang.String ns)
throws XMLDBException
XQueryServiceprefix from
the internal namespace map. If prefix is null or empty the
mapping for the default namespace will be removed.
removeNamespace in interface XQueryServiceXMLDBException
public void setCollection(Collection col)
throws XMLDBException
XMLDBException
public void setNamespace(java.lang.String prefix,
java.lang.String namespace)
throws XMLDBException
XQueryServiceprefix is null or empty the default namespace is
associated with the provided URI. A null or empty uri results
in an exception being thrown.
setNamespace in interface XQueryServiceprefix - The prefix to set in the map. If
prefix is empty or null the
default namespace will be associated with the provided URI.
XMLDBException
public void setProperty(java.lang.String property,
java.lang.String value)
throws XMLDBException
XMLDBException
public void declareVariable(java.lang.String qname,
java.lang.Object initialValue)
throws XMLDBException
XPathQueryServiceImpl
declareVariable("name", "HAMLET");
you may use the variable in an XPath expression as follows:
//SPEECH[SPEAKER=$name]Any Java object may be passed as initial value. The query engine will try to map this into a corresponding XPath value. You may also pass an XMLResource as obtained from another XPath expression. This will be converted into a node.
declareVariable in interface XPathQueryServiceImplqname - a valid QName by which the variable is identified. Any
prefix should have been mapped to a namespace, i.e. if a variable is called
x:name, there should be a prefix/namespace mapping for the prefix
xinitialValue - the initial value, which is assigned to the variable
XMLDBExceptionpublic void setXPathCompatibility(boolean backwardsCompatible)
XQueryService
setXPathCompatibility in interface XQueryServicebackwardsCompatible - public void setModuleLoadPath(java.lang.String path)
setModuleLoadPath in interface XQueryService
public void dump(CompiledExpression expression,
java.io.Writer writer)
throws XMLDBException
XQueryService
dump in interface XQueryServiceexpression - writer -
XMLDBException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||