net.ivoa.registry.search
Class SOAPSearchClient

java.lang.Object
  extended by net.ivoa.registry.search.SOAPSearchClient
Direct Known Subclasses:
TestSOAPProduction

public class SOAPSearchClient
extends java.lang.Object

A client for the IVOA Registry Search Interface


Nested Class Summary
 class SOAPSearchClient.SearchQuery
          an updatable search query
 
Field Summary
protected  ServiceCaller caller
           
protected  SOAPConnection conn
           
protected  java.net.URL endpoint
           
static java.lang.String GETIDENTITY_ACTION
           
static java.lang.String GETRESOURCE_ACTION
           
static java.lang.String KEYWORDSEARCH_ACTION
           
static java.lang.String SEARCH_ACTION
           
protected  MessageFactory soapfactory
           
static java.lang.String WSDL_NS
           
static java.lang.String WSDL_PREFIX
           
static java.lang.String XQUERYSEARCH_ACTION
           
 
Constructor Summary
protected SOAPSearchClient()
           
  SOAPSearchClient(java.net.URL endpointURL)
          Create a client configured to connect to a given registry
 
Method Summary
protected  org.w3c.dom.Element call(SOAPMessage msg, java.lang.String actionURI)
          submit the soap message
 SOAPSearchClient.SearchQuery createSearchQuery()
          return a SearchQuery object that can be used to attach an ADQL query to.
 org.w3c.dom.Element getIdentity()
          return the Registry description
 org.w3c.dom.Element getResource(java.lang.String ivoid)
          return the Resource description for a given identifier
 org.w3c.dom.Element keywordSearch(java.lang.String keywords, boolean orThem, int from, int max, boolean identifiersOnly)
          submit a keyword search
protected  Name makeRSName(SOAPMessage msg, java.lang.String elname)
           
 SOAPMessage makeSOAPMessage()
          create an empty SOAP message.
 org.w3c.dom.Element search(org.w3c.dom.Element adqlWhere, int from, int max, boolean identifiersOnly)
          submit a constraint-based search
 org.w3c.dom.Element search(SOAPSearchClient.SearchQuery query)
          submit a constraint-based search as a SearchQuery object.
 void setCaller(ServiceCaller c)
          set the Caller implementation to use.
 org.w3c.dom.Element xquerySearch(java.lang.String xquery)
          return the result of an XQuery search
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

endpoint

protected java.net.URL endpoint

soapfactory

protected MessageFactory soapfactory

conn

protected SOAPConnection conn

caller

protected ServiceCaller caller

GETIDENTITY_ACTION

public static final java.lang.String GETIDENTITY_ACTION
See Also:
Constant Field Values

GETRESOURCE_ACTION

public static final java.lang.String GETRESOURCE_ACTION
See Also:
Constant Field Values

SEARCH_ACTION

public static final java.lang.String SEARCH_ACTION
See Also:
Constant Field Values

KEYWORDSEARCH_ACTION

public static final java.lang.String KEYWORDSEARCH_ACTION
See Also:
Constant Field Values

XQUERYSEARCH_ACTION

public static final java.lang.String XQUERYSEARCH_ACTION
See Also:
Constant Field Values

WSDL_NS

public static final java.lang.String WSDL_NS
See Also:
Constant Field Values

WSDL_PREFIX

public static final java.lang.String WSDL_PREFIX
See Also:
Constant Field Values
Constructor Detail

SOAPSearchClient

protected SOAPSearchClient()

SOAPSearchClient

public SOAPSearchClient(java.net.URL endpointURL)
Create a client configured to connect to a given registry

Method Detail

setCaller

public void setCaller(ServiceCaller c)
set the Caller implementation to use. It will be initialized with the service endpoint. If the input is null, the default caller will be restored.

Parameters:
c - the caller object

keywordSearch

public org.w3c.dom.Element keywordSearch(java.lang.String keywords,
                                         boolean orThem,
                                         int from,
                                         int max,
                                         boolean identifiersOnly)
                                  throws RegistryServiceException,
                                         SOAPException
submit a keyword search

Parameters:
keywords - space-delimited words to search on
orThem - if true, return results that contain any of the keywords
from - the position of the first match to return
max - the maximum number of matches to return.
identifiersOnly - if true, return only identifiers; otherwise, return the entire VOResource record for each match.
Throws:
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

search

public org.w3c.dom.Element search(org.w3c.dom.Element adqlWhere,
                                  int from,
                                  int max,
                                  boolean identifiersOnly)
                           throws RegistryServiceException,
                                  SOAPException,
                                  org.w3c.dom.DOMException
submit a constraint-based search

Parameters:
adqlWhere - the search constraints in the form of a ADQL Where clause. The element's name should be "Where", and its contents should comply with the ADQL schema's "WhereType".
from - the position of the first match to return
max - the maximum number of matches to return.
identifiersOnly - if true, return only identifiers; otherwise, return the entire VOResource record for each match.
Throws:
org.w3c.dom.DOMException - if the adqlWhere Element object does not allow itself to be imported or otherwise its implementation is defective.
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

createSearchQuery

public SOAPSearchClient.SearchQuery createSearchQuery()
                                               throws SOAPException
return a SearchQuery object that can be used to attach an ADQL query to.

Throws:
SOAPException - if an error is encountered while creating the SOAP request.

search

public org.w3c.dom.Element search(SOAPSearchClient.SearchQuery query)
                           throws RegistryServiceException,
                                  SOAPException
submit a constraint-based search as a SearchQuery object. Submitting as a SearchQuery object is slightly more efficient(?) way to submit as it provides a way to attach an ADQL query that doesn't ultimately require a cloning of the where element.

Parameters:
query - the search constraints as a SearchQuery object.
Throws:
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

getIdentity

public org.w3c.dom.Element getIdentity()
                                throws RegistryServiceException,
                                       SOAPException
return the Registry description

Parameters:
query - the search constraints as a SearchQuery object.
Throws:
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

getResource

public org.w3c.dom.Element getResource(java.lang.String ivoid)
                                throws RegistryServiceException,
                                       IDNotFoundException,
                                       SOAPException
return the Resource description for a given identifier

Parameters:
ivoid - the IVOA Identifier to resolve
query - the search constraints as a SearchQuery object.
Throws:
IDNotFoundException - if the service cannot match the given ID to a description
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

makeRSName

protected Name makeRSName(SOAPMessage msg,
                          java.lang.String elname)
                   throws SOAPException
Throws:
SOAPException

xquerySearch

public org.w3c.dom.Element xquerySearch(java.lang.String xquery)
                                 throws RegistryServiceException,
                                        UnsupportedOperationException,
                                        SOAPException
return the result of an XQuery search

Throws:
UnsupportedOperationException - if the service does not support an XQuery-based search
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while creating or submitting the SOAP request or while processing the SOAP response.

makeSOAPMessage

public SOAPMessage makeSOAPMessage()
                            throws SOAPException
create an empty SOAP message. This can provide a DOM Document with which an element containing an ADQL query can be created and inserted directly.

Throws:
SOAPException - if an error is encountered while creating the SOAP request.

call

protected org.w3c.dom.Element call(SOAPMessage msg,
                                   java.lang.String actionURI)
                            throws RegistryServiceException,
                                   SOAPException
submit the soap message

Throws:
RegistryServiceException - if the service encounters an error (i.e. on the server side).
SOAPException - if an error is encountered while submitting the SOAP request or while processing the SOAP response.