org.globus.wsrf.impl
Class QueryEngineImpl

java.lang.Object
  extended byorg.globus.wsrf.impl.QueryEngineImpl
All Implemented Interfaces:
QueryEngine

public class QueryEngineImpl
extends java.lang.Object
implements QueryEngine

Executes queries on resource property sets. The engine looks for evaluators under "java:comp/env/query/eval" context.

See Also:
ResourcePropertySet

Field Summary
private  java.util.Hashtable evaluators
           
private static org.globus.util.I18n i18n
           
(package private) static org.apache.commons.logging.Log logger
           
private static java.lang.String QUERY_EVALUATOR_CONTEXT
           
 
Constructor Summary
QueryEngineImpl()
           
 
Method Summary
 java.lang.Object executeQuery(QueryExpressionType expression, ResourcePropertySet resourcePropertySet)
          Executes a query against a resource property set.
 ExpressionEvaluator getEvaluator(java.lang.String dialect)
          Gets the evaluator currently registered to handle an expression of the specified qualified name (from the top level element of the XML Schema definition of the expression)
 void refresh()
          Reinitializes the evaluators list from JNDI context.
 void registerEvaluator(ExpressionEvaluator evaluator)
          registers a new evaluator that can be used to evaluate queries on a service.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

static org.apache.commons.logging.Log logger

i18n

private static org.globus.util.I18n i18n

QUERY_EVALUATOR_CONTEXT

private static java.lang.String QUERY_EVALUATOR_CONTEXT

evaluators

private java.util.Hashtable evaluators
Constructor Detail

QueryEngineImpl

public QueryEngineImpl()
Method Detail

refresh

public void refresh()
Reinitializes the evaluators list from JNDI context. If any evaluators were added using registerEvaluator() function they will be lost.


registerEvaluator

public void registerEvaluator(ExpressionEvaluator evaluator)
Description copied from interface: QueryEngine
registers a new evaluator that can be used to evaluate queries on a service.

Specified by:
registerEvaluator in interface QueryEngine
Parameters:
evaluator - implementation of evaluator to be used for evaluating queries specified in its XML Schema definition.

getEvaluator

public ExpressionEvaluator getEvaluator(java.lang.String dialect)
Description copied from interface: QueryEngine
Gets the evaluator currently registered to handle an expression of the specified qualified name (from the top level element of the XML Schema definition of the expression)

Specified by:
getEvaluator in interface QueryEngine
Returns:
the matching expression evaluator or null if none was found

executeQuery

public java.lang.Object executeQuery(QueryExpressionType expression,
                                     ResourcePropertySet resourcePropertySet)
                              throws UnsupportedQueryDialectException,
                                     QueryEvaluationException,
                                     InvalidQueryExpressionException,
                                     QueryException
Description copied from interface: QueryEngine
Executes a query against a resource property set. The appropraite ExpressionEvaluator is used for the query based on the dialect attribute.

Specified by:
executeQuery in interface QueryEngine
Parameters:
expression - query expression
resourcePropertySet - resource properties set to execute the query against
Returns:
the result of the evaluation which depends on the expression. The results must be an xml serializable object in order to be passed back correctly to a remote client. The easiest way of achieving this is to model it as a Bean, or simply return a SOAPElment or DOM Element. If the result object returned is null an empty query result is returned.
Throws:
InvalidQueryExpressionException - if query expression is invalid.
QueryException - if any other error
UnsupportedQueryDialectException - if query dialect is unsupported.
QueryEvaluationException - if query evaluation fails.