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/05/13 01:20:45 UTC

svn commit: r169908 - in /incubator/hermes/trunk/src: java/org/apache/ws/eventing/ java/org/apache/ws/eventing/pubsub/ java/org/apache/ws/notification/base/ java/org/apache/ws/notification/base/faults/ java/org/apache/ws/notification/base/impl/ java/org/apache/ws/notification/base/impl/faults/ java/org/apache/ws/notification/pubsub/ java/org/apache/ws/notification/tool/ java/org/apache/ws/notification/tool/v2004_06/ java/org/apache/ws/notification/topics/ java/org/apache/ws/notification/topics/impl/ java/org/apache/ws/notification/topics/impl/faults/ java/org/apache/ws/notification/topics/util/ java/org/apache/ws/notification/topics/v2004_06/ templates/1_2_draft01/ templates/1_2_draft03/ templates/v2004_06/ test/org/apache/ws/notification/topics/ test/org/apache/ws/notification/topics/impl/

Author: ips
Date: Thu May 12 16:20:44 2005
New Revision: 169908

URL: http://svn.apache.org/viewcvs?rev=169908&view=rev
Log:
various refactorings & improvements

Added:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/InvalidTopicExpressionFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/NoCurrentMessageOnTopicFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/PauseFailedFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/ResumeFailedFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/SubscribeCreationFailedFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicNotSupportedFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicPathDialectUnknownFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SubscriptionTopicListener.java
    incubator/hermes/trunk/src/templates/v2004_06/
      - copied from r168647, incubator/hermes/trunk/src/templates/1_2_draft01/
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java
Removed:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/faults/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpression.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEngine.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicExpressionEvaluator.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceRegistry.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/AbstractTopicExpressionEvaluator.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ConcreteTopicExpressionEvaluator.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/FullTopicExpressionEvaluator.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicExpressionEngineImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/faults/InvalidTopicExpressionFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/faults/NoCurrentMessageOnTopicFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/faults/TopicNotSupportedFaultException.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/faults/TopicPathDialectUnknownFaultException.java
    incubator/hermes/trunk/src/templates/1_2_draft01/
    incubator/hermes/trunk/src/templates/1_2_draft03/
    incubator/hermes/trunk/src/templates/v2004_06/NotificationConsumerPortType.txt
    incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SimpleSubscriptionTopicListenerTest.java
Modified:
    incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
    incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/pubsub/Subscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ResourceTerminationTopicImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/v2004_06/TopicsConstants.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/eventing/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java Thu May 12 16:20:44 2005
@@ -15,20 +15,15 @@
  */ 
 package org.apache.ws.eventing;
 
-import org.apache.ws.util.uuid.UuidGenerator;
-import org.apache.ws.util.uuid.UuidGeneratorFactory;
-
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import java.util.Calendar;
+import org.apache.ws.pubsub.Filter;
 import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
-import org.apache.ws.resource.lifetime.ResourceTerminationListener;
-
-import javax.xml.soap.*;
+import org.apache.ws.util.uuid.UuidGenerator;
+import org.apache.ws.util.uuid.UuidGeneratorFactory;
+import org.apache.ws.addressing.EndpointReference;
 
 import java.util.Calendar;
-
-import org.apache.ws.pubsub.*;
 /**
  *
  * @author  Stefan Lischke
@@ -84,5 +79,10 @@
     public Calendar getCurrentTime()
     {
         return Calendar.getInstance();
+    }
+
+    public EndpointReference getEndpointReference()
+    {
+        return null; // TODO
     }
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java Thu May 12 16:20:44 2005
@@ -20,10 +20,11 @@
 import edu.berkeley.cs.db.yfilterplus.queryparser.Query;
 import edu.berkeley.cs.db.yfilterplus.queryparser.XPQuery;
 import edu.berkeley.cs.db.yfilterplus.xmltree.XMLTree;
+import org.apache.axis.message.addressing.Constants;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.pubsub.Filter;
 import org.apache.ws.pubsub.Filter;
 import org.apache.ws.resource.InvalidResourceKeyException;
 import org.apache.ws.resource.JndiConstants;
@@ -33,18 +34,10 @@
 import org.apache.ws.resource.ResourceKey;
 import org.apache.ws.resource.ResourceUnknownException;
 import org.apache.ws.resource.impl.SimpleTypeResourceKey;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.xmlbeans.XmlCursor;
-import org.apache.xmlbeans.XmlObject;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
 
 import javax.xml.namespace.QName;
 import java.util.Calendar;
- 
+
 public class SubscriptionHome extends org.apache.ws.resource.impl.AbstractResourceHome{
     private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
     /**  The service endpoint name as registered with the SOAP Platform.  This is useful for building EPR's. **/
@@ -59,18 +52,18 @@
 
     /** The name of the resource key for this resource. **/
     public static final javax.xml.namespace.QName RESOURCE_KEY_NAME = javax.xml.namespace.QName.valueOf("{http://ws.apache.org/notification/base/service/SubscriptionManager}ResourceID");
-    
+
 
     public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart() + "/" + JndiConstants.ATOMIC_NAME_HOME;
-    
+
     public int c=0;
-    
+
 //    private java.util.HashMap subs;
     private java.util.HashMap queriesBack;
     private String[] queries;
-    
+
     EXfilterBasic yfilter;
-    
+
     /** Creates a new instance of ResourceHome */
     public SubscriptionHome() {
         yfilter = new EXfilterBasic();
@@ -79,36 +72,39 @@
         queries=  new String[1000000];
         LOG.info("ResourceHome"+this.toString());
     }
-    
+
     public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
         LOG.info("getInstance ResourceHome");
         return find( resourceContext.getResourceKey() );
     }
