Xindice API

org.apache.xindice.client.xmldb.services
Class XPathQueryServiceImpl

java.lang.Object
  |
  +--org.apache.xindice.client.xmldb.CommonConfigurable
        |
        +--org.apache.xindice.client.xmldb.services.XPathQueryServiceImpl
All Implemented Interfaces:
Configurable, Service, XPathQueryService

public class XPathQueryServiceImpl
extends CommonConfigurable
implements XPathQueryService


Constructor Summary
XPathQueryServiceImpl()
           
 
Method Summary
 void clearNamespaces()
          Removes all namespace mappings stored in the internal namespace map.
 java.lang.String getDefaultNamespace()
           
 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 getVersion()
          Gets the Version attribute of the Service object
 ResourceSet query(java.lang.String query)
          Executes an XPath query on the server.
 ResourceSet queryResource(java.lang.String id, java.lang.String query)
          Run an XPath query against an XML resource stored in the Collection associated with this service.
 XMLResource queryResult(java.lang.String query)
           
 void removeDefaultNamespace()
           
 void removeNamespace(java.lang.String prefix)
          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 setDefaultNamespace(java.lang.String uri)
           
 void setNamespace(java.lang.String prefix, java.lang.String uri)
          Sets a namespace mapping in the internal namespace map used to evaluate queries.
 void setSymbolDeserializer(SymbolDeserializer syms)
           
 
Methods inherited from class org.apache.xindice.client.xmldb.CommonConfigurable
getProperty, setProperty
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.xmldb.api.base.Configurable
getProperty, setProperty
 

Constructor Detail

XPathQueryServiceImpl

public XPathQueryServiceImpl()
Method Detail

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
Following copied from interface: org.xmldb.api.base.Service
Returns:
the name of the object.
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
Following copied from interface: org.xmldb.api.base.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
Following copied from interface: org.xmldb.api.base.Service
Parameters:
col - The new Collection value
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

setSymbolDeserializer

public void setSymbolDeserializer(SymbolDeserializer syms)

setDefaultNamespace

public void setDefaultNamespace(java.lang.String uri)
                         throws XMLDBException

removeDefaultNamespace

public void removeDefaultNamespace()

setNamespace

public void setNamespace(java.lang.String prefix,
                         java.lang.String uri)
                  throws XMLDBException
Description copied from interface: XPathQueryService
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
Following copied from interface: org.xmldb.api.modules.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.
uri - 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.

removeNamespace

public void removeNamespace(java.lang.String prefix)
Description copied from interface: XPathQueryService
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
Following copied from interface: org.xmldb.api.modules.XPathQueryService
Parameters:
prefix - 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.

getDefaultNamespace

public java.lang.String getDefaultNamespace()

getNamespace

public java.lang.String getNamespace(java.lang.String prefix)
Description copied from interface: XPathQueryService
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
Following copied from interface: org.xmldb.api.modules.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.

clearNamespaces

public void clearNamespaces()
Description copied from interface: XPathQueryService
Removes all namespace mappings stored in the internal namespace map.
Specified by:
clearNamespaces in interface XPathQueryService
Following copied from interface: org.xmldb.api.modules.XPathQueryService
Throws:
XMLDBException - with expected error codes.
ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.

query

public ResourceSet query(java.lang.String query)
                  throws XMLDBException
Executes an XPath query on the server. The results are returned as an ResourceIterator
Specified by:
query in interface XPathQueryService
Parameters:
query - the XPath query string to execute.
Throws:
XMLDBException -  

queryResource

public ResourceSet queryResource(java.lang.String id,
                                 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
Following copied from interface: org.xmldb.api.modules.XPathQueryService
Parameters:
query - The XPath query string to use.
id - 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.

queryResult

public XMLResource queryResult(java.lang.String query)
                        throws XMLDBException

Xindice API

Copyright (c) 1999-2001 The Apache Software Foundation