gov.nih.nci.cagrid.data.cql
Class CQLQueryProcessor

java.lang.Object
  extended by gov.nih.nci.cagrid.data.cql.CQLQueryProcessor
Direct Known Subclasses:
DirectCQLQueryProcessor, HQL313CoreQueryProcessor, HQLCoreQueryProcessor, LazyCQLQueryProcessor, SDK4QueryProcessor

public abstract class CQLQueryProcessor
extends java.lang.Object

CQLQueryProcessor Abstract class the service providers must extend to process CQL Queries to a caGrid data service. A DataService instance will have only one instance of the query processor, created on the first call to the query method. At creation time, the processor will be configured via the initialize method. All subsequent calls to the query method will simply invoke the processQuery method.

Version:
$Id$
Author:
David W. Ervin

Constructor Summary
CQLQueryProcessor()
           
 
Method Summary
 java.lang.String getConfigurationUiClassname()
          Get the classname of the configuration user interface for this CQL Query Processor.
protected  java.util.Properties getConfiguredParameters()
           
protected  java.io.InputStream getConfiguredWsddStream()
           
 java.util.Set<java.lang.String> getPropertiesFromEtc()
          Get a set of property names whose values should be file names prepended with the location of the service's etc directory.
 java.util.Properties getRequiredParameters()
          Get a Properties object of parameters the query processor will require on initialization.
 void initialize(java.util.Properties parameters, java.io.InputStream wsdd)
          Initialize the query processor with the properties it requires as specified in the Properties instance provided by getRequiredParameters(), and values populated by the user's custom entries, if any.
abstract  CQLQueryResults processQuery(CQLQuery cqlQuery)
          Processes the CQL Query
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CQLQueryProcessor

public CQLQueryProcessor()
Method Detail

initialize

public void initialize(java.util.Properties parameters,
                       java.io.InputStream wsdd)
                throws InitializationException
Initialize the query processor with the properties it requires as specified in the Properties instance provided by getRequiredParameters(), and values populated by the user's custom entries, if any.

Parameters:
parameters - The parameters as configured by the user. The set of keys must contain all of the keys contained in the Properties object returned by getRequiredParamters(). The values in the parameters will be either the user defined value or the default value from getRequiredParameters().
wsdd - The input stream which contains the wsdd configuration for the data service. This stream may be important to locating type mappings for serializing and deserializing beans.
Throws:
InitializationException

getConfiguredParameters

protected java.util.Properties getConfiguredParameters()
Returns:
The parameters as configured by the user at runtime. The set of keys must contain all of the keys contained in the Properties object returned by getRequiredParamters(). The values in the parameters will be either the user defined value or the default value from getRequiredParameters().

getConfiguredWsddStream

protected java.io.InputStream getConfiguredWsddStream()
Returns:
The input stream which contains the wsdd configuration for the data service. This stream may be important to locating type mappings for serializing and deserializing beans.

processQuery

public abstract CQLQueryResults processQuery(CQLQuery cqlQuery)
                                      throws MalformedQueryException,
                                             QueryProcessingException
Processes the CQL Query

Parameters:
cqlQuery -
Returns:
The results of processing a CQL query
Throws:
MalformedQueryException - Should be thrown when the query itself does not conform to the CQL standard or attempts to perform queries outside of the exposed domain model
QueryProcessingException - Thrown for all exceptions in query processing not related to the query being malformed

getRequiredParameters

public java.util.Properties getRequiredParameters()
Get a Properties object of parameters the query processor will require on initialization. Subclasses can override this method to return a map describing paramters their implementation needs. The keys are the names of parameters the query processor requires, the values are the defaults for those properties. The default value of a property may be an empty string if it is an optional paramter. The keys MUST be valid java variable names. They MUST NOT contain spaces or punctuation. They may begin with an uppercase character.

Returns:
The required properties for the query processor with their default values

getPropertiesFromEtc

public java.util.Set<java.lang.String> getPropertiesFromEtc()
Get a set of property names whose values should be file names prepended with the location of the service's etc directory. Potential uses include locating config files, storing logs, etc. Subclasses can override this method to return a Set of Strings which are the names of property keys from the getRequiredParameters() method.

Returns:
The set of property names

getConfigurationUiClassname

public java.lang.String getConfigurationUiClassname()
Get the classname of the configuration user interface for this CQL Query Processor. This class should exist in the same JAR as the query processor, as well as any (non-java / caGrid) classes it depends on. This class MUST implement the abstract base class gov.nih.nci.cagrid.data.cql.ui.CQLQueryProcessorConfigUI

Returns:
The class name of the configuration user interface, or null if no UI is provided