cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asold...@apache.org
Subject svn commit: r1484099 [1/4] - in /cxf/trunk: distribution/src/main/release/samples/ distribution/src/main/release/samples/ws_eventing/ distribution/src/main/release/samples/ws_eventing/src/ distribution/src/main/release/samples/ws_eventing/src/main/ dis...
Date Sat, 18 May 2013 12:17:42 GMT
Author: asoldano
Date: Sat May 18 12:17:39 2013
New Revision: 1484099

URL: http://svn.apache.org/r1484099
Log:
[CXF-5023] Initial implementation of WS-RA WS-Eventing: Jan Martiska contribution + misc fixes/additions for wrapped delivery and to prepare for event description support

Added:
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/pom.xml
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/ApplicationSingleton.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/CreateSubscriptionServlet.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/EarthquakeEventServlet.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/FireEventServlet.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/NotificatorServiceHolder.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/SingletonSubscriptionManagerContainer.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSink.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSinkImpl.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/EarthquakeEvent.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/FireEvent.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestEventSource.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestSubscriptionManager.java
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/beans.xml
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/web.xml
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/eventlog.jsp
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/index.jsp
    cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/subscribe.jsp
    cxf/trunk/rt/ws/eventing/
    cxf/trunk/rt/ws/eventing/pom.xml
    cxf/trunk/rt/ws/eventing/src/
    cxf/trunk/rt/ws/eventing/src/main/
    cxf/trunk/rt/ws/eventing/src/main/java/
    cxf/trunk/rt/ws/eventing/src/main/java/org/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabase.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabaseImpl.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionTicket.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManager.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManagerImpl.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManagerInterfaceForEventSources.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManagerInterfaceForManagers.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManagerInterfaceForNotificators.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionTicketGrantingResponse.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/EventSinkInterfaceNotificationTask.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/EventSinkInterfaceNotificatorService.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/FilteringInterceptor.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/NotificatorService.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/SubscriptionEndNotificationTask.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/SubscriptionEndStatus.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/WrappedSink.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/emitters/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/emitters/Emitter.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/notification/emitters/EmitterImpl.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/client/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/client/EndToEndpoint.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/eventsource/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/eventsource/AbstractEventSource.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/eventsource/EventSourceEndpoint.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/manager/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/manager/AbstractSubscriptionManager.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/manager/SubscriptionManagerEndpoint.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/EventingConstants.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/CannotProcessFilter.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/DeliveryFormatRequestedUnavailable.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/EmptyFilter.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/EndToNotSupported.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/FilteringRequestedUnavailable.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/NoDeliveryMechanismEstablished.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnknownSubscription.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationType.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationValue.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnusableEPR.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/WSEventingFault.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/ReferenceParametersAddingHandler.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/SubscriptionReferenceParsingHandler.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/DurationAndDateUtil.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/EPRInspectionTool.java
    cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/FilteringUtil.java
    cxf/trunk/rt/ws/eventing/src/main/resources/
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/catalog.cat
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventdescriptions.xsd
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xjb
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xsd
    cxf/trunk/rt/ws/eventing/src/main/resources/schemas/ws-addr.xsd
    cxf/trunk/rt/ws/eventing/src/main/resources/subscription-reference-parsing-handler-chain.xml
    cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/
    cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/eventing.wsdl
    cxf/trunk/rt/ws/eventing/src/test/
    cxf/trunk/rt/ws/eventing/src/test/java/
    cxf/trunk/rt/ws/eventing/src/test/java/org/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/SimpleEventingIntegrationTest.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/TestUtil.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/SingletonSubscriptionManagerContainer.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingEventSource.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingSubscriptionManager.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/NotificationTest.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/SubscriptionEndTest.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/SubscriptionGrantingTest.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/SubscriptionManagementTest.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/eventsink/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/eventsink/TestingEndToEndpointImpl.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/eventsink/TestingEventSinkImpl.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/eventsink/TestingWrappedEventSinkImpl.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/CatastrophicEventSink.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/CatastrophicEventSinkWrapped.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/EarthquakeEvent.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/FireEvent.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/assertions/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/assertions/ReferenceParametersAssertingHandler.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/integration/notificationapi/assertions/WSAActionAssertingHandler.java
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/misc/
    cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/misc/FilterEvaluationTest.java
Modified:
    cxf/trunk/distribution/src/main/release/samples/pom.xml
    cxf/trunk/rt/pom.xml

Modified: cxf/trunk/distribution/src/main/release/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/pom.xml?rev=1484099&r1=1484098&r2=1484099&view=diff
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/pom.xml (original)
+++ cxf/trunk/distribution/src/main/release/samples/pom.xml Sat May 18 12:17:39 2013
@@ -98,6 +98,7 @@
 
         <module>jax_rs/minimal_osgi</module>
         <module>ws_discovery</module>
