You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ch...@apache.org on 2006/06/05 13:44:53 UTC
svn commit: r411752 [1/2] - in /webservices/axis2/trunk/java: etc/
modules/savan/ modules/savan/conf/ modules/savan/src/
modules/savan/src/org/ modules/savan/src/org/apache/
modules/savan/src/org/apache/savan/
modules/savan/src/org/apache/savan/eventin...
Author: chamikara
Date: Mon Jun 5 04:44:51 2006
New Revision: 411752
URL: http://svn.apache.org/viewvc?rev=411752&view=rev
Log:
Added the 'Savan' module. A publisher/subscriber implementation for Axis2.
Currently basic support for the WS-Eventing specification (more work to be done).
Will add a sample soon.
Added:
webservices/axis2/trunk/java/modules/savan/
webservices/axis2/trunk/java/modules/savan/conf/
webservices/axis2/trunk/java/modules/savan/conf/module.xml
webservices/axis2/trunk/java/modules/savan/maven.xml
webservices/axis2/trunk/java/modules/savan/project.properties
webservices/axis2/trunk/java/modules/savan/project.xml
webservices/axis2/trunk/java/modules/savan/src/
webservices/axis2/trunk/java/modules/savan/src/org/
webservices/axis2/trunk/java/modules/savan/src/org/apache/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanConstants.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanException.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Delivery.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingConstants.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingPublicationProcessor.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Filter.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClient.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClientBean.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/SubscriptionStatus.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOnlyMessageReceiver.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/SavanModule.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationErrorReport.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationProcessor.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/RenewBean.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/AbstractSavanUtilFactory.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/CommonUtil.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/ProtocolManager.java
webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/SavanUtilFactory.java
webservices/axis2/trunk/java/modules/savan/test/
webservices/axis2/trunk/java/modules/savan/test-resources/
webservices/axis2/trunk/java/modules/savan/test/org/
webservices/axis2/trunk/java/modules/savan/test/org/apache/
webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/
webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/
webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConpositeSubscriberTest.java
Modified:
webservices/axis2/trunk/java/etc/project.properties
Modified: webservices/axis2/trunk/java/etc/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/etc/project.properties?rev=411752&r1=411751&r2=411752&view=diff
==============================================================================
--- webservices/axis2/trunk/java/etc/project.properties (original)
+++ webservices/axis2/trunk/java/etc/project.properties Mon Jun 5 04:44:51 2006
@@ -26,6 +26,7 @@
rampart_version=${version_number}
rahas_version=SNAPSHOT
soapmonitor_version=${version_number}
+savan_version=${version_number}
# -------------------------------------------------------------------
# Dependency Repositories
@@ -64,6 +65,7 @@
modules/integration/project.xml,\
modules/saaj/project.xml,\
modules/jibx/project.xml,\
+modules/savan/project.xml,\
${optional.includes}
#maven.multiproject.excludes=modules/tool/project.xml
Added: webservices/axis2/trunk/java/modules/savan/conf/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/conf/module.xml?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/conf/module.xml (added)
+++ webservices/axis2/trunk/java/modules/savan/conf/module.xml Mon Jun 5 04:44:51 2006
@@ -0,0 +1,24 @@
+<module name="Savan" class="org.apache.savan.module.SavanModule">
+
+ <inflow>
+ <handler name="SavanInHandler" class="org.apache.savan.handlers.SavanInHandler">
+ <order phase="OperationInPhase"/>
+ </handler>
+ </inflow>
+
+ <outflow>
+ <handler name="SavanOutHandler" class="org.apache.savan.handlers.SavanOutHandler">
+ <order phase="OperationOutPhase"/>
+ </handler>
+ </outflow>
+
+ <operation name="SavanInOutOperation" mep="http://www.w3.org/2004/08/wsdl/in-out">
+ <messageReceiver class="org.apache.savan.messagereceiver.SavanInOutMessageReceiver"/>
+
+ <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe</actionMapping>
+ <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew</actionMapping>
+ <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus</actionMapping>
+ <actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</actionMapping>
+ </operation>
+
+</module>
\ No newline at end of file
Added: webservices/axis2/trunk/java/modules/savan/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/maven.xml?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/maven.xml (added)
+++ webservices/axis2/trunk/java/modules/savan/maven.xml Mon Jun 5 04:44:51 2006
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!-- $Revision: 1.21 $ $Date: 2004-10-27 20:54:09 +0600 (Wed, 27 Oct 2004) $ -->
+
+<project default="jar"
+ xmlns:j="jelly:core"
+ xmlns:u="jelly:util"
+ xmlns:maven="jelly:maven"
+ xmlns:deploy="deploy"
+ xmlns:ant="jelly:ant">
+
+ <postGoal name="jar">
+
+ <mkdir dir="target/classes/META-INF"/>
+ <copy file="conf/module.xml"
+ tofile="target/classes/META-INF/module.xml"/>
+ <copy file="../../LICENSE.txt"
+ tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+ <mkdir dir="target/modules"/>
+
+ <jar jarfile="target/savan-${savan_version}.mar" basedir="target/classes">
+ <include name="**"/>
+ </jar>
+
+ </postGoal>
+
+
+ <postGoal name="jar:install">
+
+ <mkdir dir="target/classes/META-INF"/>
+ <copy file="conf/module.xml"
+ tofile="target/classes/META-INF/module.xml"/>
+ <copy file="../../LICENSE.txt"
+ tofile="target/classes/META-INF/LICENSE.txt" overwrite="true"/>
+ <mkdir dir="target/modules"/>
+
+ <jar jarfile="target/savan-${savan_version}.mar" basedir="target/classes">
+ <include name="**"/>
+ </jar>
+
+ <!-- copying the jar and mar files to the local repo-->
+ <copy file="target/savan-${savan_version}.mar"
+ tofile="${maven.repo.local}/axis2/mars/savan-${savan_version}.mar"/>
+
+ </postGoal>
+
+
+</project>
Added: webservices/axis2/trunk/java/modules/savan/project.properties
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/project.properties?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/project.properties (added)
+++ webservices/axis2/trunk/java/modules/savan/project.properties Mon Jun 5 04:44:51 2006
@@ -0,0 +1,17 @@
+# -------------------------------------------------------------------
+# Copyright 2001-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.
+# -------------------------------------------------------------------
+
+maven.multiproject.type=jar
Added: webservices/axis2/trunk/java/modules/savan/project.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/project.xml?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/project.xml (added)
+++ webservices/axis2/trunk/java/modules/savan/project.xml Mon Jun 5 04:44:51 2006
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+/*
+ * Copyright 2001-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.
+ */
+ -->
+<project>
+ <pomVersion>3</pomVersion>
+ <extend>../../etc/project.xml</extend>
+
+ <name>Apache Axis 2.0 - Savan</name>
+ <id>axis2-savan</id>
+ <groupId>axis2</groupId>
+ <description>Publisher/Subscriber implememtation for Axis2</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>ws-commons</groupId>
+ <artifactId>axiom-api</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>ws-commons</groupId>
+ <artifactId>axiom-impl</artifactId>
+ <version>${axiom.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>axis2</groupId>
+ <artifactId>axis2-common</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <dependency>
+ <groupId>wsdl4j</groupId>
+ <artifactId>wsdl4j</artifactId>
+ <version>${wsdl4j.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+
+ <dependency>
+ <groupId>axis2</groupId>
+ <artifactId>axis2-core</artifactId>
+ <version>${pom.currentVersion}</version>
+ </dependency>
+ <!-- external JARs -->
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ <version>${commons.logging.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>${stax.impl.groupid}</groupId>
+ <artifactId>${stax.impl.artifactid}</artifactId>
+ <version>${stax.impl.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>stax</groupId>
+ <artifactId>stax-api</artifactId>
+ <version>${stax.api.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>geronimo-spec</groupId>
+ <artifactId>geronimo-spec-activation</artifactId>
+ <version>${geronimo.spec.activation.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons.httpclient.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons.codec.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>backport-util-concurrent</groupId>
+ <artifactId>backport-util-concurrent</artifactId>
+ <version>${backport_util_concurrent.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <!--for java2wsdl generation we use JAM , so there should be a dependency on the annogen jar or-->
+ <!--XML Beans-->
+ <dependency>
+ <groupId>annogen</groupId>
+ <artifactId>annogen</artifactId>
+ <version>${annogen.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ <dependency>
+ <groupId>ws-commons</groupId>
+ <artifactId>neethi</artifactId>
+ <version>${neethi.version}</version>
+ <properties>
+ <module>true</module>
+ </properties>
+ </dependency>
+ </dependencies>
+
+ <reports/>
+</project>
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanConstants.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanConstants.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanConstants.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,46 @@
+/*
+ * Copyright 1999-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.savan;
+
+public interface SavanConstants {
+
+ String VALUE_TRUE = "true";
+ String VALUE_FALSE = "false";
+
+ int PROTOCOL_EVENTING = 1;
+ int PROTOCOL_NOTIFICATION = 2;
+
+ String PROTOCOL_VERSION = "SavanProtocolVersion";
+ String MESSAGE_TYPE = "SavanMessageType";
+
+ String PUBLICATION_MESSAGE = "SavanPublicationMessage";
+
+ interface MessageTypes {
+ int UNKNOWN = -1;
+ int SUBSCRIPTION_MESSAGE = 1;
+ int SUBSCRIPTION_RESPONSE_MESSAGE = 2;
+ int UNSUBSCRIPTION_MESSAGE = 3;
+ int UNSUBSCRIPTION_RESPONSE_MESSAGE = 4;
+ int RENEW_MESSAGE = 5;
+ int RENEW_RESPONSE_MESSAGE = 6;
+ int GET_STATUS_MESSAGE = 7;
+ int GET_STATUS_RESPONSE_MESSAGE = 8;
+ }
+
+ String SUBSCRIBER_TABLE = "SUBSCRIBER_TABLE";
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanException.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanException.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanException.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanException.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,35 @@
+/*
+ * Copyright 1999-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.savan;
+
+import org.apache.axis2.AxisFault;
+
+public class SavanException extends AxisFault {
+
+ public SavanException (String cause) {
+ super (cause);
+ }
+
+ public SavanException (String cause, Exception superException) {
+ super (cause,superException);
+ }
+
+ public SavanException (Exception superException) {
+ super (superException);
+ }
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1999-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.savan;
+
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+
+public class SavanMessageContext {
+
+ MessageContext messageContext = null;
+
+ public SavanMessageContext (MessageContext messageContext) {
+ this.messageContext = messageContext;
+ }
+
+ public int getProtocolVersion () throws SavanException {
+ Integer version = (Integer) messageContext.getProperty(SavanConstants.PROTOCOL_VERSION);
+ if (version==null)
+ throw new SavanException ("Protocol version is not set in the SavanMessageContext");
+
+ return version.intValue();
+ }
+
+ public void setProtocolVersion (int protocolVersion) {
+ messageContext.setProperty(SavanConstants.PROTOCOL_VERSION,new Integer (protocolVersion));
+ }
+
+ public void setMessageType (int type) {
+ messageContext.setProperty(SavanConstants.MESSAGE_TYPE, new Integer (type));
+ }
+
+ public int getMessageType () {
+ Integer typeInt = (Integer) messageContext.getProperty(SavanConstants.MESSAGE_TYPE);
+ return typeInt.intValue();
+ }
+
+ public ConfigurationContext getConfigurationContext () {
+ return messageContext.getConfigurationContext();
+ }
+
+ public Object getProperty (String key) {
+ return messageContext.getProperty(key);
+ }
+
+ public void setProperty (String key, Object val) {
+ messageContext.setProperty(key,val);
+ }
+
+ public SOAPEnvelope getEnvelope () {
+ return messageContext.getEnvelope();
+ }
+
+ public MessageContext getMessageContext () {
+ return messageContext;
+ }
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Delivery.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Delivery.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Delivery.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Delivery.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import org.apache.axis2.addressing.EndpointReference;
+
+public class Delivery {
+
+ EndpointReference deliveryEPR;
+ String deliveryMode;
+
+ public EndpointReference getDeliveryEPR() {
+ return deliveryEPR;
+ }
+
+ public String getDeliveryMode() {
+ return deliveryMode;
+ }
+
+ public void setDeliveryEPR(EndpointReference deliveryEPR) {
+ this.deliveryEPR = deliveryEPR;
+ }
+
+ public void setDeliveryMode(String deliveryMode) {
+ this.deliveryMode = deliveryMode;
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingConstants.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingConstants.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingConstants.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,60 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+public interface EventingConstants {
+
+ String EVENTING_NAMESPACE = "http://schemas.xmlsoap.org/ws/2004/08/eventing";
+ String EVENTING_PREFIX = "wse";
+ String DEFAULT_DELIVERY_MODE = "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push";
+
+ interface TransferedProperties {
+ String SUBSCRIBER_UUID = "SAVAN_EVENTING_SUBSCRIBER_UUID";
+ String EXPIRES_VALUE = "SAVAN_EVENTING_EXPIRES_VALUE";
+ }
+
+ interface ElementNames {
+ String Subscribe = "Subscribe";
+ String EndTo = "EndTo";
+ String Delivery = "Delivery";
+ String Mode = "Mode";
+ String NotifyTo = "NotifyTo";
+ String Expires = "Expires";
+ String Filter = "Filter";
+ String Dialect = "Dialect";
+ String SubscribeResponse = "SubscribeResponse";
+ String SubscriptionManager = "SubscriptionManager";
+ String Renew = "Renew";
+ String RenewResponse = "RenewResponse";
+ String Identifier = "Identifier";
+ String Unsubscribe = "Unsubscribe";
+ String GetStatus = "GetStatus";
+ String GetStatusResponse = "GetStatusResponse";
+ }
+
+ interface Actions {
+ String Subscribe = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe";
+ String SubscribeResponse = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse";
+ String Renew = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew";
+ String RenewResponse = "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse";
+ String Unsubscribe = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe";
+ String UnsubscribeResponse = "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse";
+ String GetStatus = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus";
+ String GetStatusResponse = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse";
+ }
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,217 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanException;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.messagereceiver.MessageReceiverDeligater;
+
+
+public class EventingMessageReceiverDeligater implements MessageReceiverDeligater {
+
+ public void handleSubscriptionRequest(SavanMessageContext subscriptionMessage, MessageContext outMessage) throws SavanException {
+
+ if (outMessage==null)
+ throw new SavanException ("Eventing protocol need to sent the SubscriptionResponseMessage. But the outMessage is null");
+
+ MessageContext subscriptionMsgCtx = subscriptionMessage.getMessageContext();
+
+ SOAPEnvelope outMessageEnvelope = outMessage.getEnvelope();
+ SOAPFactory factory = null;
+
+ if (outMessageEnvelope!=null) {
+ factory = (SOAPFactory) outMessageEnvelope.getOMFactory();
+ } else {
+ factory = (SOAPFactory) subscriptionMsgCtx.getEnvelope().getOMFactory();
+ outMessageEnvelope = factory.getDefaultEnvelope();
+
+ try {
+ outMessage.setEnvelope(outMessageEnvelope);
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+ }
+
+ //setting the action
+ outMessage.getOptions().setAction(EventingConstants.Actions.SubscribeResponse);
+
+ //sending the subscription response message.
+ String address = subscriptionMsgCtx.getOptions().getTo().getAddress();
+ EndpointReference subscriptionManagerEPR = new EndpointReference (address);
+
+ String id = (String) subscriptionMessage.getProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID);
+ if (id==null)
+ throw new SavanException ("Subscription UUID is not set");
+
+ subscriptionManagerEPR.addReferenceParameter(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Identifier,EventingConstants.EVENTING_PREFIX),id);
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+ OMElement subscribeResponseElement = factory.createOMElement(EventingConstants.ElementNames.SubscribeResponse,ens);
+ OMElement subscriptionManagerElement = null;
+ try {
+ subscriptionManagerElement = subscriptionManagerEPR.toOM(EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.SubscriptionManager,EventingConstants.EVENTING_PREFIX);
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+
+ //TODO set expires
+
+ subscribeResponseElement.addChild(subscriptionManagerElement);
+ outMessageEnvelope.getBody().addChild(subscribeResponseElement);
+
+ }
+
+ public void handleRenewRequest(SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException {
+
+ if (outMessage==null)
+ throw new SavanException ("Eventing protocol need to sent the SubscriptionResponseMessage. But the outMessage is null");
+
+ MessageContext subscriptionMsgCtx = renewMessage.getMessageContext();
+
+ SOAPEnvelope outMessageEnvelope = outMessage.getEnvelope();
+ SOAPFactory factory = null;
+
+ if (outMessageEnvelope!=null) {
+ factory = (SOAPFactory) outMessageEnvelope.getOMFactory();
+ } else {
+ factory = (SOAPFactory) subscriptionMsgCtx.getEnvelope().getOMFactory();
+ outMessageEnvelope = factory.getDefaultEnvelope();
+
+ try {
+ outMessage.setEnvelope(outMessageEnvelope);
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+ }
+
+ //setting the action
+ outMessage.getOptions().setAction(EventingConstants.Actions.RenewResponse);
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+
+ //sending the Renew Response message.
+ OMElement renewResponseElement = factory.createOMElement(EventingConstants.ElementNames.RenewResponse,ens);
+ String expiresValue = (String) renewMessage.getProperty(EventingConstants.TransferedProperties.EXPIRES_VALUE);
+ if (expiresValue!=null) {
+ OMElement expiresElement = factory.createOMElement(EventingConstants.ElementNames.Expires,ens);
+ renewResponseElement.addChild(expiresElement);
+ }
+
+ outMessageEnvelope.getBody().addChild(renewResponseElement);
+ }
+
+ public void handleEndSubscriptionRequest(SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException {
+
+ if (outMessage==null)
+ throw new SavanException ("Eventing protocol need to sent the SubscriptionResponseMessage. But the outMessage is null");
+
+ MessageContext subscriptionMsgCtx = renewMessage.getMessageContext();
+
+ //setting the action
+ outMessage.getOptions().setAction(EventingConstants.Actions.UnsubscribeResponse);
+
+ SOAPEnvelope outMessageEnvelope = outMessage.getEnvelope();
+ SOAPFactory factory = null;
+
+ if (outMessageEnvelope!=null) {
+ factory = (SOAPFactory) outMessageEnvelope.getOMFactory();
+ } else {
+ factory = (SOAPFactory) subscriptionMsgCtx.getEnvelope().getOMFactory();
+ outMessageEnvelope = factory.getDefaultEnvelope();
+
+ try {
+ outMessage.setEnvelope(outMessageEnvelope);
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+ }
+ }
+
+ public void handleGetStatusRequest(SavanMessageContext getStatusMessage, MessageContext outMessage) throws SavanException {
+
+ if (outMessage==null)
+ throw new SavanException ("Eventing protocol need to sent the SubscriptionResponseMessage. But the outMessage is null");
+
+ MessageContext subscriptionMsgCtx = getStatusMessage.getMessageContext();
+
+ String id = (String) getStatusMessage.getProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID);
+ if (id==null)
+ throw new SavanException ("Cannot fulfil request. Subscriber ID not found");
+
+ //setting the action
+ outMessage.getOptions().setAction(EventingConstants.Actions.UnsubscribeResponse);
+
+ SOAPEnvelope outMessageEnvelope = outMessage.getEnvelope();
+ SOAPFactory factory = null;
+
+ if (outMessageEnvelope!=null) {
+ factory = (SOAPFactory) outMessageEnvelope.getOMFactory();
+ } else {
+ factory = (SOAPFactory) subscriptionMsgCtx.getEnvelope().getOMFactory();
+ outMessageEnvelope = factory.getDefaultEnvelope();
+
+ try {
+ outMessage.setEnvelope(outMessageEnvelope);
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+ }
+
+ ConfigurationContext configurationContext = getStatusMessage.getConfigurationContext();
+ HashMap subscribers = (HashMap) configurationContext.getProperty(SavanConstants.SUBSCRIBER_TABLE);
+
+ if (subscribers==null) {
+ throw new SavanException ("Subscriber not found");
+ }
+
+ EventingSubscriber subscriber = (EventingSubscriber) subscribers.get(id);
+ if (subscriber==null) {
+ throw new SavanException ("Subscriber not found");
+ }
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+
+ OMElement getStatusResponseElement = factory.createOMElement(EventingConstants.ElementNames.GetStatusResponse,ens);
+
+ long expires = subscriber.getSubscriptionEndingTime();
+ if (expires>0) {
+ OMElement expiresElement = factory.createOMElement(EventingConstants.ElementNames.Expires,ens);
+ expiresElement.setText(new Long (expires).toString());
+
+ getStatusResponseElement.addChild(expiresElement);
+ }
+
+ outMessageEnvelope.getBody().addChild(getStatusResponseElement);
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingPublicationProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingPublicationProcessor.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingPublicationProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingPublicationProcessor.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,32 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.publication.PublicationProcessor;
+
+
+public class EventingPublicationProcessor extends PublicationProcessor {
+
+ public void updatePublication() {
+ //TODO update the publication as necessary.
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,82 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.savan.SavanException;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.subscribers.LeafSubscriber;
+
+
+
+public class EventingSubscriber extends LeafSubscriber {
+
+ private EndpointReference endToEPr;
+
+ private Delivery delivery;
+
+ private Filter filter;
+
+ public Delivery getDelivery() {
+ return delivery;
+ }
+
+ public EndpointReference getEndToEPr() {
+ return endToEPr;
+ }
+
+ public Filter getFilter() {
+ return filter;
+ }
+
+ public void setDelivery(Delivery delivery) {
+ this.delivery = delivery;
+ }
+
+ public void setEndToEPr(EndpointReference errorReportingEPR) {
+ this.endToEPr = errorReportingEPR;
+ }
+
+ public void setFilter(Filter filter) {
+ this.filter = filter;
+ }
+
+ public void doProtocolSpecificNotification(SavanMessageContext notificationMessage) throws SavanException {
+
+ EndpointReference deliveryEPR = delivery.getDeliveryEPR();
+
+ try {
+ ServiceClient sc = new ServiceClient (null,null);
+ Options options = new Options ();
+ options.setTo(deliveryEPR);
+ sc.setOptions(options);
+
+ //TODO correct this to send the complete envelope.
+ sc.fireAndForget (notificationMessage.getEnvelope().getBody().getFirstElement());
+
+ } catch (AxisFault e) {
+ throw new SavanException (e);
+ }
+
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,190 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.util.UUIDGenerator;
+import org.apache.savan.SavanException;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscription.RenewBean;
+import org.apache.savan.subscription.SubscriptionProcessor;
+
+public class EventingSubscriptionProcessor extends SubscriptionProcessor {
+
+ public void init (SavanMessageContext smc) throws SavanException {
+ //setting the subscriber_id as a property if possible.
+
+ String id = getSubscriberID(smc);
+ if (id!=null) {
+ smc.setProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID,id);
+ }
+
+ }
+
+ public Subscriber getSubscriberFromMessage(SavanMessageContext smc) throws SavanException {
+
+ SOAPEnvelope envelope = smc.getEnvelope();
+ if (envelope==null)
+ return null;
+
+ EventingSubscriber subscriber = new EventingSubscriber (); //eventing only works on leaf subscriber for now.
+
+ String id = UUIDGenerator.getUUID();
+ smc.setProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID,id);
+
+ String replyTo = smc.getMessageContext().getOptions().getReplyTo().getAddress();
+ subscriber.setId(id);
+
+ SOAPBody body = envelope.getBody();
+ OMElement subscribeElement = body.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Subscribe));
+ if (subscribeElement==null)
+ throw new SavanException ("'Subscribe' element is not present");
+
+ OMElement endToElement = subscribeElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.EndTo));
+ if (endToElement!=null) {
+ EndpointReference endToEPR = new EndpointReference ("");
+ endToEPR.fromOM(endToElement);
+
+ subscriber.setEndToEPr(endToEPR);
+ }
+
+ OMElement deliveryElement = subscribeElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Delivery));
+ if (deliveryElement==null)
+ throw new SavanException ("Delivery element is not present");
+
+ OMElement notifyToElement = deliveryElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.NotifyTo));
+ if (notifyToElement==null)
+ throw new SavanException ("NotifyTo element is null");
+
+ EndpointReference notifyToEPr = new EndpointReference ("");
+ notifyToEPr.fromOM(notifyToElement);
+
+ OMAttribute deliveryModeAttr = deliveryElement.getAttribute(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Mode));
+ String deliveryMode = null;
+ if (deliveryModeAttr!=null) {
+ deliveryMode = deliveryModeAttr.getAttributeValue();
+ } else {
+ deliveryMode = EventingConstants.DEFAULT_DELIVERY_MODE;
+ }
+
+ Delivery delivery = new Delivery ();
+ delivery.setDeliveryEPR(notifyToEPr);
+ delivery.setDeliveryMode(deliveryMode);
+
+ subscriber.setDelivery(delivery);
+
+ OMElement expiresElement = subscribeElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Expires));
+ if (expiresElement!=null) {
+ String expiresText = expiresElement.getText();
+ //assuming that the expires value is in milliseconds
+ //TODO do proper date/time conversion
+
+ long expiresValue = Long.parseLong(expiresText);
+ subscriber.renewSubscription(expiresValue);
+ }
+
+ OMElement filterElement = subscribeElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Filter));
+ if (filterElement!=null) {
+ Filter filter = new Filter ();
+
+ OMNode filterNode = filterElement.getFirstOMChild();
+ filter.setFilter(filterNode);
+
+ OMAttribute dialectAttr = filterElement.getAttribute(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Dialect));
+
+ if (dialectAttr!=null)
+ filter.setFilterType(dialectAttr.getAttributeValue());
+ else
+ throw new SavanException ("Filter Dialect is not set"); //TODO set the default value
+
+ subscriber.setFilter(filter);
+ }
+
+ return subscriber;
+ }
+
+ public void pauseSubscription(SavanMessageContext pauseSubscriptionMessage) throws SavanException {
+ throw new UnsupportedOperationException ("Eventing specification does not support this type of messages");
+ }
+
+ public void resumeSubscription(SavanMessageContext resumeSubscriptionMessage) throws SavanException {
+ throw new UnsupportedOperationException ("Eventing specification does not support this type of messages");
+ }
+
+ public RenewBean getRenewBean(SavanMessageContext renewMessage) throws SavanException {
+
+ SOAPEnvelope envelope = renewMessage.getEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ RenewBean renewBean = new RenewBean ();
+
+ OMElement renewElement = body.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Renew));
+ if (renewElement==null) {
+ String message = "Renew element not present in the assumed Renew Message";
+ throw new SavanException (message);
+ }
+
+ OMElement expiresElement = renewElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Expires));
+ if (expiresElement!=null) {
+ String expiresText = expiresElement.getText();
+ long expiresValue = Long.parseLong(expiresText);
+ renewBean.setRenewMount(expiresValue);
+ }
+
+ renewMessage.setProperty(EventingConstants.TransferedProperties.EXPIRES_VALUE,new Long(renewBean.getRenewMount()).toString());
+
+ String subscriberID = getSubscriberID(renewMessage);
+ if (subscriberID==null) {
+ String message = "Cannot find the subscriber ID";
+ throw new SavanException (message);
+ }
+
+ renewBean.setSubscriberID(subscriberID);
+ return renewBean;
+ }
+
+ public String getSubscriberID(SavanMessageContext smc) throws SavanException {
+ SOAPEnvelope envelope = smc.getEnvelope();
+ SOAPHeader header = envelope.getHeader();
+ if (header==null) {
+ return null;
+ }
+
+ OMElement ideltifierElement = envelope.getHeader().getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Identifier));
+ if (ideltifierElement==null) {
+ return null;
+ }
+
+ String identifier = ideltifierElement.getText().trim();
+ return identifier;
+ }
+
+
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,72 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.messagereceiver.MessageReceiverDeligater;
+import org.apache.savan.publication.PublicationProcessor;
+import org.apache.savan.subscription.SubscriptionProcessor;
+import org.apache.savan.util.SavanUtilFactory;
+
+public class EventingUtilFactory implements SavanUtilFactory {
+
+ public SavanMessageContext createSavanMessageContext(MessageContext messageContext) {
+
+ SavanMessageContext smc = new SavanMessageContext (messageContext);
+
+ //setting the message type.
+ String action = messageContext.getOptions().getAction();
+ if (EventingConstants.Actions.Subscribe.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE);
+ else if (EventingConstants.Actions.Renew.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.RENEW_MESSAGE);
+ else if (EventingConstants.Actions.Unsubscribe.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE);
+ else if (EventingConstants.Actions.GetStatus.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.GET_STATUS_MESSAGE);
+ else if (EventingConstants.Actions.SubscribeResponse.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.SUBSCRIPTION_RESPONSE_MESSAGE);
+ else if (EventingConstants.Actions.RenewResponse.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.RENEW_RESPONSE_MESSAGE);
+ else if (EventingConstants.Actions.UnsubscribeResponse.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.UNSUBSCRIPTION_RESPONSE_MESSAGE);
+ else if (EventingConstants.Actions.GetStatusResponse.equals(action))
+ smc.setMessageType(SavanConstants.MessageTypes.GET_STATUS_RESPONSE_MESSAGE);
+ else
+ smc.setMessageType(SavanConstants.MessageTypes.UNKNOWN);
+
+ return smc;
+ }
+
+ public SubscriptionProcessor createSubscriptionProcessor() {
+ return new EventingSubscriptionProcessor ();
+ }
+
+ public PublicationProcessor createPublicationProcessor() {
+ return new EventingPublicationProcessor ();
+ }
+
+ public MessageReceiverDeligater createMessageReceiverDeligater() {
+ return new EventingMessageReceiverDeligater ();
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Filter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Filter.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Filter.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/Filter.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 1999-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.savan.eventing;
+
+import org.apache.axiom.om.OMNode;
+
+public class Filter {
+
+ OMNode filter;
+ String filterType;
+
+ public OMNode getFilter() {
+ return filter;
+ }
+
+ public String getFilterType() {
+ return filterType;
+ }
+
+ public void setFilter(OMNode filter) {
+ this.filter = filter;
+ }
+
+ public void setFilterType(String filterType) {
+ this.filterType = filterType;
+ }
+
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClient.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClient.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClient.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,324 @@
+/*
+ * Copyright 1999-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.savan.eventing.client;
+
+import java.util.HashMap;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPBody;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.savan.eventing.EventingConstants;
+
+public class EventingClient {
+
+ ServiceClient serviceClient = null;
+ HashMap subscriptionDataMap = null;
+
+ public EventingClient (ServiceClient serviceClient) {
+ this.serviceClient = serviceClient;
+ subscriptionDataMap = new HashMap ();
+ }
+
+ public void subscribe (EventingClientBean bean, String subscriptionID) throws Exception {
+
+ Options options = serviceClient.getOptions();
+ if (options==null) {
+ options = new Options ();
+ serviceClient.setOptions(options);
+ }
+
+ String SOAPVersion = options.getSoapVersionURI();
+ if (SOAPVersion==null)
+ SOAPVersion = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+
+ SOAPEnvelope envelope = createSubscriptionEnvelope(bean,SOAPVersion);
+
+ String oldAction = options.getAction();
+ String action = EventingConstants.Actions.Subscribe;
+ options.setAction(action);
+ OMElement subscriptionResponse = serviceClient.sendReceive (envelope.getBody().getFirstElement());
+ SubscriptionResponseData subscriptionResponseData = getSubscriptionResponseData (subscriptionResponse);
+
+ subscriptionDataMap.put(subscriptionID,subscriptionResponseData);
+
+ options.setAction(oldAction);
+ }
+
+ public void renewSubscription (long renewAmount, String subscriptionID) throws Exception {
+ SubscriptionResponseData data = (SubscriptionResponseData) subscriptionDataMap.get(subscriptionID);
+ EndpointReference managerEPR = data.getSubscriptionManager();
+ if (managerEPR==null)
+ throw new Exception ("Manager EPR is not set");
+
+ Options options = serviceClient.getOptions();
+ if (options==null) {
+ options = new Options ();
+ serviceClient.setOptions(options);
+ }
+
+ String SOAPVersion = options.getSoapVersionURI();
+ if (SOAPVersion==null)
+ SOAPVersion = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+
+ SOAPEnvelope envelope = createRenewSubscriptionEnvelope(renewAmount,SOAPVersion);
+
+ String oldAction = options.getAction();
+ String action = EventingConstants.Actions.Renew;
+ options.setAction(action);
+
+ EndpointReference oldTo = serviceClient.getOptions().getTo();
+ options.setTo(managerEPR);
+
+ OMElement renewResponse = serviceClient.sendReceive (envelope.getBody().getFirstElement());
+
+ options.setAction(oldAction);
+ options.setTo(oldTo);
+ }
+
+ public void unsubscribe (String subscriptionID) throws Exception {
+ SubscriptionResponseData data = (SubscriptionResponseData) subscriptionDataMap.get(subscriptionID);
+ EndpointReference managerEPR = data.getSubscriptionManager();
+ if (managerEPR==null)
+ throw new Exception ("Manager EPR is not set");
+
+ Options options = serviceClient.getOptions();
+ if (options==null) {
+ options = new Options ();
+ serviceClient.setOptions(options);
+ }
+
+ String SOAPVersion = options.getSoapVersionURI();
+ if (SOAPVersion==null)
+ SOAPVersion = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+
+ SOAPEnvelope envelope = createUnsubscriptionEnvelope(SOAPVersion);
+
+ String oldAction = options.getAction();
+ String action = EventingConstants.Actions.Unsubscribe;
+ options.setAction(action);
+
+ EndpointReference oldTo = serviceClient.getOptions().getTo();
+ options.setTo(managerEPR);
+
+ OMElement unsubscribeResponse = serviceClient.sendReceive (envelope.getBody().getFirstElement());
+
+ options.setAction(oldAction);
+ options.setTo(oldTo);
+ }
+
+ public SubscriptionStatus getSubscriptionStatus (String subscriptionID) throws Exception {
+ SubscriptionResponseData data = (SubscriptionResponseData) subscriptionDataMap.get(subscriptionID);
+ EndpointReference managerEPR = data.getSubscriptionManager();
+ if (managerEPR==null)
+ throw new Exception ("Manager EPR is not set");
+
+ Options options = serviceClient.getOptions();
+ if (options==null) {
+ options = new Options ();
+ serviceClient.setOptions(options);
+ }
+
+ String SOAPVersion = options.getSoapVersionURI();
+ if (SOAPVersion==null)
+ SOAPVersion = SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI;
+
+ SOAPEnvelope envelope = createGetStatusEnvelope(SOAPVersion);
+
+ String oldAction = options.getAction();
+ String action = EventingConstants.Actions.GetStatus;
+ options.setAction(action);
+
+ EndpointReference oldTo = serviceClient.getOptions().getTo();
+ options.setTo(managerEPR);
+
+ OMElement getStatusResponse = serviceClient.sendReceive (envelope.getBody().getFirstElement());
+ SubscriptionStatus subscriptionStatus = getSubscriptionStatus (getStatusResponse);
+
+ options.setAction(oldAction);
+ options.setTo(oldTo);
+
+ return subscriptionStatus;
+ }
+
+ private SubscriptionResponseData getSubscriptionResponseData (OMElement responseMessagePayload) {
+ SubscriptionResponseData data = new SubscriptionResponseData ();
+
+ OMElement subscriberManagerElement = responseMessagePayload.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.SubscriptionManager));
+ EndpointReference managerEPR = new EndpointReference ("");
+ managerEPR.fromOM(subscriberManagerElement);
+ data.setSubscriptionManager(managerEPR);
+
+ OMElement expiresElement = responseMessagePayload.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Expires));
+ if (expiresElement!=null) {
+ String text = expiresElement.getText();
+ long expiresValue = Long.parseLong(text);
+ data.setExpires(expiresValue);
+ }
+
+ return data;
+ }
+
+ private SubscriptionStatus getSubscriptionStatus (OMElement getStatusResponseElement) throws Exception {
+ SubscriptionStatus subscriptionStatus = new SubscriptionStatus ();
+
+ OMElement expiresElementElement = getStatusResponseElement.getFirstChildWithName(new QName (EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Expires));
+ if (expiresElementElement!=null) {
+ String valueStr = expiresElementElement.getText();
+ long expires = Long.parseLong(valueStr);
+ subscriptionStatus.setExpirationTime(expires);
+ }
+
+ return subscriptionStatus;
+ }
+
+ private SOAPEnvelope createSubscriptionEnvelope (EventingClientBean bean, String SOAPVersion) throws Exception{
+ SOAPFactory factory = null;
+
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP11Factory();
+ else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP12Factory();
+ else throw new Exception ("Unknown SOAP version");
+
+ SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+
+ OMElement subscriptionElement = factory.createOMElement(EventingConstants.ElementNames.Subscribe,ens);
+
+ EndpointReference endToEPR = bean.getEndToEPR();
+ if (bean.getEndToEPR()!=null) {
+ //TODO when Axis2 get corrected, use the method which takes an addressing version as a param.
+ OMElement endToElement = endToEPR.toOM(EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.EndTo,EventingConstants.EVENTING_PREFIX);
+ subscriptionElement.addChild(endToElement);
+ }
+
+ EndpointReference deliveryEPR = bean.getDeliveryEPR();
+ if (deliveryEPR==null)
+ throw new Exception ("Delivery EPR is not set");
+
+ OMElement deliveryElement = factory.createOMElement(EventingConstants.ElementNames.Delivery,ens);
+ OMElement notifyToElement = deliveryEPR.toOM(EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.NotifyTo,EventingConstants.EVENTING_PREFIX);
+
+ deliveryElement.addChild(notifyToElement);
+ subscriptionElement.addChild(deliveryElement);
+
+ //TODO add Expires,Filter elements.
+ body.addChild(subscriptionElement);
+
+ return envelope;
+ }
+
+ private SOAPEnvelope createRenewSubscriptionEnvelope (long renewAmount, String SOAPVersion) throws Exception{
+ SOAPFactory factory = null;
+
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP11Factory();
+ else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP12Factory();
+ else throw new Exception ("Unknown SOAP version");
+
+ SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+ OMElement renewElement = factory.createOMElement(EventingConstants.ElementNames.Renew,ens);
+ OMElement expiresElement = factory.createOMElement(EventingConstants.ElementNames.Expires,ens);
+ expiresElement.setText(new Long (renewAmount).toString());
+ renewElement.addChild(expiresElement);
+
+ body.addChild(renewElement);
+
+ return envelope;
+ }
+
+ private SOAPEnvelope createUnsubscriptionEnvelope (String SOAPVersion) throws Exception {
+ SOAPFactory factory = null;
+
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP11Factory();
+ else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP12Factory();
+ else throw new Exception ("Unknown SOAP version");
+
+ SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+ OMElement unsubscribeElement = factory.createOMElement(EventingConstants.ElementNames.Unsubscribe,ens);
+ body.addChild(unsubscribeElement);
+
+ return envelope;
+ }
+
+ private SOAPEnvelope createGetStatusEnvelope (String SOAPVersion) throws Exception {
+ SOAPFactory factory = null;
+
+ if (SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP11Factory();
+ else if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
+ factory = OMAbstractFactory.getSOAP12Factory();
+ else throw new Exception ("Unknown SOAP version");
+
+ SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ SOAPBody body = envelope.getBody();
+
+ OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);
+ OMElement getStatusElement = factory.createOMElement(EventingConstants.ElementNames.GetStatus,ens);
+ body.addChild(getStatusElement);
+
+ return envelope;
+ }
+
+ private class SubscriptionResponseData {
+
+ EndpointReference subscriptionManager = null;
+
+ long expires = -1;
+
+ public long getExpires() {
+ return expires;
+ }
+
+ public EndpointReference getSubscriptionManager() {
+ return subscriptionManager;
+ }
+
+ public void setExpires(long expires) {
+ this.expires = expires;
+ }
+
+ public void setSubscriptionManager(EndpointReference subscriptionManager) {
+ this.subscriptionManager = subscriptionManager;
+ }
+
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClientBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClientBean.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClientBean.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/EventingClientBean.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,68 @@
+/*
+ * Copyright 1999-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.savan.eventing.client;
+
+import org.apache.axis2.addressing.EndpointReference;
+
+public class EventingClientBean {
+
+ EndpointReference deliveryEPR;
+ EndpointReference endToEPR;
+ String filterDialect;
+ String filter;
+ long expirationTime;
+
+ public EndpointReference getDeliveryEPR() {
+ return deliveryEPR;
+ }
+
+ public EndpointReference getEndToEPR() {
+ return endToEPR;
+ }
+ public long getExpirationTime() {
+ return expirationTime;
+ }
+
+ public String getFilter() {
+ return filter;
+ }
+
+ public String getFilterDialect() {
+ return filterDialect;
+ }
+
+ public void setDeliveryEPR(EndpointReference deliveryEPR) {
+ this.deliveryEPR = deliveryEPR;
+ }
+
+ public void setEndToEPR(EndpointReference endToEPR) {
+ this.endToEPR = endToEPR;
+ }
+
+ public void setExpirationTime(long expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+ public void setFilter(String filter) {
+ this.filter = filter;
+ }
+
+ public void setFilterDialect(String filterDialect) {
+ this.filterDialect = filterDialect;
+ }
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/SubscriptionStatus.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/SubscriptionStatus.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/SubscriptionStatus.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/client/SubscriptionStatus.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,16 @@
+package org.apache.savan.eventing.client;
+
+public class SubscriptionStatus {
+
+ long expirationTime = -1;
+
+ public long getExpirationTime() {
+ return expirationTime;
+ }
+
+ public void setExpirationTime(long expirationTime) {
+ this.expirationTime = expirationTime;
+ }
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,55 @@
+/*
+ * Copyright 1999-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.savan.handlers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.subscription.SubscriptionProcessor;
+import org.apache.savan.util.AbstractSavanUtilFactory;
+import org.apache.savan.util.ProtocolManager;
+import org.apache.savan.util.SavanUtilFactory;
+
+
+public class SavanInHandler extends AbstractHandler {
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+
+ int protocolVersion = ProtocolManager.getMessageProtocol (msgContext);
+ SavanUtilFactory utilFactory = AbstractSavanUtilFactory.getUtilFactory(protocolVersion);
+
+ SavanMessageContext smc = utilFactory.createSavanMessageContext (msgContext);
+ smc.setProtocolVersion(protocolVersion);
+
+ int messageType = smc.getMessageType ();
+
+ SubscriptionProcessor processor = utilFactory.createSubscriptionProcessor ();
+ processor.init (smc);
+ if (messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
+ processor.subscribe(smc);
+ } else if (messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
+ processor.unsubscribe(smc);
+ } else if (messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
+ processor.renewSubscription(smc);
+ }
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,45 @@
+package org.apache.savan.handlers;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.handlers.AbstractHandler;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.publication.PublicationErrorReport;
+import org.apache.savan.publication.PublicationProcessor;
+import org.apache.savan.util.AbstractSavanUtilFactory;
+import org.apache.savan.util.ProtocolManager;
+import org.apache.savan.util.SavanUtilFactory;
+
+public class SavanOutHandler extends AbstractHandler {
+
+ public void invoke(MessageContext msgContext) throws AxisFault {
+
+ int protocolVersion = ProtocolManager.getMessageProtocol (msgContext);
+ SavanUtilFactory utilFactory = AbstractSavanUtilFactory.getUtilFactory(protocolVersion);
+
+ SavanMessageContext smc = utilFactory.createSavanMessageContext (msgContext);
+ smc.setProtocolVersion(protocolVersion);
+
+ PublicationProcessor processor = utilFactory.createPublicationProcessor();
+
+ String publicationProperty = (String) smc.getProperty(SavanConstants.PUBLICATION_MESSAGE);
+ boolean publication = false;
+ if (publicationProperty!=null && SavanConstants.VALUE_TRUE.equalsIgnoreCase(publicationProperty))
+ publication = true;
+
+ int messagetype = smc.getMessageType();
+
+ if (messagetype==SavanConstants.MessageTypes.UNKNOWN) {
+ PublicationErrorReport report = processor.notifyListners (smc);
+
+ //TODO use the report to inform abt the errors.
+
+ //stopping the message from going further.
+ msgContext.pause();
+ }
+
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/MessageReceiverDeligater.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/MessageReceiverDeligater.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/MessageReceiverDeligater.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,31 @@
+/*
+ * Copyright 1999-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.savan.messagereceiver;
+
+import org.apache.axis2.context.MessageContext;
+import org.apache.savan.SavanException;
+import org.apache.savan.SavanMessageContext;
+
+
+public interface MessageReceiverDeligater {
+
+ void handleSubscriptionRequest (SavanMessageContext subscriptionMessage, MessageContext outMessage) throws SavanException ;
+ void handleRenewRequest(SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException;
+ void handleEndSubscriptionRequest(SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException;
+ void handleGetStatusRequest (SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException;
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOnlyMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOnlyMessageReceiver.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOnlyMessageReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOnlyMessageReceiver.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,30 @@
+/*
+ * Copyright 1999-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.savan.messagereceiver;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractInMessageReceiver;
+
+public class SavanInOnlyMessageReceiver extends AbstractInMessageReceiver {
+
+ public void invokeBusinessLogic(MessageContext inMessage) throws AxisFault {
+ }
+
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,53 @@
+/*
+ * Copyright 1999-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.savan.messagereceiver;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.util.AbstractSavanUtilFactory;
+import org.apache.savan.util.SavanUtilFactory;
+
+
+public class SavanInOutMessageReceiver extends AbstractInOutSyncMessageReceiver {
+
+ public void invokeBusinessLogic(MessageContext inMessage, MessageContext outMessage) throws AxisFault {
+
+ SavanMessageContext savanInMessage = new SavanMessageContext (inMessage);
+
+ Integer protocolVersion = (Integer) inMessage.getProperty(SavanConstants.PROTOCOL_VERSION);
+ SavanUtilFactory utilFactory = AbstractSavanUtilFactory.getUtilFactory(protocolVersion.intValue());
+
+ MessageReceiverDeligater deligator = utilFactory.createMessageReceiverDeligater();
+
+ int messageType = savanInMessage.getMessageType();
+ if (messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
+ deligator.handleSubscriptionRequest(savanInMessage,outMessage);
+ } else if (messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
+ deligator.handleRenewRequest (savanInMessage,outMessage);
+ } else if (messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
+ deligator.handleEndSubscriptionRequest (savanInMessage,outMessage);
+ } else if (messageType==SavanConstants.MessageTypes.GET_STATUS_MESSAGE) {
+ deligator.handleGetStatusRequest (savanInMessage,outMessage);
+ }
+
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/SavanModule.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/SavanModule.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/SavanModule.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/module/SavanModule.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,37 @@
+/*
+ * Copyright 1999-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.savan.module;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.description.AxisDescription;
+import org.apache.axis2.description.AxisModule;
+import org.apache.axis2.modules.Module;
+
+public class SavanModule implements Module {
+
+ public void engageNotify(AxisDescription axisDescription) throws AxisFault {
+ }
+
+ public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {
+ }
+
+ public void shutdown(ConfigurationContext configurationContext) throws AxisFault {
+ }
+
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationErrorReport.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationErrorReport.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationErrorReport.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationErrorReport.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,36 @@
+/*
+ * Copyright 1999-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.savan.publication;
+
+import java.util.Hashtable;
+
+import org.apache.savan.SavanException;
+
+
+public class PublicationErrorReport {
+
+ private Hashtable report = null;
+
+ public PublicationErrorReport () {
+ report = new Hashtable ();
+ }
+
+ public void addReportEntry (String id, SavanException reason) {
+ report.put(id,reason);
+ }
+}
Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationProcessor.java?rev=411752&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationProcessor.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/PublicationProcessor.java Mon Jun 5 04:44:51 2006
@@ -0,0 +1,56 @@
+/*
+ * Copyright 1999-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.savan.publication;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanException;
+import org.apache.savan.SavanMessageContext;
+import org.apache.savan.subscribers.Subscriber;
+
+
+public abstract class PublicationProcessor {
+
+ public PublicationErrorReport notifyListners (SavanMessageContext messageToBeNotified) {
+ ConfigurationContext configurationContext = messageToBeNotified.getConfigurationContext();
+ HashMap subscribers = (HashMap) configurationContext.getProperty(SavanConstants.SUBSCRIBER_TABLE);
+
+ PublicationErrorReport report = new PublicationErrorReport ();
+
+ updatePublication ();
+
+ for (Iterator it=subscribers.keySet().iterator();it.hasNext();) {
+ Subscriber subscriber = (Subscriber) subscribers.get(it.next());
+
+ //TODO check weather the this subscriber is within the given filter
+ try {
+ subscriber.sendNotification(messageToBeNotified);
+ } catch (SavanException e) {
+ report.addReportEntry(subscriber.getId(),e);
+ }
+ }
+
+ return report;
+ }
+
+ public abstract void updatePublication ();
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org