-    
+
     public Subscription create(Filter filter, Calendar expires, java.net.URI delivery){
         Subscription rs = new Subscription(filter,expires, delivery);
         rs.setResourceHome(this);
         String id = (String) rs.getID();
-        
+
         SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), id);
-        rs.setEpr(getEPR(resourceKey));
+        //TODO !!!!! woher kommt publisher epr url ??? HACK for tcpmon 12345-8080
+        String subscriptionAddress = "http://localhost:12345/axis/services/SubscriptionManager";
+        EndpointReference subscriptionEPR = getEndpointReference( subscriptionAddress, resourceKey, Constants.NS_URI_ADDRESSING_2004_08 );
+        rs.setEpr(subscriptionEPR);
         rs.setResourceKey(resourceKey);
-        
+
         addSubscription(rs);
         return rs;
     }
-    
+
 /*
  *-------------------------------------------------------------------
  */
-    
+
     private void addSubscription(Subscription s){
         try{
             c++;
             Query query = XPQuery.parseQuery((String)s.getFilter().getExpression(),c);
             LOG.info("addSubscription "+s.getID()+" query :"+query);
             yfilter.addQuery(query);
-            
+
             add(s.getResourceKey(),s);
             queriesBack.put(s.getID(),query);
             queries[c]=(String)s.getID();
@@ -137,12 +133,12 @@
      */
     public void remove( ResourceKey key ) throws ResourceException {
         LOG.info("removeSubscription : "+key.getValue());
-        Query q=(Query)queriesBack.get(key.getValue());        
+        Query q=(Query)queriesBack.get(key.getValue());
         yfilter.deleteQuery(q,q.getQueryId());
         //TODO remove from Hashmap
         super.remove(key);
     }
-    
+
     public void notify(Object message) {
         //first check dialect
         try{
@@ -151,12 +147,12 @@
             LOG.info("Notify: ");
             LOG.info("--"+xml+"--");
             //copy
-            
+
             //first parse and drive YFilter,
             XMLTree tree = new XMLTree(new java.io.StringReader(xml));
             yfilter.setEventSequence(tree.getEvents());
             yfilter.startParsing();
-            
+
             // print the matched queries //
             if (SystemGlobals.hasQueries) {
                 yfilter.printQueryResults(System.out);
@@ -175,29 +171,17 @@
                 s.getNotificationConsumer().notify(s,env.getBody());
             }
             yfilter.clear();
-            
+
         }catch(Exception e){
             e.printStackTrace();
         }
     }
-    public EndpointReference getEPR( ResourceKey resourceKey) {
-        //TODO !!!!! woher kommt publisher epr url ???
-        //TODO HACK for tcpmon 12345-8080
-        String subscriptionAddress = "http://localhost:12345/axis/services/SubscriptionManager";
-        
-        EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance();
-        EndpointReferenceType epr = eprDoc.addNewEndpointReference();
-        AttributedURI address = epr.addNewAddress();
-        address.setStringValue( subscriptionAddress );
-        // TODO: set portType and serviceName! (read from config file)
-        ReferencePropertiesType refProps = epr.addNewReferenceProperties();
-        
-        XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps, resourceKey.getName() );
-        XmlCursor xmlCursor = xmlObject.newCursor();
-        xmlCursor.setTextValue(resourceKey.getValue().toString());
-        xmlCursor.dispose();
-        return new XmlBeansEndpointReference(epr);
+
+    public QName getServiceName()
+    {
+        return null; // TODO
     }
+
     public QName getServiceName()
     {
         return SERVICE_NAME;
@@ -217,4 +201,5 @@
     {
         return RESOURCE_KEY_NAME;
     }
+
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java Thu May 12 16:20:44 2005
@@ -14,27 +14,19 @@
  * limitations under the License.
  */
 package org.apache.ws.eventing.pubsub;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument.Unsubscribe;
-//import org.xmlsoap.schemas.ws.x2004.x08.addressing.*;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
-import java.util.Calendar;
-import org.apache.xmlbeans.XmlCursor;
-
-import org.apache.ws.addressing.XmlBeansEndpointReference;
 import org.apache.ws.addressing.EndpointReference;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.soap.MessageFactory;
-
 import org.apache.ws.eventing.AbstractSubscription;
-
+import org.apache.ws.pubsub.wsaSOAPConnection;
 import org.apache.ws.util.uuid.UuidGenerator;
 import org.apache.ws.util.uuid.UuidGeneratorFactory;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
 
-import org.apache.ws.pubsub.wsaSOAPConnection;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
 
 /** 
  *
@@ -53,7 +45,7 @@
     
     public void unsubscribe(){
         UnsubscribeDocument usdom= UnsubscribeDocument.Factory.newInstance();
-        UnsubscribeDocument.Unsubscribe us = usdom.addNewUnsubscribe();
+        usdom.addNewUnsubscribe();
         try{
             //now call 
             wsaSOAPConnection sconn = wsaSOAPConnection.newInstance();
@@ -109,5 +101,10 @@
     
     public void setSubscriptionManager(EndpointReference epr){
         super.setEpr(epr);
+    }
+
+    public EndpointReference getEndpointReference()
+    {
+        return null; // TODO
     }
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/Subscription.java Thu May 12 16:20:44 2005
@@ -16,7 +16,7 @@
 package org.apache.ws.notification.base;
 
 import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.notification.topics.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.pubsub.NotificationConsumer;
 import org.apache.ws.pubsub.NotificationProducer;
 import org.apache.ws.resource.PropertiesResource;
@@ -85,10 +85,10 @@
      *
      * @return the producer resource
      */
-    NotificationProducerResource getProducerResource() throws Exception;
+    NotificationProducerResource getProducerResource();
 
     //TODO: remove this method once getEPR() method is added to Resource interface
-    void setEpr(EndpointReference epr);
+    void setEndpointReference(EndpointReference epr);
 
     // TODO: figure out if we need this...
     void setNotificationConsumer(NotificationConsumer notificationConsumer);
@@ -102,5 +102,13 @@
      * @return the consumer EPR associated with this subscription
      */
     EndpointReference getConsumerReference();
-   
+
+    void setPolicy( Object policy );
+
+    void setPrecondition( QueryExpression precondition );
+
+    void setSelector( QueryExpression selector );
+
+    void setUseNotify( boolean useNotify );    
+
 }

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/InvalidTopicExpressionFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/InvalidTopicExpressionFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/InvalidTopicExpressionFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/InvalidTopicExpressionFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,26 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN InvalidTopicExpressionFault (thrown by GetCurrentMessage operation).
+ */
+public class InvalidTopicExpressionFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public InvalidTopicExpressionFaultException(WsnNamespaceVersionHolder namespaceVersionHolder, String faultString)
+    {
+        super(namespaceVersionHolder, faultString);
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "InvalidTopicExpressionFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/NoCurrentMessageOnTopicFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/NoCurrentMessageOnTopicFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/NoCurrentMessageOnTopicFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/NoCurrentMessageOnTopicFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,26 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN NoCurrentMessageOnTopicFault (thrown by GetCurrentMessage operation).
+ */
+public class NoCurrentMessageOnTopicFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public NoCurrentMessageOnTopicFaultException(WsnNamespaceVersionHolder namespaceVersionHolder)
+    {
+        super(namespaceVersionHolder, "The specified Topic is supported but there is no notification message currently available on it.");
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "NoCurrentMessageOnTopicFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/PauseFailedFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/PauseFailedFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/PauseFailedFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/PauseFailedFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,29 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN PauseFailedFault (thrown by Pause operation).
+ */
+public class PauseFailedFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public PauseFailedFaultException(WsnNamespaceVersionHolder namespaceVersionHolder, String faultString)
+    {
+        super(namespaceVersionHolder, faultString);
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "PauseFailedFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    }
+
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/ResumeFailedFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/ResumeFailedFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/ResumeFailedFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/ResumeFailedFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,27 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN ResumeFailedFault (thrown by Resume operation).
+ */
+public class ResumeFailedFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public ResumeFailedFaultException(WsnNamespaceVersionHolder namespaceVersionHolder, String faultString)
+    {
+        super(namespaceVersionHolder, faultString);
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "ResumeFailedFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/SubscribeCreationFailedFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/SubscribeCreationFailedFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/SubscribeCreationFailedFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/SubscribeCreationFailedFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,26 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN SubscribeCreationFailedFault (thrown by Subscribe operation).
+ */
+public class SubscribeCreationFailedFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public SubscribeCreationFailedFaultException(WsnNamespaceVersionHolder namespaceVersionHolder)
+    {
+        super(namespaceVersionHolder, "Unable to create subscription due to internal server error.");
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "SubscribeCreationFailedFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicNotSupportedFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicNotSupportedFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicNotSupportedFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicNotSupportedFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,26 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN TopicNotSupportedFault (thrown by GetCurrentMessage operation).
+ */
+public class TopicNotSupportedFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public TopicNotSupportedFaultException(WsnNamespaceVersionHolder namespaceVersionHolder, String faultString)
+    {
+        super(namespaceVersionHolder, faultString);
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "TopicNotSupportedFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicPathDialectUnknownFaultException.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicPathDialectUnknownFaultException.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicPathDialectUnknownFaultException.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/faults/TopicPathDialectUnknownFaultException.java Thu May 12 16:20:44 2005
@@ -0,0 +1,26 @@
+package org.apache.ws.notification.base.faults;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.resource.faults.AbstractBaseFaultException;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseN TopicPathDialectUnknownFault (thrown by Subscribe operation).
+ */
+public class TopicPathDialectUnknownFaultException extends AbstractBaseFaultException
+{
+    private QName m_name;
+
+    public TopicPathDialectUnknownFaultException(WsnNamespaceVersionHolder namespaceVersionHolder, String faultString)
+    {
+        super(namespaceVersionHolder, faultString);
+        m_name = new QName( namespaceVersionHolder.getBaseNotificationXsdNamespace(), "TopicPathDialectUnknownFault", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+    }
+
+    public QName getBaseFaultName()
+    {
+        return m_name;
+    }
+}

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java Thu May 12 16:20:44 2005
@@ -19,12 +19,12 @@
 import org.apache.ws.notification.base.NotificationProducerResource;
 import org.apache.ws.notification.base.Subscription;
 import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.TopicExpression;
 import org.apache.ws.notification.topics.TopicListener;
 import org.apache.ws.notification.topics.TopicListenerList;
 import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener;
-import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.impl.SubscriptionTopicListener;
 import org.apache.ws.pubsub.Filter;
 import org.apache.ws.pubsub.NotificationConsumer;
 import org.apache.ws.pubsub.NotificationProducer;
@@ -67,7 +67,7 @@
     protected String m_producerHomeLocation;
     protected TopicExpression m_topicExpression;
     protected boolean m_isPaused;
-    protected boolean m_useNotify;
+    protected boolean m_useNotify = true;
     protected Calendar m_terminationTime;
     protected Calendar m_creationTime;
     protected String m_id = null;
@@ -86,6 +86,30 @@
      */
     private List m_terminationListeners = new ArrayList();
 
+    /**
+     * Construct a new subscription resource.
+     *
+     * @param consumerReference      The WS-Addressing endpoint reference of the consumer
+     * @param producerReference      The WS-Addressing endpoint reference of the producer
+     * @param producerKey            The key of the producer resource
+     * @param producerHomeLocation   The JNDI location of the home of the producer resource
+     * @param topicExpression        The topic expression for this subscription
+     */
+    public AbstractSubscription( EndpointReference consumerReference,
+                                 EndpointReference producerReference,
+                                 ResourceKey producerKey,
+                                 String producerHomeLocation,
+                                 TopicExpression topicExpression )
+    {
+        m_id = UUID_GEN.generateUuid();
+        m_consumerReference = consumerReference;
+        m_producerReference = producerReference;
+        m_producerKey = producerKey;
+        m_producerHomeLocation = producerHomeLocation;
+        m_topicExpression = topicExpression;
+        m_creationTime = Calendar.getInstance();
+    }
+
     public ResourcePropertySet getResourcePropertySet()
     {
         return m_propSet;
@@ -116,7 +140,7 @@
         return m_consumerReference;
     }
 
-    public Object getSubscriptionPolicy()
+    public Object getPolicy()
     {
         return m_policy;
     }
@@ -131,10 +155,17 @@
         return m_producerReference;
     }
 
-    public NotificationProducerResource getProducerResource() throws Exception
+    public NotificationProducerResource getProducerResource()
     {
-        ResourceHome producerHome = (ResourceHome) new InitialContext().lookup( m_producerHomeLocation );
-        return (NotificationProducerResource) producerHome.find( m_producerKey );
+        try
+        {
+            ResourceHome producerHome = (ResourceHome) new InitialContext().lookup( m_producerHomeLocation );
+            return (NotificationProducerResource) producerHome.find( m_producerKey );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( "Failed to lookup NotificationProducer resource due to internal error: " + e, e );
+        }
     }
 
     public QueryExpression getSelector()
@@ -172,45 +203,6 @@
 
     }
 
-    /**
-     * Construct a new subscription resource.
-     *
-     * @param consumerReference      The WS-Addressing endpoint reference of the consumer
-     * @param producerReference      The WS-Addressing endpoint reference of the producer
-     * @param initialTerminationTime The initial termination time of this resource
-     * @param policy                 The subscription policy
-     * @param precondition           The precondition
-     * @param selector               The selector
-     * @param producerKey            The key of the producer resource
-     * @param producerHomeLocation   The JNDI location of the home of the producer resource
-     * @param topicExpression        The topic expression for this subscription
-     * @param useNotify              Whether to use raw notifications or not.
-     */
-    public AbstractSubscription( EndpointReference consumerReference,
-                                 EndpointReference producerReference,
-                                 Calendar initialTerminationTime,
-                                 Object policy,
-                                 QueryExpression precondition,
-                                 QueryExpression selector,
-                                 ResourceKey producerKey,
-                                 String producerHomeLocation,
-                                 TopicExpression topicExpression,
-                                 boolean useNotify )
-    {
-        m_id = UUID_GEN.generateUuid();
-        m_terminationTime = initialTerminationTime;
-        m_consumerReference = consumerReference;
-        m_producerReference = producerReference;
-        m_policy = policy;
-        m_precondition = precondition;
-        m_selector = selector;
-        m_producerKey = producerKey;
-        m_producerHomeLocation = producerHomeLocation;
-        m_topicExpression = topicExpression;
-        m_useNotify = useNotify;
-        m_creationTime = Calendar.getInstance();
-    }
-
     public Object getID()
     {
         return m_id;
@@ -309,10 +301,10 @@
                 while ( topicListenerIterator.hasNext() )
                 {
                     TopicListener listener = (TopicListener) topicListenerIterator.next();
-                    if ( listener instanceof SimpleSubscriptionTopicListener )
+                    if ( listener instanceof SubscriptionTopicListener )
                     {
-                        SimpleSubscriptionTopicListener lt =
-                                (SimpleSubscriptionTopicListener) listener;
+                        SubscriptionTopicListener lt =
+                                (SubscriptionTopicListener) listener;
                         Object subKey =
                                 lt.getSubscription().getID();
                         if ( subKey.equals( m_id ) )
@@ -360,7 +352,7 @@
         return m_epr;
     }
 
-    public void setEpr( EndpointReference epr )
+    public void setEndpointReference( EndpointReference epr )
     {
         m_epr = epr;
     }
@@ -378,5 +370,25 @@
     public void addTerminationListener( ResourceTerminationListener resourceTerminationListener )
     {
         m_terminationListeners.add( resourceTerminationListener );
+    }
+
+    public void setPolicy( Object policy )
+    {
+        m_policy = policy;
+    }
+
+    public void setPrecondition( QueryExpression precondition )
+    {
+        m_precondition = precondition;
+    }
+
+    public void setSelector( QueryExpression selector )
+    {
+        m_selector = selector;
+    }
+
+    public void setUseNotify( boolean useNotify )
+    {
+        m_useNotify = useNotify;
     }
 }

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=169908&r1=169907&r2=169908&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 Thu May 12 16:20:44 2005
@@ -19,7 +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.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.resource.i18n.Keys;
 import org.apache.ws.resource.i18n.MessagesImpl;
 import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/pubsub/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/pubsub/Subscription.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/pubsub/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/pubsub/Subscription.java Thu May 12 16:20:44 2005
@@ -48,7 +48,7 @@
 
     public void setSubscriptionManager(SubscribeResponseDocument.SubscribeResponse sresdom) {
         sMan = sresdom.getSubscriptionReference();
-        super.setEpr(new XmlBeansEndpointReference(sMan));
+        super.setEndpointReference(new XmlBeansEndpointReference(sMan));
     }
  
     public void init() {

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java Thu May 12 16:20:44 2005
@@ -15,16 +15,15 @@
  *=============================================================================*/
 package org.apache.ws.notification.tool;
 
+import org.apache.velocity.VelocityContext;
+import org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
 import org.apache.ws.notification.tool.v2004_06.NotificationConsumerPortType2JavaInfo;
 import org.apache.ws.notification.tool.v2004_06.NotificationProducerPortType2JavaInfo;
 import org.apache.ws.notification.tool.v2004_06.SubscriptionManagerPortType2JavaInfo;
-import org.apache.ws.notification.base.v2004_6.impl.WsnNamespaceVersionHolderImpl;
-import org.apache.ws.notification.base.v2004_6.porttype.NotificationProducerPortType;
+import org.apache.ws.resource.ResourceDefinition;
 import org.apache.ws.resource.tool.Wsdl2Java;
 import org.apache.ws.resource.tool.velocity.ServiceProperties;
-import org.apache.ws.resource.ResourceDefinition;
-import org.apache.ws.pubsub.NotificationProducer;
-import org.apache.velocity.VelocityContext;
 
 import java.io.File;
 
@@ -73,7 +72,7 @@
 
     protected VelocityContext updateVelociyContext(VelocityContext velocityContext, ResourceDefinition resourceDef)
     {
-        super.updateVelociyContext(velocityContext,resourceDef);
+        super.updateVelocityContext(velocityContext,resourceDef);
 
         if(hasPropChange(resourceDef))
         {
@@ -95,7 +94,7 @@
 
     private boolean hasNotificationProducer(ResourceDefinition resourceDef)
     {
-        return resourceDef.implementsResourceCapability(org.apache.ws.notification.base.v2004_6.porttype.NotificationProducerPortType.NAME);
+        return resourceDef.implementsResourceCapability(org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.NAME);
     }
 
     private boolean hasResourceTermination(ResourceDefinition resourceDef)

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java Thu May 12 16:20:44 2005
@@ -15,7 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.notification.tool.v2004_06;
 
-import org.apache.ws.notification.base.v2004_6.porttype.NotificationConsumerPortType;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationConsumerPortType;
 import org.apache.ws.resource.tool.PortType2JavaInfo;
 
 import javax.xml.namespace.QName;
@@ -36,11 +36,6 @@
     public String getServiceInterfaceName()
     {
         return NotificationConsumerPortType.class.getName();
-    }
-
-    public String getServiceTemplateFileName()
-    {
-        return "templates/1_2_draft01/NotificationConsumerPortType.txt";
     }
 
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java Thu May 12 16:20:44 2005
@@ -15,7 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.notification.tool.v2004_06;
 
-import org.apache.ws.notification.base.v2004_6.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
 import org.apache.ws.notification.base.NotificationProducerResource;
 import org.apache.ws.resource.tool.PortType2JavaInfo;
 
@@ -46,7 +46,7 @@
 
     public String getServiceTemplateFileName()
     {
-        return "templates/1_2_draft01/NotificationProducerPortType.txt";
+        return "templates/v2004_06/NotificationProducerPortType.txt";
     }
 
     public String getResourceTemplateFileName()

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java Thu May 12 16:20:44 2005
@@ -15,7 +15,7 @@
  *=============================================================================*/
 package org.apache.ws.notification.tool.v2004_06;
 
-import org.apache.ws.notification.base.v2004_6.porttype.SubscriptionManagerPortType;
+import org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
 import org.apache.ws.resource.tool.PortType2JavaInfo;
 
 import javax.xml.namespace.QName;
@@ -40,7 +40,7 @@
 
     public String getServiceTemplateFileName()
     {
-        return "templates/1_2_draft01/SubscriptionManagerPortType.txt";
+        return "templates/v2004_06/SubscriptionManagerPortType.txt";
     }
 
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/Topic.java Thu May 12 16:20:44 2005
@@ -15,6 +15,8 @@
  *=============================================================================*/
 package org.apache.ws.notification.topics;
 
+import org.apache.ws.notification.topics.expression.TopicExpression;
+
 import java.util.List;
 
 /**

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java Thu May 12 16:20:44 2005
@@ -15,7 +15,9 @@
  *=============================================================================*/
 package org.apache.ws.notification.topics;
 
-import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 
 /**
  * The set of topics that a particular NotificationProducer supports.

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ResourceTerminationTopicImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ResourceTerminationTopicImpl.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ResourceTerminationTopicImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/ResourceTerminationTopicImpl.java Thu May 12 16:20:44 2005
@@ -5,7 +5,6 @@
 import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
 import org.apache.ws.resource.properties.NamespaceVersionHolder;
 
-
 /**
  * @author Sal Campana
  */
@@ -14,25 +13,23 @@
     private static final String TOPIC_NAME = "ResourceTermination";
 
     /**
-     * This provides the version of the topic we are dealing with for use when
-     * creating the notification.
+     * This provides the version of the topic we are dealing with for use when creating the notification.
      */
     private NamespaceVersionHolder m_namespaceSet;
 
     /**
-     * Create a topic with the given name
-     *
+     * Create a resource termination topic for the given WSRF namespace set.
      */
-    public ResourceTerminationTopicImpl(NamespaceVersionHolder namespaceSet)
+    public ResourceTerminationTopicImpl( NamespaceVersionHolder namespaceSet )
     {
-        super(TOPIC_NAME);
+        super( TOPIC_NAME );
         m_namespaceSet = namespaceSet;
     }
 
-    public void terminationOccurred(ResourceTerminationEvent event)
+    public void terminationOccurred( ResourceTerminationEvent event )
     {
-         Object msg = ((ResourceTerminationEventImpl)event).getTerminationNotifDocXmlBean(m_namespaceSet);
-         try
+        Object msg = ( (ResourceTerminationEventImpl) event ).getTerminationNotifDocXmlBean( m_namespaceSet );
+        try
         {
             publish( msg );
         }

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SubscriptionTopicListener.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SubscriptionTopicListener.java?rev=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SubscriptionTopicListener.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SubscriptionTopicListener.java Thu May 12 16:20:44 2005
@@ -0,0 +1,327 @@
+/*=============================================================================*
+ *  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.impl;
+
+import EDU.oswego.cs.dl.util.concurrent.PooledExecutor;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.v2003_03.AddressingConstants;
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicListener;
+import org.apache.ws.pubsub.emitter.EmitterTask;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.query.InvalidQueryExpressionException;
+import org.apache.ws.resource.properties.query.QueryEngine;
+import org.apache.ws.resource.properties.query.QueryEvaluationErrorException;
+import org.apache.ws.resource.properties.query.QueryExpression;
+import org.apache.ws.resource.properties.query.UnknownQueryExpressionDialectException;
+import org.apache.ws.resource.properties.query.impl.QueryEngineImpl;
+import org.apache.ws.util.JaxpUtils;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.thread.NamedThread;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlOptions;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.w3c.dom.Document;
+import org.xml.sax.SAXException;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;
+
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPHeaderElement;
+import javax.xml.soap.SOAPMessage;
+import java.io.IOException;
+import java.io.Serializable;
+import java.net.URL;
+
+/**
+ * Topic listener implementation that is associated with a particular {@link Subscription}. Upon a message being
+ * published to the topic being listened to, a notification will be emitted to the consumer associated with the
+ * subscription.
+ */
+public class SubscriptionTopicListener
+        implements TopicListener,
+        Serializable
+{
+    private static Log LOG = LogFactory.getLog( SubscriptionTopicListener.class.getName() );
+
+    // the thread pool used to emit notifications
+    private static final PooledExecutor EMITTER_POOL;
+
+    static
+    {
+        EMITTER_POOL = new PooledExecutor( 100 );
+
+        // make sure the threads are non-daemon threads so they have time to complete even if the JVM wants to shut down
+        EMITTER_POOL.setThreadFactory( new NamedThread.ConcurrentThreadFactory( "notifmgr-emitter", false ) );
+    }
+
+    private static final QueryEngine QUERY_ENGINE = new QueryEngineImpl();
+
+    private Subscription m_subscription;
+
+    /**
+     * Construct a listener instance.
+     *
+     * @param subscription the subscription which is being wrapped in a listener
+     */
+    public SubscriptionTopicListener( Subscription subscription )
+    {
+        m_subscription = subscription;
+    }
+
+    /**
+     * @return Subscription
+     */
+    public Subscription getSubscription()
+    {
+        return m_subscription;
+    }
+
+    private void notify( Object rawMsg )
+            throws Exception
+    {
+        synchronized ( m_subscription )
+        {
+            if ( !m_subscription.isPaused() )
+            {
+                LOG.debug( "Notification being sent for subscription with id " + m_subscription.getID()
+                        + "; message value: " + rawMsg );
+                XmlObject msg = XmlBeanUtils.toXmlObject( rawMsg );
+                if ( evaluateSelector( m_subscription.getSelector(), msg ) &&
+                     evaluatePrecondition( m_subscription.getPrecondition(),
+                                m_subscription.getProducerResource().getResourcePropertySet() ) )
+                {
+                    if ( m_subscription.getUseNotify() )  // wrap message in Notify element
+                    {
+                        msg = wrapMessageWithNotify( msg );
+                    }
+                    Document document = toDomDocument( msg );
+                    EndpointReference consumerEPR = m_subscription.getConsumerReference();
+                    SOAPMessage soapMessage =
+                            buildSOAPMessage( document,
+                                    (EndpointReferenceType) ( (XmlObjectWrapper) consumerEPR ).getXmlObject() );
+                    EMITTER_POOL.execute( EmitterTask.createEmitterTask( soapMessage,
+                            new URL( consumerEPR.getAddress().toString() ) ) );
+                }
+            }
+        }
+    }
+
+    private XmlObject wrapMessageWithNotify( XmlObject msg )
+    {
+        NotifyDocument notifyDoc = NotifyDocument.Factory.newInstance();
+        NotifyDocument.Notify notify = notifyDoc.addNewNotify();
+        NotificationMessageHolderType notifMsgHolder = notify.addNewNotificationMessage();
+        notifMsgHolder.setMessage( msg );
+        notifMsgHolder.setProducerReference( (EndpointReferenceType) ( (XmlObjectWrapper) m_subscription.getProducerResource().getEndpointReference() ).getXmlObject() );
+        TopicExpressionType topicExpr = (TopicExpressionType) ( (XmlObjectWrapper) m_subscription.getTopicExpression() ).getXmlObject();
+        notifMsgHolder.setTopic( topicExpr );
+        msg = notifyDoc;
+        return msg;
+    }
+
+    private boolean evaluateSelector( QueryExpression selector, XmlObject msg )
+            throws UnknownQueryExpressionDialectException, QueryEvaluationErrorException,
+            InvalidQueryExpressionException
+    {
+        boolean result;
+        if ( selector == null )
+        {
+            result = true;
+        }
+        else
+        {
+            Object queryResult = QUERY_ENGINE.executeQuery( selector, msg );
+            try
+            {
+                result = ( (Boolean) queryResult ).booleanValue();
+            }
+            catch ( RuntimeException re )
+            {
+                result = false;
+                LOG.error(
+                        "Notification selector '" + selector + "' did not evaluate to a Boolean at notification time." );
+            }
+            LOG.debug(
+                    "Notification selector '" + selector + "' evaluated to " + result + " for subscription with id " +
+                    m_subscription.getID() +
+                    "." );
+        }
+        return result;
+    }
+
+    private boolean evaluatePrecondition( QueryExpression precondition, ResourcePropertySet propSet )
+            throws Exception
+    {
+        boolean result;
+        if ( precondition == null )
+        {
+            result = true;
+        }
+        else
+        {
+            Object queryResult = QUERY_ENGINE.executeQuery( precondition, propSet );
+            try
+            {
+                result = ( (Boolean) queryResult ).booleanValue();
+                LOG.debug(
+                        "Notification precondition '" + precondition + "' evaluated to " + result +
+                        " for subscription with id " +
+                        m_subscription.getID() +
+                        "." );
+            }
+            catch ( RuntimeException re )
+            {
+                result = false;
+                LOG.error(
+                        "Notification precondition '" + precondition +
+                        "' did not evaluate to a Boolean at notification time." );
+            }
+        }
+        return result;
+    }
+
+    private Document toDomDocument( XmlObject notifyDoc )
+            throws ParserConfigurationException, SAXException, IOException
+    {
+        Document document = null;
+        if ( XmlBeanUtils.isDocument( notifyDoc ) )
+        {
+            document = (Document) notifyDoc.newDomNode();
+        }
+        else
+        {
+            String s = notifyDoc.xmlText( new XmlOptions().setSaveOuter() );
+            document = JaxpUtils.toDocument( s );
+        }
+        return document;
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param topic DOCUMENT_ME
+     */
+    public void topicChanged( Topic topic )
+    {
+        if ( m_subscription != null )
+        {
+            try
+            {
+                notify( topic.getCurrentMessage() );
+            }
+            catch ( Exception e )
+            {
+                LOG.debug( "Notification for topic " + topic + " failed for subscription: " + m_subscription, e );
+            }
+        }
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param topic DOCUMENT_ME
+     */
+    public void topicAdded( Topic topic )
+    {
+        //todo
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param topic DOCUMENT_ME
+     */
+    public void topicRemoved( Topic topic )
+    {
+        //todo
+    }
+
+    /*
+     * Add WS-Addressing headers to a notification.
+     *
+     * @param header - The header to which to add the WS-Addressing headers.
+     * @param consumerEPR - An endpointReferece to the consumer of this notification.
+     * @throws Exception
+     */
+    private void addWSAHeaders( SOAPHeader header,
+                                EndpointReferenceType consumerEPR )
+            throws Exception
+    {
+        SOAPFactory factory = SOAPFactory.newInstance();
+        // TODO: this should not be hard-coded to use WSA 2003/03
+        SOAPHeaderElement headerElem =
+                header.addHeaderElement( factory.createName( org.apache.ws.addressing.v2003_03.AddressingConstants.TO,
+                        org.apache.ws.addressing.v2003_03.AddressingConstants.NSPREFIX_ADDRESSING_SCHEMA,
+                        org.apache.ws.addressing.v2003_03.AddressingConstants.NSURI_ADDRESSING_SCHEMA ) );
+
+        headerElem.addTextNode( consumerEPR.getAddress().getStringValue() );
+        headerElem = header.addHeaderElement( factory.createName( AddressingConstants.ACTION,
+                AddressingConstants.NSPREFIX_ADDRESSING_SCHEMA,
+                AddressingConstants.NSURI_ADDRESSING_SCHEMA ) );
+
+        headerElem.addTextNode( BaseNotificationConstants.NOTIFY_ACTION_URL );
+        addReferencePropertyHeaders( header, consumerEPR );
+    }
+
+    private void addReferencePropertyHeaders( SOAPHeader header, EndpointReferenceType consumerEPR )
+            throws Exception
+    {
+        SOAPHeaderElement headerElem;
+        ReferencePropertiesType props = consumerEPR.getReferenceProperties();
+        if ( props != null )
+        {
+            XmlCursor cursor = props.newCursor();
+            boolean hasAnotherChild = cursor.toFirstChild();
+            while ( hasAnotherChild )
+            {
+                // TODO: the below logic should handle refProps that are complexTypes
+                SOAPElement soapElem = XmlBeanUtils.toSOAPElement( cursor.getObject() );
+                headerElem = header.addHeaderElement( soapElem.getElementName() );
+                headerElem.addTextNode( soapElem.getValue() );
+                hasAnotherChild = cursor.toNextSibling();
+            }
+            cursor.dispose();
+        }
+    }
+
+    private SOAPMessage buildSOAPMessage( Document fullMsgBodyElem,
+                                          EndpointReferenceType consumerEPR )
+            throws Exception
+    {
+        SOAPMessage msg = MessageFactory.newInstance().createMessage();
+        SOAPEnvelope envelope = msg.getSOAPPart().getEnvelope();
+        SOAPBody body = envelope.getBody();
+        body.addDocument( fullMsgBodyElem );
+        SOAPHeader header = msg.getSOAPHeader();
+        addWSAHeaders( header, consumerEPR );
+        return msg;
+    }
+}

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicImpl.java Thu May 12 16:20:44 2005
@@ -19,8 +19,9 @@
 import org.apache.commons.logging.LogFactory;
 import org.apache.ws.notification.topics.Topic;
 import org.apache.ws.notification.topics.TopicSpace;
-import org.apache.ws.notification.topics.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 import org.apache.ws.notification.topics.TopicListener;
+import org.apache.ws.notification.topics.expression.TopicExpression;
 
 import java.util.Collection;
 import java.util.HashMap;

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/TopicSpaceSetImpl.java Thu May 12 16:20:44 2005
@@ -1,11 +1,15 @@
 package org.apache.ws.notification.topics.impl;
 
 import org.apache.ws.notification.topics.Topic;
-import org.apache.ws.notification.topics.TopicExpression;
-import org.apache.ws.notification.topics.TopicExpressionEngine;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEngine;
 import org.apache.ws.notification.topics.TopicSpace;
 import org.apache.ws.notification.topics.TopicSpaceSet;
-import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionEngine;
+import org.apache.ws.notification.topics.expression.impl.TopicExpressionEngineImpl;
 
 import java.util.Hashtable;
 import java.util.Iterator;

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java Thu May 12 16:20:44 2005
@@ -15,14 +15,14 @@
  *=============================================================================*/
 package org.apache.ws.notification.topics.util;
 
-import org.apache.ws.notification.base.v2004_6.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
 import org.apache.ws.notification.topics.ResourcePropertyValueChangeTopic;
 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.impl.ResourcePropertyValueChangeTopicImpl;
 import org.apache.ws.notification.topics.impl.ResourceTerminationTopicImpl;
-import org.apache.ws.notification.topics.impl.TopicExpressionEngineImpl;
+import org.apache.ws.notification.topics.expression.impl.TopicExpressionEngineImpl;
 import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
 import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
 import org.apache.ws.resource.Resource;

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/v2004_06/TopicsConstants.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/v2004_06/TopicsConstants.java?rev=169908&r1=169907&r2=169908&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/v2004_06/TopicsConstants.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/v2004_06/TopicsConstants.java Thu May 12 16:20:44 2005
@@ -16,18 +16,18 @@
 package org.apache.ws.notification.topics.v2004_06;
 
 /**
- * Constants defined by the WS-Topics 1.2 specification.
+ * Constants defined by the WS-Topics 1.2 Draft 01 specification.
  */
 public interface TopicsConstants
 {
 
     /**
-     * Namespace URI of the WS-Topics 1.2 schema.
+     * Namespace URI of the WS-Topics 1.2 Draft 01 schema.
      */
     String NSURI_WSTOP_SCHEMA = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-Topics-1.2-draft-01.xsd";
 
     /**
-     * Namespace prefix of the WS-Topics 1.2 schema.
+     * Namespace prefix for the WS-Topics 1.2 Draft 01 schema.
      */
     String NSPREFIX_WSTOP_SCHEMA = "wstop";
 

Added: 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=169908&view=auto
==============================================================================
--- incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java (added)
+++ incubator/hermes/trunk/src/test/org/apache/ws/notification/topics/SubscriptionTopicListenerTestCase.java Thu May 12 16:20:44 2005
@@ -0,0 +1,70 @@
+package org.apache.ws.notification.topics;
+
+import junit.framework.TestCase;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
+import org.apache.ws.notification.base.v2004_06.impl.SubscriptionResource;
+import org.apache.ws.notification.topics.impl.ResourcePropertyValueChangeTopicImpl;
+import org.apache.ws.notification.topics.impl.SubscriptionTopicListener;
+import org.apache.ws.resource.properties.impl.AnyResourcePropertyMetaData;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.xmlbeans.XmlException;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
+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;
+
+
+/**
+ * @author Sal Campana
+ */
+public class SubscriptionTopicListenerTestCase extends TestCase
+{
+
+    public void testBuildingNotificationMessages() throws SchemaViolationException
+    {
+        EndpointReferenceType epr1 = EndpointReferenceType.Factory.newInstance();
+        AttributedURI uri = AttributedURI.Factory.newInstance();
+        uri.setStringValue("http://consumer");
+        epr1.setAddress(uri);
+        EndpointReference epr = new XmlBeansEndpointReference(epr1);
+        TopicExpressionDocument topicExprType = null;
+        try
+        {
+            topicExprType = (TopicExpressionDocument) XmlObject.Factory.parse("<wsnt:TopicExpression xmlns:wsnt=\"http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd\" Dialect=\"http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Simple\">fs:MountPointDirectory</wsnt:TopicExpression>");
+        }
+        catch (XmlException e)
+        {
+            e.printStackTrace();
+        }
+        //topicExprType.setDialect("http://foobar");
+
+        XmlBeansTopicExpression topicExpr = new XmlBeansTopicExpression(topicExprType.getTopicExpression());
+        SubscriptionResource sub = new SubscriptionResource(epr,epr,null,"my/producer/home",topicExpr);
+        sub.setNotificationProducer(new NotifProducer());
+
+       /* EndpointReference consumerReference, EndpointReference producerReference,
+                                    Calendar initialTerminationTime, Object policy, QueryExpression precondition,
+                                    QueryExpression selector, ResourceKey producerKey, String producerHomeLocation,
+                                    TopicExpression topicExpression, boolean useNotify )
+    {*/
+        SubscriptionTopicListener lis = new SubscriptionTopicListener(sub);
+        AnyResourcePropertyMetaData anyMeta = new AnyResourcePropertyMetaData(new QName("foo"));
+
+        //need some sort of documenttype
+        NotifyDocument doc = NotifyDocument.Factory.newInstance();
+        XmlBeansResourcePropertySet set = new XmlBeansResourcePropertySet(doc);
+        XmlBeansResourceProperty prop = new XmlBeansResourceProperty(anyMeta,set);
+        ResourcePropertyValueChangeTopicImpl topic = new ResourcePropertyValueChangeTopicImpl(prop);
+        TopicListenerTestObj testListenr = new TopicListenerTestObj();
+        topic.addTopicListener(testListenr);
+        lis.topicChanged(topic);
+    }
+
+}

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=169908&r1=169907&r2=169908&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 Thu May 12 16:20:44 2005
@@ -20,8 +20,10 @@
 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.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;
+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;
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;

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=169908&r1=169907&r2=169908&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 Thu May 12 16:20:44 2005
@@ -20,8 +20,10 @@
 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.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;
+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.impl.FullTopicExpressionEvaluator;
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;

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=169908&r1=169907&r2=169908&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 Thu May 12 16:20:44 2005
@@ -20,8 +20,11 @@
 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.TopicExpressionEvaluator;
-import org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException;
+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;
 import org.apache.xmlbeans.XmlObject;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;



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