|
|||||||
| 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
| Field Summary |
|---|
| Fields inherited from interface org.xmldb.api.modules.XPathQueryService |
|---|
SERVICE_NAME |
| Fields inherited from interface org.xmldb.api.modules.XQueryService |
|---|
SERVICE_NAME |
| 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()
Removes all namespace mappings stored in the internal namespace map. |
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). |
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(CompiledExpression expression,
Writer writer)
Return a diagnostic dump of the query. |
void |
endProtected()
Close the protected environment. |
ResourceSet |
execute(CompiledExpression expression)
Execute a compiled XQuery. |
ResourceSet |
execute(Source source)
|
ResourceSet |
execute(XMLResource res,
CompiledExpression expression)
|
String |
getName()
Returns the name associated with the Service instance. |
String |
getNamespace(String prefix)
Returns the URI string associated with prefix from
the internal namespace map. |
String |
getProperty(String property)
Returns the value of the property identified by name. |
String |
getVersion()
Gets the Version attribute of the Service object |
ResourceSet |
query(String query)
Run an XPath query against the Collection. |
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. |
ResourceSet |
query(XMLResource res,
String query)
Process an XPath query based on the result of a previous query. |
ResourceSet |
query(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. |
ResourceSet |
queryResource(String resource,
String query)
Run an XPath query against an XML resource stored in the Collection associated with this service. |
void |
removeNamespace(String ns)
Removes the namespace mapping associated with prefix from
the internal namespace map. |
void |
setCollection(Collection col)
Sets the Collection attribute of the Service object |
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)
Sets the property name to have the value provided in
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 XMLDBException
XPathQueryService
clearNamespaces in interface XPathQueryServiceclearNamespaces in interface XQueryServiceXMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public String getName()
throws XMLDBException
Service
getName in interface ServiceXMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public String getNamespace(String prefix)
throws XMLDBException
XPathQueryServiceprefix 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 XPathQueryServicegetNamespace in interface XQueryServiceprefix - The prefix to retrieve from the namespace map.
prefix
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public String getProperty(String property)
throws XMLDBException
Configurablename.
getProperty in interface Configurableproperty - the name of the property to retrieve.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public String getVersion()
throws XMLDBException
Service
getVersion in interface ServiceXMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public ResourceSet query(String query)
throws XMLDBException
XPathQueryServiceCollection. The XPath will be
applied to all XML resources stored in the Collection.
The result is a
ResourceSet containing the results of the query. Any
namespaces used in the query string will be evaluated using
the mappings setup using setNamespace.
query in interface XPathQueryServicequery in interface XQueryServicequery - The XPath query string to use.
ResourceSet containing the results of the query.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public ResourceSet query(XMLResource res,
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(String query,
String sortBy)
throws XMLDBException
XPathQueryServiceImpl
query in interface XPathQueryServiceImplquery - the XPath querysortBy - another XPath expression, which is executed relative to the
results of the primary expression.
XMLDBException
public ResourceSet query(XMLResource res,
String query,
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
XQueryServiceXQueryService to the compiled XQuery code.
execute in interface XQueryServiceXMLDBException
public ResourceSet execute(XMLResource res,
CompiledExpression expression)
throws XMLDBException
XMLDBException
public ResourceSet execute(Source source)
throws XMLDBException
XMLDBException
public CompiledExpression compile(String query)
throws XMLDBException
XQueryServiceXQueryService.execute(CompiledExpression).
compile in interface XQueryServiceXMLDBException
public CompiledExpression compileAndCheck(String query)
throws XMLDBException,
XPathException
XQueryServiceXQueryService.execute(CompiledExpression).
If a static error is detected, an XPathException will be thrown.
XMLDBException
XPathException
public ResourceSet queryResource(String resource,
String query)
throws XMLDBException
XPathQueryServiceCollection associated with this service. The result is a
ResourceSet containing the results of the query. Any
namespaces used in the query string will be evaluated using
the mappings setup using setNamespace.
queryResource in interface XPathQueryServicequeryResource in interface XQueryServiceresource - The id of the document to run the query against.query - The XPath query string to use.
ResourceSet containing the results of the query.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.public void beginProtected()
endProtected() is called.
beginProtected in interface XPathQueryServiceImplpublic void endProtected()
endProtected in interface XPathQueryServiceImpl
public void removeNamespace(String ns)
throws XMLDBException
XPathQueryServiceprefix from
the internal namespace map. If prefix is null or empty the
mapping for the default namespace will be removed.
removeNamespace in interface XPathQueryServiceremoveNamespace in interface XQueryServicens - The prefix to remove from the namespace map. If
prefix is null or empty the mapping for the default
namespace will be removed.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public void setCollection(Collection col)
throws XMLDBException
Service
setCollection in interface Servicecol - The new Collection value
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public void setNamespace(String prefix,
String namespace)
throws XMLDBException
XPathQueryServiceprefix 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 XPathQueryServicesetNamespace 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.namespace - The URI for the namespace to be associated with prefix.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public void setProperty(String property,
String value)
throws XMLDBException
Configurablename to have the value provided in
value.
setProperty in interface Configurableproperty - the name of the property to set.value - the value to set for the property.
XMLDBException - with expected error codes.ErrorCodes.VENDOR_ERROR for any vendor
specific errors that occur.
public void declareVariable(String qname,
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 XPathQueryServiceImpldeclareVariable in interface XQueryServiceqname - 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 XQueryServicepublic void setModuleLoadPath(String path)
setModuleLoadPath in interface XQueryService
public void dump(CompiledExpression expression,
Writer writer)
throws XMLDBException
XQueryService
XMLDBException
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||