You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-dev@ws.apache.org by ip...@apache.org on 2005/06/07 00:31:12 UTC

svn commit: r185073 - in /incubator/hermes/trunk/src: java/org/apache/ws/notification/base/impl/ java/org/apache/ws/notification/base/v2004_06/porttype/impl/ site/content/xdocs/ test/org/apache/ws/notification/topics/ test/org/apache/ws/notification/topics/impl/

Author: ips
Date: Mon Jun  6 15:31:12 2005
New Revision: 185073

URL: http://svn.apache.org/viewcvs?rev=185073&view=rev
Log:
better handling of invalid topic expressions

Modified:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
    incubator/hermes/trunk/src/site/content/xdocs/index.xml
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluatorTestCase.java
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluatorTestCase.java
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluatorTestCase.java

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java Mon Jun  6 15:31:12 2005
@@ -19,6 +19,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.resource.i18n.Keys;
 import org.apache.ws.resource.i18n.MessagesImpl;
@@ -43,7 +44,7 @@
     private static final Log LOG = LogFactory.getLog( XmlBeansQueryExpression.class );
     public static final Messages MSG = MessagesImpl.getInstance();
 
-    private XmlObject m_queryExprXBean;
+    private XmlObject m_topicExprXBean;
     private URI m_dialect;
     private Object m_content;
     private Object m_nsContext;
@@ -55,19 +56,19 @@
      *
      * @throws JAXRPCException          DOCUMENT_ME
      */
-    public XmlBeansTopicExpression( TopicExpressionType topicExprXBean )
+    public XmlBeansTopicExpression( TopicExpressionType topicExprXBean ) throws InvalidTopicExpressionException
     {
         this( topicExprXBean, getDialect( topicExprXBean ) );
     }
 
-    protected XmlBeansTopicExpression( XmlObject xBean, URI dialect )
+    protected XmlBeansTopicExpression( XmlObject xBean, URI dialect ) throws InvalidTopicExpressionException
     {
-        m_queryExprXBean = xBean;
+        m_topicExprXBean = xBean;
         m_dialect = dialect;
-        XmlObject[] childElems = XmlBeanUtils.getChildElements( m_queryExprXBean );
+        XmlObject[] childElems = XmlBeanUtils.getChildElements( m_topicExprXBean );
         if ( childElems.length > 1 )
         {
-            throw new JAXRPCException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
+            throw new InvalidTopicExpressionException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
         }
         if ( childElems.length == 1 )
         {
@@ -75,9 +76,9 @@
         }
         else
         {
-            m_content = XmlBeanUtils.getValue( m_queryExprXBean );
+            m_content = XmlBeanUtils.getValue( m_topicExprXBean );
         }
-        m_nsContext = new XmlBeansNamespaceContext( m_queryExprXBean );
+        m_nsContext = new XmlBeansNamespaceContext( m_topicExprXBean );
         if ( LOG.isDebugEnabled() )
         {
             LOG.debug( MSG.getMessage( Keys.QUERY_EXPR, toString() ) );
@@ -85,7 +86,7 @@
     }
 
     private static URI getDialect(
-            TopicExpressionType topicExprElem )
+            TopicExpressionType topicExprElem ) throws InvalidTopicExpressionException
     {
         try
         {
@@ -93,7 +94,7 @@
         }
         catch ( Exception e )
         {
-            throw new JAXRPCException( MSG.getMessage( Keys.FAILED_INIT_DIALECT, e ) );
+            throw new InvalidTopicExpressionException( "The specified topic expression dialect '" + topicExprElem.getDialect() + "' is not a valid URI." );
         }
     }
 
@@ -141,7 +142,7 @@
 
     public XmlObject getXmlObject()
     {
-        return m_queryExprXBean;
+        return m_topicExprXBean;
     }
 
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java Mon Jun  6 15:31:12 2005
@@ -37,6 +37,7 @@
 import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.notification.topics.expression.TopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.impl.SubscriptionTopicListener;
 import org.apache.ws.resource.ResourceContext;
 import org.apache.ws.resource.faults.BaseFaultException;
