org.globus.wsrf.impl
Class TopicExpressionEngineImpl

java.lang.Object
  extended byorg.globus.wsrf.impl.TopicExpressionEngineImpl
All Implemented Interfaces:
TopicExpressionEngine

public class TopicExpressionEngineImpl
extends java.lang.Object
implements TopicExpressionEngine

Resolves topic expressions over topic lists. The engine looks for topic expression evaluators under "java:comp/env/topic/eval" context.

See Also:
TopicList

Field Summary
private  java.util.Map evaluators
           
private static org.globus.util.I18n i18n
           
(package private) static org.apache.commons.logging.Log logger
           
private static java.lang.String TOPIC_EXPRESSION_EVALUATOR_CONTEXT
           
 
Constructor Summary
TopicExpressionEngineImpl()
           
 
Method Summary
 java.util.List getConcretePath(TopicExpressionType topicExpression)
          Converts the expression from dialect specific form to a ordered list of QNames.
 TopicExpressionEvaluator getEvaluator(java.lang.String dialect)
          Gets the evaluator currently registered to handle a topic expression of the specified dialect.
static TopicExpressionEngine getInstance()
          Get the default topic expression engine instance (currently used to hide JNDI lookup details, may change in the future)
 java.lang.String[] getSupportedDialects()
          Returns a list of URIs representing the registered topic expression dialects
 void refresh()
          Refresh the set of registered topic expression evaluators using information discovered from the JNDI registry.
 void registerEvaluator(TopicExpressionEvaluator evaluator)
          registers a new evaluator that can be used to evaluate topic expressions
 java.util.Collection resolveTopicExpression(TopicExpressionType topicExpression, TopicList topicList)
          Resolves a topic expression using the passed topic list.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

TOPIC_EXPRESSION_EVALUATOR_CONTEXT

private static java.lang.String TOPIC_EXPRESSION_EVALUATOR_CONTEXT

i18n

private static org.globus.util.I18n i18n

logger

static org.apache.commons.logging.Log logger

evaluators

private java.util.Map evaluators
Constructor Detail

TopicExpressionEngineImpl

public TopicExpressionEngineImpl()
Method Detail

getInstance

public static TopicExpressionEngine getInstance()
Get the default topic expression engine instance (currently used to hide JNDI lookup details, may change in the future)

Returns:
The default topic expression engine instance

refresh

public void refresh()
Refresh the set of registered topic expression evaluators using information discovered from the JNDI registry. This method removes any previously registered topic expression evaluators, so handle with care.


registerEvaluator

public void registerEvaluator(TopicExpressionEvaluator evaluator)
Description copied from interface: TopicExpressionEngine
registers a new evaluator that can be used to evaluate topic expressions

Specified by:
registerEvaluator in interface TopicExpressionEngine
Parameters:
evaluator - implementation of evaluator to be used for evaluating topic expressions

getEvaluator

public TopicExpressionEvaluator getEvaluator(java.lang.String dialect)
Description copied from interface: TopicExpressionEngine
Gets the evaluator currently registered to handle a topic expression of the specified dialect.

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

resolveTopicExpression

public java.util.Collection resolveTopicExpression(TopicExpressionType topicExpression,
                                                   TopicList topicList)
                                            throws UnsupportedTopicExpressionDialectException,
                                                   TopicExpressionResolutionException,
                                                   InvalidTopicExpressionException,
                                                   TopicExpressionException
Description copied from interface: TopicExpressionEngine
Resolves a topic expression using the passed topic list. The appropraite TopicExpressionEvaluator is used based on the dialect element.

Specified by:
resolveTopicExpression in interface TopicExpressionEngine
Parameters:
topicExpression - topic expression
topicList - the topic list to apply the expression to
Returns:
the set of topics the expression evaluated to
Throws:
TopicExpressionResolutionException - if the expression could not be evaluated
UnsupportedTopicExpressionDialectException - if the topic expression dialect is not supported
InvalidTopicExpressionException - if the topic expression is invalid
TopicExpressionException - if any other error occurs

getConcretePath

public java.util.List getConcretePath(TopicExpressionType topicExpression)
                               throws UnsupportedTopicExpressionDialectException,
                                      TopicExpressionResolutionException,
                                      InvalidTopicExpressionException,
                                      TopicExpressionException
Description copied from interface: TopicExpressionEngine
Converts the expression from dialect specific form to a ordered list of QNames. This method throws an exception if the expression does not evaluate to a concrete topic path.

Specified by:
getConcretePath in interface TopicExpressionEngine
Parameters:
topicExpression - topic expression
Returns:
a list of QNames describing the concrete topic path
Throws:
TopicExpressionException - if any other error occurs
UnsupportedTopicExpressionDialectException - if the topic expression dialect is not supported
InvalidTopicExpressionException - if the topic expression is invalid
TopicExpressionResolutionException - if the expression could not be evaluated

getSupportedDialects

public java.lang.String[] getSupportedDialects()
Description copied from interface: TopicExpressionEngine
Returns a list of URIs representing the registered topic expression dialects

Specified by:
getSupportedDialects in interface TopicExpressionEngine
Returns:
the list of supported dialects