|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.exist.xmldb.LocalXPathQueryService
public class LocalXPathQueryService
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()
|
org.xmldb.api.base.CompiledExpression |
compile(String query)
Compiles the specified XQuery and returns a handle to the compiled code, which can then be passed to XQueryService.execute(CompiledExpression) . |
org.xmldb.api.base.CompiledExpression |
compileAndCheck(String query)
Tries to compile the specified XQuery and returns a handle to the compiled code, which can then be passed to XQueryService.execute(CompiledExpression) . |
void |
declareVariable(String qname,
Object initialValue)
Declare an external XPath variable and assign a value to it. |
void |
dump(org.xmldb.api.base.CompiledExpression expression,
Writer writer)
Return a diagnostic dump of the query. |
void |
endProtected()
Close the protected environment. |
org.xmldb.api.base.ResourceSet |
execute(org.xmldb.api.base.CompiledExpression expression)
Execute a compiled XQuery. |
org.xmldb.api.base.ResourceSet |
execute(Source source)
|
org.xmldb.api.base.ResourceSet |
execute(org.xmldb.api.modules.XMLResource res,
org.xmldb.api.base.CompiledExpression expression)
|
String |
getName()
|
String |
getNamespace(String prefix)
Returns the URI string associated with prefix from
the internal namespace map. |
String |
getProperty(String property)
|
String |
getVersion()
|
org.xmldb.api.base.ResourceSet |
query(String query)
Execute the specified query and return the results as a ResourceSet . |
org.xmldb.api.base.ResourceSet |
query(String query,
String sortBy)
Process an XPath query and sort the results by applying a second XPath expression to each of the search results. |
org.xmldb.api.base.ResourceSet |
query(org.xmldb.api.modules.XMLResource res,
String query)
Process an XPath query based on the result of a previous query. |
org.xmldb.api.base.ResourceSet |
query(org.xmldb.api.modules.XMLResource res,
String query,
String sortBy)
Process an XPath query based on the result of a previous query and sort the results using the second XPath expression. |
org.xmldb.api.base.ResourceSet |
queryResource(String resource,
String query)
|
void |
removeNamespace(String ns)
Removes the namespace mapping associated with prefix from
the internal namespace map. |
void |
setCollection(org.xmldb.api.base.Collection col)
|
void |
setModuleLoadPath(String path)
|
void |
setNamespace(String prefix,
String namespace)
Sets a namespace mapping in the internal namespace map used to evaluate queries. |
void |
setProperty(String property,
String value)
|
void |
setXPathCompatibility(boolean backwardsCompatible)
Enable or disable XPath 1.0 compatibility mode. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public LocalXPathQueryService(User user, BrokerPool pool, LocalCollection collection, AccessContext accessCtx)
Method Detail |
---|
public void clearNamespaces() throws org.xmldb.api.base.XMLDBException
clearNamespaces
in interface org.xmldb.api.modules.XPathQueryService
clearNamespaces
in interface org.xmldb.api.modules.XQueryService
org.xmldb.api.base.XMLDBException
public String getName() throws org.xmldb.api.base.XMLDBException
getName
in interface org.xmldb.api.base.Service
org.xmldb.api.base.XMLDBException
public String getNamespace(String prefix) throws org.xmldb.api.base.XMLDBException
XQueryService
prefix
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 org.xmldb.api.modules.XPathQueryService
getNamespace
in interface org.xmldb.api.modules.XQueryService
prefix
- The prefix to retrieve from the namespace map.
prefix
org.xmldb.api.base.XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public String getProperty(String property) throws org.xmldb.api.base.XMLDBException
getProperty
in interface org.xmldb.api.base.Configurable
org.xmldb.api.base.XMLDBException
public String getVersion() throws org.xmldb.api.base.XMLDBException
getVersion
in interface org.xmldb.api.base.Service
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet query(String query) throws org.xmldb.api.base.XMLDBException
XQueryService
ResourceSet
.
query
in interface org.xmldb.api.modules.XPathQueryService
query
in interface org.xmldb.api.modules.XQueryService
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet query(org.xmldb.api.modules.XMLResource res, String query) throws org.xmldb.api.base.XMLDBException
XPathQueryServiceImpl
query
in interface XPathQueryServiceImpl
res
- an XMLResource as obtained from a previous query.query
- the XPath query
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet query(String query, String sortBy) throws org.xmldb.api.base.XMLDBException
XPathQueryServiceImpl
query
in interface XPathQueryServiceImpl
query
- the XPath querysortBy
- another XPath expression, which is executed relative to the
results of the primary expression.
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet query(org.xmldb.api.modules.XMLResource res, String query, String sortBy) throws org.xmldb.api.base.XMLDBException
XPathQueryServiceImpl
query
in interface XPathQueryServiceImpl
res
- 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.
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet execute(org.xmldb.api.base.CompiledExpression expression) throws org.xmldb.api.base.XMLDBException
XQueryService
XQueryService
to the compiled XQuery code.
Note: CompiledExpression
is not thread safe. Please make sure you don't
call the same compiled expression from two threads at the same time.
execute
in interface org.xmldb.api.modules.XQueryService
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet execute(org.xmldb.api.modules.XMLResource res, org.xmldb.api.base.CompiledExpression expression) throws org.xmldb.api.base.XMLDBException
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.ResourceSet execute(Source source) throws org.xmldb.api.base.XMLDBException
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.CompiledExpression compile(String query) throws org.xmldb.api.base.XMLDBException
XQueryService
XQueryService.execute(CompiledExpression)
.
Note: CompiledExpression
is not thread safe. Please make sure you don't
call the same compiled expression from two threads at the same time.
compile
in interface org.xmldb.api.modules.XQueryService
org.xmldb.api.base.XMLDBException
public org.xmldb.api.base.CompiledExpression compileAndCheck(String query) throws org.xmldb.api.base.XMLDBException, XPathException
XQueryService
XQueryService.execute(CompiledExpression)
.
If a static error is detected, an XPathException
will be thrown.
org.xmldb.api.base.XMLDBException
XPathException
public org.xmldb.api.base.ResourceSet queryResource(String resource, String query) throws org.xmldb.api.base.XMLDBException
queryResource
in interface org.xmldb.api.modules.XPathQueryService
queryResource
in interface org.xmldb.api.modules.XQueryService
org.xmldb.api.base.XMLDBException
public void beginProtected() throws org.xmldb.api.base.XMLDBException
endProtected()
is called.
beginProtected
in interface XPathQueryServiceImpl
org.xmldb.api.base.XMLDBException
public void endProtected()
endProtected
in interface XPathQueryServiceImpl
public void removeNamespace(String ns) throws org.xmldb.api.base.XMLDBException
XQueryService
prefix
from
the internal namespace map. If prefix
is null or empty the
mapping for the default namespace will be removed.
removeNamespace
in interface org.xmldb.api.modules.XPathQueryService
removeNamespace
in interface org.xmldb.api.modules.XQueryService
ns
- The prefix to remove from the namespace map. If
prefix
is null or empty the mapping for the default
namespace will be removed.
org.xmldb.api.base.XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void setCollection(org.xmldb.api.base.Collection col) throws org.xmldb.api.base.XMLDBException
setCollection
in interface org.xmldb.api.base.Service
org.xmldb.api.base.XMLDBException
public void setNamespace(String prefix, String namespace) throws org.xmldb.api.base.XMLDBException
XQueryService
prefix
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 org.xmldb.api.modules.XPathQueryService
setNamespace
in interface org.xmldb.api.modules.XQueryService
prefix
- The prefix to set in the map. If
prefix
is empty or null the
default namespace will be associated with the provided URI.namespace
- The URI for the namespace to be associated with prefix.
org.xmldb.api.base.XMLDBException
- with expected error codes.ErrorCodes.VENDOR_ERROR
for any vendor
specific errors that occur.public void setProperty(String property, String value) throws org.xmldb.api.base.XMLDBException
setProperty
in interface org.xmldb.api.base.Configurable
org.xmldb.api.base.XMLDBException
public void declareVariable(String qname, Object initialValue) throws org.xmldb.api.base.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 XPathQueryServiceImpl
declareVariable
in interface org.xmldb.api.modules.XQueryService
qname
- 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
org.xmldb.api.base.XMLDBException
public void setXPathCompatibility(boolean backwardsCompatible)
XQueryService
setXPathCompatibility
in interface org.xmldb.api.modules.XQueryService
public void setModuleLoadPath(String path)
setModuleLoadPath
in interface org.xmldb.api.modules.XQueryService
public void dump(org.xmldb.api.base.CompiledExpression expression, Writer writer) throws org.xmldb.api.base.XMLDBException
XQueryService
org.xmldb.api.base.XMLDBException
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |