Author: ips
Date: Thu May 12 16:23:40 2005
New Revision: 169910

URL: http://svn.apache.org/viewcvs?rev=169910&view=rev
Log:
fixed typo in package name

Added:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionService.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/WsnNamespaceVersionHolderImpl.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationConsumerPortType.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationProducerPortType.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/SubscriptionManagerPortType.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
    
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/BaseNotificationConstants.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,49 @@
+/*=============================================================================*
+ *  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";
+
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionHome.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,153 @@
+/*=============================================================================*
+ *  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.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.Resource;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceContextException;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.ResourceKey;
+import org.apache.ws.resource.ResourceUnknownException;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+import org.apache.ws.resource.properties.query.QueryExpression;
+
+import javax.xml.namespace.QName;
+import java.lang.reflect.Constructor;
+import java.util.Calendar;
+
+/**
+ * TODO
+ */
+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;
+
+    /**
+     * @param resourceContext
+     *
+     * @return
+     *
+     * @throws ResourceException
+     * @throws ResourceContextException
+     * @throws ResourceUnknownException
+     */
+    public Resource getInstance( ResourceContext resourceContext ) throws 
ResourceException, ResourceContextException,
+            ResourceUnknownException
+    {
+        return find( resourceContext.getResourceKey() );
+    }
+
+    public Subscription create( Class subscriptionResourceClass,
+                                EndpointReference consumerReference,
+                                EndpointReference producerReference,
+                                Calendar initialTerminationTime,
+                                Object policy,
+                                QueryExpression precondition,
+                                QueryExpression selector,
+                                ResourceKey producerKey,
+                                String producerHomeLocation,
+                                TopicExpression topicExpression,
+                                boolean useNotify, WsnNamespaceVersionHolder 
nsSet ) throws ResourceException
+    {
+        try
+        {
+            Constructor constructor = 
subscriptionResourceClass.getConstructor( new Class[]{
+                EndpointReference.class,
+                EndpointReference.class,
+                ResourceKey.class,
+                String.class,
+                TopicExpression.class} );
+            Subscription subscription = (Subscription) constructor.newInstance(
+                    new Object[]{consumerReference, producerReference, 
producerKey, 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();
+            SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( 
QName.valueOf( getResourceKeyName() ), id );
+            EndpointReference subscriptionEPR = getEndpointReference( 
getSubscriptionAddress( producerReference ),
+                    resourceKey, nsSet.getAddressingNamespace() );
+            subscription.setEndpointReference( subscriptionEPR );
+            add( resourceKey, subscription );
+            return subscription;
+        }
+        catch ( Exception e )
+        {
+            throw new ResourceException( "Failed to create Subscription 
resource." );
+        }
+    }
+
+    private String getSubscriptionAddress( EndpointReference producerReference 
)
+    {
+        String producerAddress = producerReference.getAddress();
+        return producerAddress.substring( 0, producerAddress.lastIndexOf( "/" 
) + 1 ) + SERVICE_NAME;
+    }
+
+    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;
+    }
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionResource.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,126 @@
+/*=============================================================================*
+ *  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.ResourceKey;
+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;
+
+/**
+ * TODO
+ */
+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,
+                                 ResourceKey producerKey, String 
producerHomeLocation,
+                                 TopicExpression topicExpression )
+    {
+        super( consumerReference, producerReference,
+                producerKey, producerHomeLocation, 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.add( currTimeDoc );
+        //prop.setCallback( new CurrentTimeCallback() );
+        prop = m_propSet.get( 
ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
+        TerminationTimeDocument termTimeDoc = 
TerminationTimeDocument.Factory.newInstance();
+        termTimeDoc.setTerminationTime( getTerminationTime() );
+        // 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 = m_propSet.get( 
SubscriptionManagerPortType.PROP_QNAME_CREATION_TIME );
+        CreationTimeDocument creationTimeDoc = 
CreationTimeDocument.Factory.newInstance();
+        creationTimeDoc.setCreationTime( m_creationTime );
+        prop = m_propSet.get( 
SubscriptionManagerPortType.PROP_QNAME_PRECONDITION );
+        PreconditionDocument preconditionDoc = 
PreconditionDocument.Factory.newInstance();
+        preconditionDoc.setPrecondition(
+                (QueryExpressionType) ( (XmlBeansQueryExpression) 
m_precondition ).getXmlObject() );
+        prop = m_propSet.get( SubscriptionManagerPortType.PROP_QNAME_SELECTOR 
);
+        SelectorDocument selectorDoc = SelectorDocument.Factory.newInstance();
+        selectorDoc.setSelector( (QueryExpressionType) ( 
(XmlBeansQueryExpression) m_selector ).getXmlObject() );
+        prop = m_propSet.get( 
SubscriptionManagerPortType.PROP_QNAME_SUBSCRIPTION_POLICY );
+        SubscriptionPolicyDocument subPolicyDoc = 
SubscriptionPolicyDocument.Factory.newInstance();
+        subPolicyDoc.setSubscriptionPolicy( null );
+        prop = m_propSet.get( 
SubscriptionManagerPortType.PROP_QNAME_TOPIC_EXPRESSION );
+        TopicExpressionDocument topicExprDoc = 
TopicExpressionDocument.Factory.newInstance();
+        topicExprDoc.setTopicExpression( (TopicExpressionType) ( 
(XmlBeansTopicExpression) m_selector ).getXmlObject() );
+        prop = m_propSet.get( 
SubscriptionManagerPortType.PROP_QNAME_USE_NOTIFY );
+        UseNotifyDocument useNotifyDoc = 
UseNotifyDocument.Factory.newInstance();
+        useNotifyDoc.setUseNotify( m_useNotify );
+    }
+
+    public void setResourcePropertySet( ResourcePropertySet 
resourcePropertySet )
+    {
+        //todo
+    }
+
+    /**
+     * Get the subscriptionEnd consumer associated with this subscription.
+     *
+     * @return the subscriptionEnd consumer
+     */
+    public SubscriptionEndConsumer getSubscriptionEndConsumer()
+    {
+        return null;   //todo
+    }
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionService.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionService.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionService.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/SubscriptionService.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,163 @@
+package org.apache.ws.notification.base.v2004_06.impl;
+
+import org.apache.ws.resource.handler.SoapMethodNameMap;
+import org.apache.ws.resource.handler.ServiceSoapMethodNameMap;
+import org.apache.ws.resource.handler.WsrfService;
+import org.apache.ws.resource.ResourceContext;
+import 
org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
+import 
org.apache.ws.notification.base.v2004_06.porttype.impl.SubscriptionManagerPortTypeImpl;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionDocument;
+
+import javax.xml.namespace.QName;
+
+
+/**
+ * Implementation of the SubscriptionService
+ * 
+ * @author Sal Campana
+ */
+public class SubscriptionService implements WsrfService  , 
SubscriptionManagerPortType,
+                                            
org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType,
+                                            
org.apache.ws.resource.properties.v2004_06.porttype.GetResourcePropertyPortType,
+                                            
org.apache.ws.resource.lifetime.v2004_06.porttype.ImmediateResourceTerminationPortType
+{
+    public static final String TARGET_NSURI = 
"http://ws.apache.org/notification/base/service/SubscriptionManager";;
+    public static final String TARGET_NSPREFIX = "SubscriptionManager";
+    private ResourceContext m_resourceContext;
+    /**
+       * DOCUMENT_ME
+       */
+      private ServiceSoapMethodNameMap m_methodNameMap;
+
+      /**
+       * DOCUMENT_ME
+       */
+      private boolean m_isInitialized;
+
+   /**
+    * Creates a new [EMAIL PROTECTED] SubscriptionService } object.
+    *
+    * @param resourceContext DOCUMENT_ME
+    */
+   public SubscriptionService( ResourceContext resourceContext )
+   {
+      m_resourceContext = resourceContext;
+      init();
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestQname DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public String getMethodName( QName requestQname )
+   {
+      if ( !m_isInitialized )
+      {
+         init(  );
+      }
+
+      return m_methodNameMap.getMethodName( requestQname );
+   }
+
+  /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public ResourceContext getResourceContext(  )
+   {
+      return m_resourceContext;
+   }
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public final SoapMethodNameMap getMethodNameMap(  )
+   {
+      return m_methodNameMap;
+   }
+
+      /**
+       * DOCUMENT_ME
+       */
+   public void init(  )
+   {
+      m_methodNameMap    = new ServiceSoapMethodNameMap( getResourceContext(  
) );
+      m_isInitialized      = true;
+   }
+
+
+      /**
+       * DOCUMENT_ME
+       *
+       * @return DOCUMENT_ME
+       */
+   protected final boolean isInitialized(  )
+   {
+         return m_isInitialized;
+   }
+
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeResponseDocument
 setTerminationTime( 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.SetTerminationTimeDocument
 requestDoc )
+   {
+      return new 
org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ScheduledResourceTerminationPortTypeImpl(
 getResourceContext(  ) ).setTerminationTime( requestDoc );
+   }
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyResponseDocument
 getResourceProperty( 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.GetResourcePropertyDocument
 requestDoc )
+   {
+      return new 
org.apache.ws.resource.properties.v2004_06.porttype.impl.GetResourcePropertyPortTypeImpl(
 getResourceContext(  ) ).getResourceProperty( requestDoc );
+   }
+
+
+   /**
+    * DOCUMENT_ME
+    *
+    * @param requestDoc DOCUMENT_ME
+    *
+    * @return DOCUMENT_ME
+    */
+   public 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyResponseDocument
 destroy( 
org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceLifetime12Draft01.DestroyDocument
 requestDoc )
+   {
+      return new 
org.apache.ws.resource.lifetime.v2004_06.porttype.impl.ImmediateResourceTerminationPortTypeImpl(
 getResourceContext(  ) ).destroy( requestDoc );
+   }
+
+    /**
+     * @param requestDoc
+     * @return
+     */
+    public PauseSubscriptionResponseDocument 
pauseSubscription(PauseSubscriptionDocument requestDoc)
+    {
+        return new 
SubscriptionManagerPortTypeImpl(getResourceContext()).pauseSubscription(requestDoc);
+    }
+
+    /**
+     * @param requestDoc
+     * @return
+     */
+    public ResumeSubscriptionResponseDocument 
resumeSubscription(ResumeSubscriptionDocument requestDoc)
+    {
+        return new 
SubscriptionManagerPortTypeImpl(getResourceContext()).resumeSubscription(requestDoc);
+
+    }
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/WsnNamespaceVersionHolderImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/WsnNamespaceVersionHolderImpl.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/WsnNamespaceVersionHolderImpl.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/impl/WsnNamespaceVersionHolderImpl.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,27 @@
+package org.apache.ws.notification.base.v2004_06.impl;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
+import 
org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl;
+
+/**
+ * @author Sal Campana
+ */
+public class WsnNamespaceVersionHolderImpl extends NamespaceVersionHolderImpl 
implements WsnNamespaceVersionHolder
+{
+    public String getTopicsXsdNamespace()
+    {
+        return TopicsConstants.NSURI_WSTOP_SCHEMA;
+    }
+
+    public String getBaseNotificationXsdNamespace()
+    {
+        return BaseNotificationConstants.NSURI_WSNT_SCHEMA;
+    }
+
+    public String getBrokeredNotificationXsdNamespace()
+    {
+        return 
"http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BrokeredNotification-1.2-draft-01.xsd";;
+    }
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationConsumerPortType.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationConsumerPortType.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationConsumerPortType.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationConsumerPortType.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,36 @@
+/*=============================================================================*
+ *  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.porttype;
+
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseNotification NotificationConsumer portType.
+ */
+public interface NotificationConsumerPortType
+{
+
+    QName NAME = new QName( BaseNotificationConstants.NSURI_WSNT_WSDL, 
"NotificationConsumer", BaseNotificationConstants.NSPREFIX_WSNT_WSDL );
+            
+    /**
+     * @param requestDoc
+     */
+    void notify( NotifyDocument requestDoc );
+
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationProducerPortType.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationProducerPortType.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationProducerPortType.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/NotificationProducerPortType.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,67 @@
+/*=============================================================================*
+ *  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.porttype;
+
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument;
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseNotification NotificationProducer portType.
+ */
+public interface NotificationProducerPortType
+{
+
+    QName NAME = new QName( BaseNotificationConstants.NSURI_WSNT_WSDL, 
"NotificationProducer", BaseNotificationConstants.NSPREFIX_WSNT_WSDL );
+    QName PROPS_DOC_NAME = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "NotificationProducerRP", 
BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Topic property name.
+     */
+    QName PROP_QNAME_TOPIC = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA,
+            "Topic", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * FixedTopicSet property name.
+     */
+    QName PROP_QNAME_FIXED_TOPIC_SET = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA,
+            "FixedTopicSet", BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * TopicExpressionDialects property name.
+     */
+    QName PROP_QNAME_TOPIC_EXPRESSION_DIALECTS = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA,
+            "TopicExpressionDialects", 
BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     *
+     * @param requestDoc
+     * @return
+     */
+    SubscribeResponseDocument subscribe( SubscribeDocument requestDoc );
+
+    /**
+     *
+     * @param requestDoc
+     * @return
+     */
+    GetCurrentMessageResponseDocument getCurrentMessage( 
GetCurrentMessageDocument requestDoc );
+
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/SubscriptionManagerPortType.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/SubscriptionManagerPortType.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/SubscriptionManagerPortType.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/SubscriptionManagerPortType.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,93 @@
+/*=============================================================================*
+ *  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.porttype;
+
+import org.apache.ws.notification.base.v2004_06.BaseNotificationConstants;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionResponseDocument;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseNotification SubscriptionManager portType.
+ */
+public interface SubscriptionManagerPortType
+{
+
+    QName NAME = new QName( BaseNotificationConstants.NSURI_WSNT_WSDL, 
"SubscriptionManager",
+            BaseNotificationConstants.NSPREFIX_WSNT_WSDL );
+    QName PROPS_DOC_NAME = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "SubscriptionManagerRP",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * ConsumerReference property name.
+     */
+    QName PROP_QNAME_CONSUMER_REFERENCE = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA,
+            "ConsumerReference", 
BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * TopicExpression property name.
+     */
+    QName PROP_QNAME_TOPIC_EXPRESSION = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "TopicExpression",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * UseNotify property name.
+     */
+    QName PROP_QNAME_USE_NOTIFY = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "UseNotify",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Precondition property name.
+     */
+    QName PROP_QNAME_PRECONDITION = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "Precondition",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Selector property name.
+     */
+    QName PROP_QNAME_SELECTOR = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "Selector",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * SubscriptionPolicy property name.
+     */
+    QName PROP_QNAME_SUBSCRIPTION_POLICY = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA,
+            "SubscriptionPolicy", 
BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * CreationTime property name.
+     */
+    QName PROP_QNAME_CREATION_TIME = new QName( 
BaseNotificationConstants.NSURI_WSNT_SCHEMA, "CreationTime",
+            BaseNotificationConstants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * @param requestDoc
+     *
+     * @return
+     */
+    PauseSubscriptionResponseDocument pauseSubscription( 
PauseSubscriptionDocument requestDoc );
+
+    /**
+     * @param requestDoc
+     *
+     * @return
+     */
+    ResumeSubscriptionResponseDocument resumeSubscription( 
ResumeSubscriptionDocument requestDoc );
+
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,205 @@
+/*=============================================================================*
+ *  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.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.notification.base.NotificationProducerResource;
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import 
org.apache.ws.notification.base.faults.InvalidTopicExpressionFaultException;
+import 
org.apache.ws.notification.base.faults.NoCurrentMessageOnTopicFaultException;
+import 
org.apache.ws.notification.base.faults.SubscribeCreationFailedFaultException;
+import 
org.apache.ws.notification.base.faults.TopicPathDialectUnknownFaultException;
+import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
+import org.apache.ws.notification.base.v2004_06.impl.SubscriptionHome;
+import org.apache.ws.notification.base.v2004_06.impl.SubscriptionResource;
+import 
org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import 
org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.Topic;
+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.expression.TopicPathDialectUnknownException;
+import org.apache.ws.notification.topics.impl.SubscriptionTopicListener;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.faults.BaseFaultException;
+import org.apache.ws.resource.impl.AbstractResourceContext;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import 
org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.query.QueryExpression;
+import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlObject;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Calendar;
+
+/**
+ * An implementation of the WS-BaseNotification NotificationProducer portType.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class NotificationProducerPortTypeImpl extends 
AbstractResourcePropertiesPortType
+        implements NotificationProducerPortType
+{
+
+    private static final Log LOG = 
LogFactory.getLog(NotificationProducerPortTypeImpl.class.getName());
+
+    public NotificationProducerPortTypeImpl( ResourceContext resourceContext )
+    {
+        super( resourceContext );
+    }
+
+    /**
+     * @see 
NotificationProducerPortType#subscribe(org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument)
+     */
+    public SubscribeResponseDocument subscribe( SubscribeDocument requestDoc )
+    {
+        SubscribeDocument.Subscribe request = requestDoc.getSubscribe();
+        TopicExpression topicExpr = new XmlBeansTopicExpression( 
request.getTopicExpression() );
+        Topic[] topics = evaluateTopicExpression( topicExpr );
+        if ( topics.length == 0 )
+        {
+            throw new InvalidTopicExpressionFaultException( new 
WsnNamespaceVersionHolderImpl(),
+                    "Given TopicExpression did not match any Topics supported 
by this NotificationProducer." );
+        }
+        Calendar initialTerminationTime = null;
+        if ( request.isSetInitialTerminationTime() )
+        {
+            initialTerminationTime = request.getInitialTerminationTime();
+        }
+        QueryExpression precondition = null;
+        if ( request.isSetPrecondition() )
+        {
+            precondition = new XmlBeansQueryExpression( 
request.getPrecondition() );
+        }
+        QueryExpression selector = null;
+        if ( request.isSetSelector() )
+        {
+            selector = new XmlBeansQueryExpression( request.getSelector() );
+        }
+        XmlObject subPolicy = null;
+        if ( request.isSetSubscriptionPolicy() )
+        {
+            subPolicy = request.getSubscriptionPolicy();
+        }
+        EndpointReferenceType subscriptionEPR = null;
+
+        //this prop has default values in schema...it "should" get a value 
either way if not explicitly set in request
+        boolean useNotify = request.isSetUseNotify() ? request.getUseNotify() 
: true;
+        EndpointReference producerEPR = getResource().getEndpointReference();
+        SubscriptionHome subscriptionHome = null;
+        try
+        {
+            subscriptionHome = (SubscriptionHome) new InitialContext().lookup(
+                            SubscriptionHome.HOME_LOCATION );
+        }
+        catch ( NamingException ne )
+        {
+            LOG.error( "Subscribe failed due to internal error: " + ne );
+            throw new BaseFaultException( getNamespaceSet(), "Subscribe failed 
due to internal server error." );
+        }
+        Subscription subscription = null;
+        try
+        {
+            subscription = subscriptionHome.create( SubscriptionResource.class,
+                            new XmlBeansEndpointReference( 
request.getConsumerReference() ), producerEPR, initialTerminationTime,
+                            subPolicy, precondition, selector, 
getResourceKey(),
+                            ( (AbstractResourceContext) getResourceContext() 
).getResourceHomeLocation(), topicExpr, useNotify, (WsnNamespaceVersionHolder) 
getNamespaceSet() );
+        }
+        catch ( Exception e )
+        {
+            LOG.error( "Subscribe failed due to internal error: " + e );
+            if ( LOG.isDebugEnabled() )
+            {
+                e.printStackTrace( );
+            }
+            throw new SubscribeCreationFailedFaultException( 
(WsnNamespaceVersionHolder) getNamespaceSet() );
+        }
+        SubscriptionTopicListener subscriptionTopicListener = new 
SubscriptionTopicListener( subscription );
+        for ( int i = 0; i < topics.length; i++ )
+        {
+            topics[i].addTopicListener( subscriptionTopicListener );
+        }
+        SubscribeResponseDocument subscribeResponseDoc = 
SubscribeResponseDocument.Factory.newInstance();
+        SubscribeResponseDocument.SubscribeResponse subscribeResponse = 
subscribeResponseDoc.addNewSubscribeResponse();
+        subscriptionEPR = (EndpointReferenceType) ( (XmlObjectWrapper) 
subscription.getEndpointReference() ).getXmlObject();
+        subscribeResponse.setSubscriptionReference( subscriptionEPR );
+        return subscribeResponseDoc;
+    }
+
+    /**
+     * @see 
NotificationProducerPortType#getCurrentMessage(org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument)
+     */
+    public GetCurrentMessageResponseDocument getCurrentMessage( 
GetCurrentMessageDocument requestDoc )
+    {
+        GetCurrentMessageDocument.GetCurrentMessage request = 
requestDoc.getGetCurrentMessage();
+        TopicExpressionType topicExprXmlBean = request.getTopic();
+        TopicExpression topicExpr = new XmlBeansTopicExpression( 
topicExprXmlBean );
+        Topic[] topics = evaluateTopicExpression( topicExpr );
+        if ( topics.length != 1 )
+        {
+            throw new InvalidTopicExpressionFaultException( new 
WsnNamespaceVersionHolderImpl(),
+                    "Given TopicExpression did not match exactly one Topic 
supported by this NotificationProducer." );
+        }
+        Topic topic = topics[0];
+        XmlObject currentMsg = (XmlObject) topic.getCurrentMessage();
+        if ( currentMsg == null )
+        {
+            throw new NoCurrentMessageOnTopicFaultException( 
(WsnNamespaceVersionHolder) getNamespaceSet() );
+        }
+        GetCurrentMessageResponseDocument responseDoc = 
GetCurrentMessageResponseDocument.Factory.newInstance();
+        GetCurrentMessageResponseDocument.GetCurrentMessageResponse response = 
responseDoc.addNewGetCurrentMessageResponse();
+        XmlBeanUtils.addChildElement( response, currentMsg );
+        return responseDoc;
+    }
+
+    private Topic[] evaluateTopicExpression( TopicExpression topicExpr )
+    {
+        try
+        {
+            NotificationProducerResource resource = 
(NotificationProducerResource) getResource();
+            TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet();
+            return topicSpaceSet.evaluateTopicExpression( topicExpr );
+        }
+        catch ( TopicPathDialectUnknownException tpdue )
+        {
+            throw new TopicPathDialectUnknownFaultException( 
(WsnNamespaceVersionHolder) getNamespaceSet(),
+                    tpdue.getLocalizedMessage() );
+        }
+        catch ( TopicExpressionException tee )
+        {
+            throw new BaseFaultException( getNamespaceSet(), 
tee.getLocalizedMessage() );
+        }
+    }
+
+    protected NamespaceVersionHolder getNamespaceSet()
+    {
+        return new WsnNamespaceVersionHolderImpl();
+    }
+
+}

Added: 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java
URL: 
http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java?rev=169910&view=auto
==============================================================================
--- 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java
 (added)
+++ 
incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java
 Thu May 12 16:23:40 2005
@@ -0,0 +1,94 @@
+/*=============================================================================*
+ *  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.porttype.impl;
+
+import org.apache.ws.notification.base.faults.PauseFailedFaultException;
+import org.apache.ws.notification.base.faults.ResumeFailedFaultException;
+import 
org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
+import 
org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import 
org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionResponseDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionDocument;
+import 
org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionResponseDocument;
+import org.apache.ws.notification.base.Subscription;
+
+/**
+ * An implementation of the WS-BaseNotification SubscriptionManager portType.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class SubscriptionManagerPortTypeImpl extends 
AbstractResourcePropertiesPortType
+        implements SubscriptionManagerPortType
+{
+
+    public SubscriptionManagerPortTypeImpl( ResourceContext resourceContext )
+    {
+        super( resourceContext );
+    }
+
+    public PauseSubscriptionResponseDocument pauseSubscription( 
PauseSubscriptionDocument requestDoc )
+    {
+        Subscription subscription = (Subscription) getResource();
+        try
+        {
+            subscription.pause();
+        }
+        catch ( Exception e )
+        {
+            throw new PauseFailedFaultException(new 
WsnNamespaceVersionHolderImpl(),"Pause failed on subscription: " + 
subscription.getID());
+        }
+        return createPauseSubscriptionResponseDocument();
+    }
+
+    public ResumeSubscriptionResponseDocument resumeSubscription( 
ResumeSubscriptionDocument requestDoc )
+    {
+        Subscription subscription = (Subscription) getResource();
+        try
+        {
+            subscription.resume();
+        }
+        catch ( Exception e )
+        {
+            throw new ResumeFailedFaultException(new 
WsnNamespaceVersionHolderImpl(),"Resume failed on subscription: " + 
subscription.getID());
+        }
+        return createResumeSubscriptionResponseDocument();
+    }
+
+    private PauseSubscriptionResponseDocument 
createPauseSubscriptionResponseDocument()
+    {
+        PauseSubscriptionResponseDocument responseDoc =
+                PauseSubscriptionResponseDocument.Factory.newInstance();
+        responseDoc.addNewPauseSubscriptionResponse();
+        return responseDoc;
+    }
+
+    private ResumeSubscriptionResponseDocument 
createResumeSubscriptionResponseDocument()
+    {
+        ResumeSubscriptionResponseDocument responseDoc =
+                ResumeSubscriptionResponseDocument.Factory.newInstance();
+        responseDoc.addNewResumeSubscriptionResponse();
+        return responseDoc;
+    }
+
+    protected NamespaceVersionHolder getNamespaceSet()
+    {
+        return null; // not currently used - will be needed once we need to 
support multiple spec versions
+    }
+
+}



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to