Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.exist.xmldb
Class RemoteXPathQueryService

    java.lang.Object
      org.exist.xmldb.RemoteXPathQueryService

All Implemented Interfaces:
  Configurable, Service, XPathQueryService, XPathQueryServiceImpl, XQueryService, XQueryService

public class RemoteXPathQueryService
extends java.lang.Object
implements XPathQueryServiceImpl, XQueryService

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
`RemoteXPathQueryService(RemoteCollection collection)`

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(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)` Execute a compiled XQuery.
`ResourceSet` | `execute(Source source)`
`ResourceSet` | `execute(XMLResource res, CompiledExpression expression)`
`java.lang.String` | `getName()` Returns the name associated with the Service instance.
`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)` Returns the value of the property identified by `name`.
`java.lang.String` | `getVersion()` Gets the Version attribute of the Service object
`ResourceSet` | `query(java.lang.String query)` Execute the specified query and return the results as a `ResourceSet`.
`ResourceSet` | `query(java.lang.String query, java.lang.String sortExpr)` Process an XPath query and sort the results by applying a second XPath expression to each of the search results.
`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 sortExpr)` 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)` Run an XPath query against an XML resource stored in the `Collection` associated with this service.
`void` | `removeNamespace(java.lang.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(java.lang.String path)` Calling this method has no effect.
`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)` 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

### RemoteXPathQueryService

    public RemoteXPathQueryService(RemoteCollection collection)

Method Detail

### query

    public ResourceSet query(java.lang.String query)
                      throws XMLDBException

  Description copied from interface: `XQueryService`
  Execute the specified query and return the results as a `ResourceSet`.

  Specified by:
    `query` in interface `XPathQueryService`
  Parameters:
    `query` - The XPath query string to use.
  Returns:
    A `ResourceSet` containing the results of the query.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### query

    public ResourceSet query(java.lang.String query,
                             java.lang.String sortExpr)
                      throws XMLDBException

  Description copied from interface: `XPathQueryServiceImpl`
  Process an XPath query and sort the results by applying a second XPath expression to each of the search results. The result of applying the sort expression is converted into a string, which is then used to sort the set of results.

  Specified by:
    `query` in interface `XPathQueryServiceImpl`
  Parameters:
    `query` - the XPath query
    `sortExpr` - another XPath expression, which is executed relative to the results of the primary expression.
  Throws:
    `XMLDBException`

### compile

    public CompiledExpression compile(java.lang.String query)
                               throws XMLDBException

  Description copied from interface: `XQueryService`
  Compiles the specified XQuery and returns a handle to the compiled code, which can then be passed to `XQueryService.execute(CompiledExpression)`.

  Specified by:
    `compile` in interface `XQueryService`
  Parameters:
    `query` -
  Throws:
    `XMLDBException`

### compileAndCheck

    public CompiledExpression compileAndCheck(java.lang.String query)
                                       throws XMLDBException,
                                              XPathException

  Description copied from interface: `XQueryService`
  Tries to compile the specified XQuery and returns a handle to the compiled code, which can then be passed to `XQueryService.execute(CompiledExpression)`. If a static error is detected, an `XPathException` will be thrown.

  Specified by:
    `compileAndCheck` in interface `XQueryService`
  Parameters:
    `query` -
  Throws:
    `XMLDBException`
    `XPathException`

### execute

    public ResourceSet execute(Source source)
                        throws XMLDBException

  Specified by:
    `execute` in interface `XQueryService`
  Throws:
    `XMLDBException`

### query

    public ResourceSet query(XMLResource res,
                             java.lang.String query)
                      throws XMLDBException

  Description copied from interface: `XPathQueryServiceImpl`
  Process an XPath query based on the result of a previous query. The XMLResource contains the result received from a previous query.

  Specified by:
    `query` in interface `XPathQueryServiceImpl`
  Parameters:
    `res` - an XMLResource as obtained from a previous query.
    `query` - the XPath query
  Throws:
    `XMLDBException`

### query

    public ResourceSet query(XMLResource res,
                             java.lang.String query,
                             java.lang.String sortExpr)
                      throws XMLDBException

  Description copied from interface: `XPathQueryServiceImpl`
  Process an XPath query based on the result of a previous query and sort the results using the second XPath expression. The XMLResource contains the result received from a previous query.

  Specified by:
    `query` in interface `XPathQueryServiceImpl`
  Parameters:
    `res` - an XMLResource as obtained from a previous query
    `query` - the XPath query
    `sortExpr` - 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.
  Throws:
    `XMLDBException`