+	<module>ws_eventing</module>
 
     </modules>
     <dependencyManagement>

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/pom.xml?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/pom.xml Sat May 18 12:17:39 2013
@@ -0,0 +1,77 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>ws_eventing</artifactId>
+    <version>3.0.0-SNAPSHOT</version>
+    <name>WS-Eventing Demo</name>
+    <packaging>war</packaging>
+
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+    </parent>
+
+    <properties>
+        <cxf.version>${project.version}</cxf.version>
+    </properties>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-core</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.2.0.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>3.2.0.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-eventing</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-addr</artifactId>
+            <version>${cxf.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>javax.servlet-api</artifactId>
+            <version>3.0.1</version>
+            <scope>provided</scope>
+        </dependency>
+        <dependency>
+            <groupId>commons-lang</groupId>
+            <artifactId>commons-lang</artifactId>
+            <version>2.6</version>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <finalName>ws_eventing</finalName>
+    </build>
+
+
+</project>

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/ApplicationSingleton.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/ApplicationSingleton.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/ApplicationSingleton.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/ApplicationSingleton.java Sat May 18 12:17:39 2013
@@ -0,0 +1,64 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import demo.wseventing.eventapi.CatastrophicEventSinkImpl;
+
+public final class ApplicationSingleton {
+
+    private static ApplicationSingleton instance;
+    private List<CatastrophicEventSinkImpl> eventSinks = new ArrayList<CatastrophicEventSinkImpl>();
+
+    private ApplicationSingleton() {
+    }
+
+    public static ApplicationSingleton getInstance() {
+        if (instance == null) {
+            instance = new ApplicationSingleton();
+        }
+        return instance;
+    }
+
+    public void createEventSink(String url) {
+        if (!url.startsWith("/")) {
+            url = "/" + url;
+        }
+        eventSinks.add(new CatastrophicEventSinkImpl(url));
+    }
+
+    public List<CatastrophicEventSinkImpl> getEventSinks() {
+        return this.eventSinks;
+    }
+
+    public CatastrophicEventSinkImpl getEventSinkByURL(String url) {
+        for (CatastrophicEventSinkImpl eventSink : eventSinks) {
+            if (eventSink.getShortURL().equals(url)) {
+                return eventSink;
+            }
+        }
+        return null;
+    }
+
+
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/CreateSubscriptionServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/CreateSubscriptionServlet.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/CreateSubscriptionServlet.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/CreateSubscriptionServlet.java Sat May 18 12:17:39 2013
@@ -0,0 +1,128 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.JAXBException;
+import javax.xml.bind.Marshaller;
+import javax.xml.datatype.DatatypeConfigurationException;
+
+import org.apache.commons.lang.StringEscapeUtils;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.ws.eventing.AttributedURIType;
+import org.apache.cxf.ws.eventing.DeliveryType;
+import org.apache.cxf.ws.eventing.EndpointReferenceType;
+import org.apache.cxf.ws.eventing.ExpirationType;
+import org.apache.cxf.ws.eventing.FilterType;
+import org.apache.cxf.ws.eventing.NotifyTo;
+import org.apache.cxf.ws.eventing.Subscribe;
+import org.apache.cxf.ws.eventing.SubscribeResponse;
+import org.apache.cxf.ws.eventing.eventsource.EventSourceEndpoint;
+
+@WebServlet(urlPatterns = "/CreateSubscriptionServlet")
+public class CreateSubscriptionServlet extends HttpServlet {
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+        throws ServletException, IOException {
+        try {
+            resp.getWriter().append("<html><body>");
+
+
+            JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+            factory.setServiceClass(EventSourceEndpoint.class);
+            factory.setAddress("http://localhost:8080/ws_eventing/services/EventSource");
+            EventSourceEndpoint requestorClient = (EventSourceEndpoint)factory.create();
+
+            String expires = null;
+            if (req.getParameter("expires-set") == null) {
+                expires = req.getParameter("expires");
+            } else {
+                if (!req.getParameter("expires-set").equals("false")) {
+                    expires = req.getParameter("expires");
+                }
+            }
+
+            Subscribe sub = createSubscribeMessage(req.getParameter("targeturl"),
+                    req.getParameter("filter-set") == null ? req.getParameter("filter") : null,
+                    expires);
+
+            resp.getWriter().append("<h3>Subscription request</h3>");
+            resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(sub));
+
+            SubscribeResponse subscribeResponse = requestorClient.subscribeOp(sub);
+
+            resp.getWriter().append("<h3>Response from Event Source</h3>");
+            resp.getWriter().append(convertJAXBElementToStringAndEscapeHTML(subscribeResponse));
+
+            resp.getWriter().append("<br/><a href=\"index.jsp\">Back to main page</a>");
+            resp.getWriter().append("</body></html>");
+        } catch (Exception e) {
+            throw new ServletException(e);
+        }
+
+    }
+
+    public Subscribe createSubscribeMessage(String targetURL, String filter, String expires)
+        throws DatatypeConfigurationException {
+        Subscribe sub = new Subscribe();
+
+
+        // expires
+        if (expires != null) {
+            sub.setExpires(new ExpirationType());
+            sub.getExpires().setValue(expires);
+        }
+
+        // delivery
+        EndpointReferenceType eventSink = new EndpointReferenceType();
+        AttributedURIType eventSinkAddr = new AttributedURIType();
+        eventSinkAddr.setValue(targetURL);
+        eventSink.setAddress(eventSinkAddr);
+        sub.setDelivery(new DeliveryType());
+        sub.getDelivery().getContent().add(new NotifyTo());
+        ((NotifyTo)sub.getDelivery().getContent().get(0)).setValue(eventSink);
+
+        // filter
+        if (filter != null && filter.length() > 0) {
+            sub.setFilter(new FilterType());
+            sub.getFilter().getContent().add(filter);
+        }
+
+        return sub;
+    }
+
+    public String convertJAXBElementToStringAndEscapeHTML(Object o) throws JAXBException {
+        JAXBContext jc = JAXBContext.newInstance(Subscribe.class.getPackage().getName());
+        Marshaller m = jc.createMarshaller();
+        ByteArrayOutputStream baos = new ByteArrayOutputStream();
+        m.marshal(o, baos);
+        String unescaped = baos.toString();
+        return StringEscapeUtils.escapeHtml(unescaped);
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/EarthquakeEventServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/EarthquakeEventServlet.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/EarthquakeEventServlet.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/EarthquakeEventServlet.java Sat May 18 12:17:39 2013
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import demo.wseventing.eventapi.EarthquakeEvent;
+
+@WebServlet(urlPatterns = "/EarthquakeEvent")
+public class EarthquakeEventServlet  extends HttpServlet {
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+        throws ServletException, IOException {
+        float strength = Float.parseFloat(req.getParameter("strength"));
+        EarthquakeEvent event = new EarthquakeEvent(strength, req.getParameter("location"));
+        NotificatorServiceHolder.getInstance().dispatchEvent(event);
+        resp.getWriter().append("<html><body>");
+        resp.getWriter().append("Event ").append(event.toString()).append(" emitted successfully!");
+        resp.getWriter().append("<br/><a href=\"index.jsp\">Back to main page</a>");
+        resp.getWriter().append("</body></html>");
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/FireEventServlet.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/FireEventServlet.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/FireEventServlet.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/FireEventServlet.java Sat May 18 12:17:39 2013
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.annotation.WebServlet;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import demo.wseventing.eventapi.FireEvent;
+
+@WebServlet(urlPatterns = "/FireEvent")
+public class FireEventServlet extends HttpServlet {
+
+    @Override
+    protected void doGet(HttpServletRequest req, HttpServletResponse resp)
+        throws ServletException, IOException {
+        FireEvent event = new FireEvent(req.getParameter("location"), Integer.parseInt(
+                req.getParameter("strength")));
+        NotificatorServiceHolder.getInstance().dispatchEvent(event);
+        resp.getWriter().append("<html><body>");
+        resp.getWriter().append("Event ").append(event.toString()).append(" emitted successfully!");
+        resp.getWriter().append("<br/><a href=\"index.jsp\">Back to main page</a>");
+        resp.getWriter().append("</body></html>");
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/NotificatorServiceHolder.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/NotificatorServiceHolder.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/NotificatorServiceHolder.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/NotificatorServiceHolder.java Sat May 18 12:17:39 2013
@@ -0,0 +1,68 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import java.util.logging.Logger;
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+import javax.servlet.annotation.WebListener;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerInterfaceForNotificators;
+import org.apache.cxf.ws.eventing.backend.notification.EventSinkInterfaceNotificatorService;
+import org.apache.cxf.ws.eventing.backend.notification.NotificatorService;
+
+import demo.wseventing.eventapi.CatastrophicEventSink;
+
+@WebListener
+public class NotificatorServiceHolder implements ServletContextListener {
+
+    private static NotificatorService instance;
+
+    private Logger logger = Logger.getLogger(NotificatorServiceHolder.class.getName());
+
+    public static NotificatorService getInstance() {
+        return instance;
+    }
+
+    @Override
+    public void contextInitialized(ServletContextEvent sce) {
+        logger.info("Initializing and starting NotificatorService");
+        instance = new EventSinkInterfaceNotificatorService() {
+            @Override
+            protected SubscriptionManagerInterfaceForNotificators obtainManager() {
+                return SingletonSubscriptionManagerContainer.getInstance();
+            }
+
+            @Override
+            protected Class getEventSinkInterface() {
+                return CatastrophicEventSink.class;
+            }
+        };
+        instance.start();
+        ApplicationSingleton.getInstance().createEventSink("/default");
+    }
+
+    @Override
+    public void contextDestroyed(ServletContextEvent sce) {
+        logger.info("Stopping NotificatorService");
+        instance.stop();     // very important!
+        SingletonSubscriptionManagerContainer.destroy();
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/SingletonSubscriptionManagerContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/SingletonSubscriptionManagerContainer.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/SingletonSubscriptionManagerContainer.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/SingletonSubscriptionManagerContainer.java Sat May 18 12:17:39 2013
@@ -0,0 +1,45 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManager;
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerImpl;
+
+public final class SingletonSubscriptionManagerContainer {
+
+    private static SubscriptionManager instance;
+
+    private SingletonSubscriptionManagerContainer() {
+
+    }
+
+    public static synchronized SubscriptionManager getInstance() {
+        if (instance == null) {
+            instance = new SubscriptionManagerImpl(
+                    "http://localhost:8080/ws_eventing/services/SubscriptionManager");
+        }
+        return instance;
+    }
+
+    public static synchronized void destroy() {
+        instance = null;
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSink.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSink.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSink.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSink.java Sat May 18 12:17:39 2013
@@ -0,0 +1,42 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.eventapi;
+
+import javax.jws.Oneway;
+import javax.jws.WebParam;
+import javax.jws.WebService;
+import javax.jws.soap.SOAPBinding;
+import javax.xml.ws.Action;
+import javax.xml.ws.soap.Addressing;
+
+@WebService(targetNamespace = "http://www.events.com")
+@Addressing(enabled = true, required = true)
+@SOAPBinding(parameterStyle = SOAPBinding.ParameterStyle.BARE)
+public interface CatastrophicEventSink {
+
+    @Action(input = "http://www.earthquake.com")
+    @Oneway
+    void earthquake(@WebParam(name = "earthquake") EarthquakeEvent ev);
+
+    @Action(input = "http://www.fire.com")
+    @Oneway
+    void fire(@WebParam(name = "fire") FireEvent ev);
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSinkImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSinkImpl.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSinkImpl.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/CatastrophicEventSinkImpl.java Sat May 18 12:17:39 2013
@@ -0,0 +1,76 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.eventapi;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+
+public class CatastrophicEventSinkImpl implements CatastrophicEventSink {
+
+    private String url;
+
+    private Server server;
+
+    private List<Object> receivedEvents = new ArrayList<Object>();
+
+    public CatastrophicEventSinkImpl(String url) {
+        JaxWsServerFactoryBean bean = new JaxWsServerFactoryBean();
+        bean.setServiceBean(this);
+        bean.setAddress(url);
+        this.url = url;
+        server = bean.create();
+    }
+
+    @Override
+    public void earthquake(EarthquakeEvent ev) {
+        System.out.println("Event sink received an earthquake notification: " + ev.toString());
+        receivedEvents.add(ev);
+    }
+
+    @Override
+    public void fire(FireEvent ev) {
+        System.out.println("Event sink received an fire notification: " + ev.toString());
+        receivedEvents.add(ev);
+    }
+
+    public void stop() {
+        server.stop();
+    }
+
+    public boolean isRunning() {
+        return server.isStarted();
+    }
+
+    public String getFullURL() {
+        return "services" + url;
+    }
+
+    public String getShortURL() {
+        return url;
+    }
+
+    public List<Object> getReceivedEvents() {
+        return receivedEvents;
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/EarthquakeEvent.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/EarthquakeEvent.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/EarthquakeEvent.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/EarthquakeEvent.java Sat May 18 12:17:39 2013
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.eventapi;
+
+public class EarthquakeEvent {
+
+    private String location;
+    private float richterScale;
+
+    public EarthquakeEvent() {
+
+    }
+
+    public EarthquakeEvent(float richterScale, String location) {
+        this.richterScale = richterScale;
+        this.location = location;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public float getRichterScale() {
+        return richterScale;
+    }
+
+    public void setRichterScale(float richterScale) {
+        this.richterScale = richterScale;
+    }
+
+    @Override
+    public String toString() {
+        return "EarthquakeEvent{"
+                + "location='" + location + '\''
+                + ", richterScale=" + richterScale
+                + '}';
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/FireEvent.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/FireEvent.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/FireEvent.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/eventapi/FireEvent.java Sat May 18 12:17:39 2013
@@ -0,0 +1,59 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.eventapi;
+
+public class FireEvent {
+
+    private String location;
+    private int severity;
+
+
+    public FireEvent() {
+    }
+
+    public FireEvent(String location, int severity) {
+        this.location = location;
+        this.severity = severity;
+    }
+
+    public String getLocation() {
+        return location;
+    }
+
+    public void setLocation(String location) {
+        this.location = location;
+    }
+
+    public int getSeverity() {
+        return severity;
+    }
+
+    public void setSeverity(int severity) {
+        this.severity = severity;
+    }
+
+    @Override
+    public String toString() {
+        return "FireEvent{"
+                + "location='" + location + '\''
+                + ", severity=" + severity
+                + '}';
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestEventSource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestEventSource.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestEventSource.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestEventSource.java Sat May 18 12:17:39 2013
@@ -0,0 +1,43 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.services;
+
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerInterfaceForEventSources;
+import org.apache.cxf.ws.eventing.eventsource.AbstractEventSource;
+
+import demo.wseventing.SingletonSubscriptionManagerContainer;
+
+@WebService(endpointInterface = "org.apache.cxf.ws.eventing.eventsource.EventSourceEndpoint")
+public class TestEventSource extends AbstractEventSource {
+
+    @Resource
+    WebServiceContext ctx;
+
+    @Override
+    protected SubscriptionManagerInterfaceForEventSources getSubscriptionManagerBackend() {
+        return SingletonSubscriptionManagerContainer.getInstance();
+    }
+
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestSubscriptionManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestSubscriptionManager.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestSubscriptionManager.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/java/demo/wseventing/services/TestSubscriptionManager.java Sat May 18 12:17:39 2013
@@ -0,0 +1,36 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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 demo.wseventing.services;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerInterfaceForManagers;
+import org.apache.cxf.ws.eventing.manager.AbstractSubscriptionManager;
+
+import demo.wseventing.SingletonSubscriptionManagerContainer;
+
+@WebService(endpointInterface = "org.apache.cxf.ws.eventing.manager.SubscriptionManagerEndpoint")
+public class TestSubscriptionManager extends AbstractSubscriptionManager {
+
+    @Override
+    protected SubscriptionManagerInterfaceForManagers getSubscriptionManagerBackend() {
+        return SingletonSubscriptionManagerContainer.getInstance();
+    }
+}

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/beans.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/beans.xml?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/beans.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/beans.xml Sat May 18 12:17:39 2013
@@ -0,0 +1,28 @@
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:cxf="http://cxf.apache.org/core"
+       xmlns:jaxws="http://cxf.apache.org/jaxws"
+       xsi:schemaLocation="
+http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
+http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
+http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd">
+
+    <import resource="classpath:META-INF/cxf/cxf.xml"/>
+    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
+
+    <bean id="eventSourceBean" class="demo.wseventing.services.TestEventSource"/>
+    <bean id="subscriptionManagerBean" class="demo.wseventing.services.TestSubscriptionManager"/>
+
+    <jaxws:endpoint implementor="#eventSourceBean" address="/EventSource">
+        <jaxws:features>
+            <cxf:logging/>
+        </jaxws:features>
+    </jaxws:endpoint>
+
+    <jaxws:endpoint implementor="#subscriptionManagerBean" address="/SubscriptionManager">
+        <jaxws:features>
+            <cxf:logging/>
+        </jaxws:features>
+    </jaxws:endpoint>
+
+</beans>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/web.xml?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/web.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/WEB-INF/web.xml Sat May 18 12:17:39 2013
@@ -0,0 +1,38 @@
+<web-app id="WebApp_9" version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee
+http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
+
+    <display-name>cxf</display-name>
+
+    <servlet>
+        <servlet-name>cxf</servlet-name>
+        <servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>cxf</servlet-name>
+        <url-pattern>/services/*</url-pattern>
+    </servlet-mapping>
+
+    <session-config>
+        <session-timeout>60</session-timeout>
+    </session-config>
+
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>WEB-INF/beans.xml</param-value>
+    </context-param>
+
+    <welcome-file-list>
+        <welcome-file>/index.jsp</welcome-file>
+    </welcome-file-list>
+
+    <listener>
+        <listener-class>
+            org.springframework.web.context.ContextLoaderListener
+        </listener-class>
+    </listener>
+
+</web-app>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/eventlog.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/eventlog.jsp?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/eventlog.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/eventlog.jsp Sat May 18 12:17:39 2013
@@ -0,0 +1,39 @@
+<%@ page import="demo.wseventing.eventapi.CatastrophicEventSinkImpl" %>
+<%@ page import="demo.wseventing.SingletonSubscriptionManagerContainer" %>
+<%@ page import="demo.wseventing.ApplicationSingleton" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+    <title></title>
+</head>
+<body>
+
+<%
+    String sinkURL = request.getParameter("sink");
+    CatastrophicEventSinkImpl sink = ApplicationSingleton.getInstance().getEventSinkByURL(sinkURL);
+    if (sink == null) {
+        throw new RuntimeException("No such event sink: " + sinkURL);
+    }
+%>
+
+<h2>Event sink with URL: <%= sink.getFullURL() %></h2>
+<table border="1">
+    <tr><td>Event Class</td><td>toString</td></tr>
+    <%
+        for (Object o : sink.getReceivedEvents()) {
+    %>
+    <tr>
+        <td><%=o.getClass().getSimpleName()%></td>
+        <td><%=o.toString()%></td>
+    </tr>
+    <%
+        }
+    %>
+</table>
+
+<a href="index.jsp">Back to main page</a>
+
+
+
+</body>
+</html>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/index.jsp?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/index.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/index.jsp Sat May 18 12:17:39 2013
@@ -0,0 +1,68 @@
+<%@ page import="demo.wseventing.ApplicationSingleton" %>
+<%@ page import="demo.wseventing.eventapi.CatastrophicEventSinkImpl" %>
+<%@ page import="org.apache.cxf.ws.eventing.backend.database.SubscriptionTicket" %>
+<%@ page import="demo.wseventing.SingletonSubscriptionManagerContainer" %>
+<%@ page import="org.apache.commons.lang.StringEscapeUtils" %>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+    <title></title>
+</head>
+<body>
+
+    <h2>Event sinks</h2>
+    <h3>List of registered event sinks</h3>
+    <table border="1">
+        <tr><td>URL</td><td>Is running?</td><td>Event log</td></tr>
+        <%
+            for (CatastrophicEventSinkImpl sink : ApplicationSingleton.getInstance().getEventSinks()) {
+                %>
+                    <tr>
+                        <td><a href="<%=sink.getFullURL()%>"><%=sink.getFullURL()%></a></td>
+                        <td><%=sink.isRunning()%></td>
+                        <td><a href="eventlog.jsp?sink=<%=sink.getShortURL()%>">List events</a></td>
+                    </tr>
+                <%
+            }
+        %>
+    </table>
+
+    <h2>Subscriptions</h2>
+    <a href="subscribe.jsp">Request a new subscription</a>
+    <h3>List of existing subscriptions</h3>
+    <table border="1">
+        <tr><td>UUID</td><td>Target URL</td><td>Filter</td><td>Expires</td></tr>
+        <%
+            for (SubscriptionTicket ticket : SingletonSubscriptionManagerContainer.getInstance().getTickets()) {
+        %>
+        <tr>
+            <td><%=ticket.getUuid()%></td>
+            <td><a href="<%=ticket.getTargetURL()%>"><%=ticket.getTargetURL()%></a></td>
+            <td><%=StringEscapeUtils.escapeHtml(ticket.getFilterString())%></td>
+            <td><%=ticket.isNonExpiring() ? "never" : ticket.getExpires().toXMLFormat()%></td>
+        </tr>
+        <%
+            }
+        %>
+    </table>
+
+    <h2>Emit new events</h2>
+    <form action="EarthquakeEvent">
+        <h3>Earthquake event</h3>
+        Location: <input type="text" name="location" value="Russia"/><br/>
+        Strength on Richter scale (a float number): <input type="text" name="strength" value="5.1"/><br/>
+        <input type="submit" value="Let the ground shake!">
+    </form><br/>
+
+    <form action="FireEvent">
+        <h3>Fire event</h3>
+        Location: <input type="text" name="location" value="Norway"/><br/>
+        Severity (an int number): <input type="text" name="strength" value="8"/><br/>
+        <input type="submit" value="Burn it down!">
+    </form>
+
+    List <a href="services">registered SOAP endpoints</a> in this webapp.<br />
+
+
+</body>
+</html>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/subscribe.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/subscribe.jsp?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/subscribe.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/ws_eventing/src/main/webapp/subscribe.jsp Sat May 18 12:17:39 2013
@@ -0,0 +1,45 @@
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<html>
+<head>
+    <title>New Subscription</title>
+</head>
+<body>
+
+<h2>New subscription</h2>
+
+<form action="CreateSubscriptionServlet">
+    <ul>
+        <li>Target URL to notify: <input name="targeturl" type="text" size="50"
+                                         value="http://localhost:8080${pageContext.request.contextPath}/services/default"/>
+        </li>
+        <li>
+            XPath filter: <input name="filter" type="text" size="30"
+                                 value="//location[text()='Russia']"/><br/>
+            <ul>
+                <li>You will only receive events which conform to the specified XPath filter</li>
+                <li>Right now only XPath 1.0 expressions are supported</li>
+                <li>unset <input name="filter-set" type="checkbox" value="false"/>
+                    - if you check this, you will receive all events
+                </li>
+            </ul>
+        </li>
+        <li>
+            Requested expiration : <input id="expires" name="expires" type="text" size="30"
+                                          value="2016-06-26T12:23:12.000-01:00"/>
+            <ul>
+                <li>Specify when you would like the subscription to expire. You can either provide a xs:duration or a xs:dateTime
+                    (you can find the correct string formats <a href="http://www.w3schools.com/schema/schema_dtypes_date.asp">here</a>)</li>
+                <li>A value of PT0S says that you wish the subscription to never expire</li>
+                <li>unset <input name="expires-set" type="checkbox" value="false"/>
+                    - if you check this, you let the server decide how long your subscription will last
+                    <!-- onselect="Document.getElementById('expires').disabled = true; --></li>
+            </ul>
+        </li>
+    </ul>
+    <input type="submit" value="Submit"/>
+</form>
+
+<a href="index.jsp">Back to main page</a>
+
+</body>
+</html>
\ No newline at end of file

Modified: cxf/trunk/rt/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/pom.xml?rev=1484099&r1=1484098&r2=1484099&view=diff
==============================================================================
--- cxf/trunk/rt/pom.xml (original)
+++ cxf/trunk/rt/pom.xml Sat May 18 12:17:39 2013
@@ -56,6 +56,7 @@
         <module>ws/rm</module>
         <module>ws/security</module>
         <module>ws/mex</module>
+        <module>ws/eventing</module>
         <module>rs/client</module>
         <module>rs/extensions/providers</module>
         <module>rs/extensions/search</module> 

Added: cxf/trunk/rt/ws/eventing/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/pom.xml?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/pom.xml (added)
+++ cxf/trunk/rt/ws/eventing/pom.xml Sat May 18 12:17:39 2013
@@ -0,0 +1,151 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <artifactId>cxf-rt-ws-eventing</artifactId>
+    <packaging>jar</packaging>
+    <name>Apache CXF Runtime WS Eventing</name>
+    <description>Apache CXF Runtime WS Eventing</description>
+    <url>http://cxf.apache.org</url>
+
+    <parent>
+        <groupId>org.apache.cxf</groupId>
+        <artifactId>cxf-parent</artifactId>
+        <version>3.0.0-SNAPSHOT</version>
+        <relativePath>../../../parent/pom.xml</relativePath>
+    </parent>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-api</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-bindings-soap</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-ws-addr</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-simple</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>junit</groupId>
+            <artifactId>junit</artifactId>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxws</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+        
+        <dependency>
+           <groupId>org.apache.cxf</groupId>
+           <artifactId>cxf-testutils</artifactId>
+           <version>${project.version}</version>
+           <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-local</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.1.1.RELEASE</version>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>servlet-api</artifactId>
+            <version>2.5</version>
+            <scope>provided</scope>
+        </dependency>
+
+
+    </dependencies>
+
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.cxf</groupId>
+                <artifactId>cxf-xjc-plugin</artifactId>
+                <version>${cxf.xjc-utils.version}</version>
+                <executions>
+                    <execution>
+                        <id>generate-sources</id>
+                        <phase>generate-sources</phase>
+                        <goals>
+                            <goal>xsdtojava</goal>
+                        </goals>
+                        <configuration>
+                            <extensions>
+                                <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:${cxf.xjc-utils.version}</extension>
+                            </extensions>
+                            <sourceRoot>${basedir}/target/generated/src/main/java</sourceRoot>
+                            <xsdOptions>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/eventing.xsd</xsd>
+                                    <packagename>org.apache.cxf.ws.eventing</packagename>
+                                    <bindingFile>${basedir}/src/main/resources/schemas/eventing.xjb</bindingFile>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                    <extension>true</extension>
+                                </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/eventdescriptions.xsd</xsd>
+                                    <packagename>org.apache.cxf.ws.eventing.descriptions</packagename>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                    <extension>true</extension>
+                                </xsdOption>
+                                <xsdOption>
+                                    <xsd>${basedir}/src/main/resources/schemas/ws-addr.xsd</xsd>
+                                    <packagename>org.apache.cxf.ws.eventing.addressing</packagename>
+                                    <catalog>${basedir}/src/main/build-resources/catalog.cat</catalog>
+                                </xsdOption>
+                            </xsdOptions>
+                        </configuration>
+                    </execution>
+                </executions>
+
+                <configuration>
+                    <extensions>
+                        <extension>org.apache.cxf.xjcplugins:cxf-xjc-dv:${cxf.xjc-utils.version}</extension>
+                    </extensions>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+
+</project>

Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabase.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabase.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabase.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabase.java Sat May 18 12:17:39 2013
@@ -0,0 +1,35 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.eventing.backend.database;
+
+import java.util.List;
+import java.util.UUID;
+
+public interface SubscriptionDatabase {
+
+    void addTicket(SubscriptionTicket ticket);
+
+    List<SubscriptionTicket> getTickets();
+
+    SubscriptionTicket findById(UUID id);
+
+    void removeTicketByUUID(UUID id);
+
+}

Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabaseImpl.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabaseImpl.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabaseImpl.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionDatabaseImpl.java Sat May 18 12:17:39 2013
@@ -0,0 +1,94 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.eventing.backend.database;
+
+import java.util.List;
+import java.util.UUID;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.logging.Logger;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.eventing.shared.faults.UnknownSubscription;
+
+/**
+ * Default implementation of a Subscription Database. Basically it is simply a wrapper
+ * around a List<SubscriptionTicket> with some convenience methods. The underlying List
+ * is a thread-safe CopyOnWriteArrayList.
+ */
+public class SubscriptionDatabaseImpl implements SubscriptionDatabase {
+
+    private static final Logger LOG = LogUtils.getLogger(SubscriptionDatabaseImpl.class);
+    private final List<SubscriptionTicket> ticketList;
+
+    public SubscriptionDatabaseImpl() {
+        LOG.info("Instantiating SubscriptionDatabaseImpl");
+        ticketList = new CopyOnWriteArrayList<SubscriptionTicket>();
+    }
+
+
+    @Override
+    public void addTicket(SubscriptionTicket ticket) {
+        ticketList.add(ticket);
+        LOG.info("SubscriptionDatabaseImpl accepted ticket for subscription: " + ticket.getUuid());
+    }
+
+    @Override
+    public List<SubscriptionTicket> getTickets() {
+        return ticketList;
+    }
+
+    /**
+     * Searches the database for a ticket with the specified UUID
+     *
+     * @param id the UUID which will be searched for
+     * @return the ticket, or null of no ticket with this UUID exists
+     */
+    @Override
+    public SubscriptionTicket findById(UUID id) {
+        for (SubscriptionTicket ticket : ticketList) {
+            if (ticket.getUuid().equals(id)) {
+                return ticket;
+            }
+        }
+        return null;
+    }
+
+    /**
+     * Removes a ticket by UUID from the database.
+     *
+     * @param id the UUID of the ticket to remove
+     * @throws UnknownSubscription if unknown UUID is supplied
+     */
+    @Override
+    public synchronized void removeTicketByUUID(UUID id) {
+        boolean removed = false;
+        for (SubscriptionTicket ticket : ticketList) {
+            if (ticket.getUuid().equals(id)) {
+                ticketList.remove(ticket);
+                removed = true;
+                break;
+            }
+        }
+        if (!removed) {
+            throw new UnknownSubscription();
+        }
+    }
+
+}

Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionTicket.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionTicket.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionTicket.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/database/SubscriptionTicket.java Sat May 18 12:17:39 2013
@@ -0,0 +1,158 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.eventing.backend.database;
+
+import java.util.GregorianCalendar;
+import java.util.UUID;
+import javax.xml.datatype.XMLGregorianCalendar;
+
+import org.apache.cxf.ws.eventing.DeliveryType;
+import org.apache.cxf.ws.eventing.EndpointReferenceType;
+import org.apache.cxf.ws.eventing.FilterType;
+import org.apache.cxf.ws.eventing.ReferenceParametersType;
+import org.apache.cxf.ws.eventing.shared.faults.FilteringRequestedUnavailable;
+import org.apache.cxf.ws.eventing.shared.utils.FilteringUtil;
+
+
+
+/**
+ * This class represents a valid subscription granted to a requesting client. Instances of such tickets
+ * are stored in a SubscriptionDatabase.
+ */
+public class SubscriptionTicket {
+
+    private EndpointReferenceType endTo;
+    private DeliveryType delivery;
+    private XMLGregorianCalendar expires;
+    private FilterType filter;
+    private UUID uuid;
+    private boolean wrappedDelivery;
+
+    /**
+     * If set to true, this ticket does not expire and the 'expires' field is ignored.
+     */
+    private boolean nonExpiring;
+
+    public SubscriptionTicket() {
+    }
+
+    public XMLGregorianCalendar getExpires() {
+        return expires;
+    }
+
+
+    public EndpointReferenceType getEndTo() {
+        return endTo;
+    }
+
+    public void setEndTo(EndpointReferenceType endTo) {
+        this.endTo = endTo;
+    }
+
+    public DeliveryType getDelivery() {
+        return delivery;
+    }
+
+    public void setDelivery(DeliveryType delivery) {
+        this.delivery = delivery;
+    }
+
+    public FilterType getFilter() {
+        return filter;
+    }
+
+    public void setFilter(FilterType filter) {
+        if (!FilteringUtil.isFilteringDialectSupported(filter.getDialect())) {
+            throw new FilteringRequestedUnavailable();
+        }
+        this.filter = filter;
+    }
+
+    public boolean isExpired() {
+        if (nonExpiring) {
+            return false;
+        }
+        return  expires.toGregorianCalendar().before(new GregorianCalendar());
+    }
+
+    public void setExpires(XMLGregorianCalendar expires) {
+        this.expires = expires;
+    }
+
+    public UUID getUuid() {
+        return uuid;
+    }
+
+    public void setUuid(UUID uuid) {
+        this.uuid = uuid;
+    }
+
+    /**
+     * Convenience method to extract the subscribed target URL.
+     *
+     * @return
+     */
+    public String getTargetURL() {
+        return ((org.apache.cxf.ws.eventing.NotifyTo)this.getDelivery().getContent().get(0)).getValue()
+                .getAddress().getValue().trim();
+    }
+
+    /**
+     * Convenience method to extract the subscribed target URL.
+     *
+     * @return
+     */
+    public String getEndToURL() {
+        try {
+            return this.getEndTo().getAddress().getValue();
+        } catch (NullPointerException ex) {
+            return null;
+        }
+    }
+
+    public String getFilterString() {
+        try {
+            return (String)this.getFilter().getContent().get(0);
+        } catch (NullPointerException ex) {
+            return null;
+        }
+    }
+
+    public boolean isWrappedDelivery() {
+        return wrappedDelivery;
+    }
+
+    public void setWrappedDelivery(boolean wrappedDelivery) {
+        this.wrappedDelivery = wrappedDelivery;
+    }
+
+    public ReferenceParametersType getNotificationReferenceParams() {
+        return ((org.apache.cxf.ws.eventing.NotifyTo)this
+                .getDelivery().getContent().get(0)).getValue().getReferenceParameters();
+    }
+
+    public boolean isNonExpiring() {
+        return nonExpiring;
+    }
+
+    public void setNonExpiring(boolean nonExpiring) {
+        this.nonExpiring = nonExpiring;
+    }
+}

Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManager.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManager.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/backend/manager/SubscriptionManager.java Sat May 18 12:17:39 2013
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you 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.cxf.ws.eventing.backend.manager;
+
+import java.util.UUID;
+
+import org.apache.cxf.ws.eventing.backend.notification.SubscriptionEndStatus;
+
+/**
+ * The core functionality representing WS-Eventing backend logic. It holds an instance of a database and
+ * acts as a layer for communicating with it. There are two interfaces which are used to communicate
+ * with a SubscriptionManager:
+ * - SubscriptionManagerInterfaceForManagers is used by the manager Web Service
+ * - SubscriptionManagerInterfaceForEventSources is used by the event source Web Service
+ */
+public interface SubscriptionManager
+        extends SubscriptionManagerInterfaceForManagers,
+        SubscriptionManagerInterfaceForEventSources,
+        SubscriptionManagerInterfaceForNotificators {
+
+    void subscriptionEnd(UUID subscriptionId, String reason, SubscriptionEndStatus status);
+
+}



Mime
View raw message