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/04 21:26:25 UTC

svn commit: r168172 - in /incubator/hermes/trunk/src/java/org/apache/ws/notification: base/ base/v2004_6/porttype/impl/ topics/ topics/impl/

Author: ips
Date: Wed May  4 12:26:25 2005
New Revision: 168172

URL: http://svn.apache.org/viewcvs?rev=168172&view=rev
Log:
misc minor

Removed:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/DialectDependentType.java
Modified:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/NotificationProducerResource.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSet.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpaceSet.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/TopicImpl.java

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/NotificationProducerResource.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/NotificationProducerResource.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/NotificationProducerResource.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/NotificationProducerResource.java Wed May  4 12:26:25 2005
@@ -21,8 +21,6 @@
 /**
  * A resource that implements the WS-BaseNotification NotificationProducer portType.
  * Provides access to the set of TopicSpaces supported by the resource.
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
  */
 public interface NotificationProducerResource extends Resource
 {

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java Wed May  4 12:26:25 2005
@@ -19,21 +19,16 @@
 import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
 
 /**
- * TODO
+ * TODO?
  *
  * @author Ian Springer (ian DOT springer AT hp DOT com)
  */
 public class NotificationConsumerPortTypeImpl implements NotificationConsumerPortType
 {
 
-    public void subscribe( NotifyDocument requestDoc )
-    {
-        // TODO
-        return;
-    }
-
     public void notify(NotifyDocument requestDoc)
     {
 
     }
+
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java Wed May  4 12:26:25 2005
@@ -133,11 +133,10 @@
             throw new SubscribeCreationFailedFaultException(new WsnNamespaceVersionHolderImpl(),"Subscribe failed, reason: " + e.getLocalizedMessage());
         }
 
-
-        SubscribeResponseDocument subscribeResponseDocument = SubscribeResponseDocument.Factory.newInstance();
-        SubscribeResponseDocument.SubscribeResponse subscribeResponse = subscribeResponseDocument.addNewSubscribeResponse();
+        SubscribeResponseDocument subscribeResponseDoc = SubscribeResponseDocument.Factory.newInstance();
+        SubscribeResponseDocument.SubscribeResponse subscribeResponse = subscribeResponseDoc.addNewSubscribeResponse();
         subscribeResponse.setSubscriptionReference( epr);
-        return subscribeResponseDocument;
+        return subscribeResponseDoc;
     }
 
     private Topic[] evaluateTopicExpression(TopicExpression topicExpr)

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java Wed May  4 12:26:25 2005
@@ -16,15 +16,11 @@
 package org.apache.ws.notification.topics;
 
 import org.apache.ws.resource.properties.ResourcePropertyValueChangeListener;