### queryResource

    public ResourceSet queryResource(java.lang.String resource,
                                     java.lang.String query)
                              throws XMLDBException

  Description copied from interface: `XPathQueryService`
  Run an XPath query against an XML resource stored in the `Collection` 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`.

  Specified by:
    `queryResource` in interface `XPathQueryService`
  Parameters:
    `query` - The XPath query string to use.
    `resource` - The id of the document to run the query against.
  Returns:
    A `ResourceSet` containing the results of the query.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getVersion

    public java.lang.String getVersion()
                                throws XMLDBException

  Description copied from interface: `Service`
  Gets the Version attribute of the Service object

  Specified by:
    `getVersion` in interface `Service`
  Returns:
    The Version value
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### setCollection

    public void setCollection(Collection col)
                       throws XMLDBException

  Description copied from interface: `Service`
  Sets the Collection attribute of the Service object

  Specified by:
    `setCollection` in interface `Service`
  Parameters:
    `col` - The new Collection value
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getName

    public java.lang.String getName()
                             throws XMLDBException

  Description copied from interface: `Service`
  Returns the name associated with the Service instance.

  Specified by:
    `getName` in interface `Service`
  Returns:
    the name of the object.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### getProperty

    public java.lang.String getProperty(java.lang.String property)
                                 throws XMLDBException

  Description copied from interface: `Configurable`
  Returns the value of the property identified by `name`.

  Specified by:
    `getProperty` in interface `Configurable`
  Parameters:
    `property` - the name of the property to retrieve.
  Returns:
    the property value or null if no property exists.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### setProperty

    public void setProperty(java.lang.String property,
                            java.lang.String value)
                     throws XMLDBException

  Description copied from interface: `Configurable`
  Sets the property `name` to have the value provided in `value`.

  Specified by:
    `setProperty` in interface `Configurable`
  Parameters:
    `property` - the name of the property to set.
    `value` - the value to set for the property.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### clearNamespaces

    public void clearNamespaces()
                         throws XMLDBException

  Description copied from interface: `XPathQueryService`
  Removes all namespace mappings stored in the internal namespace map.

  Specified by:
    `clearNamespaces` in interface `XPathQueryService`
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### removeNamespace

    public void removeNamespace(java.lang.String ns)
                         throws XMLDBException

  Description copied from interface: `XQueryService`
  Removes the namespace mapping associated with `prefix` from the internal namespace map. If `prefix` is null or empty the mapping for the default namespace will be removed.

  Specified by:
    `removeNamespace` in interface `XPathQueryService`
  Parameters:
    `ns` - The prefix to remove from the namespace map. If `prefix` is null or empty the mapping for the default namespace will be removed.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### setNamespace

    public void setNamespace(java.lang.String prefix,
                             java.lang.String namespace)
                      throws XMLDBException

  Description copied from interface: `XQueryService`
  Sets a namespace mapping in the internal namespace map used to evaluate queries. If `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.

  Specified by:
    `setNamespace` in interface `XPathQueryService`
  Parameters:
    `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.
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.
    TODO: probably need some special error here.

### getNamespace

    public java.lang.String getNamespace(java.lang.String prefix)
                                  throws XMLDBException

  Description copied from interface: `XQueryService`
  Returns the URI string associated with `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.

  Specified by:
    `getNamespace` in interface `XPathQueryService`
  Parameters:
    `prefix` - The prefix to retrieve from the namespace map.
  Returns:
    The URI associated with `prefix`
  Throws:
    `XMLDBException` - with expected error codes.
    `ErrorCodes.VENDOR_ERROR` for any vendor specific errors that occur.

### declareVariable

    public void declareVariable(java.lang.String qname,
                                java.lang.Object initialValue)
                         throws XMLDBException

  Description copied from interface: `XPathQueryServiceImpl`
  Declare an external XPath variable and assign a value to it. A variable can be referenced inside an XPath expression as $variable. For example, if you declare a variable with

       	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.

  Specified by:
    `declareVariable` in interface `XPathQueryServiceImpl`
  Parameters:
    `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 x
    `initialValue` - the initial value, which is assigned to the variable
  Throws:
    `XMLDBException`

### execute

    public ResourceSet execute(CompiledExpression expression)
                        throws XMLDBException

  Description copied from interface: `XQueryService`
  Execute a compiled XQuery. The implementation should pass all namespaces and variables declared through `XQueryService` to the compiled XQuery code.

  Specified by:
    `execute` in interface `XQueryService`
  Parameters:
    `expression` -
  Throws:
    `XMLDBException`

### execute

    public ResourceSet execute(XMLResource res,
                               CompiledExpression expression)
                        throws XMLDBException

  Specified by:
    `execute` in interface `XQueryService`
  Throws:
    `XMLDBException`

### setXPathCompatibility

    public void setXPathCompatibility(boolean backwardsCompatible)

  Description copied from interface: `XQueryService`
  Enable or disable XPath 1.0 compatibility mode. In XPath 1.0 compatibility mode, some XQuery expressions will behave different. In particular, additional automatic type conversions will be applied to the operands of numeric operators.

  Specified by:
    `setXPathCompatibility` in interface `XQueryService`
  Parameters:
    `backwardsCompatible` -

### setModuleLoadPath

    public void setModuleLoadPath(java.lang.String path)

  Calling this method has no effect. The server loads modules relative to its own context.

  Specified by:
    `setModuleLoadPath` in interface `XQueryService`
  See Also:
    `XQueryService.setModuleLoadPath(java.lang.String)`

### dump

    public void dump(CompiledExpression expression,
                     java.io.Writer writer)
              throws XMLDBException

  Description copied from interface: `XQueryService`
  Return a diagnostic dump of the query. The query should have been executed before calling this function.

  Specified by:
    `dump` in interface `XQueryService`
  Parameters:
    `expression` -
    `writer` -
  Throws:
    `XMLDBException`

### beginProtected

    public void beginProtected()

  Description copied from interface: `XPathQueryServiceImpl`
  Execute all following queries in a protected environment. Protected means: it is guaranteed that documents referenced by the query or the result set are not modified by other threads until `XPathQueryServiceImpl.endProtected()` is called.

  Specified by:
    `beginProtected` in interface `XPathQueryServiceImpl`

### endProtected

    public void endProtected()

  Description copied from interface: `XPathQueryServiceImpl`
  Close the protected environment. All locks held by the current thread are released. The result set is no longer guaranteed to be stable.

  Specified by:
    `endProtected` in interface `XPathQueryServiceImpl`

Overview | Package | Class | Deprecated | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (C) Wolfgang Meier. All rights reserved.