You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by sc...@apache.org on 2005/08/02 18:41:44 UTC

svn commit: r227035 [7/12] - in /webservices/pubscribe/trunk: ./ src/java/org/apache/ws/eventing/ src/java/org/apache/ws/eventing/porttype/ src/java/org/apache/ws/eventing/porttype/impl/ src/java/org/apache/ws/eventing/pubsub/ src/java/org/apache/ws/ev...

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +12,16 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression;
 
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpaceSet;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
 import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
 import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.TopicSpaceSet;
 
 /**
  * The <code>TopicExpressionEngine</code> interface is used to map queries on a
@@ -35,51 +33,52 @@
  */
 public interface TopicExpressionEngine
 {
-    /**
-     * registers a new evaluator that can be used to evaluate topic expressions
-     *
-     * @param evaluator implementation of evaluator to be used for evaluating
-     *                  topic expressions
-     */
-    void registerEvaluator(TopicExpressionEvaluator evaluator);
-
-    /**
-     * Resolves a topic expression using the passed topic list. The appropraite
-     * TopicExpressionEvaluator is used based on the dialect element.
-     *
-     * @param topicSpaceSet       the topic list to apply the expression to
-     * @param topicExpression topic expression
-     * @return the set of topics the expression evaluated to
-     * @throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException
-     *                                  if the topic expression dialect is not
-     *                                  supported
-     * @throws TopicExpressionResolutionException
-     *                                  if the expression could not be
-     *                                  evaluated
-     * @throws InvalidTopicExpressionException
-     *                                  if the topic expression is invalid
-     * @throws TopicExpressionException if any other error occurs
-     */
-    Topic[] evaluateTopicExpression( TopicSpaceSet topicSpaceSet, TopicExpression topicExpression ) throws TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-                                    InvalidTopicExpressionException,
-            TopicExpressionException;
-
-    /**
-     * Gets the evaluator currently registered to handle a topic expression of
-     * the specified dialect.
-     *
-     * @return the matching topic expression evaluator or null if none was
-     *         found
-     */
-    TopicExpressionEvaluator getEvaluator(String dialect);
-
-    /**
-     * Returns a list of URIs representing the registered topic expression
-     * dialects
-     *
-     * @return the list of supported dialects
-     */
-    String[] getSupportedDialects();
-
-}
+   /**
+    * Gets the evaluator currently registered to handle a topic expression of
+    * the specified dialect.
+    *
+    * @return the matching topic expression evaluator or null if none was
+    *         found
+    */
+   TopicExpressionEvaluator getEvaluator( String dialect );
+
+   /**
+    * Returns a list of URIs representing the registered topic expression
+    * dialects
+    *
+    * @return the list of supported dialects
+    */
+   String[] getSupportedDialects(  );
+
+   /**
+    * Resolves a topic expression using the passed topic list. The appropraite
+    * TopicExpressionEvaluator is used based on the dialect element.
+    *
+    * @param topicSpaceSet       the topic list to apply the expression to
+    * @param topicExpression topic expression
+    * @return the set of topics the expression evaluated to
+    * @throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException
+    *                                  if the topic expression dialect is not
+    *                                  supported
+    * @throws TopicExpressionResolutionException
+    *                                  if the expression could not be
+    *                                  evaluated
+    * @throws InvalidTopicExpressionException
+    *                                  if the topic expression is invalid
+    * @throws TopicExpressionException if any other error occurs
+    */
+   Topic[] evaluateTopicExpression( TopicSpaceSet   topicSpaceSet,
+                                    TopicExpression topicExpression )
+   throws TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException;
+
+   /**
+    * registers a new evaluator that can be used to evaluate topic expressions
+    *
+    * @param evaluator implementation of evaluator to be used for evaluating
+    *                  topic expressions
+    */
+   void registerEvaluator( TopicExpressionEvaluator evaluator );
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,18 +12,16 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression;
 
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpaceSet;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.notification.topics.expression.TopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
 import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.TopicSpaceSet;
 
 /**
  * A <code>TopicExpressionEvaluator</code> is used to implement a topic expression evaluation against a
@@ -32,33 +30,32 @@
  */
 public interface TopicExpressionEvaluator
 {
+   /**
+    * Gets the URIs for the dialects that this evaluator can handle
+    *
+    * @return array of URIs supported by this evaluator
+    */
+   String[] getDialects(  );
 
-    /**
-     * Evaluates the expression over a TopicSpace and returns the set of matching topics.
-     *
-     * @param topicSpaceSet topic list associated with the service/resource
-     * @param expression object passed by client representing the topic expression
-     * @return the set of topics that matched the specified expression
-     *
-     * @throws TopicPathDialectUnknownException
-     *                                  if the topic expression dialect is not supported
-     * @throws TopicExpressionResolutionException
-     *                                  if the expression could not be evaluated
-     * @throws org.apache.ws.notification.topics.expression.InvalidTopicExpressionException
-     *                                  if the topic expression is invalid
-     * @throws TopicExpressionException if any other error occurs
-     */
-    Topic[] evaluate( TopicSpaceSet topicSpaceSet, TopicExpression expression )
-            throws TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-            InvalidTopicExpressionException,
-            TopicExpressionException;
-
-    /**
-     * Gets the URIs for the dialects that this evaluator can handle
-     *
-     * @return array of URIs supported by this evaluator
-     */
-    String[] getDialects();
-
-}
+   /**
+    * Evaluates the expression over a TopicSpace and returns the set of matching topics.
+    *
+    * @param topicSpaceSet topic list associated with the service/resource
+    * @param expression object passed by client representing the topic expression
+    * @return the set of topics that matched the specified expression
+    *
+    * @throws TopicPathDialectUnknownException
+    *                                  if the topic expression dialect is not supported
+    * @throws TopicExpressionResolutionException
+    *                                  if the expression could not be evaluated
+    * @throws org.apache.ws.notification.topics.expression.InvalidTopicExpressionException
+    *                                  if the topic expression is invalid
+    * @throws TopicExpressionException if any other error occurs
+    */
+   Topic[] evaluate( TopicSpaceSet   topicSpaceSet,
+                     TopicExpression expression )
+   throws TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException;
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionException.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionException.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionException.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionException.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,53 +12,54 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression;
 
+
 /**
  * This is a basic exception raised by <code>TopicExpressionEngine</code> or
  * <code>TopicExpressionEvaluator</code>.
  */