-import org.apache.ws.resource.properties.ResourceProperty;
 
 /**
- * TODO
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
+ * A topic that acts as a listener for resource property value change events.
  */
 public interface ResourcePropertyValueChangeTopic extends Topic, ResourcePropertyValueChangeListener
 {
 
-    
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSet.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSet.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSet.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSet.java Wed May  4 12:26:25 2005
@@ -18,9 +18,7 @@
 import java.util.Iterator;
 
 /**
- * TODO
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
+ * A set of {@link Topic}s.
  */
 public interface TopicSet
 {

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/TopicSpace.java Wed May  4 12:26:25 2005
@@ -16,7 +16,7 @@
 package org.apache.ws.notification.topics;
 
 /**
- * A topic space (i.e. a set of topics within a particular namespace).
+ * A topic space (i.e. a hierarchy of topics within a particular namespace).
  * Provides methods for managing the topics and performing queries on them.
  */
 public interface TopicSpace extends TopicSet, TopicListenerList

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=168172&r1=168171&r2=168172&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 Wed May  4 12:26:25 2005
@@ -19,8 +19,6 @@
 
 /**
  * The set of topics that a particular NotificationProducer supports.
- *
- * @author Ian Springer (ian DOT springer AT hp DOT com)
  */
 public interface TopicSpaceSet
 {

Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java?rev=168172&r1=168171&r2=168172&view=diff
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java Wed May  4 12:26:25 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.resource.properties.query.QueryExpression;
 import org.apache.ws.addressing.Addressing_03_2003_Constants;
 import org.apache.ws.addressing.EndpointReference;
 import org.apache.ws.notification.base.Subscription;
@@ -57,278 +58,283 @@
 import java.net.URL;
 
 /**
- * Topic listener implementation that will trigger notifications when a topic
- * changes. To be used in conjunction with the SimpleSubscription class.
- *
- * @see SimpleSubscription
+ * 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 SimpleSubscriptionTopicListener
-   implements TopicListener,
-              NotificationConsumer,
-              Serializable
+        implements TopicListener,
+        NotificationConsumer,
+        Serializable
 {
-   private static Log logger = LogFactory.getLog( SimpleSubscriptionTopicListener.class.getName(  ) );
+    private static Log LOG = LogFactory.getLog( SimpleSubscriptionTopicListener.class.getName() );
 
-   // the thread pool used to emit notifications
-   private static final PooledExecutor EMITTER_POOL;
+    // 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 Subscription m_subscription;
-   private EndpointReference m_epr;
-
-   /**
-    * Construct a listener instance.
-    *
-    * @param Subscription the subscription which is being wrapped in a listener
-    */
-   public SimpleSubscriptionTopicListener( Subscription subscription )
-   {
-      this.m_subscription = subscription;
-      subscription.setNotificationConsumer( this );
-      m_epr = subscription.getConsumerReference(  );
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @return DOCUMENT_ME
-    */
-   public EndpointReference getEPR(  )
-   {
-      return m_epr;
-   }
-
-   /**
-    * what's this for??
-    *
-    * @return
-    */
-   public int getMode(  )
-   {
-      return 0;
-   }
-
-   /**
-    * @return Subscription
-    */
-   public Subscription getSubscription(  )
-   {
-      return this.m_subscription;
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param subscription DOCUMENT_ME
-    * @param status DOCUMENT_ME
-    * @param reason DOCUMENT_ME
-    */
-   public void end( org.apache.ws.pubsub.Subscription subscription,
-                    URI                               status,
-                    String                            reason )
-   {
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param subscription DOCUMENT_ME
-    * @param message DOCUMENT_ME
-    */
-   public void notify( org.apache.ws.pubsub.Subscription subscription,
-                       Object                            message )
-   {
-      try
-      {
-         notify( (Subscription) subscription, message );
-      }
-      catch ( Exception e )
-      {
-         throw new RuntimeException( e );
-      }
-   }
-
-   /**
-    * Send a notification
-    *
-    * @param subscription The subscription for which to send the notification
-    * @param rawMsg     The new value of the topic
-    * @throws Exception
-    */
-   public void notify( Subscription subscription,
-                       Object       rawMsg )
-   throws Exception
-   {
-       XmlObject message = null;
-      synchronized ( subscription )
-      {
-         if ( !subscription.isPaused(  ) )
-         {
-            System.out.println( "Notification received for subscription with Id " + subscription.getID(  )
-                                + "; value: " + rawMsg );
-              EndpointReference             epr                           =
-               subscription.getNotificationConsumer(  ).getEPR(  );
-             if(subscription.getUseNotify())
-             {
-
-            NotifyDocument                notifyDoc                     = NotifyDocument.Factory.newInstance(  );
-            NotifyDocument.Notify         notify                        = notifyDoc.addNewNotify(  );
-            NotificationMessageHolderType notificationMessageHolderType = notify.addNewNotificationMessage(  );
-
-            //assumes xmlobject for rawMsg...this needs to change
-            notificationMessageHolderType.setMessage( (XmlObject) rawMsg );
-
-            //set the producer ref
-            notificationMessageHolderType.setProducerReference( (EndpointReferenceType) ( (XmlObjectWrapper) subscription.getNotificationProducer(  )
-                                                                                                                         .getEPR(  ) )
-                                                                .getXmlObject(  ) );
-
-            TopicExpression     topicExpressionIntf = subscription.getTopicExpression(  );
-            TopicExpressionType tp =
-               (TopicExpressionType) ( (XmlObjectWrapper) topicExpressionIntf ).getXmlObject(  );
-            notificationMessageHolderType.setTopic( tp );
-                 message = notifyDoc;
+    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 Subscription m_subscription;
+    private EndpointReference m_epr;
+
+    /**
+     * Construct a listener instance.
+     *
+     * @param subscription the subscription which is being wrapped in a listener
+     */
+    public SimpleSubscriptionTopicListener( Subscription subscription )
+    {
+        this.m_subscription = subscription;
+        subscription.setNotificationConsumer( this );
+        m_epr = subscription.getConsumerReference();
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @return DOCUMENT_ME
+     */
+    public EndpointReference getEPR()
+    {
+        return m_epr;
+    }
+
+    /**
+     * what's this for??
+     *
+     * @return
+     */
+    public int getMode()
+    {
+        return 0;
+    }
+
+    /**
+     * @return Subscription
+     */
+    public Subscription getSubscription()
+    {
+        return this.m_subscription;
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param subscription DOCUMENT_ME
+     * @param status       DOCUMENT_ME
+     * @param reason       DOCUMENT_ME
+     */
+    public void end( org.apache.ws.pubsub.Subscription subscription,
+                     URI status,
+                     String reason )
+    {
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param subscription DOCUMENT_ME
+     * @param message      DOCUMENT_ME
+     */
+    public void notify( org.apache.ws.pubsub.Subscription subscription,
+                        Object message )
+    {
+        try
+        {
+            notify( (Subscription) subscription, message );
+        }
+        catch ( Exception e )
+        {
+            throw new RuntimeException( e );
+        }
+    }
+
+    /**
+     * Send a notification
+     *
+     * @param subscription The subscription for which to send the notification
+     * @param rawMsg       The new value of the topic
+     *
+     * @throws Exception
+     */
+    public void notify( Subscription subscription,
+                        Object rawMsg )
+            throws Exception
+    {
+        XmlObject message = null;
+        synchronized ( subscription )
+        {
+            if ( !subscription.isPaused() )
+            {
+                LOG.debug( "Notification being sent for subscription with Id " + subscription.getID()
+                        + "; message value: " + rawMsg );
+                if ( subscription.getSelector() != null )
+                {
+                    QueryExpression selector = subscription.getSelector();
+                    
+                }
+                EndpointReference epr =
+                        subscription.getNotificationConsumer().getEPR();
+                if ( subscription.getUseNotify() )
+                {
+                    NotifyDocument notifyDoc = NotifyDocument.Factory.newInstance();
+                    NotifyDocument.Notify notify = notifyDoc.addNewNotify();
+                    NotificationMessageHolderType notificationMessageHolderType = notify.addNewNotificationMessage();
+
+                    //assumes xmlobject for rawMsg...this needs to change
+                    notificationMessageHolderType.setMessage( (XmlObject) rawMsg );
+
+                    //set the producer ref
+                    notificationMessageHolderType.setProducerReference( (EndpointReferenceType) ( (XmlObjectWrapper) subscription.getNotificationProducer()
+                            .getEPR() )
+                            .getXmlObject() );
+
+                    TopicExpression topicExpressionIntf = subscription.getTopicExpression();
+                    TopicExpressionType tp =
+                            (TopicExpressionType) ( (XmlObjectWrapper) topicExpressionIntf ).getXmlObject();
+                    notificationMessageHolderType.setTopic( tp );
+                    message = notifyDoc;
+                }
+                else
+                {
+                    message = XmlBeanUtils.toXmlObject( rawMsg );
+                }
+                Document document = toDocument( message );
+
+                SOAPMessage soapMessage =
+                        buildSOAPMessage( document,
+                                (EndpointReferenceType) ( (XmlObjectWrapper) epr ).getXmlObject() );
+
+                EMITTER_POOL.execute( EmitterTask.createEmitterTask( soapMessage,
+                        new URL( epr.getAddress().toString() ) ) );
             }
-            else
-             {
-                 message = XmlBeanUtils.toXmlObject(rawMsg);
-             }
-            Document document = toDocument(message);
-
-             SOAPMessage soapMessage =
-                  buildSOAPMessage( document, (EndpointReferenceType) ( (XmlObjectWrapper) epr ).getXmlObject(  ) );
-
-               EMITTER_POOL.execute( EmitterTask.createEmitterTask( soapMessage,
-                                                                    new URL( epr.getAddress(  ).toString(  ) ) ) );
-         }
-      }
-   }
+        }
+    }
 
-    private Document toDocument(XmlObject notifyDoc)
+    private Document toDocument( XmlObject notifyDoc )
             throws ParserConfigurationException, SAXException, IOException
     {
         Document document = null;
         //notify is now populated
 
-        if (XmlBeanUtils.isDocument(notifyDoc))
+        if ( XmlBeanUtils.isDocument( notifyDoc ) )
         {
             document = (Document) notifyDoc.newDomNode();
         }
         else
-        {           
-            String s = notifyDoc.xmlText(new XmlOptions().setSaveOuter());
+        {
+            String s = notifyDoc.xmlText( new XmlOptions().setSaveOuter() );
             document = JaxpUtils.toDocument( s );
         }
         return document;
     }
 
     /**
-    * DOCUMENT_ME
-    *
-    * @param topic DOCUMENT_ME
-    */
-   public void topicAdded( Topic topic )
-   {
-       //todo
-   }
-
-   /**
-    * DOCUMENT_ME
-    *
-    * @param topic DOCUMENT_ME
-    */
-   public void topicChanged( Topic topic )
-   {
-      Subscription subscription = m_subscription;
-
-      if ( subscription != null )
-      {
-         try
-         {
-            this.notify( subscription,
-                         topic.getCurrentMessage(  ) );
-         }
-         catch ( Exception e )
-         {
-            logger.warn( "notificationFailed" + subscription );
-            logger.debug( "", e );
-         }
-      }
-   }
-
-   /**
-    * 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(  );
-
-      SOAPHeaderElement h =
-         header.addHeaderElement( factory.createName( Addressing_03_2003_Constants.TO,
-                                                      Addressing_03_2003_Constants.NSPREFIX_WSRL_SCHEMA,
-                                                      Addressing_03_2003_Constants.NSURI_WSRL_SCHEMA ) );
-
-      h.addTextNode( consumerEPR.getAddress(  ).getStringValue(  ) );
-
-      h = header.addHeaderElement( factory.createName( Addressing_03_2003_Constants.ACTION,
-                                                       Addressing_03_2003_Constants.NSPREFIX_WSRL_SCHEMA,
-                                                       Addressing_03_2003_Constants.NSURI_WSRL_SCHEMA ) );
-      h.addTextNode( BaseNotificationConstants.NOTIFY_ACTION_URL );
-
-      ReferencePropertiesType props = consumerEPR.getReferenceProperties(  );
-      if ( props != null )
-      {
-         XmlCursor cursor = props.newCursor(  );
-
-         boolean   haveChild = cursor.toFirstChild(  );
-
-         while ( haveChild )
-         {
-            SOAPElement e = XmlBeanUtils.toSOAPElement( cursor.getObject(  ) );
-            h = header.addHeaderElement( e.getElementName(  ) );
-            h.addTextNode( e.getValue(  ) );
-
-            haveChild = 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 );
+     * DOCUMENT_ME
+     *
+     * @param topic DOCUMENT_ME
+     */
+    public void topicAdded( Topic topic )
+    {
+        //todo
+    }
+
+    /**
+     * DOCUMENT_ME
+     *
+     * @param topic DOCUMENT_ME
+     */
+    public void topicChanged( Topic topic )
+    {
+        Subscription subscription = m_subscription;
 
-      return msg;
-   }
+        if ( subscription != null )
+        {
+            try
+            {
+                this.notify( subscription,
+                        topic.getCurrentMessage() );
+            }
+            catch ( Exception e )
+            {
+                LOG.warn( "notificationFailed" + subscription );
+                LOG.debug( "", e );
+            }
+        }
+    }
+
+    /**
+     * 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();
+
+        SOAPHeaderElement h =
+                header.addHeaderElement( factory.createName( Addressing_03_2003_Constants.TO,
+                        Addressing_03_2003_Constants.NSPREFIX_WSRL_SCHEMA,
+                        Addressing_03_2003_Constants.NSURI_WSRL_SCHEMA ) );
+
+        h.addTextNode( consumerEPR.getAddress().getStringValue() );
+
+        h = header.addHeaderElement( factory.createName( Addressing_03_2003_Constants.ACTION,
+                Addressing_03_2003_Constants.NSPREFIX_WSRL_SCHEMA,
+                Addressing_03_2003_Constants.NSURI_WSRL_SCHEMA ) );
+        h.addTextNode( BaseNotificationConstants.NOTIFY_ACTION_URL );
+
+        ReferencePropertiesType props = consumerEPR.getReferenceProperties();
+        if ( props != null )
+        {
+            XmlCursor cursor = props.newCursor();
+
+            boolean haveChild = cursor.toFirstChild();
+
+            while ( haveChild )
+            {
+                SOAPElement e = XmlBeanUtils.toSOAPElement( cursor.getObject() );
+                h = header.addHeaderElement( e.getElementName() );
+                h.addTextNode( e.getValue() );
+
+                haveChild = 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=168172&r1=168171&r2=168172&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 Wed May  4 12:26:25 2005
@@ -66,6 +66,7 @@
         topic.addTopicListener( this );
 
         topic.setTopicSpace(m_topicSpace);
+        ((TopicImpl)topic).setParent( this );
 
         this.topicAdded( topic );
         return topic;
@@ -121,13 +122,13 @@
         return m_subTopics.values().iterator();
     }
 
-    public void publish( Object obj ) throws Exception
+    public void publish( Object msg ) throws Exception
     {
-        m_currentMsg = obj;
+        m_currentMsg = msg;
         if ( LOG.isDebugEnabled() )
         {
-            LOG.debug( "Notify called on topic " +
-                    m_name + " with message " + obj.toString() );
+            LOG.debug( "Publish called on topic " +
+                    m_name + " with message " + msg );
         }
         this.topicChanged( this );
     }



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