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

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

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java Tue Aug  2 09:41:00 2005
@@ -1,384 +1,581 @@
-/*=============================================================================*
- *  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.base.impl;
-
-import org.apache.commons.id.IdentifierUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.Soap1_1Constants;
-import org.apache.ws.addressing.EndpointReference;
-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.TopicListener;
-import org.apache.ws.notification.topics.TopicListenerList;
-import org.apache.ws.notification.topics.TopicSpaceSet;
-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;
-import org.apache.ws.resource.PersistentResource;
-import org.apache.ws.resource.PropertiesResource;
-import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.ResourceHome;
-import org.apache.ws.resource.faults.FaultException;
-import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
-import org.apache.ws.resource.lifetime.ResourceTerminationListener;
-import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
-import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.resource.properties.query.QueryExpression;
-
-import javax.naming.InitialContext;
-import java.net.URI;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Iterator;
-import java.util.List;
-
-/**
- * An Abstract Base class for Subscription Implementations.
- */
-public abstract class AbstractSubscription implements Subscription, PropertiesResource
-{
-   private static final Log LOG = LogFactory.getLog(AbstractSubscription.class);
-
-    protected EndpointReference m_consumerReference;
-    protected EndpointReference m_producerReference;
-    protected Object m_policy;
-    protected QueryExpression m_precondition;
-    protected QueryExpression m_selector;
-    protected String m_producerHomeLocation;
-    protected TopicExpression m_topicExpression;
-    protected boolean m_isPaused;
-    protected boolean m_useNotify = true;
-    protected Calendar m_terminationTime;
-    protected Calendar m_creationTime;
-    protected String m_id;
-    protected EndpointReference m_epr;
-
-    transient protected ResourcePropertySet m_propSet;
-
-    private NotificationConsumer m_notificationConsumer;
-    private NotificationProducer m_notificationProducer;
-
-    /**
-     * A list of termination listeners to be notified when the resource is terminated.
-     */
-    private List m_terminationListeners = new ArrayList();
-    private Object m_producerId;
-
-    /**
-     * 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 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,
-                                 String producerHomeLocation,
-                                 Object producerId,
-                                 TopicExpression topicExpression )
-    {
-        m_id = IdentifierUtils.UUID_VERSION_FOUR_GENERATOR.nextIdentifier().toString();
-        m_consumerReference = consumerReference;
-        m_producerReference = producerReference;
-        m_producerHomeLocation = producerHomeLocation;
-        m_producerId = producerId;
-        m_topicExpression = topicExpression;
-        m_creationTime = Calendar.getInstance();
-    }
-
-    public ResourcePropertySet getResourcePropertySet()
-    {
-        return m_propSet;
-    }
-    public void setResourcePropertySet(ResourcePropertySet resourcePropertySet) {
-         m_propSet = resourcePropertySet;
-     }
-
-    public void setTerminationTime( Calendar time )
-    {
-        m_terminationTime = time;
-    }
-
-    public Calendar getTerminationTime()
-    {
-        return m_terminationTime;
-    }
-
-    public Calendar getCurrentTime()
-    {
-        return Calendar.getInstance();
-    }
-
-    public Calendar getCreationTime()
-    {
-        return m_creationTime;
-    }
-
-    public EndpointReference getConsumerReference()
-    {
-        return m_consumerReference;
-    }
-
-    public Object getPolicy()
-    {
-        return m_policy;
-    }
-
-    public QueryExpression getPrecondition()
-    {
-        return m_precondition;
-    }
-
-    public EndpointReference getProducerReference()
-    {
-        return m_producerReference;
-    }
-
-    public NotificationProducerResource getProducerResource()
-    {
-        try
-        {
-            ResourceHome producerHome = (ResourceHome) new InitialContext().lookup( m_producerHomeLocation );
-            return (NotificationProducerResource) producerHome.find( m_producerId );
-        }
-        catch ( Exception e )
-        {
-            throw new RuntimeException( "Failed to lookup NotificationProducer resource due to internal error: " + e, e );
-        }
-    }
-
-    public QueryExpression getSelector()
-    {
-        return m_selector;
-    }
-
-    public TopicExpression getTopicExpression()
-    {
-        return m_topicExpression;
-    }
-
-    public boolean isPaused()
-    {
-        return m_isPaused;
-    }
-
-    public void pause() throws Exception
-    {
-        m_isPaused = true;
-    }
-
-    public void resume() throws Exception
-    {
-        m_isPaused = false;
-    }
-
-    public boolean getUseNotify()
-    {
-        return m_useNotify;
-    }
-
-    public AbstractSubscription()
-    {
-
-    }
-
-    public Object getID()
-    {
-        return m_id;
-    }
-
-    public void setID( Object id )
-    {
-        m_id = (String) id;
-    }
-
-    public void destroy()
-    {
-        Resource producerResource = null;
-        try
-        {
-            producerResource = getProducerResource();
-        }
-        catch ( Exception e )
-        {
-            ;
-        }
-
-        if ( !( producerResource instanceof NotificationProducerResource ) )
-        {
-            return;
-        }
-
-        Topic[] topics = null;
-        topics = evaluateTopicExpression();
-
-
-        synchronized ( producerResource )
-        {
-            //removes listeners from the topics
-            boolean removed = removeListener( topics );
-
-            //persists the resource
-            if ( removed && producerResource instanceof PersistentResource )
-            {
-                try
-                {
-                    ( (PersistentResource) producerResource ).store();
-                }
-                catch ( ResourceException e )
-                {
-                    LOG.debug("Unable to persist the resource: " + producerResource + " with id: " + producerResource.getID(), e);
-                }
-
-            }
-        }
-
-        //notify listeners that this subscription expired.
-        ResourceTerminationEvent rte = new ResourceTerminationEventImpl( getID(), "Subscription Destroyed" );
-        for ( int i = 0; i < m_terminationListeners.size(); i++ )
-        {
-            ResourceTerminationListener resourceTerminationListener = (ResourceTerminationListener) m_terminationListeners.get(
-                    i );
-            resourceTerminationListener.terminationOccurred( rte );
-        }
-
-    }
-
-    private Topic[] evaluateTopicExpression()
-    {
-        NotificationProducerResource resource = (NotificationProducerResource) getProducerResource();
-        TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet();
-        try
-        {
-            return topicSpaceSet.evaluateTopicExpression( m_topicExpression );
-        }
-        catch ( TopicExpressionException e )
-        {
-            LOG.debug("Failed to evaluate TopicExpression.",e);
-            throw new FaultException( Soap1_1Constants.FAULT_CLIENT, "An exception occurred evaluating the topic expression. ");
-        }
-    }
-
-    private boolean removeListener( Topic[] topics )
-    {
-        boolean removed = false;
-        for ( int i = 0; i < topics.length; i++ )
-        {
-            TopicListenerList topicListenerList = topics[i];
-            synchronized ( topicListenerList )
-            {
-                Iterator topicListenerIterator = topicListenerList.topicListenerIterator();
-                while ( topicListenerIterator.hasNext() )
-                {
-                    TopicListener listener = (TopicListener) topicListenerIterator.next();
-                    if ( listener instanceof SubscriptionTopicListener )
-                    {
-                        SubscriptionTopicListener lt =
-                                (SubscriptionTopicListener) listener;
-                        Object subKey =
-                                lt.getSubscription().getID();
-                        if ( subKey.equals( m_id ) )
-                        {
-                            topicListenerIterator.remove();
-                            removed = true;
-                        }
-                    }
-                }
-            }
-        }
-
-        return removed;
-    }
-
-    public void unsubscribe()
-    {
-        destroy();
-    }
-
-    public Filter getFilters()
-    {
-        // TODO. *SJC* This is provided for pubsub abstraction layer
-        return null;
-    }
-
-    public URI getDeliveryMode()
-    {
-        // TODO. *SJC* This is provided for pubsub abstraction layer
-        return null;
-    }
-
-    public NotificationConsumer getNotificationConsumer()
-    {
-        return m_notificationConsumer;
-    }
-
-    public NotificationProducer getNotificationProducer()
-    {
-        return m_notificationProducer;
-    }
-
-    public EndpointReference getEndpointReference()
-    {
-        return m_epr;
-    }
-
-    public void setEndpointReference( EndpointReference epr )
-    {
-        m_epr = epr;
-    }
-
-    public void setNotificationConsumer( NotificationConsumer notificationConsumer )
-    {
-        m_notificationConsumer = notificationConsumer;
-    }
-
-    public void setNotificationProducer( NotificationProducer notificationProducer )
-    {
-        m_notificationProducer = notificationProducer;
-    }
-
-    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;
-    }
-}
+/*=============================================================================*
+ *  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.base.impl;
+
+import org.apache.commons.id.IdentifierUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.Soap1_1Constants;
+import org.apache.ws.addressing.EndpointReference;
+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.TopicListener;
+import org.apache.ws.notification.topics.TopicListenerList;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+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;
+import org.apache.ws.resource.PersistentResource;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.ResourceHome;
+import org.apache.ws.resource.faults.FaultException;
+import org.apache.ws.resource.lifetime.ResourceTerminationEvent;
+import org.apache.ws.resource.lifetime.ResourceTerminationListener;
+import org.apache.ws.resource.lifetime.impl.ResourceTerminationEventImpl;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.query.QueryExpression;
+import javax.naming.InitialContext;
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Calendar;
+import java.util.Iterator;
+import java.util.List;
+
+/**
+ * An Abstract Base class for Subscription Implementations.
+ */
+public abstract class AbstractSubscription
+   implements Subscription,
+              PropertiesResource
+{
+   private static final Log                LOG = LogFactory.getLog( AbstractSubscription.class );
+
+   /** DOCUMENT_ME */
+   protected EndpointReference             m_consumerReference;
+
+   /** DOCUMENT_ME */
+   protected EndpointReference             m_producerReference;
+
+   /** DOCUMENT_ME */
+   protected Object                        m_policy;
+
+   /** DOCUMENT_ME */
+   protected QueryExpression               m_precondition;
+
+   /** DOCUMENT_ME */
+   protected QueryExpression               m_selector;
+
+   /** DOCUMENT_ME */
+   protected String                        m_producerHomeLocation;
+
+   /** DOCUMENT_ME */
+   protected TopicExpression               m_topicExpression;
+
+   /** DOCUMENT_ME */
+   protected boolean                       m_isPaused;
+
+   /** DOCUMENT_ME */
+   protected boolean                       m_useNotify       = true;
+
+   /** DOCUMENT_ME */
+   protected Calendar                      m_terminationTime;
+
+   /** DOCUMENT_ME */
+   protected Calendar                      m_creationTime;
+
+   /** DOCUMENT_ME */
+   protected String                        m_id;
+
+   /** DOCUMENT_ME */
+   protected EndpointReference             m_epr;
+
+   /** DOCUMENT_ME */
+   protected transient ResourcePropertySet m_propSet;
+   private NotificationConsumer            m_notificationConsumer;
+   private NotificationProducer            m_notificationProducer;
+
+   /**
+    * A list of termination listeners to be notified when the resource is terminated.
+    */
+   private List   m_terminationListeners = new ArrayList(  );
+   private Object m_producerId;
+
+   /**
+    * 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 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,
+                                String            producerHomeLocation,
+                                Object            producerId,
+                                TopicExpression   topicExpression )
+   {
+      m_id                      = IdentifierUtils.UUID_VERSION_FOUR_GENERATOR.nextIdentifier(  ).toString(  );
+      m_consumerReference       = consumerReference;
+      m_producerReference       = producerReference;
+      m_producerHomeLocation    = producerHomeLocation;
+      m_producerId              = producerId;
+      m_topicExpression         = topicExpression;
+      m_creationTime            = Calendar.getInstance(  );
+   }
+
+   /**
+    * Creates a new {@link AbstractSubscription} object.
+    */
+   public AbstractSubscription(  )
+   {
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public EndpointReference getConsumerReference(  )
+   {
+      return m_consumerReference;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Calendar getCreationTime(  )
+   {
+      return m_creationTime;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Calendar getCurrentTime(  )
+   {
+      return Calendar.getInstance(  );
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public URI getDeliveryMode(  )
+   {
+      // TODO. *SJC* This is provided for pubsub abstraction layer
+      return null;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param epr DOCUMENT_ME
+    */
+   public void setEndpointReference( EndpointReference epr )
+   {
+      m_epr = epr;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public EndpointReference getEndpointReference(  )
+   {
+      return m_epr;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Filter getFilters(  )
+   {
+      // TODO. *SJC* This is provided for pubsub abstraction layer
+      return null;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param id DOCUMENT_ME
+    */
+   public void setID( Object id )
+   {
+      m_id = (String) id;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getID(  )
+   {
+      return m_id;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param notificationConsumer DOCUMENT_ME
+    */
+   public void setNotificationConsumer( NotificationConsumer notificationConsumer )
+   {
+      m_notificationConsumer = notificationConsumer;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public NotificationConsumer getNotificationConsumer(  )
+   {
+      return m_notificationConsumer;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param notificationProducer DOCUMENT_ME
+    */
+   public void setNotificationProducer( NotificationProducer notificationProducer )
+   {
+      m_notificationProducer = notificationProducer;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public NotificationProducer getNotificationProducer(  )
+   {
+      return m_notificationProducer;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public boolean isPaused(  )
+   {
+      return m_isPaused;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param policy DOCUMENT_ME
+    */
+   public void setPolicy( Object policy )
+   {
+      m_policy = policy;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getPolicy(  )
+   {
+      return m_policy;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param precondition DOCUMENT_ME
+    */
+   public void setPrecondition( QueryExpression precondition )
+   {
+      m_precondition = precondition;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public QueryExpression getPrecondition(  )
+   {
+      return m_precondition;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public EndpointReference getProducerReference(  )
+   {
+      return m_producerReference;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public NotificationProducerResource getProducerResource(  )
+   {
+      try
+      {
+         ResourceHome producerHome = (ResourceHome) new InitialContext(  ).lookup( m_producerHomeLocation );
+         return (NotificationProducerResource) producerHome.find( m_producerId );
+      }
+      catch ( Exception e )
+      {
+         throw new RuntimeException( "Failed to lookup NotificationProducer resource due to internal error: " + e,
+                                     e );
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param resourcePropertySet DOCUMENT_ME
+    */
+   public void setResourcePropertySet( ResourcePropertySet resourcePropertySet )
+   {
+      m_propSet = resourcePropertySet;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public ResourcePropertySet getResourcePropertySet(  )
+   {
+      return m_propSet;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param selector DOCUMENT_ME
+    */
+   public void setSelector( QueryExpression selector )
+   {
+      m_selector = selector;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public QueryExpression getSelector(  )
+   {
+      return m_selector;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param time DOCUMENT_ME
+    */
+   public void setTerminationTime( Calendar time )
+   {
+      m_terminationTime = time;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Calendar getTerminationTime(  )
+   {
+      return m_terminationTime;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public TopicExpression getTopicExpression(  )
+   {
+      return m_topicExpression;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param useNotify DOCUMENT_ME
+    */
+   public void setUseNotify( boolean useNotify )
+   {
+      m_useNotify = useNotify;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public boolean getUseNotify(  )
+   {
+      return m_useNotify;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param resourceTerminationListener DOCUMENT_ME
+    */
+   public void addTerminationListener( ResourceTerminationListener resourceTerminationListener )
+   {
+      m_terminationListeners.add( resourceTerminationListener );
+   }
+
+   /**
+    * DOCUMENT_ME
+    */
+   public void destroy(  )
+   {
+      Resource producerResource = null;
+      try
+      {
+         producerResource = getProducerResource(  );
+      }
+      catch ( Exception e )
+      {
+         ;
+      }
+
+      if ( !( producerResource instanceof NotificationProducerResource ) )
+      {
+         return;
+      }
+
+      Topic[] topics = null;
+      topics = evaluateTopicExpression(  );
+
+      synchronized ( producerResource )
+      {
+         //removes listeners from the topics
+         boolean removed = removeListener( topics );
+
+         //persists the resource
+         if ( removed && producerResource instanceof PersistentResource )
+         {
+            try
+            {
+               ( (PersistentResource) producerResource ).store(  );
+            }
+            catch ( ResourceException e )
+            {
+               LOG.debug( "Unable to persist the resource: " + producerResource + " with id: "
+                          + producerResource.getID(  ), e );
+            }
+         }
+      }
+
+      //notify listeners that this subscription expired.
+      ResourceTerminationEvent rte = new ResourceTerminationEventImpl( getID(  ),
+                                                                       "Subscription Destroyed" );
+      for ( int i = 0; i < m_terminationListeners.size(  ); i++ )
+      {
+         ResourceTerminationListener resourceTerminationListener =
+            (ResourceTerminationListener) m_terminationListeners.get( i );
+         resourceTerminationListener.terminationOccurred( rte );
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @throws Exception DOCUMENT_ME
+    */
+   public void pause(  )
+   throws Exception
+   {
+      m_isPaused = true;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @throws Exception DOCUMENT_ME
+    */
+   public void resume(  )
+   throws Exception
+   {
+      m_isPaused = false;
+   }
+
+   /**
+    * DOCUMENT_ME
+    */
+   public void unsubscribe(  )
+   {
+      destroy(  );
+   }
+
+   private Topic[] evaluateTopicExpression(  )
+   {
+      NotificationProducerResource resource      = (NotificationProducerResource) getProducerResource(  );
+      TopicSpaceSet                topicSpaceSet = resource.getTopicSpaceSet(  );
+      try
+      {
+         return topicSpaceSet.evaluateTopicExpression( m_topicExpression );
+      }
+      catch ( TopicExpressionException e )
+      {
+         LOG.debug( "Failed to evaluate TopicExpression.", e );
+         throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                                   "An exception occurred evaluating the topic expression. " );
+      }
+   }
+
+   private boolean removeListener( Topic[] topics )
+   {
+      boolean removed = false;
+      for ( int i = 0; i < topics.length; i++ )
+      {
+         TopicListenerList topicListenerList = topics[i];
+         synchronized ( topicListenerList )
+         {
+            Iterator topicListenerIterator = topicListenerList.topicListenerIterator(  );
+            while ( topicListenerIterator.hasNext(  ) )
+            {
+               TopicListener listener = (TopicListener) topicListenerIterator.next(  );
+               if ( listener instanceof SubscriptionTopicListener )
+               {
+                  SubscriptionTopicListener lt = (SubscriptionTopicListener) listener;
+                  Object                    subKey = lt.getSubscription(  ).getID(  );
+                  if ( subKey.equals( m_id ) )
+                  {
+                     topicListenerIterator.remove(  );
+                     removed = true;
+                  }
+               }
+            }
+         }
+      }
+
+      return removed;
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/impl/XmlBeansTopicExpression.java Tue Aug  2 09:41:00 2005
@@ -1,155 +1,187 @@
-/*=============================================================================*
- *  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.base.impl;
-
-import org.apache.commons.lang.builder.ToStringBuilder;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.ws.XmlObjectWrapper;
-import org.apache.ws.Soap1_1Constants;
-import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.resource.i18n.Keys;
-import org.apache.ws.resource.i18n.MessagesImpl;
-import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
-import org.apache.ws.resource.faults.FaultException;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.util.i18n.Messages;
-import org.apache.ws.util.xml.impl.XmlBeansNamespaceContext;
-import org.apache.xmlbeans.XmlObject;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
-
-import javax.xml.rpc.JAXRPCException;
-import java.net.URI;
-import java.net.URISyntaxException;
-
-/**
- * A TopicExpression impl that wraps a TopicExpressionType XMLBean.
- *
- * @author Ian Springer
- */
-public class XmlBeansTopicExpression implements TopicExpression, XmlObjectWrapper
-{
-
-    private static final Log LOG = LogFactory.getLog( XmlBeansQueryExpression.class );
-    public static final Messages MSG = MessagesImpl.getInstance();
-
-    private XmlObject m_topicExprXBean;
-    private URI m_dialect;
-    private Object m_content;
-    private Object m_nsContext;
-
-    /**
-     * Creates a new {@link XmlBeansTopicExpression} object.
-     *
-     * @param topicExprXBean DOCUMENT_ME
-     *
-     * @throws JAXRPCException          DOCUMENT_ME
-     */
-    public XmlBeansTopicExpression( TopicExpressionType topicExprXBean ) throws InvalidTopicExpressionException
-    {
-        this( topicExprXBean, getDialect( topicExprXBean ) );
-    }
-
-    protected XmlBeansTopicExpression( XmlObject xBean, URI dialect ) throws InvalidTopicExpressionException
-    {
-        m_topicExprXBean = xBean;
-        m_dialect = dialect;
-        XmlObject[] childElems = XmlBeanUtils.getChildElements( m_topicExprXBean );
-        if ( childElems.length > 1 )
-        {
-            throw new InvalidTopicExpressionException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
-        }
-        if ( childElems.length == 1 )
-        {
-            m_content = childElems[0];
-        }
-        else
-        {
-            m_content = XmlBeanUtils.getValue( m_topicExprXBean );
-        }
-        m_nsContext = new XmlBeansNamespaceContext( m_topicExprXBean );
-        if ( LOG.isDebugEnabled() )
-        {
-            LOG.debug( MSG.getMessage( Keys.QUERY_EXPR, toString() ) );
-        }
-    }
-
-    private static URI getDialect(
-            TopicExpressionType topicExprElem )
-    {
-        if ( ! topicExprElem.isSetDialect() )
-        {
-            throw new FaultException( Soap1_1Constants.FAULT_CLIENT, "The Dialect attribute is required by the WS-BaseNotification TopicExpressionType." );
-        }
-        try
-        {
-            return new URI( topicExprElem.getDialect() );
-        }
-        catch ( URISyntaxException urise )
-        {
-            throw new FaultException( Soap1_1Constants.FAULT_CLIENT, "The Dialect attribute of the WS-BaseNotification TopicExpressionType must be a valid URI." );
-        }
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     */
-    public Object getContent()
-    {
-        return m_content;
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     */
-    public URI getDialect()
-    {
-        return m_dialect;
-    }
-
-    public Object getNamespaceContext()
-    {
-        return m_nsContext;
-    }
-
-    public void setNamespaceContext( Object nsContext )
-    {
-        m_nsContext = nsContext;
-    }
-
-    /**
-     * DOCUMENT_ME
-     *
-     * @return DOCUMENT_ME
-     */
-    public String toString()
-    {
-        return new ToStringBuilder( this ).append( MSG.getMessage( Keys.DIALECT ), m_dialect ).append(
-                MSG.getMessage( Keys.CONTENT ), m_content )
-                .toString();
-    }
-
-    public XmlObject getXmlObject()
-    {
-        return m_topicExprXBean;
-    }
-
-}
+/*=============================================================================*
+ *  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.base.impl;
+
+import org.apache.commons.lang.builder.ToStringBuilder;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.Soap1_1Constants;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.resource.faults.FaultException;
+import org.apache.ws.resource.i18n.Keys;
+import org.apache.ws.resource.i18n.MessagesImpl;
+import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.xml.impl.XmlBeansNamespaceContext;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import javax.xml.rpc.JAXRPCException;
+import java.net.URI;
+import java.net.URISyntaxException;
+
+/**
+ * A TopicExpression impl that wraps a TopicExpressionType XMLBean.
+ *
+ * @author Ian Springer
+ */
+public class XmlBeansTopicExpression
+   implements TopicExpression,
+              XmlObjectWrapper
+{
+   private static final Log     LOG = LogFactory.getLog( XmlBeansQueryExpression.class );
+
+   /** DOCUMENT_ME */
+   public static final Messages MSG = MessagesImpl.getInstance(  );
+   private XmlObject            m_topicExprXBean;
+   private URI                  m_dialect;
+   private Object               m_content;
+   private Object               m_nsContext;
+
+   /**
+    * Creates a new {@link XmlBeansTopicExpression} object.
+    *
+    * @param topicExprXBean DOCUMENT_ME
+    *
+    * @throws JAXRPCException          DOCUMENT_ME
+    */
+   public XmlBeansTopicExpression( TopicExpressionType topicExprXBean )
+   throws InvalidTopicExpressionException
+   {
+      this( topicExprXBean,
+            getDialect( topicExprXBean ) );
+   }
+
+   /**
+    * Creates a new {@link XmlBeansTopicExpression} object.
+    *
+    * @param xBean DOCUMENT_ME
+    * @param dialect DOCUMENT_ME
+    *
+    * @throws InvalidTopicExpressionException DOCUMENT_ME
+    */
+   protected XmlBeansTopicExpression( XmlObject xBean,
+                                      URI       dialect )
+   throws InvalidTopicExpressionException
+   {
+      m_topicExprXBean    = xBean;
+      m_dialect           = dialect;
+      XmlObject[] childElems = XmlBeanUtils.getChildElements( m_topicExprXBean );
+      if ( childElems.length > 1 )
+      {
+         throw new InvalidTopicExpressionException( MSG.getMessage( Keys.QUERY_ONLY_ONE_NODE ) );
+      }
+
+      if ( childElems.length == 1 )
+      {
+         m_content = childElems[0];
+      }
+      else
+      {
+         m_content = XmlBeanUtils.getValue( m_topicExprXBean );
+      }
+
+      m_nsContext = new XmlBeansNamespaceContext( m_topicExprXBean );
+      if ( LOG.isDebugEnabled(  ) )
+      {
+         LOG.debug( MSG.getMessage( Keys.QUERY_EXPR,
+                                    toString(  ) ) );
+      }
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getContent(  )
+   {
+      return m_content;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public URI getDialect(  )
+   {
+      return m_dialect;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param nsContext DOCUMENT_ME
+    */
+   public void setNamespaceContext( Object nsContext )
+   {
+      m_nsContext = nsContext;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public Object getNamespaceContext(  )
+   {
+      return m_nsContext;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public XmlObject getXmlObject(  )
+   {
+      return m_topicExprXBean;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String toString(  )
+   {
+      return new ToStringBuilder( this ).append( MSG.getMessage( Keys.DIALECT ),
+                                                 m_dialect ).append( MSG.getMessage( Keys.CONTENT ),
+                                                                     m_content ).toString(  );
+   }
+
+   private static URI getDialect( TopicExpressionType topicExprElem )
+   {
+      if ( !topicExprElem.isSetDialect(  ) )
+      {
+         throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                                   "The Dialect attribute is required by the WS-BaseNotification TopicExpressionType." );
+      }
+
+      try
+      {
+         return new URI( topicExprElem.getDialect(  ) );
+      }
+      catch ( URISyntaxException urise )
+      {
+         throw new FaultException( Soap1_1Constants.FAULT_CLIENT,
+                                   "The Dialect attribute of the WS-BaseNotification TopicExpressionType must be a valid URI." );
+      }
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java Tue Aug  2 09:41:00 2005
@@ -1,49 +1,48 @@
-/*=============================================================================*
- *  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.base.v2004_06;
-
-/**
- * Constants defined by the WS-BaseNotification 1.2 Draft 01 specification.
- */
-public interface BaseNotificationConstants
-{
-
-    /**
-     * Namespace URI of the WS-BaseNotification 1.2 Draft 01 schema.
-     */
-    String NSURI_WSNT_SCHEMA = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
-
-    /**
-     * Namespace prefix for the WS-BaseNotification 1.2 Draft 01 schema.
-     */
-    String NSPREFIX_WSNT_SCHEMA = "wsnt";
-
-    /**
-     * Namespace URI of the WS-BaseNotification 1.2 Draft 01 WSDL.
-     */
-    String NSURI_WSNT_WSDL = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl";
-
-    /**
-     * Namespace prefix for the WS-BaseNotification 1.2 Draft 01 WSDL.
-     */
-    String NSPREFIX_WSNT_WSDL = "wsntw";
-
-    /**
-     * The value to use for the wsa:Action header in outgoing Notify messages.
-     */ 
-    String NOTIFY_ACTION_URL = BaseNotificationConstants.NSURI_WSNT_WSDL + "/Notify";
-
-}
+/*=============================================================================*
+ *  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.base.v2004_06;
+
+
+/**
+ * Constants defined by the WS-BaseNotification 1.2 Draft 01 specification.
+ */
+public interface BaseNotificationConstants
+{
+   /**
+    * Namespace URI of the WS-BaseNotification 1.2 Draft 01 schema.
+    */
+   String NSURI_WSNT_SCHEMA = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
+
+   /**
+    * Namespace prefix for the WS-BaseNotification 1.2 Draft 01 schema.
+    */
+   String NSPREFIX_WSNT_SCHEMA = "wsnt";
+
+   /**
+    * Namespace URI of the WS-BaseNotification 1.2 Draft 01 WSDL.
+    */
+   String NSURI_WSNT_WSDL = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl";
+
+   /**
+    * Namespace prefix for the WS-BaseNotification 1.2 Draft 01 WSDL.
+    */
+   String NSPREFIX_WSNT_WSDL = "wsntw";
+
+   /**
+    * The value to use for the wsa:Action header in outgoing Notify messages.
+    */
+   String NOTIFY_ACTION_URL = BaseNotificationConstants.NSURI_WSNT_WSDL + "/Notify";
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java Tue Aug  2 09:41:00 2005
@@ -1,179 +1,237 @@
-/*=============================================================================*
- *  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.base.v2004_06.impl;
-
-import org.apache.commons.collections.map.ReferenceMap;
-import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.notification.base.Subscription;
-import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.resource.JndiConstants;
-import org.apache.ws.resource.ResourceException;
-import org.apache.ws.resource.impl.AbstractResourceHome;
-import org.apache.ws.resource.properties.query.QueryExpression;
-import org.apache.ws.resource.properties.NamespaceVersionHolder;
-
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import javax.xml.namespace.QName;
-import java.lang.reflect.Constructor;
-import java.util.Calendar;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * The home for the builtin SubscriptionManager service.
- */
-public class SubscriptionHome extends AbstractResourceHome
-{
-
-    /**
-     * The service endpoint name as registered with the SOAP Platform.  This is useful for building EPR's. *
-     */
-    public static final javax.xml.namespace.QName SERVICE_NAME = javax.xml.namespace.QName.valueOf(
-            "{http://ws.apache.org/notification/base/service/SubscriptionManager}SubscriptionManager" );
-
-    /**
-     * The management PortType associated with this resource. This is useful for building EPR's.*
-     */
-    public static final javax.xml.namespace.QName PORT_TYPE = javax.xml.namespace.QName.valueOf(
-            "{http://ws.apache.org/notification/base/service/SubscriptionManager}SubscriptionManagerPortType" );
-
-    /**
-     * The WSDL Port name associated with the resource. This is useful for building EPR's. *
-     */
-    public static final String PORT_NAME = "SubscriptionManager";
-
-    /**
-     * 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;
-    private static final NamespaceVersionHolder SPEC_NAMESPACE_SET = new WsnNamespaceVersionHolderImpl();
-
-    /**
-     * Do not modify this method.
-     */
-    protected final Map initResourceMap()
-            throws NamingException
-    {
-        Context initialContext = new InitialContext();
-        if (m_resourceIsPersistent)
-        {
-            s_resources = new ReferenceMap(ReferenceMap.HARD, ReferenceMap.SOFT, true);
-            initCachePolicy(initialContext);
-        }
-        else
-        {
-            s_resources = new HashMap();
-        }
-
-        s_resources = Collections.synchronizedMap(s_resources);
-        return s_resources;
-    }
-
-    public Subscription create( Class subscriptionResourceClass,
-                                EndpointReference consumerReference,
-                                EndpointReference producerReference,
-                                Calendar initialTerminationTime,
-                                Object policy,
-                                QueryExpression precondition,
-                                QueryExpression selector,
-                                Object producerId,
-                                String producerHomeLocation,
-                                TopicExpression topicExpression,
-                                boolean useNotify, WsnNamespaceVersionHolder nsSet ) throws ResourceException
-    {
-        try
-        {
-            Constructor constructor = subscriptionResourceClass.getConstructor( new Class[]{
-                EndpointReference.class,
-                EndpointReference.class,
-                Object.class,
-                String.class,
-                TopicExpression.class} );
-            Subscription subscription = (Subscription) constructor.newInstance(
-                    new Object[]{consumerReference, producerReference, producerId, producerHomeLocation,
-                                 topicExpression} );
-            subscription.setTerminationTime( initialTerminationTime );
-            subscription.setUseNotify( useNotify );
-            subscription.setSelector( selector );
-            subscription.setPrecondition( precondition );
-            subscription.setPolicy( policy );
-            subscription.init();  // initialize resource properties
-            String id = (String) subscription.getID();
-            EndpointReference subscriptionEPR = getEndpointReference( id );
-            //do this here (rather than in find() ) since we need the EPR to be returned on the subscribe request.
-            subscription.setEndpointReference( subscriptionEPR );
-            add( subscription );
-            return subscription;
-        }
-        catch ( Exception e )
-        {
-            throw new ResourceException( "Failed to create Subscription resource.", e );
-        }
-    }
-
-    public QName getServiceName()
-    {
-        return SERVICE_NAME;
-    }
-
-    public QName getPortType()
-    {
-        return PORT_TYPE;
-    }
-
-    public String getServicePortName()
-    {
-        return PORT_NAME;
-    }
-
-    public QName getResourceKeyNameQName()
-    {
-        return RESOURCE_KEY_NAME;
-    }
-
-    /**
-     * Map containing all FilesystemResource instances - this map <em>must</em> be static for
-     * compatibility with certain JNDI providers.
-     */
-    private static Map s_resources;
-
-    /**
-     * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
-     * superclass.
-     */
-    protected synchronized final Map getResourceMap()
-    {
-        if ( s_resources == null )
-        {
-            s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
-        }
-        return s_resources;
-    }
-    public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder()
-    {
-        return SPEC_NAMESPACE_SET; 
-    }
-
-}
+/*=============================================================================*
+ *  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.base.v2004_06.impl;
+
+import org.apache.commons.collections.map.ReferenceMap;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.query.QueryExpression;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import javax.xml.namespace.QName;
+import java.lang.reflect.Constructor;
+import java.util.Calendar;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * The home for the builtin SubscriptionManager service.
+ */
+public class SubscriptionHome
+   extends AbstractResourceHome
+{
+   /**
+    * The service endpoint name as registered with the SOAP Platform.  This is useful for building EPR's. *
+    */
+   public static final javax.xml.namespace.QName SERVICE_NAME =
+      javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/notification/base/service/SubscriptionManager}SubscriptionManager" );
+
+   /**
+    * The management PortType associated with this resource. This is useful for building EPR's.*
+    */
+   public static final javax.xml.namespace.QName PORT_TYPE =
+      javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/notification/base/service/SubscriptionManager}SubscriptionManagerPortType" );
+
+   /**
+    * The WSDL Port name associated with the resource. This is useful for building EPR's. *
+    */
+   public static final String PORT_NAME = "SubscriptionManager";
+
+   /**
+    * 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" );
+
+   /** DOCUMENT_ME */
+   public static final String HOME_LOCATION =
+      JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart(  ) + "/"
+      + JndiConstants.ATOMIC_NAME_HOME;
+   private static final NamespaceVersionHolder SPEC_NAMESPACE_SET = new WsnNamespaceVersionHolderImpl(  );
+
+   /**
+    * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+    * compatibility with certain JNDI providers.
+    */
+   private static Map s_resources;
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder(  )
+   {
+      return SPEC_NAMESPACE_SET;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public QName getPortType(  )
+   {
+      return PORT_TYPE;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public QName getResourceKeyNameQName(  )
+   {
+      return RESOURCE_KEY_NAME;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public QName getServiceName(  )
+   {
+      return SERVICE_NAME;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getServicePortName(  )
+   {
+      return PORT_NAME;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param subscriptionResourceClass DOCUMENT_ME
+    * @param consumerReference DOCUMENT_ME
+    * @param producerReference DOCUMENT_ME
+    * @param initialTerminationTime DOCUMENT_ME
+    * @param policy DOCUMENT_ME
+    * @param precondition DOCUMENT_ME
+    * @param selector DOCUMENT_ME
+    * @param producerId DOCUMENT_ME
+    * @param producerHomeLocation DOCUMENT_ME
+    * @param topicExpression DOCUMENT_ME
+    * @param useNotify DOCUMENT_ME
+    * @param nsSet DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    *
+    * @throws ResourceException DOCUMENT_ME
+    */
+   public Subscription create( Class                     subscriptionResourceClass,
+                               EndpointReference         consumerReference,
+                               EndpointReference         producerReference,
+                               Calendar                  initialTerminationTime,
+                               Object                    policy,
+                               QueryExpression           precondition,
+                               QueryExpression           selector,
+                               Object                    producerId,
+                               String                    producerHomeLocation,
+                               TopicExpression           topicExpression,
+                               boolean                   useNotify,
+                               WsnNamespaceVersionHolder nsSet )
+   throws ResourceException
+   {
+      try
+      {
+         Constructor constructor =
+            subscriptionResourceClass.getConstructor( new Class[]
+                                                      {
+                                                         EndpointReference.class,
+                                                         EndpointReference.class,
+                                                         Object.class,
+                                                         String.class,
+                                                         TopicExpression.class
+                                                      } );
+         Subscription subscription =
+            (Subscription) constructor.newInstance( new Object[]
+                                                    {
+                                                       consumerReference,
+                                                       producerReference,
+                                                       producerId,
+                                                       producerHomeLocation,
+                                                       topicExpression
+                                                    } );
+         subscription.setTerminationTime( initialTerminationTime );
+         subscription.setUseNotify( useNotify );
+         subscription.setSelector( selector );
+         subscription.setPrecondition( precondition );
+         subscription.setPolicy( policy );
+         subscription.init(  ); // initialize resource properties
+         String            id              = (String) subscription.getID(  );
+         EndpointReference subscriptionEPR = getEndpointReference( id );
+
+         //do this here (rather than in find() ) since we need the EPR to be returned on the subscribe request.
+         subscription.setEndpointReference( subscriptionEPR );
+         add( subscription );
+         return subscription;
+      }
+      catch ( Exception e )
+      {
+         throw new ResourceException( "Failed to create Subscription resource.", e );
+      }
+   }
+
+   /**
+    * Returns a map of all FilesystemResource instances. Used by the {@link AbstractResourceHome}
+    * superclass.
+    */
+   protected final synchronized Map getResourceMap(  )
+   {
+      if ( s_resources == null )
+      {
+         s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+      }
+
+      return s_resources;
+   }
+
+   /**
+    * Do not modify this method.
+    */
+   protected final Map initResourceMap(  )
+   throws NamingException
+   {
+      Context initialContext = new InitialContext(  );
+      if ( m_resourceIsPersistent )
+      {
+         s_resources = new ReferenceMap( ReferenceMap.HARD, ReferenceMap.SOFT, true );
+         initCachePolicy( initialContext );
+      }
+      else
+      {
+         s_resources = new HashMap(  );
+      }
+
+      s_resources = Collections.synchronizedMap( s_resources );
+      return s_resources;
+   }
+}
\ No newline at end of file

Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java?rev=227035&r1=227034&r2=227035&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java Tue Aug  2 09:41:00 2005
@@ -1,130 +1,155 @@
-/*=============================================================================*
- *  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.base.v2004_06.impl;
-
-import org.apache.ws.XmlObjectWrapper;
-import org.apache.ws.addressing.EndpointReference;
-import org.apache.ws.notification.base.impl.AbstractSubscription;
-import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
-import org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
-import org.apache.ws.notification.topics.expression.TopicExpression;
-import org.apache.ws.pubsub.SubscriptionEndConsumer;
-import org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType;
-import org.apache.ws.resource.lifetime.callback.CurrentTimeCallback;
-import org.apache.ws.resource.properties.ResourceProperty;
-import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.resource.properties.ResourcePropertySetMetaData;
-import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
-import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySetMetaData;
-import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ConsumerReferenceDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.CreationTimeDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PreconditionDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SelectorDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscriptionManagerRPDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscriptionPolicyDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.UseNotifyDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.CurrentTimeDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationTimeDocument;
-import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
-import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
-
-import javax.xml.namespace.QName;
-
-/**
- * The resource for the builtin SubscriptionManager service.
- */
-public class SubscriptionResource extends AbstractSubscription {
-
-    private static final QName[] READ_ONLY_PROP_NAMES =
-            {
-                ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME,
-                ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME,
-                SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME
-            };
-
-    public SubscriptionResource(EndpointReference consumerReference, EndpointReference producerReference,
-                                Object producerId, String producerHomeLocation,
-                                TopicExpression topicExpression) {
-        super(consumerReference, producerReference
-               , producerHomeLocation, producerId, topicExpression);
-    }
-
-    public void init() {
-        SubscriptionManagerRPDocument propsDoc = SubscriptionManagerRPDocument.Factory.newInstance();
-        ResourcePropertySetMetaData propSetMetaData = new XmlBeansResourcePropertySetMetaData(propsDoc.schemaType(),
-                READ_ONLY_PROP_NAMES);
-        m_propSet = new XmlBeansResourcePropertySet(propsDoc, propSetMetaData);
-
-        // wsrlw:ScheduledResourceTermination props
-        ResourceProperty prop = m_propSet.get(ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME);
-        CurrentTimeDocument currTimeDoc = CurrentTimeDocument.Factory.newInstance();
-        currTimeDoc.setCurrentTime(getCurrentTime());
-        prop.setCallback( new CurrentTimeCallback() );
-        prop.add(currTimeDoc);
-        prop = m_propSet.get(ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME);
-        TerminationTimeDocument termTimeDoc = TerminationTimeDocument.Factory.newInstance();
-        termTimeDoc.setTerminationTime(getTerminationTime());
-        prop.add(termTimeDoc);
-        // wsntw:SubscriptionManager props
-        prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_CONSUMER_REFERENCE);
-        ConsumerReferenceDocument consumerRefDoc = ConsumerReferenceDocument.Factory.newInstance();
-        consumerRefDoc.setConsumerReference((EndpointReferenceType) ((XmlObjectWrapper) m_consumerReference).getXmlObject());
-        prop.add(consumerRefDoc);
-        prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME);
-        CreationTimeDocument creationTimeDoc = CreationTimeDocument.Factory.newInstance();
-        creationTimeDoc.setCreationTime(m_creationTime);
-        prop.add(creationTimeDoc);
-        prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_TOPIC_EXPRESSION);
-        TopicExpressionDocument topicExprDoc = TopicExpressionDocument.Factory.newInstance();
-        topicExprDoc.setTopicExpression((TopicExpressionType) ((XmlBeansTopicExpression) m_topicExpression).getXmlObject());
-        prop.add(topicExprDoc);
-        prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_USE_NOTIFY);
-        UseNotifyDocument useNotifyDoc = UseNotifyDocument.Factory.newInstance();
-        useNotifyDoc.setUseNotify(m_useNotify);
-        prop.add(useNotifyDoc);
-        if (m_precondition != null) {
-            prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_PRECONDITION);
-            PreconditionDocument preconditionDoc = PreconditionDocument.Factory.newInstance();
-            preconditionDoc.setPrecondition((QueryExpressionType) ((XmlBeansQueryExpression) m_precondition).getXmlObject());
-            prop.add(preconditionDoc);
-        }
-        if (m_selector != null) {
-            prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_SELECTOR);
-            SelectorDocument selectorDoc = SelectorDocument.Factory.newInstance();
-            selectorDoc.setSelector((QueryExpressionType) ((XmlBeansQueryExpression) m_selector).getXmlObject());
-            prop.add(selectorDoc);
-        }
-        if (m_policy != null) {
-            prop = m_propSet.get(SubscriptionManagerPortType.PROP_QNAME_SUBSCRIPTION_POLICY);
-            SubscriptionPolicyDocument subPolicyDoc = SubscriptionPolicyDocument.Factory.newInstance();
-            subPolicyDoc.setSubscriptionPolicy(null);
-            prop.add(subPolicyDoc);
-        }
-    }
-
-
-    /**
-     * Get the subscriptionEnd consumer associated with this subscription.
-     *
-     * @return the subscriptionEnd consumer
-     */
-    public SubscriptionEndConsumer getSubscriptionEndConsumer() {
-        return null;   //todo *SJC* pubsub stuff
-    }
-}
+/*=============================================================================*
+ *  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.base.v2004_06.impl;
+
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.notification.base.impl.AbstractSubscription;
+import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
+import org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+import org.apache.ws.resource.lifetime.callback.CurrentTimeCallback;
+import org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.ResourcePropertySetMetaData;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySetMetaData;
+import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ConsumerReferenceDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.CreationTimeDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PreconditionDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SelectorDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscriptionManagerRPDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscriptionPolicyDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.UseNotifyDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.CurrentTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.TerminationTimeDocument;
+import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import javax.xml.namespace.QName;
+
+/**
+ * The resource for the builtin SubscriptionManager service.
+ */
+public class SubscriptionResource
+   extends AbstractSubscription
+{
+   private static final QName[] READ_ONLY_PROP_NAMES =
+      {
+         ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME,
+         ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME,
+         SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME
+      };
+
+   /**
+    * Creates a new {@link SubscriptionResource} object.
+    *
+    * @param consumerReference DOCUMENT_ME
+    * @param producerReference DOCUMENT_ME
+    * @param producerId DOCUMENT_ME
+    * @param producerHomeLocation DOCUMENT_ME
+    * @param topicExpression DOCUMENT_ME
+    */
+   public SubscriptionResource( EndpointReference consumerReference,
+                                EndpointReference producerReference,
+                                Object            producerId,
+                                String            producerHomeLocation,
+                                TopicExpression   topicExpression )
+   {
+      super( consumerReference, producerReference, producerHomeLocation, producerId, topicExpression );
+   }
+
+   /**
+    * Get the subscriptionEnd consumer associated with this subscription.
+    *
+    * @return the subscriptionEnd consumer
+    */
+   public SubscriptionEndConsumer getSubscriptionEndConsumer(  )
+   {
+      return null; //todo *SJC* pubsub stuff
+   }
+
+   /**
+    * DOCUMENT_ME
+    */
+   public void init(  )
+   {
+      SubscriptionManagerRPDocument propsDoc        = SubscriptionManagerRPDocument.Factory.newInstance(  );
+      ResourcePropertySetMetaData   propSetMetaData =
+         new XmlBeansResourcePropertySetMetaData( propsDoc.schemaType(  ), READ_ONLY_PROP_NAMES );
+      m_propSet = new XmlBeansResourcePropertySet( propsDoc, propSetMetaData );
+
+      // wsrlw:ScheduledResourceTermination props
+      ResourceProperty    prop        =
+         m_propSet.get( ScheduledResourceTerminationPortType.PROP_QNAME_CURRENT_TIME );
+      CurrentTimeDocument currTimeDoc = CurrentTimeDocument.Factory.newInstance(  );
+      currTimeDoc.setCurrentTime( getCurrentTime(  ) );
+      prop.setCallback( new CurrentTimeCallback(  ) );
+      prop.add( currTimeDoc );
+      prop = m_propSet.get( ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
+      TerminationTimeDocument termTimeDoc = TerminationTimeDocument.Factory.newInstance(  );
+      termTimeDoc.setTerminationTime( getTerminationTime(  ) );
+      prop.add( termTimeDoc );
+
+      // wsntw:SubscriptionManager props
+      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_CONSUMER_REFERENCE );
+      ConsumerReferenceDocument consumerRefDoc = ConsumerReferenceDocument.Factory.newInstance(  );
+      consumerRefDoc.setConsumerReference( (EndpointReferenceType) ( (XmlObjectWrapper) m_consumerReference )
+                                           .getXmlObject(  ) );
+      prop.add( consumerRefDoc );
+      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME );
+      CreationTimeDocument creationTimeDoc = CreationTimeDocument.Factory.newInstance(  );
+      creationTimeDoc.setCreationTime( m_creationTime );
+      prop.add( creationTimeDoc );
+      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_TOPIC_EXPRESSION );
+      TopicExpressionDocument topicExprDoc = TopicExpressionDocument.Factory.newInstance(  );
+      topicExprDoc.setTopicExpression( (TopicExpressionType) ( (XmlBeansTopicExpression) m_topicExpression )
+                                       .getXmlObject(  ) );
+      prop.add( topicExprDoc );
+      prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_USE_NOTIFY );
+      UseNotifyDocument useNotifyDoc = UseNotifyDocument.Factory.newInstance(  );
+      useNotifyDoc.setUseNotify( m_useNotify );
+      prop.add( useNotifyDoc );
+      if ( m_precondition != null )
+      {
+         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_PRECONDITION );
+         PreconditionDocument preconditionDoc = PreconditionDocument.Factory.newInstance(  );
+         preconditionDoc.setPrecondition( (QueryExpressionType) ( (XmlBeansQueryExpression) m_precondition )
+                                          .getXmlObject(  ) );
+         prop.add( preconditionDoc );
+      }
+
+      if ( m_selector != null )
+      {
+         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_SELECTOR );
+         SelectorDocument selectorDoc = SelectorDocument.Factory.newInstance(  );
+         selectorDoc.setSelector( (QueryExpressionType) ( (XmlBeansQueryExpression) m_selector ).getXmlObject(  ) );
+         prop.add( selectorDoc );
+      }
+
+      if ( m_policy != null )
+      {
+         prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_SUBSCRIPTION_POLICY );
+         SubscriptionPolicyDocument subPolicyDoc = SubscriptionPolicyDocument.Factory.newInstance(  );
+         subPolicyDoc.setSubscriptionPolicy( null );
+         prop.add( subPolicyDoc );
+      }
+   }
+}
\ No newline at end of file