-public class TopicExpressionException extends Exception
+public class TopicExpressionException
+   extends Exception
 {
-
-    /**
-     * Creates a TopicExpressionException without error message.
-     */
-    public TopicExpressionException()
-    {
-    }
-
-    /**
-     * Creates a TopicExpressionException with a given error message.
-     *
-     * @param message error message
-     */
-    public TopicExpressionException(String message)
-    {
-        super(message);
-    }
-
-    /**
-     * Creates a TopicExpressionException with a given error message and nested
-     * exception.
-     *
-     * @param message error message
-     * @param exception nested exception/
-     */
-    public TopicExpressionException(String message, Throwable exception)
-    {
-        super(message, exception);
-    }
-
-    /**
-     * Creates a TopicExpressionException from a nested exception.
-     *
-     * @param exception nested exception
-     */
-    public TopicExpressionException(Throwable exception)
-    {
-        super(exception);
-    }
-
-}
+   /**
+    * Creates a TopicExpressionException without error message.
+    */
+   public TopicExpressionException(  )
+   {
+   }
+
+   /**
+    * Creates a TopicExpressionException with a given error message.
+    *
+    * @param message error message
+    */
+   public TopicExpressionException( String message )
+   {
+      super( message );
+   }
+
+   /**
+    * Creates a TopicExpressionException with a given error message and nested
+    * exception.
+    *
+    * @param message error message
+    * @param exception nested exception/
+    */
+   public TopicExpressionException( String    message,
+                                    Throwable exception )
+   {
+      super( message, exception );
+   }
+
+   /**
+    * Creates a TopicExpressionException from a nested exception.
+    *
+    * @param exception nested exception
+    */
+   public TopicExpressionException( Throwable exception )
+   {
+      super( exception );
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionResolutionException.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionResolutionException.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionResolutionException.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicExpressionResolutionException.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,54 +12,53 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression;
 
 
-
 /**
  * This exception is raised when resolution of a topic expression fails.
  */
-public class TopicExpressionResolutionException extends org.apache.ws.notification.topics.expression.TopicExpressionException
+public class TopicExpressionResolutionException
+   extends org.apache.ws.notification.topics.expression.TopicExpressionException
 {
-    /**
-     * Creates a TopicExpressionResolutionException without error message.
-     */
-    public TopicExpressionResolutionException()
-    {
-    }
-
-    /**
-     * Creates a TopicExpressionResolutionException with a given error message.
-     *
-     * @param message error message
-     */
-    public TopicExpressionResolutionException(String message)
-    {
-        super(message);
-    }
-
-    /**
-     * Creates a TopicExpressionResolutionException with a given error message
-     * and nested exception.
-     *
-     * @param message   error message
-     * @param exception nested exception
-     */
-    public TopicExpressionResolutionException(
-        String message,
-        Throwable exception)
-    {
-        super(message, exception);
-    }
-
-    /**
-     * Creates a TopicExpressionResolutionException from a nested exception.
-     *
-     * @param exception nested exception
-     */
-    public TopicExpressionResolutionException(Throwable exception)
-    {
-        super(exception);
-    }
-}
+   /**
+    * Creates a TopicExpressionResolutionException without error message.
+    */
+   public TopicExpressionResolutionException(  )
+   {
+   }
+
+   /**
+    * Creates a TopicExpressionResolutionException with a given error message.
+    *
+    * @param message error message
+    */
+   public TopicExpressionResolutionException( String message )
+   {
+      super( message );
+   }
+
+   /**
+    * Creates a TopicExpressionResolutionException with a given error message
+    * and nested exception.
+    *
+    * @param message   error message
+    * @param exception nested exception
+    */
+   public TopicExpressionResolutionException( String    message,
+                                              Throwable exception )
+   {
+      super( message, exception );
+   }
+
+   /**
+    * Creates a TopicExpressionResolutionException from a nested exception.
+    *
+    * @param exception nested exception
+    */
+   public TopicExpressionResolutionException( Throwable exception )
+   {
+      super( exception );
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicPathDialectUnknownException.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicPathDialectUnknownException.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicPathDialectUnknownException.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/TopicPathDialectUnknownException.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,56 +12,54 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression;
 
 
-
 /**
  * This exception is raised if the given topic expression dialect is
  * unsupported.
  */
 public class TopicPathDialectUnknownException
-    extends TopicExpressionException
+   extends TopicExpressionException
 {
-    /**
-     * Creates a UnsupportedQueryDialectException without error message.
-     */
-    public TopicPathDialectUnknownException()
-    {
-    }
-
-    /**
-     * Creates a UnsupportedQueryDialectException with a given error message.
-     *
-     * @param message error message
-     */
-    public TopicPathDialectUnknownException(String message)
-    {
-        super(message);
-    }
-
-    /**
-     * Creates a UnsupportedQueryDialectException with a given error message
-     * and nested exception.
-     *
-     * @param message error message
-     * @param exception nested exception/
-     */
-    public TopicPathDialectUnknownException(
-        String message,
-        Throwable exception)
-    {
-        super(message, exception);
-    }
-
-    /**
-     * Creates a UnsupportedQueryDialectException from a nested exception.
-     *
-     * @param exception nested exception
-     */
-    public TopicPathDialectUnknownException(Throwable exception)
-    {
-        super(exception);
-    }
-}
+   /**
+    * Creates a UnsupportedQueryDialectException without error message.
+    */
+   public TopicPathDialectUnknownException(  )
+   {
+   }
+
+   /**
+    * Creates a UnsupportedQueryDialectException with a given error message.
+    *
+    * @param message error message
+    */
+   public TopicPathDialectUnknownException( String message )
+   {
+      super( message );
+   }
+
+   /**
+    * Creates a UnsupportedQueryDialectException with a given error message
+    * and nested exception.
+    *
+    * @param message error message
+    * @param exception nested exception/
+    */
+   public TopicPathDialectUnknownException( String    message,
+                                            Throwable exception )
+   {
+      super( message, exception );
+   }
+
+   /**
+    * Creates a UnsupportedQueryDialectException from a nested exception.
+    *
+    * @param exception nested exception
+    */
+   public TopicPathDialectUnknownException( Throwable exception )
+   {
+      super( exception );
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/AbstractTopicExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/AbstractTopicExpressionEvaluator.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/AbstractTopicExpressionEvaluator.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/AbstractTopicExpressionEvaluator.java Tue Aug  2 09:41:00 2005
@@ -1,111 +1,156 @@
-/*=============================================================================*
- *  Copyright 2005 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *=============================================================================*/
-package org.apache.ws.notification.topics.expression.impl;
-
-import org.apache.commons.lang.StringUtils;
-import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.util.xml.NamespaceContext;
-
-import javax.xml.namespace.QName;
-
-/**
- * An abstract class that provides functionality that is shared by the
- * {@link TopicExpressionEvaluator}s for all three WS-Topics topic expression
- * dialects.
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
- */
-public abstract class AbstractTopicExpressionEvaluator implements TopicExpressionEvaluator
-{
-
-    protected NamespaceContext getNamespaceContext( TopicExpression topicExpr ) throws TopicExpressionException
-    {
-        if ( !( topicExpr.getNamespaceContext() instanceof NamespaceContext ) )
-        {
-            throw new TopicExpressionException(
-                    "This evaluator requires the TopicExpression namespaceContext to be a NamespaceContext." );
-        }
-        return (NamespaceContext) topicExpr.getNamespaceContext();
-    }
-
-    protected String getContent( TopicExpression topicExpr )
-            throws TopicExpressionException
-    {
-        if ( !( topicExpr.getContent() instanceof String ) )
-        {
-            throw new TopicExpressionException( "This evaluator requires the TopicExpression content to be a String." );
-        }
-        String expr = (String) topicExpr.getContent();
-        if ( StringUtils.isEmpty( expr ) || !StringUtils.containsNone( expr, " \t\n\r\f" ) )
-        {
-            throw new InvalidTopicExpressionException( "Topic expression contains whitespace." );
-        }
-        return expr;
-    }
-
-    protected TopicSpace getTopicSpace( TopicSpaceSet topicSpaceSet, QName topicPath )
-            throws TopicExpressionResolutionException
-    {
-        TopicSpace topicSpace = topicSpaceSet.getTopicSpace( topicPath.getNamespaceURI() );
-        if ( topicSpace == null )
-        {
-            throw new TopicExpressionResolutionException( "Topic path '" + topicPath.getPrefix() + ":" +
-                    topicPath.getLocalPart() +
-                    "' references an unknown TopicSpace with namespace URI '" +
-                    topicPath.getNamespaceURI() +
-                    "'." );
-        }
-        return topicSpace;
-    }
-
-    protected QName toQName( String topicPath, NamespaceContext nsContext )
-            throws InvalidTopicExpressionException
-    {
-        String prefix, localPart;
-        int i = topicPath.indexOf( ':' );
-        if ( i == -1 )  // no prefix
-        {
-            prefix = "";
-            localPart = topicPath;
-        }
-        else if ( i == 0 )
-        {
-            throw new InvalidTopicExpressionException( "Topic path '" + topicPath + "' starts with a colon." );
-        }
-        else if ( i == topicPath.length() - 1 )
-        {
-            throw new InvalidTopicExpressionException( "Topic path '" + topicPath + "' ends with a colon." );
-        }
-        else
-        {
-            prefix = topicPath.substring( 0, i );
-            localPart = topicPath.substring( i + 1 );
-            if ( localPart.indexOf( ':' ) != -1 )
-            {
-                throw new InvalidTopicExpressionException( "Local part of topic path '" + topicPath + "' contains a colon." );
-            }
-        }
-        String nsURI = nsContext.getNamespaceURI( prefix );
-        return new QName( nsURI, localPart, prefix );
-    }
-
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.notification.topics.expression.impl;
+
+import org.apache.commons.lang.StringUtils;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
+import org.apache.ws.util.xml.NamespaceContext;
+import javax.xml.namespace.QName;
+
+/**
+ * An abstract class that provides functionality that is shared by the
+ * {@link TopicExpressionEvaluator}s for all three WS-Topics topic expression
+ * dialects.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public abstract class AbstractTopicExpressionEvaluator
+   implements TopicExpressionEvaluator
+{
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicExpr DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicExpressionException DOCUMENT_ME
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    */
+   protected String getContent( TopicExpression topicExpr )
+   throws TopicExpressionException
+   {
+      if ( !( topicExpr.getContent(  ) instanceof String ) )
+      {
+         throw new TopicExpressionException( "This evaluator requires the TopicExpression content to be a String." );
+      }
+
+      String expr = (String) topicExpr.getContent(  );
+      if ( StringUtils.isEmpty( expr ) || !StringUtils.containsNone( expr, " \t\n\r\f" ) )
+      {
+         throw new InvalidTopicExpressionException( "Topic expression contains whitespace." );
+      }
+
+      return expr;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicExpr DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicExpressionException DOCUMENT_ME
+    */
+   protected NamespaceContext getNamespaceContext( TopicExpression topicExpr )
+   throws TopicExpressionException
+   {
+      if ( !( topicExpr.getNamespaceContext(  ) instanceof NamespaceContext ) )
+      {
+         throw new TopicExpressionException( "This evaluator requires the TopicExpression namespaceContext to be a NamespaceContext." );
+      }
+
+      return (NamespaceContext) topicExpr.getNamespaceContext(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicSpaceSet DOCUMENT_ME
+    * @param topicPath DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicExpressionResolutionException DOCUMENT_ME
+    */
+   protected TopicSpace getTopicSpace( TopicSpaceSet topicSpaceSet,
+                                       QName         topicPath )
+   throws TopicExpressionResolutionException
+   {
+      TopicSpace topicSpace = topicSpaceSet.getTopicSpace( topicPath.getNamespaceURI(  ) );
+      if ( topicSpace == null )
+      {
+         throw new TopicExpressionResolutionException( "Topic path '" + topicPath.getPrefix(  ) + ":"
+                                                       + topicPath.getLocalPart(  )
+                                                       + "' references an unknown TopicSpace with namespace URI '"
+                                                       + topicPath.getNamespaceURI(  ) + "'." );
+      }
+
+      return topicSpace;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicPath DOCUMENT_ME
+    * @param nsContext DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    */
+   protected QName toQName( String           topicPath,
+                            NamespaceContext nsContext )
+   throws InvalidTopicExpressionException
+   {
+      String prefix;
+      String localPart;
+      int    i = topicPath.indexOf( ':' );
+      if ( i == -1 ) // no prefix
+      {
+         prefix       = "";
+         localPart    = topicPath;
+      }
+      else if ( i == 0 )
+      {
+         throw new InvalidTopicExpressionException( "Topic path '" + topicPath + "' starts with a colon." );
+      }
+      else if ( i == ( topicPath.length(  ) - 1 ) )
+      {
+         throw new InvalidTopicExpressionException( "Topic path '" + topicPath + "' ends with a colon." );
+      }
+      else
+      {
+         prefix       = topicPath.substring( 0, i );
+         localPart    = topicPath.substring( i + 1 );
+         if ( localPart.indexOf( ':' ) != -1 )
+         {
+            throw new InvalidTopicExpressionException( "Local part of topic path '" + topicPath
+                                                       + "' contains a colon." );
+         }
+      }
+
+      String nsURI = nsContext.getNamespaceURI( prefix );
+      return new QName( nsURI, localPart, prefix );
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/ConcreteTopicExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/ConcreteTopicExpressionEvaluator.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/ConcreteTopicExpressionEvaluator.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/ConcreteTopicExpressionEvaluator.java Tue Aug  2 09:41:00 2005
@@ -1,103 +1,128 @@
-/*=============================================================================*
- *  Copyright 2005 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *=============================================================================*/
-package org.apache.ws.notification.topics.expression.impl;
-
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.TopicSet;
-import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.expression.impl.AbstractTopicExpressionEvaluator;
-import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
-import org.apache.ws.util.xml.NamespaceContext;
-
-import javax.xml.namespace.QName;
-import java.util.StringTokenizer;
-import java.util.List;
-import java.util.ArrayList;
-
-/**
- * Topic expression evalutor for the WS-Topics "Concrete" topic dialect.
- *
- * @see org.apache.ws.notification.topics.expression.TopicExpressionEvaluator
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
- */
-public class ConcreteTopicExpressionEvaluator extends AbstractTopicExpressionEvaluator
-{
-
-    //private static final Log LOG = LogFactory.getLog(ConcreteTopicExpressionEvaluator.class.getName());
-
-    private static final String[] SUPPORTED_DIALECTS = {TopicsConstants.TOPIC_EXPR_DIALECT_CONCRETE};
-
-    public Topic[] evaluate( TopicSpaceSet topicSpaceSet, TopicExpression topicExpr )
-        throws TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-            InvalidTopicExpressionException,
-            TopicExpressionException
-    {
-        String expr = getContent( topicExpr );
-        NamespaceContext nsContext = getNamespaceContext( topicExpr );
-        QName topicPath = toQName( expr, nsContext );
-        List matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
-        return (Topic[]) matchedTopics.toArray( new Topic[0] );
-    }
-
-    public String[] getDialects()
-    {
-        return SUPPORTED_DIALECTS;
-    }
-
-    private List evaluateTopicPath( TopicSpaceSet topicSpaceSet, QName topicPath )
-            throws TopicExpressionResolutionException, InvalidTopicExpressionException
-    {
-        List matchedTopics = new ArrayList();
-        TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
-        if ( topicPath.getLocalPart().indexOf( "//" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "*" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "|" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "." ) != -1 )
-        {
-            throw new InvalidTopicExpressionException( "Topic path '" + topicPath +
-                    "' contains one or more illegal characters ('//', '*', '|' or '.')." );
-        }
-        StringTokenizer pathTokenizer = new StringTokenizer( topicPath.getLocalPart(), "/" );
-        TopicSet topicSet = topicSpace;
-        boolean resolvedPath = true;
-        while ( pathTokenizer.hasMoreTokens() )
-        {
-            String name = pathTokenizer.nextToken();
-            if ( ! topicSet.containsTopic( name ) )
-            {
-                resolvedPath = false;
-                break;
-            }
-            topicSet = topicSet.getTopic( name );
-        }
-        if ( resolvedPath ) { matchedTopics.add( topicSet ); }
-        return matchedTopics;
-    }
-
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.notification.topics.expression.impl;
+
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSet;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
+import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+import org.apache.ws.notification.topics.expression.impl.AbstractTopicExpressionEvaluator;
+import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
+import org.apache.ws.util.xml.NamespaceContext;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
+/**
+ * Topic expression evalutor for the WS-Topics "Concrete" topic dialect.
+ *
+ * @see org.apache.ws.notification.topics.expression.TopicExpressionEvaluator
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class ConcreteTopicExpressionEvaluator
+   extends AbstractTopicExpressionEvaluator
+{
+   //private static final Log LOG = LogFactory.getLog(ConcreteTopicExpressionEvaluator.class.getName());
+   private static final String[] SUPPORTED_DIALECTS = 
+                                                      {
+                                                         TopicsConstants.TOPIC_EXPR_DIALECT_CONCRETE
+                                                      };
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String[] getDialects(  )
+   {
+      return SUPPORTED_DIALECTS;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicSpaceSet DOCUMENT_ME
+    * @param topicExpr DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicPathDialectUnknownException DOCUMENT_ME
+    * @throws TopicExpressionResolutionException DOCUMENT_ME
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    * @throws TopicExpressionException DOCUMENT_ME
+    */
+   public Topic[] evaluate( TopicSpaceSet   topicSpaceSet,
+                            TopicExpression topicExpr )
+   throws TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException
+   {
+      String           expr          = getContent( topicExpr );
+      NamespaceContext nsContext     = getNamespaceContext( topicExpr );
+      QName            topicPath     = toQName( expr, nsContext );
+      List             matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
+      return (Topic[]) matchedTopics.toArray( new Topic[0] );
+   }
+
+   private List evaluateTopicPath( TopicSpaceSet topicSpaceSet,
+                                   QName         topicPath )
+   throws TopicExpressionResolutionException, 
+          InvalidTopicExpressionException
+   {
+      List       matchedTopics = new ArrayList(  );
+      TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
+      if ( ( topicPath.getLocalPart(  ).indexOf( "//" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "*" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "|" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "." ) != -1 ) )
+      {
+         throw new InvalidTopicExpressionException( "Topic path '" + topicPath
+                                                    + "' contains one or more illegal characters ('//', '*', '|' or '.')." );
+      }
+
+      StringTokenizer pathTokenizer = new StringTokenizer( topicPath.getLocalPart(  ),
+                                                           "/" );
+      TopicSet        topicSet     = topicSpace;
+      boolean         resolvedPath = true;
+      while ( pathTokenizer.hasMoreTokens(  ) )
+      {
+         String name = pathTokenizer.nextToken(  );
+         if ( !topicSet.containsTopic( name ) )
+         {
+            resolvedPath = false;
+            break;
+         }
+
+         topicSet = topicSet.getTopic( name );
+      }
+
+      if ( resolvedPath )
+      {
+         matchedTopics.add( topicSet );
+      }
+
+      return matchedTopics;
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/FullTopicExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/FullTopicExpressionEvaluator.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/FullTopicExpressionEvaluator.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/FullTopicExpressionEvaluator.java Tue Aug  2 09:41:00 2005
@@ -1,233 +1,296 @@
-/*=============================================================================*
- *  Copyright 2005 The Apache Software Foundation
- *
- *  Licensed under the Apache License, Version 2.0 (the "License");
- *  you may not use this file except in compliance with the License.
- *  You may obtain a copy of the License at
- *
- *      http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing, software
- *  distributed under the License is distributed on an "AS IS" BASIS,
- *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- *  See the License for the specific language governing permissions and
- *  limitations under the License.
- *=============================================================================*/
-package org.apache.ws.notification.topics.expression.impl;
-
-import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.TopicSet;
-import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.impl.AbstractTopicExpressionEvaluator;
-import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
-import org.apache.ws.util.xml.NamespaceContext;
-
-import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-/**
- * Topic expression evalutor for the WS-Topics "Full" topic dialect.
- *
- * @see TopicExpressionEvaluator
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
- */
-public class FullTopicExpressionEvaluator extends AbstractTopicExpressionEvaluator
-{
-
-    //private static final Log LOG = LogFactory.getLog( FullTopicExpressionEvaluator.class.getName() );
-
-    private static final String[] SUPPORTED_DIALECTS = {TopicsConstants.TOPIC_EXPR_DIALECT_FULL};
-
-    public Topic[] evaluate( TopicSpaceSet topicSpaceSet, TopicExpression topicExpr )
-            throws TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-            InvalidTopicExpressionException,
-            TopicExpressionException
-    {
-        String expr = getContent( topicExpr );
-        NamespaceContext nsContext = getNamespaceContext( topicExpr );
-        StringTokenizer exprTokenizer = new StringTokenizer( expr, "|" );
-        Set allMatchedTopics = new HashSet();
-        while ( exprTokenizer.hasMoreTokens() )
-        {
-            QName topicPath = toQName( exprTokenizer.nextToken(), nsContext );
-            List matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
-            allMatchedTopics.addAll( matchedTopics );
-        }
-        if ( topicSpaceSet.isFixed() && allMatchedTopics.isEmpty() )
-        {
-            throw new InvalidTopicExpressionException( "Full topic expression '" + expr +
-                    "' does not match any topics, and the target topic set is fixed." );
-        }
-        return (Topic[]) allMatchedTopics.toArray( new Topic[0] );
-    }
-
-    public String[] getDialects()
-    {
-        return SUPPORTED_DIALECTS;
-    }
-
-    private List evaluateTopicPath( TopicSpaceSet topicSpaceSet, QName topicPath )
-            throws TopicExpressionResolutionException, InvalidTopicExpressionException
-    {
-        List matchedTopics = new ArrayList();
-        TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
-        if ( topicPath.getLocalPart().indexOf( "///" ) != -1 )
-        {
-            throw new InvalidTopicExpressionException( "Topic path '" + topicPath +
-                    "' contains an empty path component." );
-        }
-        PathTokenizer pathTokenizer = new PathTokenizer( topicPath.getLocalPart() );
-        List topicSetsToSearch = new ArrayList();
-        topicSetsToSearch.add( topicSpace );
-        boolean atFirstToken = true;
-        while ( pathTokenizer.hasMoreTokens() )
-        {
-            String pathToken = pathTokenizer.nextToken();
-            matchedTopics.clear();
-            for ( int i = 0; i < topicSetsToSearch.size(); i++ )
-            {
-                TopicSet topicSetToSearch = (TopicSet) topicSetsToSearch.get( i );
-                boolean recurse = pathToken.startsWith( "/" );
-                String name = recurse ? pathToken.substring( 1 ) : pathToken;
-                matchedTopics.addAll( findTopics( topicSetToSearch, name, recurse ) );
-            }
-            if ( atFirstToken && matchedTopics.isEmpty() )
-            {
-                throw new InvalidTopicExpressionException( "Topic path '" + topicPath +
-                        "' refers to a root topic that is not defined in the referenced topic space." );
-            }
-            topicSetsToSearch.clear();
-            topicSetsToSearch.addAll( matchedTopics );
-            atFirstToken = false;
-        }
-        return matchedTopics;
-    }
-
-    private List findTopics( TopicSet topicSet, String name, boolean recurse ) throws InvalidTopicExpressionException
-    {
-        List allMatchedTopics = new ArrayList();
-        if ( name.equals( "." ) )
-        {
-            allMatchedTopics.add( topicSet );
-            name = "*";  // we only want to evaluate "." the first time through during recursion
-        }
-        List matchedTopics = findTopics( topicSet, name );
-        allMatchedTopics.addAll( matchedTopics );
-        if ( recurse )
-        {
-            Iterator topicIter = topicSet.topicIterator();
-            while ( topicIter.hasNext() )
-            {
-                allMatchedTopics.addAll( findTopics( (Topic) topicIter.next(), name, recurse ) );
-            }
-        }
-        return allMatchedTopics;
-    }
-
-    private List findTopics( TopicSet topicSet, String name )
-    {
-        List matchedTopics = new ArrayList();
-        if ( name.equals( "*" ) )
-        {
-            Iterator topicIter = topicSet.topicIterator();
-            while ( topicIter.hasNext() )
-            {
-                matchedTopics.add( (Topic) topicIter.next() );
-            }
-        }
-        else
-        {
-            if ( topicSet.containsTopic( name ) )
-            {
-                matchedTopics.add( topicSet.getTopic( name ) );
-            }
-        }
-        return matchedTopics;
-    }
-
-    protected class PathTokenizer
-    {
-        private String m_path;
-        private int m_currentPos;
-        private int m_maxPos;
-
-        public PathTokenizer( String path )
-        {
-            m_path = path;
-            m_maxPos = m_path.length();
-        }
-
-        public boolean hasMoreTokens()
-        {
-            return m_currentPos < m_maxPos;
-        }
-
-        public String nextToken() throws InvalidTopicExpressionException
-        {
-            if ( m_currentPos >= m_maxPos )
-            {
-                throw new NoSuchElementException();
-            }
-            int startPos = m_currentPos;
-            m_currentPos = scanToken( startPos );
-            String token = m_path.substring( startPos, m_currentPos );
-            if ( token.startsWith( "//" ) )
-            {
-                token = token.substring( 1 );
-            }
-            ++m_currentPos; // skip the slash
-            return token;
-        }
-
-        private int scanToken( int startPos ) throws InvalidTopicExpressionException
-        {
-            int newPos = startPos;
-            if ( newPos == 0 )  // special handling for head of path, as per spec
-            {
-                if ( m_path.startsWith( "//" ) )
-                {
-                    newPos += 2;
-                }
-                if ( m_path.charAt( newPos ) == '.' )
-                {
-                    throw new InvalidTopicExpressionException(
-                            "'.' may not be used as the first component of a topic path." );
-                }
-            }
-            else
-            {
-                if ( m_path.charAt( newPos ) == '/' )
-                {
-                    newPos += 1;  // do not count leading slash as a delim
-                }
-            }
-            while ( newPos < m_maxPos )
-            {
-                if ( m_path.charAt( newPos ) == '/' )
-                {
-                    break;
-                }
-                newPos++;
-            }
-            return newPos;
-        }
-    }
-
-}
+/*=============================================================================*
+ *  Copyright 2004 The Apache Software Foundation
+ *
+ *  Licensed under the Apache License, Version 2.0 (the "License");
+ *  you may not use this file except in compliance with the License.
+ *  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ *=============================================================================*/
+package org.apache.ws.notification.topics.expression.impl;
+
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSet;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
+import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+import org.apache.ws.notification.topics.expression.impl.AbstractTopicExpressionEvaluator;
+import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
+import org.apache.ws.util.xml.NamespaceContext;
+import javax.xml.namespace.QName;
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.NoSuchElementException;
+import java.util.Set;
+import java.util.StringTokenizer;
+
+/**
+ * Topic expression evalutor for the WS-Topics "Full" topic dialect.
+ *
+ * @see TopicExpressionEvaluator
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class FullTopicExpressionEvaluator
+   extends AbstractTopicExpressionEvaluator
+{
+   //private static final Log LOG = LogFactory.getLog( FullTopicExpressionEvaluator.class.getName() );
+   private static final String[] SUPPORTED_DIALECTS = 
+                                                      {
+                                                         TopicsConstants.TOPIC_EXPR_DIALECT_FULL
+                                                      };
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String[] getDialects(  )
+   {
+      return SUPPORTED_DIALECTS;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicSpaceSet DOCUMENT_ME
+    * @param topicExpr DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicPathDialectUnknownException DOCUMENT_ME
+    * @throws TopicExpressionResolutionException DOCUMENT_ME
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    * @throws TopicExpressionException DOCUMENT_ME
+    */
+   public Topic[] evaluate( TopicSpaceSet   topicSpaceSet,
+                            TopicExpression topicExpr )
+   throws TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException
+   {
+      String           expr             = getContent( topicExpr );
+      NamespaceContext nsContext        = getNamespaceContext( topicExpr );
+      StringTokenizer  exprTokenizer    = new StringTokenizer( expr, "|" );
+      Set              allMatchedTopics = new HashSet(  );
+      while ( exprTokenizer.hasMoreTokens(  ) )
+      {
+         QName topicPath     = toQName( exprTokenizer.nextToken(  ),
+                                        nsContext );
+         List  matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
+         allMatchedTopics.addAll( matchedTopics );
+      }
+
+      if ( topicSpaceSet.isFixed(  ) && allMatchedTopics.isEmpty(  ) )
+      {
+         throw new InvalidTopicExpressionException( "Full topic expression '" + expr
+                                                    + "' does not match any topics, and the target topic set is fixed." );
+      }
+
+      return (Topic[]) allMatchedTopics.toArray( new Topic[0] );
+   }
+
+   private List evaluateTopicPath( TopicSpaceSet topicSpaceSet,
+                                   QName         topicPath )
+   throws TopicExpressionResolutionException, 
+          InvalidTopicExpressionException
+   {
+      List       matchedTopics = new ArrayList(  );
+      TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
+      if ( topicPath.getLocalPart(  ).indexOf( "///" ) != -1 )
+      {
+         throw new InvalidTopicExpressionException( "Topic path '" + topicPath
+                                                    + "' contains an empty path component." );
+      }
+
+      PathTokenizer pathTokenizer     = new PathTokenizer( topicPath.getLocalPart(  ) );
+      List          topicSetsToSearch = new ArrayList(  );
+      topicSetsToSearch.add( topicSpace );
+      boolean atFirstToken = true;
+      while ( pathTokenizer.hasMoreTokens(  ) )
+      {
+         String pathToken = pathTokenizer.nextToken(  );
+         matchedTopics.clear(  );
+         for ( int i = 0; i < topicSetsToSearch.size(  ); i++ )
+         {
+            TopicSet topicSetToSearch = (TopicSet) topicSetsToSearch.get( i );
+            boolean  recurse = pathToken.startsWith( "/" );
+            String   name    = recurse ? pathToken.substring( 1 ) : pathToken;
+            matchedTopics.addAll( findTopics( topicSetToSearch, name, recurse ) );
+         }
+
+         if ( atFirstToken && matchedTopics.isEmpty(  ) )
+         {
+            throw new InvalidTopicExpressionException( "Topic path '" + topicPath
+                                                       + "' refers to a root topic that is not defined in the referenced topic space." );
+         }
+
+         topicSetsToSearch.clear(  );
+         topicSetsToSearch.addAll( matchedTopics );
+         atFirstToken = false;
+      }
+
+      return matchedTopics;
+   }
+
+   private List findTopics( TopicSet topicSet,
+                            String   name )
+   {
+      List matchedTopics = new ArrayList(  );
+      if ( name.equals( "*" ) )
+      {
+         Iterator topicIter = topicSet.topicIterator(  );
+         while ( topicIter.hasNext(  ) )
+         {
+            matchedTopics.add( (Topic) topicIter.next(  ) );
+         }
+      }
+      else
+      {
+         if ( topicSet.containsTopic( name ) )
+         {
+            matchedTopics.add( topicSet.getTopic( name ) );
+         }
+      }
+
+      return matchedTopics;
+   }
+
+   private List findTopics( TopicSet topicSet,
+                            String   name,
+                            boolean  recurse )
+   throws InvalidTopicExpressionException
+   {
+      List allMatchedTopics = new ArrayList(  );
+      if ( name.equals( "." ) )
+      {
+         allMatchedTopics.add( topicSet );
+         name = "*"; // we only want to evaluate "." the first time through during recursion
+      }
+
+      List matchedTopics = findTopics( topicSet, name );
+      allMatchedTopics.addAll( matchedTopics );
+      if ( recurse )
+      {
+         Iterator topicIter = topicSet.topicIterator(  );
+         while ( topicIter.hasNext(  ) )
+         {
+            allMatchedTopics.addAll( findTopics( (Topic) topicIter.next(  ), name, recurse ) );
+         }
+      }
+
+      return allMatchedTopics;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @version $Revision: 1.8 $
+    * @author $author$
+    */
+   protected class PathTokenizer
+   {
+      private String m_path;
+      private int    m_currentPos;
+      private int    m_maxPos;
+
+      /**
+       * Creates a new {@link PathTokenizer} object.
+       *
+       * @param path DOCUMENT_ME
+       */
+      public PathTokenizer( String path )
+      {
+         m_path      = path;
+         m_maxPos    = m_path.length(  );
+      }
+
+      /**
+       * DOCUMENT_ME
+       *
+       * @return DOCUMENT_ME
+       */
+      public boolean hasMoreTokens(  )
+      {
+         return m_currentPos < m_maxPos;
+      }
+
+      /**
+       * DOCUMENT_ME
+       *
+       * @return DOCUMENT_ME
+       *
+       * @throws InvalidTopicExpressionException DOCUMENT_ME
+       * @throws NoSuchElementException DOCUMENT_ME
+       */
+      public String nextToken(  )
+      throws InvalidTopicExpressionException
+      {
+         if ( m_currentPos >= m_maxPos )
+         {
+            throw new NoSuchElementException(  );
+         }
+
+         int startPos = m_currentPos;
+         m_currentPos = scanToken( startPos );
+         String token = m_path.substring( startPos, m_currentPos );
+         if ( token.startsWith( "//" ) )
+         {
+            token = token.substring( 1 );
+         }
+
+         ++m_currentPos; // skip the slash
+         return token;
+      }
+
+      private int scanToken( int startPos )
+      throws InvalidTopicExpressionException
+      {
+         int newPos = startPos;
+         if ( newPos == 0 ) // special handling for head of path, as per spec
+         {
+            if ( m_path.startsWith( "//" ) )
+            {
+               newPos += 2;
+            }
+
+            if ( m_path.charAt( newPos ) == '.' )
+            {
+               throw new InvalidTopicExpressionException( "'.' may not be used as the first component of a topic path." );
+            }
+         }
+         else
+         {
+            if ( m_path.charAt( newPos ) == '/' )
+            {
+               newPos += 1; // do not count leading slash as a delim
+            }
+         }
+         while ( newPos < m_maxPos )
+         {
+            if ( m_path.charAt( newPos ) == '/' )
+            {
+               break;
+            }
+
+            newPos++;
+         }
+
+         return newPos;
+      }
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/SimpleTopicExpressionEvaluator.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/SimpleTopicExpressionEvaluator.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/SimpleTopicExpressionEvaluator.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/SimpleTopicExpressionEvaluator.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,26 +12,21 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression.impl;
 
 import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.TopicSpaceSet;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.expression.TopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
 import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.notification.topics.expression.impl.AbstractTopicExpressionEvaluator;
 import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
 import org.apache.ws.util.xml.NamespaceContext;
-
 import javax.xml.namespace.QName;
 import java.util.ArrayList;
 import java.util.List;
@@ -43,51 +38,75 @@
  *
  * @author Ian Springer (ian DOT springer AT hp DOT com)
  */
-public class SimpleTopicExpressionEvaluator extends AbstractTopicExpressionEvaluator
+public class SimpleTopicExpressionEvaluator
+   extends AbstractTopicExpressionEvaluator
 {
-
-    //private static final Log LOG = LogFactory.getLog(SimpleTopicExpressionEvaluator.class.getName());
-
-    private static final String[] SUPPORTED_DIALECTS = {TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE};
-
-    public Topic[] evaluate( TopicSpaceSet topicSpaceSet, TopicExpression topicExpr )
-        throws TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-               InvalidTopicExpressionException,
-            TopicExpressionException
-    {
-        String expr = getContent( topicExpr );
-        NamespaceContext nsContext = getNamespaceContext( topicExpr );
-        QName topicPath = toQName( expr, nsContext );
-        List matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
-        return (Topic[]) matchedTopics.toArray( new Topic[0] );
-    }
-
-    public String[] getDialects()
-    {
-        return SUPPORTED_DIALECTS;
-    }
-
-    private List evaluateTopicPath( TopicSpaceSet topicSpaceSet, QName topicPath )
-            throws TopicExpressionResolutionException, InvalidTopicExpressionException
-    {
-        List matchedTopics = new ArrayList();
-        TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
-        if ( topicPath.getLocalPart().indexOf( "/" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "*" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "|" ) != -1 ||
-             topicPath.getLocalPart().indexOf( "." ) != -1 )
-        {
-            throw new InvalidTopicExpressionException( "Topic path '" + topicPath +
-                    "' contains one or more illegal characters ('/', '*', '|' or '.')." );
-        }
-        String name = topicPath.getLocalPart();
-        Topic topic = topicSpace.getTopic( name );
-        if ( topic != null )
-        {
-            matchedTopics.add( topic );
-        }
-        return matchedTopics;
-    }
-
-}
+   //private static final Log LOG = LogFactory.getLog(SimpleTopicExpressionEvaluator.class.getName());
+   private static final String[] SUPPORTED_DIALECTS = 
+                                                      {
+                                                         TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE
+                                                      };
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String[] getDialects(  )
+   {
+      return SUPPORTED_DIALECTS;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicSpaceSet DOCUMENT_ME
+    * @param topicExpr DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws TopicPathDialectUnknownException DOCUMENT_ME
+    * @throws TopicExpressionResolutionException DOCUMENT_ME
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    * @throws TopicExpressionException DOCUMENT_ME
+    */
+   public Topic[] evaluate( TopicSpaceSet   topicSpaceSet,
+                            TopicExpression topicExpr )
+   throws TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException
+   {
+      String           expr          = getContent( topicExpr );
+      NamespaceContext nsContext     = getNamespaceContext( topicExpr );
+      QName            topicPath     = toQName( expr, nsContext );
+      List             matchedTopics = evaluateTopicPath( topicSpaceSet, topicPath );
+      return (Topic[]) matchedTopics.toArray( new Topic[0] );
+   }
+
+   private List evaluateTopicPath( TopicSpaceSet topicSpaceSet,
+                                   QName         topicPath )
+   throws TopicExpressionResolutionException, 
+          InvalidTopicExpressionException
+   {
+      List       matchedTopics = new ArrayList(  );
+      TopicSpace topicSpace = getTopicSpace( topicSpaceSet, topicPath );
+      if ( ( topicPath.getLocalPart(  ).indexOf( "/" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "*" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "|" ) != -1 )
+           || ( topicPath.getLocalPart(  ).indexOf( "." ) != -1 ) )
+      {
+         throw new InvalidTopicExpressionException( "Topic path '" + topicPath
+                                                    + "' contains one or more illegal characters ('/', '*', '|' or '.')." );
+      }
+
+      String name  = topicPath.getLocalPart(  );
+      Topic  topic = topicSpace.getTopic( name );
+      if ( topic != null )
+      {
+         matchedTopics.add( topic );
+      }
+
+      return matchedTopics;
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/TopicExpressionEngineImpl.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/TopicExpressionEngineImpl.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/TopicExpressionEngineImpl.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/expression/impl/TopicExpressionEngineImpl.java Tue Aug  2 09:41:00 2005
@@ -1,4 +1,4 @@
-/*
+/*=============================================================================*
  *  Copyright 2004 The Apache Software Foundation
  *
  *  Licensed under the Apache License, Version 2.0 (the "License");
@@ -12,7 +12,7 @@
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
- */
+ *=============================================================================*/
 package org.apache.ws.notification.topics.expression.impl;
 
 import org.apache.commons.logging.Log;
@@ -28,7 +28,6 @@
 import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
 import org.apache.ws.resource.JndiConstants;
 import org.apache.ws.util.jndi.JNDIUtils;
-
 import javax.naming.Context;
 import javax.naming.InitialContext;
 import javax.naming.NameClassPair;
@@ -44,148 +43,183 @@
  *
  * @see org.apache.ws.notification.topics.TopicSpaceSet
  */
-public class TopicExpressionEngineImpl implements TopicExpressionEngine
+public class TopicExpressionEngineImpl
+   implements TopicExpressionEngine
 {
+   private static final Log LOG = LogFactory.getLog( TopicExpressionEngineImpl.class.getName(  ) );
+   private Map              m_evaluators = new HashMap(  );
 
-    private static final Log LOG =
-            LogFactory.getLog( TopicExpressionEngineImpl.class.getName() );
-
-    private Map m_evaluators = new HashMap();
-
-    public TopicExpressionEngineImpl()
-    {
-        this.refresh();
-    }
-
-    /**
-     * Get the default topic expression engine instance (currently used to hide JNDI lookup details, may change in the
-     * future)
-     *
-     * @return The default topic expression engine instance
-     */
-    public static TopicExpressionEngine getInstance()
-    {
-        try
-        {
-            Context context = new InitialContext();
-            return (TopicExpressionEngine) context.lookup( JndiConstants.KEY_NAME_DEFAULT_TOPIC_EXPRESSION_ENGINE );
-        }
-        catch ( NamingException ne )
-        {
-            LOG.warn( "topicEngineConfigError: " + ne );
-            return new TopicExpressionEngineImpl();
-        }
-    }
-
-    /**
-     * 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.
-     */
-    public synchronized void refresh()
-    {
-        m_evaluators.clear();
-        NamingEnumeration list = null;
-        try
-        {
-            Context context = new InitialContext();
-            list = context.list( JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT );
-            while ( list.hasMore() )
+   /**
+    * Creates a new {@link TopicExpressionEngineImpl} object.
+    */
+   public TopicExpressionEngineImpl(  )
+   {
+      this.refresh(  );
+   }
+
+   /**
+    * Get the default topic expression engine instance (currently used to hide JNDI lookup details, may change in the
+    * future)
+    *
+    * @return The default topic expression engine instance
+    */
+   public static TopicExpressionEngine getInstance(  )
+   {
+      try
+      {
+         Context context = new InitialContext(  );
+         return (TopicExpressionEngine) context.lookup( JndiConstants.KEY_NAME_DEFAULT_TOPIC_EXPRESSION_ENGINE );
+      }
+      catch ( NamingException ne )
+      {
+         LOG.warn( "topicEngineConfigError: " + ne );
+         return new TopicExpressionEngineImpl(  );
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param dialect DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public synchronized TopicExpressionEvaluator getEvaluator( String dialect )
+   {
+      TopicExpressionEvaluator evaluator = (TopicExpressionEvaluator) this.m_evaluators.get( dialect );
+      return evaluator;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public synchronized String[] getSupportedDialects(  )
+   {
+      return (String[]) this.m_evaluators.keySet(  ).toArray( new String[this.m_evaluators.size(  )] );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param topicSpaceSet DOCUMENT_ME
+    * @param topicExpression DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException DOCUMENT_ME
+    * @throws TopicExpressionResolutionException DOCUMENT_ME
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    * @throws TopicExpressionException DOCUMENT_ME
+    * @throws TopicPathDialectUnknownException DOCUMENT_ME
+    */
+   public synchronized Topic[] evaluateTopicExpression( TopicSpaceSet   topicSpaceSet,
+                                                        TopicExpression topicExpression )
+   throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException, 
+          TopicExpressionResolutionException, 
+          InvalidTopicExpressionException, 
+          TopicExpressionException
+   {
+      if ( topicExpression == null )
+      {
+         throw new InvalidTopicExpressionException( "nullArgument" + "topicExpression" );
+      }
+
+      if ( topicExpression.getDialect(  ) == null )
+      {
+         throw new org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException( "nullArgument"
+                                                                                                  + "topicExpression.dialect" );
+      }
+
+      String                   dialect   = topicExpression.getDialect(  ).toString(  );
+      TopicExpressionEvaluator evaluator = getEvaluator( dialect );
+
+      if ( evaluator == null )
+      {
+         if ( LOG.isDebugEnabled(  ) )
+         {
+            LOG.debug( "Dialect not supported:" + dialect );
+            LOG.debug( "Registered dialects are:" );
+            Iterator keyIterator = m_evaluators.keySet(  ).iterator(  );
+            Object   key = null;
+            while ( keyIterator.hasNext(  ) )
             {
-                NameClassPair pair = (NameClassPair) list.next();
-                TopicExpressionEvaluator evaluator = (TopicExpressionEvaluator) JNDIUtils.lookup( context,
-                        JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT + "/" + pair.getName(),
-                        TopicExpressionEvaluator.class );
-                registerEvaluator( evaluator );
+               key = keyIterator.next(  );
+               LOG.debug( key );
             }
-        }
-        catch ( NamingException ne )
-        {
-            LOG.warn( "topicEngineInitError: " + ne );
-            registerEvaluator( new SimpleTopicExpressionEvaluator() );
-            registerEvaluator( new ConcreteTopicExpressionEvaluator() );
-            registerEvaluator( new FullTopicExpressionEvaluator() );
-        }
-        finally
-        {
-            if ( list != null )
+
+            LOG.debug( "key.equals(dialect): " + ( key.equals( dialect.toString(  ) ) ) );
+            LOG.debug( "this.evaluators.containsKey(dialect): "
+                       + this.m_evaluators.containsKey( dialect.toString(  ) ) );
+            LOG.debug( "HashCode of key: " + String.valueOf( key.hashCode(  ) ) );
+            LOG.debug( "HashCode of dialect: " + String.valueOf( dialect.toString(  ).hashCode(  ) ) );
+            LOG.debug( "Object stored for key: " + this.m_evaluators.get( key ) );
+         }
+
+         throw new TopicPathDialectUnknownException( "The dialect " + dialect + " was not recognized." );
+      }
+
+      return evaluator.evaluate( topicSpaceSet, topicExpression );
+   }
+
+   /**
+    * 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.
+    */
+   public synchronized void refresh(  )
+   {
+      m_evaluators.clear(  );
+      NamingEnumeration list = null;
+      try
+      {
+         Context context = new InitialContext(  );
+         list = context.list( JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT );
+         while ( list.hasMore(  ) )
+         {
+            NameClassPair            pair      = (NameClassPair) list.next(  );
+            TopicExpressionEvaluator evaluator =
+               (TopicExpressionEvaluator) JNDIUtils.lookup( context,
+                                                            JndiConstants.TOPIC_EXPRESSION_EVALUATOR_CONTEXT + "/"
+                                                            + pair.getName(  ), TopicExpressionEvaluator.class );
+            registerEvaluator( evaluator );
+         }
+      }
+      catch ( NamingException ne )
+      {
+         LOG.warn( "topicEngineInitError: " + ne );
+         registerEvaluator( new SimpleTopicExpressionEvaluator(  ) );
+         registerEvaluator( new ConcreteTopicExpressionEvaluator(  ) );
+         registerEvaluator( new FullTopicExpressionEvaluator(  ) );
+      }
+      finally
+      {
+         if ( list != null )
+         {
+            try
             {
-                try
-                {
-                    list.close();
-                }
-                catch ( NamingException ne )
-                {
-                }
+               list.close(  );
             }
-        }
-    }
-
-    public synchronized void registerEvaluator( TopicExpressionEvaluator evaluator )
-    {
-        LOG.debug( "Adding dialects for " + evaluator.getClass().getName() );
-        String[] dialects = evaluator.getDialects();
-        for ( int i = 0; i < dialects.length; i++ )
-        {
-            LOG.debug( "Adding dialect: " + dialects[i] );
-            this.m_evaluators.put( dialects[i], evaluator );
-        }
-    }
-
-    public synchronized TopicExpressionEvaluator getEvaluator( String dialect )
-    {
-        TopicExpressionEvaluator evaluator =
-                (TopicExpressionEvaluator) this.m_evaluators.get( dialect );
-        return evaluator;
-    }
-
-    public synchronized Topic[] evaluateTopicExpression( TopicSpaceSet topicSpaceSet,
-                                                            TopicExpression topicExpression )
-            throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException,
-            TopicExpressionResolutionException,
-            InvalidTopicExpressionException,
-            TopicExpressionException
-    {
-        if ( topicExpression == null )
-        {
-            throw new InvalidTopicExpressionException(  "nullArgument"+"topicExpression"  );
-        }
-
-        if ( topicExpression.getDialect() == null )
-        {
-            throw new org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException(
-                     "nullArgument"+"topicExpression.dialect"  );
-        }
-
-        String dialect = topicExpression.getDialect().toString();
-        TopicExpressionEvaluator evaluator = getEvaluator( dialect );
-
-        if ( evaluator == null )
-        {
-            if ( LOG.isDebugEnabled() )
+            catch ( NamingException ne )
             {
-                LOG.debug( "Dialect not supported:" + dialect );
-                LOG.debug( "Registered dialects are:" );
-                Iterator keyIterator = m_evaluators.keySet().iterator();
-                Object key = null;
-                while ( keyIterator.hasNext() )
-                {
-                    key = keyIterator.next();
-                    LOG.debug( key );
-                }
-                LOG.debug( "key.equals(dialect): " + ( key.equals( dialect.toString() ) ) );
-                LOG.debug( "this.evaluators.containsKey(dialect): " +
-                        this.m_evaluators.containsKey( dialect.toString() ) );
-                LOG.debug( "HashCode of key: " + String.valueOf( key.hashCode() ) );
-                LOG.debug( "HashCode of dialect: " + String.valueOf( dialect.toString().hashCode() ) );
-                LOG.debug( "Object stored for key: " + this.m_evaluators.get( key ) );
             }
-            throw new TopicPathDialectUnknownException( "The dialect " + dialect + " was not recognized." );
-        }
-        return evaluator.evaluate( topicSpaceSet, topicExpression );
-    }
-
-    public synchronized String[] getSupportedDialects()
-    {
-        return (String[]) this.m_evaluators.keySet().toArray( new String[this.m_evaluators.size()] );
-    }
-}
+         }
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param evaluator DOCUMENT_ME
+    */
+   public synchronized void registerEvaluator( TopicExpressionEvaluator evaluator )
+   {
+      LOG.debug( "Adding dialects for " + evaluator.getClass(  ).getName(  ) );
+      String[] dialects = evaluator.getDialects(  );
+      for ( int i = 0; i < dialects.length; i++ )
+      {
+         LOG.debug( "Adding dialect: " + dialects[i] );
+         this.m_evaluators.put( dialects[i], evaluator );
+      }
+   }
+}
\ No newline at end of file