org.apache.ws.resource.properties.query
Interface QueryEngine


public interface QueryEngine

The QueryEngine interface is used to map queries on the service data of a service to the appropriate ExpressionEvaluators and then return the result. ExpressionEvaluators can be preconfigured or dynamically added at runtime.

See Also:
ExpressionEvaluator

Method Summary
 java.lang.Object executeQuery(QueryExpression queryExpr, java.lang.Object evalContext)
          Evaluates the expression over the specified context object and returns the result.
 java.lang.Object executeQuery(QueryExpression queryExpr, ResourcePropertySet resourcePropSet)
          Executes a query against a resource property set.
 ExpressionEvaluator getEvaluator(java.net.URI 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 registerEvaluator(ExpressionEvaluator evaluator)
          Registers a new evaluator that can be used to evaluate queries on a service.
 void registerEvaluator(java.net.URI dialect, ExpressionEvaluator evaluator)
          Registers a query expression evaluator for handling query expressions in specified dialect.
 

Method Detail

getEvaluator

public ExpressionEvaluator getEvaluator(java.net.URI 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)

Returns:
the matching expression evaluator or null if none was found

executeQuery

public java.lang.Object executeQuery(QueryExpression queryExpr,
                                     ResourcePropertySet resourcePropSet)
                              throws UnknownQueryExpressionDialectException,
                                     QueryEvaluationErrorException,
                                     InvalidQueryExpressionException
Executes a query against a resource property set. The appropriate ExpressionEvaluator is used for the evalution based on the dialect attribute.

Parameters:
queryExpr - a query expression
resourcePropSet - the resource properties set to evluate the query expression 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 SOAPElement or DOM Element. If the result object returned is null an empty query result is returned.
Throws:
UnknownQueryExpressionDialectException - if query dialect is unsupported
QueryEvaluationErrorException - if query evaluation fails
InvalidQueryExpressionException - if query expression is invalid

executeQuery

public java.lang.Object executeQuery(QueryExpression queryExpr,
                                     java.lang.Object evalContext)
                              throws UnknownQueryExpressionDialectException,
                                     QueryEvaluationErrorException,
                                     InvalidQueryExpressionException
Evaluates the expression over the specified context object and returns the result. The appropriate ExpressionEvaluator is used for the evaluation based on the dialect attribute.

Parameters:
queryExpr - a query expression
evalContext - the context to evaluate the query expression 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 SOAPElement or DOM Element. If the result object returned is null an empty query result is returned.
Throws:
UnknownQueryExpressionDialectException - if query dialect is unsupported
QueryEvaluationErrorException - if query evaluation fails
InvalidQueryExpressionException - if query expression is invalid

registerEvaluator

public void registerEvaluator(ExpressionEvaluator evaluator)
Registers a new evaluator that can be used to evaluate queries on a service.

Parameters:
evaluator - implementation of evaluator to be used for evaluating queries specified in its XML Schema definition.

registerEvaluator

public void registerEvaluator(java.net.URI dialect,
                              ExpressionEvaluator evaluator)
                       throws UnknownQueryExpressionDialectException
Registers a query expression evaluator for handling query expressions in specified dialect.

Parameters:
dialect - a query expression dialect
evaluator - a query expression evaluator
Throws:
UnknownQueryExpressionDialectException - if the evaluator does not supoport the specified dialect


Copyright © 2004-2005 Apache Software Foundation. All Rights Reserved.