@@ -81,7 +82,7 @@
     public SubscribeResponseDocument subscribe( SubscribeDocument requestDoc )
     {
         SubscribeDocument.Subscribe request = requestDoc.getSubscribe();
-        TopicExpression topicExpr = new XmlBeansTopicExpression( request.getTopicExpression() );
+        TopicExpression topicExpr = getTopicExpression( request.getTopicExpression() );
         Topic[] topics = evaluateTopicExpression( topicExpr );
         if ( topics.length == 0 )
         {
@@ -152,14 +153,28 @@
         return subscribeResponseDoc;
     }
 
+    private TopicExpression getTopicExpression( TopicExpressionType topicExpressionType )
+    {
+        TopicExpression topicExpr = null;
+        try
+        {
+            topicExpr = new XmlBeansTopicExpression( topicExpressionType );
+        }
+        catch ( InvalidTopicExpressionException ite )
+        {
+            throw new InvalidTopicExpressionFaultException( NAMESPACE_SET,
+                    ite.getLocalizedMessage() );
+        }
+        return topicExpr;
+    }
+
     /**
      * @see NotificationProducerPortType#getCurrentMessage(org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument)
      */
     public GetCurrentMessageResponseDocument getCurrentMessage( GetCurrentMessageDocument requestDoc )
     {
-        GetCurrentMessageDocument.GetCurrentMessage request = requestDoc.getGetCurrentMessage();
-        TopicExpressionType topicExprXmlBean = request.getTopic();
-        TopicExpression topicExpr = new XmlBeansTopicExpression( topicExprXmlBean );
+        GetCurrentMessageDocument.GetCurrentMessage request = requestDoc.getGetCurrentMessage();        
+        TopicExpression topicExpr = getTopicExpression( request.getTopic() );
         Topic[] topics = evaluateTopicExpression( topicExpr );
         if ( topics.length == 0 )
         {

Modified: incubator/hermes/trunk/src/site/content/xdocs/index.xml
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/site/content/xdocs/index.xml?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/site/content/xdocs/index.xml (original)
+++ incubator/hermes/trunk/src/site/content/xdocs/index.xml Mon Jun  6 15:31:12 2005
@@ -6,47 +6,53 @@
 <document> 
 
   <header> 
-    <title>Welcome to Hermes!</title> 
+    <title>Apache WebServices - Hermes</title> 
   </header> 
 
   <body> 
     
     <section>
       <title>Overview</title>
-      
       <p>
-       This project will eventually host an implementation of OASIS
-       WS-Notification (WSN) 1.2. The implementation will be build by pulling
-       in code from the Globus WSRF/WSN implementation and
-       refactoring it to make use of the new <a href="/apollo/">Apollo</a> 
-       WSRF impl and to use XMLBeans instead of Axis types for improved SOAP
-       engine portability,
+       Hermes is a robust Java implementation of the 
+       <a href="wsn.html">Web Services Notification (WSN)</a>
+       family of specifications.
       </p>
       <p>
-       The Globus WSRF/WSN impl will soon be checked in to into a
-       subdir of the Apollo project. If you want to look at the Globus
-       code in the meantime it's available from Globus' anon CVS:
-      </p> 
-      <source>
-       cvs -d :pserver:anonymous@cvs.globus.org:/home/globdev/CVS/globus-packages login
-       [hit Enter when prompted for password]       
-       cvs -d :pserver:anonymous@cvs.globus.org:/home/globdev/CVS/globus-packages co wsrf
-      </source>
-      <p>
-       Note, the Muse project contains not only a MuWS 0.5 implementation, but
-       also implementations of WSRF 1.1 (minus WS-ServiceGroups) and WSN 1.1
-       (minus WS-BrokeredNotification).
-      </p> 
+       WSN defines a set of specifications that standardize the way Web services
+       can interact using the Notification pattern, which defines a way for consumers
+       to subscribe to a producer for notifications whenever a particular situation
+       occurs. 
+      </p>           
+      <p>
+       WSN builds upon the WS-ResourceFramework
+       (WSRF) family of specifications. Hermes leverages the <a href="ext:apollo/">Apollo</a>
+       project as its implementation of the WSRF foundation.                    
+      </p>                   
+    </section>
+
+    <section>
+      <title>News</title>
+      <ul>
+         <li>(May 25, 2005) <a href="http://cvs.apache.org/dist/incubator/hermes/1.0-beta/">Hermes 1.0 Beta</a> is now available!</li> 
+      </ul>
+    </section>
+
+    <section>
+      <title>History</title>
       <p>
-       For more information, please <a href="contact_info.html">contact the 
-       development team</a>.
+       Much of the code in Hermes is based on code from the GTK4 WSRF/WSN
+       implementation that was donated by the Globus Consortium. This code
+       was refactored to make extensive use of Apache XMLBeans to
+       add improved runtime schema type validation and to enable
+       portability to SOAP engines other than Axis. The original GTK4
+       WSRF/WSN code is checked in to SVN 
+       <a href="http://svn.apache.org/viewcvs.cgi/incubator/apollo/globus/">here</a>.
       </p>
-                   
     </section>
     
     <section>
-      <title>Incubation Disclaimer</title>
-  
+      <title>Incubation Disclaimer</title>  
       <p>
         The Hermes project is an effort undergoing incubation at the Apache
         Software Foundation (ASF), sponsored by Davanum Srinivas. Incubation is
@@ -56,18 +62,15 @@
         projects. While incubation status is not necessarily a reflection of
         the completeness or stability of the code, it does indicate that the
         project has yet to be fully endorsed by the ASF.
-      </p>
-      
+      </p>      
       <p>
         The initial proposal for Hermes is
         <a href="http://wiki.apache.org/incubator/HermesProposal">here</a>.
-      </p>
-      
+      </p>      
       <p>
         The status of the Hermes project is tracked by the Apache incubator
         <a href="http://incubator.apache.org/projects/hermes.html">here</a>.
-      </p>
-      
+      </p>      
     </section>        
     
   </body>

Modified: incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java (original)
+++ incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java Mon Jun  6 15:31:12 2005
@@ -17,17 +17,17 @@
 import org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI;
 import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
 
-import javax.naming.directory.SchemaViolationException;
 import javax.xml.namespace.QName;
 
-
 /**
+ * A test case for {@link SubscriptionTopicListener}.
+ *
  * @author Sal Campana
  */
 public class SubscriptionTopicListenerTestCase extends TestCase
 {
 
-    public void testBuildingNotificationMessages() throws SchemaViolationException
+    public void testBuildingNotificationMessages() throws Exception
     {
         EndpointReferenceType epr1 = EndpointReferenceType.Factory.newInstance();
         AttributedURI uri = AttributedURI.Factory.newInstance();

Modified: incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluatorTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluatorTestCase.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluatorTestCase.java (original)
+++ incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluatorTestCase.java Mon Jun  6 15:31:12 2005
@@ -20,7 +20,6 @@
 import org.apache.ws.notification.topics.Topic;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.expression.impl.ConcreteTopicExpressionEvaluator;

Modified: incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluatorTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluatorTestCase.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluatorTestCase.java (original)
+++ incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluatorTestCase.java Mon Jun  6 15:31:12 2005
@@ -20,9 +20,8 @@
 import org.apache.ws.notification.topics.Topic;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.expression.impl.FullTopicExpressionEvaluator;
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;

Modified: incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluatorTestCase.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluatorTestCase.java?rev=185073&r1=185072&r2=185073&view=diff
==============================================================================
--- incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluatorTestCase.java (original)
+++ incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluatorTestCase.java Mon Jun  6 15:31:12 2005
@@ -20,8 +20,6 @@
 import org.apache.ws.notification.topics.Topic;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
 import org.apache.ws.notification.topics.expression.TopicExpressionEvaluator;
 import org.apache.ws.notification.topics.expression.impl.SimpleTopicExpressionEvaluator;



---------------------------------------------------------------------
To unsubscribe, e-mail: hermes-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: hermes-dev-help@ws.apache.org