com.apelon.apelonserver.client
Class BasicQuery

java.lang.Object
  extended by com.apelon.apelonserver.client.BasicQuery
Direct Known Subclasses:
ClassifyDetailsQuery, ClassifyQuery, DTSCommonQuery, DTSLicenseQuery, MatchQuery, NamespaceQuery, QualifierTypeQuery, SubsetQuery

public abstract class BasicQuery
extends Object

A BasicQuery provides common methods for queries. BasicQuery provides multiple connections to Remote server using setVersion(). A class which extends BasicQuery can direct a query to a specific query server by calling setVersion().

For example, To direct a query to a query server with DTS1_HEADER,

  //create a socke connection
  srvr_conn = new ServerConnectionSocket(host,port);
 

earchServer which extends BasicQueryServer SearchServer srvr = SearchServer.createInstance(srvr_conn);

call setVersion to prefix header to a query. srvr.setVersion(com.apelon.apelonserver.ApelonHeader.DTS1_HEADER);

Version:
1.0.1
Author:
Apelon, Inc.

Field Summary
protected  String ADMIN
           
protected  String queryHeader
           
 
Constructor Summary
protected BasicQuery()
           
 
Method Summary
protected  Document executeQuery(String query)
           
protected  String executeQueryNoParse(String query)
           
protected abstract  ServerConnection getServerConnection()
           
protected  void initializeDtds(String newQueryDtdUri, Class newResultDtdRes, String newResultDtdUri, String newResDtdFileName)
          Initialize the Server's DTDs.
protected  void initializeDtds(String newQueryDtdUri, Class newResultDtdRes, String newResultDtdUri, String newResDtdFileName, boolean isValidingParser)
          Initialize the Server's DTDs.
 String ping(boolean db)
          Ping the server
 void setVersion(String qh)
          setVesion sets query header which will be prepended to a query before the query is sent to the server.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

queryHeader

protected String queryHeader

ADMIN

protected String ADMIN
Constructor Detail

BasicQuery

protected BasicQuery()
Method Detail

setVersion

public void setVersion(String qh)
setVesion sets query header which will be prepended to a query before the query is sent to the server. The length of query header should be 7 length characters

Parameters:
qh - query header of 7 length characters

initializeDtds

protected void initializeDtds(String newQueryDtdUri,
                              Class newResultDtdRes,
                              String newResultDtdUri,
                              String newResDtdFileName)
Initialize the Server's DTDs. This must be done before this class is used. Preferably, this method will be called from the constructor of any concrete subclass of this class.

Parameters:
newQueryDtdUri - The DTD URI for all queries sent by this object.
newResultDtdRes - The resource class used to locate the (jarred) DTD file for result documents
newResultDtdUri - The URI that all results parsed by this object will use
newResDtdFileName - The name of the DTD file that will be loaded using newResultDtdRes when parsing the result document.

initializeDtds

protected void initializeDtds(String newQueryDtdUri,
                              Class newResultDtdRes,
                              String newResultDtdUri,
                              String newResDtdFileName,
                              boolean isValidingParser)
Initialize the Server's DTDs. This must be done before this class is used. Preferably, this method will be called from the constructor of any concrete subclass of this class.

Parameters:
newQueryDtdUri - The DTD URI for all queries sent by this object.
newResultDtdRes - The resource class used to locate the (jarred) DTD file for result documents
newResultDtdUri - The URI that all results parsed by this object will use
newResDtdFileName - The name of the DTD file that will be loaded using newResultDtdRes when parsing the result document.
isValidingParser - true to turn on validation of response otherwise false

ping

public String ping(boolean db)
            throws com.apelon.common.xml.XMLException
Ping the server

Parameters:
db - if true, return date from db
Returns:
XML formatted string which shows the result of ping.
Throws:
com.apelon.common.xml.XMLException

executeQuery

protected Document executeQuery(String query)
                         throws ApelonException
Throws:
ApelonException

executeQueryNoParse

protected String executeQueryNoParse(String query)
                              throws ApelonException
Throws:
ApelonException

getServerConnection

protected abstract ServerConnection getServerConnection()


Copyright © 2011. All Rights Reserved.