You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-dev@ws.apache.org by sc...@apache.org on 2005/04/25 17:24:43 UTC

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

Author: scamp
Date: Mon Apr 25 08:24:42 2005
New Revision: 164586

URL: http://svn.apache.org/viewcvs?rev=164586&view=rev
Log: (empty)

Added:
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/BaseNotification1_2Constants.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/Subscription1_2Resource.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/WsnNamespaceVersionHolderImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationConsumerPortType.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationProducerPortType.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/SubscriptionManagerPortType.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java
    incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/SubscriptionManagerPortTypeImpl.java

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/BaseNotification1_2Constants.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/BaseNotification1_2Constants.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/BaseNotification1_2Constants.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/BaseNotification1_2Constants.java Mon Apr 25 08:24:42 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_6;
+
+/**
+ * Constants defined by the WS-BaseNotification 1.2 specification.
+ */
+public interface BaseNotification1_2Constants
+{
+
+    /**
+     * Namespace URI of the WS-BaseNotification 1.2 schema.
+     */
+    String NSURI_WSNT_SCHEMA = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.xsd";
+
+    /**
+     * Namespace prefix of the WS-BaseNotification 1.2 schema.
+     */
+    String NSPREFIX_WSNT_SCHEMA = "wsnt";
+
+    /**
+     * Namespace URI of the WS-BaseNotification 1.2 WSDL.
+     */
+    String NSURI_WSNT_WSDL = "http://docs.oasis-open.org/wsn/2004/06/wsn-WS-BaseNotification-1.2-draft-01.wsdl";
+
+    /**
+     * Namespace prefix of the WS-BaseNotification 1.2 WSDL.
+     */
+    String NSPREFIX_WSNT_WSDL = "wsntw";
+
+    /**
+     * The value to use for the wsa:Action header in outgoing Notify messages.
+     */ 
+    String NOTIFY_ACTION_URL = BaseNotification1_2Constants.NSURI_WSNT_WSDL + "/Notify";
+
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/Subscription1_2Resource.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/Subscription1_2Resource.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/Subscription1_2Resource.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/Subscription1_2Resource.java Mon Apr 25 08:24:42 2005
@@ -0,0 +1,135 @@
+/*=============================================================================*
+ *  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_6.impl;
+
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+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_6.porttype.SubscriptionManagerPortType;
+import org.apache.ws.notification.topics.TopicExpression;
+import org.apache.ws.resource.ResourceKey;
+import org.apache.ws.resource.lifetime.callback.CurrentTimeCallback;
+import org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType;
+import org.apache.ws.resource.lifetime.ResourceTerminationListener;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertySetMetaData;
+import org.apache.ws.resource.properties.ResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySetMetaData;
+import org.apache.ws.resource.properties.query.QueryExpression;
+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;
+import java.util.Calendar;
+import java.util.List;
+import java.util.ArrayList;
+
+/**
+ * TODO
+ */
+public class Subscription1_2Resource 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 Subscription1_2Resource( EndpointReference consumerReference, EndpointReference producerReference,
+                                    Calendar initialTerminationTime, Object policy, QueryExpression precondition,
+                                    QueryExpression selector, ResourceKey producerKey, String producerHomeLocation,
+                                    TopicExpression topicExpression, boolean useNotify )
+    {
+        super( consumerReference, producerReference, initialTerminationTime, policy, precondition, selector,
+                producerKey, producerHomeLocation, topicExpression, useNotify );
+    }
+
+    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( Calendar.getInstance() );
+        prop.add( currTimeDoc );
+        prop.setCallback( new CurrentTimeCallback() );
+        prop = m_propSet.get( ScheduledResourceTerminationPortType.PROP_QNAME_TERMINATION_TIME );
+        TerminationTimeDocument termTimeDoc = TerminationTimeDocument.Factory.newInstance();
+        termTimeDoc.setNilTerminationTime();
+
+        // 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_6/impl/WsnNamespaceVersionHolderImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/WsnNamespaceVersionHolderImpl.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/WsnNamespaceVersionHolderImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/impl/WsnNamespaceVersionHolderImpl.java Mon Apr 25 08:24:42 2005
@@ -0,0 +1,28 @@
+package org.apache.ws.notification.base.v2004_6.impl;
+
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.v2004_6.BaseNotification1_2Constants;
+import org.apache.ws.notification.topics.v1_2.Topics1_2Constants;
+import org.apache.ws.resource.properties.v2004_06.impl.NamespaceVersionHolderImpl;
+
+
+/**
+ * @author Sal Campana
+ */
+public class WsnNamespaceVersionHolderImpl extends NamespaceVersionHolderImpl implements WsnNamespaceVersionHolder
+{
+    public String getTopicsXsdNamespace()
+    {
+        return Topics1_2Constants.NSURI_WSTOP_SCHEMA;
+    }
+
+    public String getBaseNotificationXsdNamespace()
+    {
+        return BaseNotification1_2Constants.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_6/porttype/NotificationConsumerPortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationConsumerPortType.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationConsumerPortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationConsumerPortType.java Mon Apr 25 08:24:42 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_6.porttype;
+
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+import org.apache.ws.notification.base.v2004_6.BaseNotification1_2Constants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseNotification NotificationConsumer portType.
+ */
+public interface NotificationConsumerPortType
+{
+
+    QName NAME = new QName( BaseNotification1_2Constants.NSURI_WSNT_WSDL, "NotificationConsumer", BaseNotification1_2Constants.NSPREFIX_WSNT_WSDL );
+            
+    /**
+     * @param requestDoc
+     */
+    void notify( NotifyDocument requestDoc );
+
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationProducerPortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationProducerPortType.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationProducerPortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/NotificationProducerPortType.java Mon Apr 25 08:24:42 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_6.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_6.BaseNotification1_2Constants;
+
+import javax.xml.namespace.QName;
+
+/**
+ * The WS-BaseNotification NotificationProducer portType.
+ */
+public interface NotificationProducerPortType
+{
+
+    QName NAME = new QName( BaseNotification1_2Constants.NSURI_WSNT_WSDL, "NotificationProducer", BaseNotification1_2Constants.NSPREFIX_WSNT_WSDL );
+    QName PROPS_DOC_NAME = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "NotificationProducerRP", BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Topic property name.
+     */
+    QName PROP_QNAME_TOPIC = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA,
+            "Topic", BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * FixedTopicSet property name.
+     */
+    QName PROP_QNAME_FIXED_TOPIC_SET = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA,
+            "FixedTopicSet", BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * TopicExpressionDialects property name.
+     */
+    QName PROP_QNAME_TOPIC_EXPRESSION_DIALECTS = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA,
+            "TopicExpressionDialects", BaseNotification1_2Constants.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_6/porttype/SubscriptionManagerPortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/SubscriptionManagerPortType.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/SubscriptionManagerPortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/SubscriptionManagerPortType.java Mon Apr 25 08:24:42 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_6.porttype;
+
+import org.apache.ws.notification.base.v2004_6.BaseNotification1_2Constants;
+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( BaseNotification1_2Constants.NSURI_WSNT_WSDL, "SubscriptionManager",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_WSDL );
+    QName PROPS_DOC_NAME = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "SubscriptionManagerRP",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * ConsumerReference property name.
+     */
+    QName PROP_QNAME_CONSUMER_REFERENCE = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA,
+            "ConsumerReference", BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * TopicExpression property name.
+     */
+    QName PROP_QNAME_TOPIC_EXPRESSION = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "TopicExpression",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * UseNotify property name.
+     */
+    QName PROP_QNAME_USE_NOTIFY = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "UseNotify",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Precondition property name.
+     */
+    QName PROP_QNAME_PRECONDITION = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "Precondition",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * Selector property name.
+     */
+    QName PROP_QNAME_SELECTOR = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "Selector",
+            BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * SubscriptionPolicy property name.
+     */
+    QName PROP_QNAME_SUBSCRIPTION_POLICY = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA,
+            "SubscriptionPolicy", BaseNotification1_2Constants.NSPREFIX_WSNT_SCHEMA );
+
+    /**
+     * CreationTime property name.
+     */
+    QName PROP_QNAME_CREATION_TIME = new QName( BaseNotification1_2Constants.NSURI_WSNT_SCHEMA, "CreationTime",
+            BaseNotification1_2Constants.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_6/porttype/impl/NotificationConsumerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationConsumerPortTypeImpl.java Mon Apr 25 08:24:42 2005
@@ -0,0 +1,39 @@
+/*=============================================================================*
+ *  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_6.porttype.impl;
+
+import org.apache.ws.notification.base.v2004_6.porttype.NotificationConsumerPortType;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument;
+
+/**
+ * TODO
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class NotificationConsumerPortTypeImpl implements NotificationConsumerPortType
+{
+
+    public void subscribe( NotifyDocument requestDoc )
+    {
+        // TODO
+        return;
+    }
+
+    public void notify(NotifyDocument requestDoc)
+    {
+
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/NotificationProducerPortTypeImpl.java Mon Apr 25 08:24:42 2005
@@ -0,0 +1,280 @@
+/*=============================================================================*
+ *  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_6.porttype.impl;
+
+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.impl.SubscriptionHome;
+import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
+import org.apache.ws.notification.base.impl.faults.SubscribeCreationFailedFaultException;
+import org.apache.ws.notification.base.v2004_6.impl.Subscription1_2Resource;
+import org.apache.ws.notification.base.v2004_6.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.notification.base.v2004_6.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicExpression;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener;
+import org.apache.ws.notification.topics.impl.faults.NoCurrentMessageOnTopicFaultException;
+import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException;
+import org.apache.ws.pubsub.DeliveryMode;
+import org.apache.ws.pubsub.Filter;
+import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.NotificationProducer;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+import org.apache.ws.pubsub.TopicFilter;
+import org.apache.ws.pubsub.XPathFilter;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.ResourceContextException;
+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.AttributedURI;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.directory.SchemaViolationException;
+import javax.xml.rpc.JAXRPCException;
+import java.util.Calendar;
+import java.util.Collection;
+import java.util.Iterator;
+
+/**
+ * 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, NotificationProducer
+{
+
+    public NotificationProducerPortTypeImpl( ResourceContext resourceContext )
+    {
+        super( resourceContext );
+    }
+
+    public SubscribeResponseDocument subscribe( SubscribeDocument requestDoc )
+    {
+        SubscribeDocument.Subscribe request = requestDoc.getSubscribe();
+
+        //make sure to check if optional elements are set in request...
+        Calendar initialTerminationTime = null;
+        if(request.getInitialTerminationTime() != null)
+        {
+            initialTerminationTime = request.getInitialTerminationTime();
+        }
+
+        QueryExpression precondition = null;
+        if(request.getPrecondition() != null)
+        {
+            precondition = new XmlBeansQueryExpression( request.getPrecondition() );
+        }
+
+        QueryExpression selector = null;
+        if(request.getSelector() != null)
+        {
+            selector = new XmlBeansQueryExpression( request.getSelector() );
+        }
+
+        XmlObject subPolicy = null;
+        if(request.getSubscriptionPolicy() != null)
+        {
+            subPolicy = request.getSubscriptionPolicy();
+        }
+
+        EndpointReferenceType epr = null;
+        try
+        {
+            TopicExpression topicExpr = new XmlBeansTopicExpression( request.getTopicExpression() );
+            //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 = buildEPR( getResourceContext() );
+
+            Context initialContext = new InitialContext(  );
+            SubscriptionHome subscriptionHome = (SubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
+          
+            Subscription subscription = subscriptionHome.create(Subscription1_2Resource.class, new XmlBeansEndpointReference(request.getConsumerReference()), producerEPR, initialTerminationTime,subPolicy, precondition, selector,getResourceKey(), ((AbstractResourceContext)getResourceContext()).getResourceHomeLocation(),topicExpr,useNotify );
+            subscription.setNotificationProducer(this);
+            epr = (EndpointReferenceType) ((XmlObjectWrapper)subscription.getEpr()).getXmlObject();
+
+            Collection collection = evaluateTopicExpression(topicExpr);
+            SimpleSubscriptionTopicListener simpleSubscriptionTopicListener = new SimpleSubscriptionTopicListener(subscription);
+            //add listeners
+            for (Iterator iterator = collection.iterator(); iterator.hasNext();)
+            {
+                Topic topic = (Topic) iterator.next();
+                topic.addTopicListener(simpleSubscriptionTopicListener);
+            }
+        }
+        catch (Exception e)
+        {
+            throw new SubscribeCreationFailedFaultException(new WsnNamespaceVersionHolderImpl(),"Subscribe failed, reason: " + e.getLocalizedMessage());
+        }
+
+
+        SubscribeResponseDocument subscribeResponseDocument = SubscribeResponseDocument.Factory.newInstance();
+        SubscribeResponseDocument.SubscribeResponse subscribeResponse = subscribeResponseDocument.addNewSubscribeResponse();
+        subscribeResponse.setSubscriptionReference( epr);
+        return subscribeResponseDocument;
+    }
+
+    private Collection evaluateTopicExpression(TopicExpression topicExpr)
+    {
+        NotificationProducerResource resource = (NotificationProducerResource) getResource();
+        TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet();
+
+        Collection collection = null;
+        try
+        {
+            collection = topicSpaceSet.evaluateExpression(topicExpr);
+        }
+        catch (TopicExpressionException e)
+        {
+            throw new JAXRPCException("An exception occurred evaluating a TopicExpression. ", e);
+        }
+
+
+        return collection;
+    }
+
+    private static XmlBeansEndpointReference buildEPR( ResourceContext resourceContext )
+    {
+        EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance();
+        EndpointReferenceType epr = eprDoc.addNewEndpointReference();
+        AttributedURI address = epr.addNewAddress();
+        address.setStringValue( resourceContext.getServiceURL().toString() );
+        // TODO: set portType and serviceName! (read from config file)
+        ReferencePropertiesType refProps = epr.addNewReferenceProperties();
+        try
+        {
+            XmlBeanUtils.addChildElement( refProps, resourceContext.getResourceKey().getName() );
+        }
+        catch ( ResourceContextException rce )
+        {
+            throw new JAXRPCException( rce );
+        }
+        return new XmlBeansEndpointReference(epr);
+    }
+
+    public GetCurrentMessageResponseDocument getCurrentMessage( GetCurrentMessageDocument requestDoc )
+    {
+        GetCurrentMessageDocument.GetCurrentMessage request = requestDoc.getGetCurrentMessage();
+        TopicExpressionType topicExprMess = request.getTopic();
+        Collection collection = null;
+        try
+        {
+            TopicExpression topicExpr = new XmlBeansTopicExpression( topicExprMess );
+            collection = evaluateTopicExpression(topicExpr);
+        }
+        catch ( SchemaViolationException e)
+        {
+            throw new JAXRPCException("An exception occurred: ",e);
+        }
+
+        if(collection.size() < 1)
+        {
+            throw new NoCurrentMessageOnTopicFaultException(new WsnNamespaceVersionHolderImpl(),"There was no current message to retrieve.");
+        }
+
+        GetCurrentMessageResponseDocument message = GetCurrentMessageResponseDocument.Factory.newInstance();
+            GetCurrentMessageResponseDocument.GetCurrentMessageResponse response = message.addNewGetCurrentMessageResponse();
+        if(collection.size() > 1)
+        {
+            throw new JAXRPCException("The topicexpression for GetCurrentMessage return more than 1 value!  This is an invalid request.");
+        }
+        else
+        {
+            Topic topic = (Topic) collection.iterator().next();
+            XmlObject currentMessage = (XmlObject) topic.getCurrentMessage();
+
+            XmlBeanUtils.addChildElement(response, currentMessage);
+        }
+
+        //todo need to throw appropriate exceptions...
+        return message;
+    }
+
+    /**
+     * Returns this producer's endpoint reference.
+     *
+     * @return this producer's endpoint reference
+     */
+    public EndpointReference getEPR()
+    {
+        return buildEPR(getResourceContext());
+    }
+
+    /**
+     * Subscribe to notifications from this producer.
+     *
+     * @param notificationConsumer
+     * @param subscriptionEndConsumer the callback Interface for SubscriptionEnd Notifications, or null if no SubscriptionEnd should be send
+     * @param filters
+     * @param initialTerminationTime
+     * @param deliveryMode            the notification delivery mode, or null to use default mode
+     * @return the subscription
+     */
+    public org.apache.ws.pubsub.Subscription subscribe(NotificationConsumer notificationConsumer, SubscriptionEndConsumer subscriptionEndConsumer, TopicFilter tf, XPathFilter xf, Calendar initialTerminationTime, boolean UseNotify)
+    {
+        return null;    //todo
+    }
+
+    /**
+     * Subscribe to notifications from this producer.
+     *
+     * @param notificationConsumer
+     * @param filters
+     * @param initialTerminationTime
+     * @param deliveryMode           the notification delivery mode, or null to use default mode
+     * @param policy                 a policy to be associated with the subscription, or null if no policy should be used
+     * @return the subscription
+     */
+    public org.apache.ws.pubsub.Subscription subscribe(NotificationConsumer notificationConsumer, Filter filters[], Calendar initialTerminationTime, DeliveryMode deliveryMode, Object policy)
+    {
+        return null;
+    }
+
+    /**
+     * Returns the last notification message published for the given set of filters.
+     *
+     * @param filters
+     * @return
+     */
+    public Object getCurrentMessage(Filter filters[])
+    {
+        return null;
+    }
+
+    protected NamespaceVersionHolder getNamespaceSet()
+    {
+        return null; // not currently used - will be needed once we need to support multiple spec versions
+    }
+
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/SubscriptionManagerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/SubscriptionManagerPortTypeImpl.java?rev=164586&view=auto
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/SubscriptionManagerPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/v2004_6/porttype/impl/SubscriptionManagerPortTypeImpl.java Mon Apr 25 08:24:42 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_6.porttype.impl;
+
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.impl.faults.PauseFailedFaultException;
+import org.apache.ws.notification.base.impl.faults.ResumeFailedFaultException;
+import org.apache.ws.notification.base.v2004_6.porttype.SubscriptionManagerPortType;
+import org.apache.ws.notification.base.v2004_6.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;
+
+/**
+ * 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: hermes-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: hermes-dev-help@ws.apache.org