Class SimpleXPathQueryService

    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void clearNamespaces()
      Removes all namespace mappings stored in the internal namespace map.
      java.lang.String getName()
      Returns the service name
      java.lang.String getNamespace​(java.lang.String prefix)
      Returns the URI string associated with prefix.
      java.lang.String getVersion()
      Returns the version of the Service
      ResourceSet query​(java.lang.String query)
      Run an XPath query againt the Collection.
      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.
      void removeNamespace​(java.lang.String prefix)
      Removes the namespace mapping associated with prefix.
      void setCollection​(Collection col)
      Sets the Collection attribute of the Service object
      void setNamespace​(java.lang.String prefix, java.lang.String uri)
      Sets a namespace mapping in the internal namespace map used to evaluate queries.
      • Methods inherited from class java.lang.Object

        equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleXPathQueryService

        public SimpleXPathQueryService()
    • Method Detail

      • getName

        public java.lang.String getName()
                                 throws XMLDBException
        Returns the service name
        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.
      • getVersion

        public java.lang.String getVersion()
                                    throws XMLDBException
        Returns the version of the Service
        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
        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.
      • setNamespace

        public void setNamespace​(java.lang.String prefix,
                                 java.lang.String uri)
                          throws XMLDBException
        Sets a namespace mapping in the internal namespace map used to evaluate queries.
        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.
        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.
      • getNamespace

        public java.lang.String getNamespace​(java.lang.String prefix)
                                      throws XMLDBException
        Returns the URI string associated with prefix.
        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.
      • removeNamespace

        public void removeNamespace​(java.lang.String prefix)
                             throws XMLDBException
        Removes the namespace mapping associated with prefix.
        Specified by:
        removeNamespace in interface 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.
      • clearNamespaces

        public void clearNamespaces()
                             throws XMLDBException
        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.
      • query

        public ResourceSet query​(java.lang.String query)
                          throws XMLDBException
        Run an XPath query againt the Collection. The result is a ResourceIterator containing the results of the query.
        Specified by:
        query in interface XPathQueryService
        Parameters:
        query - The XPath query string to use.
        Returns:
        A ResourceIterator containing the results of the query.
        Throws:
        XMLDBException - with expected error codes.
        ErrorCodes.VENDOR_ERROR for any vendor specific errors that occur.
      • queryResource

        public ResourceSet queryResource​(java.lang.String id,
                                         java.lang.String query)
                                  throws XMLDBException
        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.
        Specified by:
        queryResource in interface 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.