You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by as...@apache.org on 2013/05/18 14:17:42 UTC
svn commit: r1484099 [3/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...
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/NoDeliveryMechanismEstablished.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/NoDeliveryMechanismEstablished.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/NoDeliveryMechanismEstablished.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/NoDeliveryMechanismEstablished.java Sat May 18 12:17:39 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+public class NoDeliveryMechanismEstablished extends WSEventingFault {
+
+ public static final String REASON = "No delivery mechanism specified.";
+ public static final String LOCAL_PART = "NoDeliveryMechanismEstablished";
+
+ public NoDeliveryMechanismEstablished() {
+ super(REASON,
+ null,
+ new QName(EventingConstants.EVENTING_2011_03_NAMESPACE, LOCAL_PART));
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnknownSubscription.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnknownSubscription.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnknownSubscription.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnknownSubscription.java Sat May 18 12:17:39 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+public class UnknownSubscription extends WSEventingFault {
+
+ public static final String REASON = "The subscription is not known.";
+ public static final String LOCAL_PART = "UnknownSubscription";
+
+ public UnknownSubscription() {
+ super(REASON,
+ null,
+ new QName(EventingConstants.EVENTING_2011_03_NAMESPACE, LOCAL_PART));
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationType.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationType.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationType.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationType.java Sat May 18 12:17:39 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+public class UnsupportedExpirationType extends WSEventingFault {
+
+ public static final String REASON = "Only expiration durations are supported.";
+ public static final String LOCAL_PART = "UnsupportedExpirationType";
+
+ public UnsupportedExpirationType() {
+ super(REASON,
+ null,
+ new QName(EventingConstants.EVENTING_2011_03_NAMESPACE, LOCAL_PART));
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationValue.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationValue.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationValue.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnsupportedExpirationValue.java Sat May 18 12:17:39 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+public class UnsupportedExpirationValue extends WSEventingFault {
+
+ public static final String REASON = "The expiration time requested is not within the min/max range.";
+ public static final String LOCAL_PART = "UnsupportedExpirationValue";
+
+ public UnsupportedExpirationValue() {
+ super(REASON,
+ null,
+ new QName(EventingConstants.EVENTING_2011_03_NAMESPACE, LOCAL_PART));
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnusableEPR.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnusableEPR.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnusableEPR.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/UnusableEPR.java Sat May 18 12:17:39 2013
@@ -0,0 +1,37 @@
+/**
+ * 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.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+public class UnusableEPR extends WSEventingFault {
+
+ public static final String REASON = "An EPR in the Subscribe request message is unusable.";
+ public static final String LOCAL_PART = "UnusableEPR";
+
+ public UnusableEPR() {
+ super(REASON,
+ null,
+ new QName(EventingConstants.EVENTING_2011_03_NAMESPACE, LOCAL_PART));
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/WSEventingFault.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/WSEventingFault.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/WSEventingFault.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/faults/WSEventingFault.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 org.apache.cxf.ws.eventing.shared.faults;
+
+import javax.xml.namespace.QName;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.binding.soap.SoapFault;
+import org.apache.cxf.ws.addressing.FaultAction;
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+/**
+ * The parent for all WS-Eventing-specific faults.
+ */
+@FaultAction(EventingConstants.ACTION_FAULT)
+public abstract class WSEventingFault extends SoapFault {
+
+ public WSEventingFault(String reason, Element detail, QName faultCode) {
+ super(reason, faultCode);
+ if (detail != null) {
+ setDetail(detail);
+ }
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/ReferenceParametersAddingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/ReferenceParametersAddingHandler.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/ReferenceParametersAddingHandler.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/ReferenceParametersAddingHandler.java Sat May 18 12:17:39 2013
@@ -0,0 +1,78 @@
+/**
+ * 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.shared.handlers;
+
+import java.util.Set;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPFactory;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.ws.eventing.ReferenceParametersType;
+
+public class ReferenceParametersAddingHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private final ReferenceParametersType params;
+
+ public ReferenceParametersAddingHandler(ReferenceParametersType parametersType) {
+ this.params = parametersType;
+ }
+
+
+ @Override
+ public Set<QName> getHeaders() {
+ return null;
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ // we are interested only in outbound messages here
+ if (!(Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
+ return true;
+ }
+ if (params == null) {
+ return true;
+ }
+ try {
+ SOAPFactory factory = SOAPFactory.newInstance();
+ for (Object o : params.getAny()) {
+ SOAPElement elm = factory.createElement((Element)o);
+ context.getMessage().getSOAPHeader()
+ .addChildElement(SOAPFactory.newInstance().createElement(elm));
+ }
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return true;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+}
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/SubscriptionReferenceParsingHandler.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/SubscriptionReferenceParsingHandler.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/SubscriptionReferenceParsingHandler.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/handlers/SubscriptionReferenceParsingHandler.java Sat May 18 12:17:39 2013
@@ -0,0 +1,100 @@
+/**
+ * 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.shared.handlers;
+
+import java.util.Iterator;
+import java.util.Set;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import javax.xml.ws.handler.MessageContext;
+import javax.xml.ws.handler.soap.SOAPHandler;
+import javax.xml.ws.handler.soap.SOAPMessageContext;
+
+import org.w3c.dom.Element;
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+
+/**
+ * Subscription reference parsing handler is a SOAP handler on the Subscription Manager's side
+ * which takes care of parsing the reference parameters and retrieving the subscription
+ * ID from SOAP headers before the message is passed to the Subscription Manager itself.
+ * In handleMessage method, it is supposed to retrieve the UUID of the subscription and
+ * save it into the SOAPMessageContext as a String with the key 'uuid'
+ */
+public class SubscriptionReferenceParsingHandler implements SOAPHandler<SOAPMessageContext> {
+
+ private static final Logger LOG = LogUtils.getLogger(SubscriptionReferenceParsingHandler.class);
+
+ private final String namespace;
+ private final String elementName;
+
+ public SubscriptionReferenceParsingHandler(String namespace, String elementName) {
+ this.namespace = namespace;
+ this.elementName = elementName;
+ }
+
+ public SubscriptionReferenceParsingHandler() {
+ this.namespace = EventingConstants.SUBSCRIPTION_ID_DEFAULT_NAMESPACE;
+ this.elementName = EventingConstants.SUBSCRIPTION_ID_DEFAULT_ELEMENT_NAME;
+ }
+
+
+
+ @Override
+ public Set<QName> getHeaders() {
+ return null;
+ }
+
+ @Override
+ public boolean handleMessage(SOAPMessageContext context) {
+ // we are interested only in inbound messages here
+ if ((Boolean)context.get(MessageContext.MESSAGE_OUTBOUND_PROPERTY)) {
+ return true;
+ }
+ try {
+ // read headers
+ Iterator headerElements = context.getMessage().getSOAPHeader().examineAllHeaderElements();
+ Element o;
+ LOG.finer("Examining header elements");
+ while (headerElements.hasNext()) {
+ o = (Element)headerElements.next();
+ if (o.getNamespaceURI().equals(namespace)
+ && o.getLocalName().equals(elementName)) {
+ LOG.fine("found UUID parameter in header, uuid=" + o.getTextContent());
+ context.put("uuid", o.getTextContent());
+ }
+ }
+ } catch (SOAPException e) {
+ throw new RuntimeException(e);
+ }
+ return true;
+ }
+
+ @Override
+ public boolean handleFault(SOAPMessageContext context) {
+ return true;
+ }
+
+ @Override
+ public void close(MessageContext context) {
+ }
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/DurationAndDateUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/DurationAndDateUtil.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/DurationAndDateUtil.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/DurationAndDateUtil.java Sat May 18 12:17:39 2013
@@ -0,0 +1,117 @@
+/**
+ * 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.shared.utils;
+
+import java.util.GregorianCalendar;
+import javax.xml.datatype.DatatypeConfigurationException;
+import javax.xml.datatype.DatatypeFactory;
+import javax.xml.datatype.Duration;
+import javax.xml.datatype.XMLGregorianCalendar;
+import org.apache.cxf.ws.eventing.ExpirationType;
+
+public final class DurationAndDateUtil {
+
+ private static DatatypeFactory factory;
+
+ static {
+ try {
+ factory = DatatypeFactory.newInstance();
+ } catch (DatatypeConfigurationException ex) {
+ throw new RuntimeException(
+ "Cannot instantiate a DatatypeFactory required for unmarshalling "
+ + "to XMLGregorianCalendar and Duration",
+ ex);
+ }
+ }
+
+ private DurationAndDateUtil() {
+
+ }
+
+ public static Duration parseDuration(String input) throws IllegalArgumentException {
+ return factory.newDuration(input);
+ }
+
+ public static XMLGregorianCalendar parseXMLGregorianCalendar(String input)
+ throws IllegalArgumentException {
+ return factory.newXMLGregorianCalendar(input);
+ }
+
+ public static boolean isXMLGregorianCalendar(String input) {
+ try {
+ factory.newXMLGregorianCalendar(input);
+ return true;
+ } catch (IllegalArgumentException ex) {
+ return false;
+ }
+ }
+
+ public static boolean isDuration(String input) {
+ try {
+ factory.newDuration(input);
+ return true;
+ } catch (IllegalArgumentException ex) {
+ return false;
+ }
+ }
+
+ public static Object parseDurationOrTimestamp(String input) throws IllegalArgumentException {
+ Object ret;
+ try {
+ ret = factory.newDuration(input);
+ } catch (Exception e) {
+ ret = factory.newXMLGregorianCalendar(input);
+ }
+ return ret;
+ }
+
+ public static String convertToXMLString(Object input) {
+ if (input instanceof XMLGregorianCalendar) {
+ return ((XMLGregorianCalendar)input).toXMLFormat();
+ }
+ if (input instanceof Duration) {
+ return ((Duration)input).toString();
+ }
+ throw new IllegalArgumentException(
+ "convertToXMLString requires either an instance of XMLGregorianCalendar or Duration");
+ }
+
+ public static ExpirationType toExpirationTypeContainingGregorianCalendar(XMLGregorianCalendar date) {
+ ExpirationType et = new ExpirationType();
+ et.setValue(date.toXMLFormat());
+ return et;
+ }
+
+ public static ExpirationType toExpirationTypeContainingDuration(XMLGregorianCalendar date) {
+ ExpirationType et = new ExpirationType();
+ XMLGregorianCalendar now = factory.newXMLGregorianCalendar(new GregorianCalendar());
+ XMLGregorianCalendar then = factory.newXMLGregorianCalendar(date.toGregorianCalendar());
+ long durationMillis = then.toGregorianCalendar().getTimeInMillis()
+ - now.toGregorianCalendar().getTimeInMillis();
+ Duration duration = factory.newDuration(durationMillis);
+ et.setValue(duration.toString());
+ return et;
+ }
+
+ public static boolean isPT0S(Duration duration) {
+ return duration.toString().equals("PT0S");
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/EPRInspectionTool.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/EPRInspectionTool.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/EPRInspectionTool.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/EPRInspectionTool.java Sat May 18 12:17:39 2013
@@ -0,0 +1,38 @@
+/**
+ * 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.shared.utils;
+
+import org.apache.cxf.ws.eventing.EndpointReferenceType;
+
+public final class EPRInspectionTool {
+
+ private EPRInspectionTool() {
+
+ }
+
+ public static boolean containsUsableEPR(EndpointReferenceType ert) {
+ try {
+ return ert.getAddress().getValue().length() > 0;
+ } catch (NullPointerException ex) {
+ return false;
+ }
+ }
+}
Added: cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/FilteringUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/FilteringUtil.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/FilteringUtil.java (added)
+++ cxf/trunk/rt/ws/eventing/src/main/java/org/apache/cxf/ws/eventing/shared/utils/FilteringUtil.java Sat May 18 12:17:39 2013
@@ -0,0 +1,101 @@
+/**
+ * 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.shared.utils;
+
+import java.util.Iterator;
+import java.util.logging.Logger;
+
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.xpath.XPath;
+import javax.xml.xpath.XPathConstants;
+import javax.xml.xpath.XPathExpression;
+import javax.xml.xpath.XPathExpressionException;
+import javax.xml.xpath.XPathFactory;
+
+import org.w3c.dom.Element;
+
+import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.ws.eventing.FilterType;
+
+public final class FilteringUtil {
+
+ public static final String NAMESPACE_XPATH10 = "http://www.w3.org/2011/03/ws-evt/Dialects/XPath10";
+ public static final String NAMESPACE_XPATH20 = "http://www.w3.org/2011/03/ws-evt/Dialects/XPath20";
+
+ private static final Logger LOG = LogUtils.getLogger(FilteringUtil.class);
+ private static XPathFactory xPathFactory = XPathFactory.newInstance();
+
+ private FilteringUtil() {
+
+ }
+
+ public static boolean isFilteringDialectSupported(String namespace) {
+ return namespace.equals(NAMESPACE_XPATH10);
+ }
+
+ public static boolean doesConformToFilter(Element elm, FilterType filter) {
+ if ((filter == null) || (filter.getContent() == null)) {
+ return true;
+ }
+ String xPathString = (String)filter.getContent().get(0);
+ try {
+ XPath xPath = xPathFactory.newXPath();
+ XPathExpression xPathExpression = xPath.compile(xPathString);
+ return (Boolean)xPathExpression.evaluate(elm, XPathConstants.BOOLEAN);
+ } catch (XPathExpressionException ex) {
+ LOG.severe(ex.toString());
+ return false;
+ }
+ }
+
+ public static boolean isValidFilter(String xPathString) {
+ if (xPathString == null) {
+ return true;
+ }
+ try {
+ XPath xPath = xPathFactory.newXPath();
+ xPath.compile(xPathString);
+ return true;
+ } catch (XPathExpressionException ex) {
+ return false;
+ }
+ }
+
+ public static boolean runFilterOnMessage(SOAPMessage msg, FilterType filter) {
+ try {
+ Iterator<?> i = msg.getSOAPBody().getChildElements();
+ final String xPath = (String)filter.getContent().get(0);
+ while (i.hasNext()) {
+ Element elm = (Element)i.next();
+ if (FilteringUtil.doesConformToFilter(elm, filter)) {
+ LOG.info("Message passed through filter: " + xPath);
+ } else {
+ LOG.info("Filter " + xPath + " filtered out this message.");
+ return false;
+ }
+ }
+ return true;
+ } catch (SOAPException e) {
+ LOG.severe("SOAPException in runFilterOnMessage: " + e.toString());
+ return false;
+ }
+ }
+}
Added: cxf/trunk/rt/ws/eventing/src/main/resources/schemas/catalog.cat
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/schemas/catalog.cat?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/schemas/catalog.cat (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/schemas/catalog.cat Sat May 18 12:17:39 2013
@@ -0,0 +1,24 @@
+--
+ 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.
+--
+
+
+SYSTEM "http://www.w3.org/2011/03/ws-evt" "eventing.xsd"
+SYSTEM "http://www.w3.org/2011/03/ws-evd" "eventdescriptions.xsd"
+SYSTEM "http://www.w3.org/2005/08/addressing" "ws-addr.xsd"
+
Added: cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventdescriptions.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventdescriptions.xsd?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventdescriptions.xsd (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventdescriptions.xsd Sat May 18 12:17:39 2013
@@ -0,0 +1,35 @@
+<xs:schema xmlns:xs='http://www.w3.org/2001/XMLSchema'
+ targetNamespace='http://www.w3.org/2011/03/ws-evd'
+ elementFormDefault='qualified' attributeFormDefault='unqualified'>
+ <xs:element name='EventDescriptions'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name='types'>
+ <xs:annotation>
+ <xs:documentation>Data type definitions that are relevant to described notifications.</xs:documentation>
+ </xs:annotation>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+ </xs:sequence>
+ <xs:anyAttribute namespace='##other' processContents='lax'/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name='eventType' maxOccurs='unbounded'>
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+ </xs:sequence>
+ <xs:attribute name='id' type='xs:ID' use='required'/>
+ <xs:attribute name='element' type='xs:QName' use='optional'/>
+ <xs:attribute name='actionURI' type='xs:anyURI' use='optional'/>
+ <xs:anyAttribute namespace='##other' processContents='lax'/>
+ </xs:complexType>
+ </xs:element>
+ <xs:any namespace='##other' minOccurs='0' maxOccurs='unbounded'/>
+ </xs:sequence>
+ <xs:attribute name='targetNamespace' type='xs:anyURI' use='required'/>
+ <xs:anyAttribute namespace='##other' processContents='lax'/>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xjb
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xjb?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xjb (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xjb Sat May 18 12:17:39 2013
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<bindings version="2.0" xmlns="http://java.sun.com/xml/ns/jaxb"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:xjc="http://java.sun.com/xml/ns/jaxb/xjc"
+ extensionBindingPrefixes="xjc">
+<!-- <globalBindings>
+ <javaType name="java.util.Calendar" xmlType="xs:date"
+ parseMethod="javax.xml.bind.DatatypeConverter.parseDate"
+ printMethod="javax.xml.bind.DatatypeConverter.printDate"/>
+ <javaType name="java.util.Calendar" xmlType="xs:time"
+ parseMethod="javax.xml.bind.DatatypeConverter.parseTime"
+ printMethod="javax.xml.bind.DatatypeConverter.printTime"/>
+ <javaType name="java.util.Calendar" xmlType="xs:dateTime"
+ parseMethod="javax.xml.bind.DatatypeConverter.parseDateTime"
+ printMethod="javax.xml.bind.DatatypeConverter.printDateTime"/>
+ </globalBindings>-->
+ <bindings schemaLocation="eventing.xsd">
+ <bindings node="//xs:element[@name='RetryAfter']">
+ <class name="EvtRetryAfter" />
+ </bindings>
+ </bindings>
+ <bindings schemaLocation="eventing.xsd">
+ <bindings node="//xs:element[@name='NotifyTo']">
+ <class implClass="org.apache.cxf.ws.eventing.addressing.EndpointReferenceType" />
+ </bindings>
+ </bindings>
+ <!-- use it or not? -->
+<!-- <bindings schemaLocation="eventing.xsd">
+ <bindings node="//xs:simpleType[@name='DurationDateTime']">
+ <xjc:javaType name="org.apache.cxf.ws.eventing.shared.jaxbutils.DurationDateTime"
+ adapter="org.apache.cxf.ws.eventing.shared.jaxbutils.DurationDateTimeAdapter" />
+ </bindings>
+ </bindings>-->
+</bindings>
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xsd?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xsd (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/schemas/eventing.xsd Sat May 18 12:17:39 2013
@@ -0,0 +1,290 @@
+<xs:schema targetNamespace="http://www.w3.org/2011/03/ws-evt" xmlns:tns="http://www.w3.org/2011/03/ws-evt" xmlns:wsa="http://www.w3.org/2005/08/addressing" xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" blockDefault="#all">
+
+ <xs:import namespace="http://www.w3.org/XML/1998/namespace" schemaLocation="http://www.w3.org/2001/xml.xsd"/>
+ <xs:import namespace="http://www.w3.org/2005/08/addressing" schemaLocation="http://www.w3.org/2006/03/addressing/ws-addr.xsd"/>
+
+ <!-- Types and global elements -->
+ <xs:complexType name="DeliveryType" mixed="true">
+ <xs:sequence>
+ <xs:element ref="tns:NotifyTo" minOccurs="0" maxOccurs="1"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:complexType name="FormatType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Name" type="xs:anyURI" use="optional" default="http://www.w3.org/2011/03/ws-evt/DeliveryFormats/Unwrap"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:simpleType name="NonNegativeDurationType">
+ <xs:restriction base="xs:duration">
+ <xs:minInclusive value="P0Y0M0DT0H0M0S"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="DurationDateTime">
+ <xs:union memberTypes="xs:dateTime tns:NonNegativeDurationType"/>
+ </xs:simpleType>
+
+ <xs:complexType name="MiniExpirationType">
+ <xs:simpleContent>
+ <xs:extension base="tns:DurationDateTime">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="ExpirationType">
+ <xs:simpleContent>
+ <xs:extension base="tns:MiniExpirationType">
+ <xs:attribute name="BestEffort" type="xs:boolean" use="optional"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="FilterType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="Dialect" type="xs:anyURI" use="optional" default="http://www.w3.org/2011/03/ws-evt/Dialects/XPath10"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:complexType name="LanguageSpecificStringType">
+ <xs:simpleContent>
+ <xs:extension base="xs:string">
+ <xs:attribute ref="xml:lang"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="NotifyTo" type="wsa:EndpointReferenceType"/>
+
+ <xs:complexType name="NotificationPolicy">
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" maxOccurs="unbounded"/>
+ </xs:sequence>
+ </xs:complexType>
+
+ <!-- Subscribe request -->
+ <xs:element name="Subscribe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="EndTo" type="wsa:EndpointReferenceType" minOccurs="0"/>
+ <xs:element name="Delivery" type="tns:DeliveryType"/>
+ <xs:element name="Format" type="tns:FormatType" minOccurs="0"/>
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0"/>
+ <xs:element name="Filter" type="tns:FilterType" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Subscribe response -->
+ <xs:element name="SubscribeResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SubscriptionManager" type="wsa:EndpointReferenceType"/>
+ <xs:element name="GrantedExpires" type="tns:MiniExpirationType"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Used in a fault if there's an unsupported dialect -->
+ <xs:element name="SupportedDialect" type="xs:anyURI"/>
+
+ <!-- Used in a fault if there's an unsupported format name -->
+ <xs:element name="SupportedDeliveryFormat" type="xs:anyURI"/>
+
+ <!-- Renew request -->
+ <xs:element name="Renew">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Expires" type="tns:ExpirationType" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Renew response -->
+ <xs:element name="RenewResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="GrantedExpires" type="tns:MiniExpirationType"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- GetStatus request -->
+ <xs:element name="GetStatus">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- GetStatus response -->
+ <xs:element name="GetStatusResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="GrantedExpires" type="tns:MiniExpirationType"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Unsubscribe request -->
+ <xs:element name="Unsubscribe">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- Unsubscribe response -->
+ <xs:element name="UnsubscribeResponse">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <!-- SubscriptionEnd message -->
+ <xs:element name="SubscriptionEnd">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="Status" type="tns:OpenSubscriptionEndCodeType"/>
+ <xs:element name="Reason" type="tns:LanguageSpecificStringType" minOccurs="0" maxOccurs="unbounded"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:simpleType name="SubscriptionEndCodeType">
+ <xs:restriction base="xs:anyURI">
+ <xs:enumeration value="http://www.w3.org/2011/03/ws-evt/DeliveryFailure"/>
+ <xs:enumeration value="http://www.w3.org/2011/03/ws-evt/SourceShuttingDown"/>
+ <xs:enumeration value="http://www.w3.org/2011/03/ws-evt/SourceCancelling"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:simpleType name="OpenSubscriptionEndCodeType">
+ <xs:union memberTypes="tns:SubscriptionEndCodeType xs:anyURI"/>
+ </xs:simpleType>
+
+ <!-- RetryAfter Fault Detail Element -->
+ <xs:element name="RetryAfter" type="tns:RetryAfterType"/>
+ <xs:complexType name="RetryAfterType">
+ <xs:simpleContent>
+ <xs:extension base="xs:nonNegativeInteger">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- Wrapped Events -->
+ <xs:complexType name="EventType" mixed="true">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="actionURI" type="xs:anyURI" use="optional"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="Notify" type="tns:EventType"/>
+
+ <!-- Policy -->
+ <xs:complexType name="Duration">
+ <xs:simpleContent>
+ <xs:extension base="tns:NonNegativeDurationType">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="URI">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:complexType name="Empty">
+ <xs:sequence/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="EventSource">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="FilterDialect" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="URI" type="xs:anyURI" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="FormatName" minOccurs="0" maxOccurs="unbounded">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:attribute name="URI" type="xs:anyURI" use="required"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="DateTimeSupported" type="tns:Empty" minOccurs="0"/>
+ <xs:element name="Expires" minOccurs="0">
+ <xs:complexType>
+ <xs:attribute name="min" type="xs:duration" use="optional"/>
+ <xs:attribute name="max" type="xs:duration" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:element name="EndToSupported" type="tns:Empty" minOccurs="0"/>
+ <xs:element name="NotificationPolicy" type="tns:NotificationPolicy" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+ <xs:element name="SubscriptionManager">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="DateTimeSupported" type="tns:Empty" minOccurs="0"/>
+ <xs:element name="Expires" minOccurs="0">
+ <xs:complexType>
+ <xs:attribute name="min" type="xs:duration" use="optional"/>
+ <xs:attribute name="max" type="xs:duration" use="optional"/>
+ </xs:complexType>
+ </xs:element>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+ </xs:element>
+
+</xs:schema>
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/resources/schemas/ws-addr.xsd
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/schemas/ws-addr.xsd?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/schemas/ws-addr.xsd (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/schemas/ws-addr.xsd Sat May 18 12:17:39 2013
@@ -0,0 +1,137 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ W3C XML Schema defined in the Web Services Addressing 1.0 specification
+ http://www.w3.org/TR/ws-addr-core
+
+ Copyright © 2005 World Wide Web Consortium,
+
+ (Massachusetts Institute of Technology, European Research Consortium for
+ Informatics and Mathematics, Keio University). All Rights Reserved. This
+ work is distributed under the W3C® Software License [1] in the hope that
+ it will be useful, but WITHOUT ANY WARRANTY; without even the implied
+ warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+
+ [1] http://www.w3.org/Consortium/Legal/2002/copyright-software-20021231
+
+ $Id: ws-addr.xsd,v 1.2 2008/07/23 13:38:16 plehegar Exp $
+-->
+<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://www.w3.org/2005/08/addressing" targetNamespace="http://www.w3.org/2005/08/addressing" blockDefault="#all" elementFormDefault="qualified" finalDefault="" attributeFormDefault="unqualified">
+
+ <!-- Constructs from the WS-Addressing Core -->
+
+ <xs:element name="EndpointReference" type="tns:EndpointReferenceType"/>
+ <xs:complexType name="EndpointReferenceType" mixed="false">
+ <xs:sequence>
+ <xs:element name="Address" type="tns:AttributedURIType"/>
+ <xs:element ref="tns:ReferenceParameters" minOccurs="0"/>
+ <xs:element ref="tns:Metadata" minOccurs="0"/>
+ <xs:any namespace="##other" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="ReferenceParameters" type="tns:ReferenceParametersType"/>
+ <xs:complexType name="ReferenceParametersType" mixed="false">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="Metadata" type="tns:MetadataType"/>
+ <xs:complexType name="MetadataType" mixed="false">
+ <xs:sequence>
+ <xs:any namespace="##any" processContents="lax" minOccurs="0" maxOccurs="unbounded"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+ <xs:element name="MessageID" type="tns:AttributedURIType"/>
+ <xs:element name="RelatesTo" type="tns:RelatesToType"/>
+ <xs:complexType name="RelatesToType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:attribute name="RelationshipType" type="tns:RelationshipTypeOpenEnum" use="optional" default="http://www.w3.org/2005/08/addressing/reply"/>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:simpleType name="RelationshipTypeOpenEnum">
+ <xs:union memberTypes="tns:RelationshipType xs:anyURI"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="RelationshipType">
+ <xs:restriction base="xs:anyURI">
+ <xs:enumeration value="http://www.w3.org/2005/08/addressing/reply"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="ReplyTo" type="tns:EndpointReferenceType"/>
+ <xs:element name="From" type="tns:EndpointReferenceType"/>
+ <xs:element name="FaultTo" type="tns:EndpointReferenceType"/>
+ <xs:element name="To" type="tns:AttributedURIType"/>
+ <xs:element name="Action" type="tns:AttributedURIType"/>
+
+ <xs:complexType name="AttributedURIType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:anyURI">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <!-- Constructs from the WS-Addressing SOAP binding -->
+
+ <xs:attribute name="IsReferenceParameter" type="xs:boolean"/>
+
+ <xs:simpleType name="FaultCodesOpenEnumType">
+ <xs:union memberTypes="tns:FaultCodesType xs:QName"/>
+ </xs:simpleType>
+
+ <xs:simpleType name="FaultCodesType">
+ <xs:restriction base="xs:QName">
+ <xs:enumeration value="tns:InvalidAddressingHeader"/>
+ <xs:enumeration value="tns:InvalidAddress"/>
+ <xs:enumeration value="tns:InvalidEPR"/>
+ <xs:enumeration value="tns:InvalidCardinality"/>
+ <xs:enumeration value="tns:MissingAddressInEPR"/>
+ <xs:enumeration value="tns:DuplicateMessageID"/>
+ <xs:enumeration value="tns:ActionMismatch"/>
+ <xs:enumeration value="tns:MessageAddressingHeaderRequired"/>
+ <xs:enumeration value="tns:DestinationUnreachable"/>
+ <xs:enumeration value="tns:ActionNotSupported"/>
+ <xs:enumeration value="tns:EndpointUnavailable"/>
+ </xs:restriction>
+ </xs:simpleType>
+
+ <xs:element name="RetryAfter" type="tns:AttributedUnsignedLongType"/>
+ <xs:complexType name="AttributedUnsignedLongType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:unsignedLong">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="ProblemHeaderQName" type="tns:AttributedQNameType"/>
+ <xs:complexType name="AttributedQNameType" mixed="false">
+ <xs:simpleContent>
+ <xs:extension base="xs:QName">
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:extension>
+ </xs:simpleContent>
+ </xs:complexType>
+
+ <xs:element name="ProblemIRI" type="tns:AttributedURIType"/>
+
+ <xs:element name="ProblemAction" type="tns:ProblemActionType"/>
+ <xs:complexType name="ProblemActionType" mixed="false">
+ <xs:sequence>
+ <xs:element ref="tns:Action" minOccurs="0"/>
+ <xs:element name="SoapAction" minOccurs="0" type="xs:anyURI"/>
+ </xs:sequence>
+ <xs:anyAttribute namespace="##other" processContents="lax"/>
+ </xs:complexType>
+
+</xs:schema>
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/resources/subscription-reference-parsing-handler-chain.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/subscription-reference-parsing-handler-chain.xml?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/subscription-reference-parsing-handler-chain.xml (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/subscription-reference-parsing-handler-chain.xml Sat May 18 12:17:39 2013
@@ -0,0 +1,11 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<jws:handler-chains xmlns:jws="http://java.sun.com/xml/ns/javaee">
+
+ <jws:handler-chain>
+ <jws:handler>
+ <jws:handler-name>EventingSoapHandler</jws:handler-name>
+ <jws:handler-class>org.apache.cxf.ws.eventing.shared.handlers.SubscriptionReferenceParsingHandler</jws:handler-class>
+ </jws:handler>
+ </jws:handler-chain>
+
+</jws:handler-chains>
\ No newline at end of file
Added: cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/eventing.wsdl
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/eventing.wsdl?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/eventing.wsdl (added)
+++ cxf/trunk/rt/ws/eventing/src/main/resources/wsdl/eventing.wsdl Sat May 18 12:17:39 2013
@@ -0,0 +1,106 @@
+<wsdl:definitions
+ targetNamespace='http://www.w3.org/2011/03/ws-evt'
+ xmlns:wsa='http://www.w3.org/2005/08/addressing'
+ xmlns:wsam='http://www.w3.org/2007/05/addressing/metadata'
+ xmlns:wse='http://www.w3.org/2011/03/ws-evt'
+ xmlns:wsdl='http://schemas.xmlsoap.org/wsdl/'
+ xmlns:xs='http://www.w3.org/2001/XMLSchema' >
+
+ <wsdl:types>
+ <xs:schema>
+ <xs:import
+ namespace='http://www.w3.org/2011/03/ws-evt'
+ schemaLocation=
+ 'http://www.w3.org/2011/03/ws-evt/eventing.xsd' />
+ </xs:schema>
+ </wsdl:types>
+
+ <wsdl:message name='SubscribeMsg' >
+ <wsdl:part name='body' element='wse:Subscribe' />
+ </wsdl:message>
+ <wsdl:message name='SubscribeResponseMsg' >
+ <wsdl:part name='body' element='wse:SubscribeResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='RenewMsg' >
+ <wsdl:part name='body' element='wse:Renew' />
+ </wsdl:message>
+ <wsdl:message name='RenewResponseMsg' >
+ <wsdl:part name='body' element='wse:RenewResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='GetStatusMsg' >
+ <wsdl:part name='body' element='wse:GetStatus' />
+ </wsdl:message>
+ <wsdl:message name='GetStatusResponseMsg' >
+ <wsdl:part name='body' element='wse:GetStatusResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='UnsubscribeMsg' >
+ <wsdl:part name='body' element='wse:Unsubscribe' />
+ </wsdl:message>
+ <wsdl:message name='UnsubscribeResponseMsg' >
+ <wsdl:part name='body' element='wse:UnsubscribeResponse' />
+ </wsdl:message>
+
+ <wsdl:message name='SubscriptionEnd' >
+ <wsdl:part name='body' element='wse:SubscriptionEnd' />
+ </wsdl:message>
+
+ <wsdl:message name='notifyEvent'>
+ <wsdl:part name='parameter' element='wse:Notify'/>
+ </wsdl:message>
+
+ <wsdl:portType name='EventSource' >
+ <wsdl:operation name='SubscribeOp' >
+ <wsdl:input
+ message='wse:SubscribeMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/Subscribe'/>
+ <wsdl:output
+ message='wse:SubscribeResponseMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/SubscribeResponse'/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name='SubscriptionEndPortType' >
+ <wsdl:operation name='SubscriptionEnd' >
+ <wsdl:input
+ message='wse:SubscriptionEnd'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/SubscriptionEnd'/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name='SubscriptionManager' >
+ <wsdl:operation name='RenewOp' >
+ <wsdl:input
+ message='wse:RenewMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/Renew'/>
+ <wsdl:output
+ message='wse:RenewResponseMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/RenewResponse'/>
+ </wsdl:operation>
+ <wsdl:operation name='GetStatusOp' >
+ <wsdl:input
+ message='wse:GetStatusMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/GetStatus'/>
+ <wsdl:output
+ message='wse:GetStatusResponseMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/GetStatusResponse'/>
+ </wsdl:operation>
+ <wsdl:operation name='UnsubscribeOp' >
+ <wsdl:input
+ message='wse:UnsubscribeMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/Unsubscribe'/>
+ <wsdl:output
+ message='wse:UnsubscribeResponseMsg'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/UnsubscribeResponse'/>
+ </wsdl:operation>
+ </wsdl:portType>
+
+ <wsdl:portType name='WrappedSinkPortType'>
+ <wsdl:operation name='NotifyEvent'>
+ <wsdl:input message='wse:notifyEvent'
+ wsam:Action='http://www.w3.org/2011/03/ws-evt/WrappedSinkPortType/NotifyEvent'/>
+ </wsdl:operation>
+ </wsdl:portType>
+</wsdl:definitions>
Added: cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/SimpleEventingIntegrationTest.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/SimpleEventingIntegrationTest.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/SimpleEventingIntegrationTest.java (added)
+++ cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/SimpleEventingIntegrationTest.java Sat May 18 12:17:39 2013
@@ -0,0 +1,211 @@
+/**
+ * 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.base;
+
+import org.apache.cxf.endpoint.Server;
+import org.apache.cxf.interceptor.LoggingInInterceptor;
+import org.apache.cxf.interceptor.LoggingOutInterceptor;
+import org.apache.cxf.jaxws.JaxWsProxyFactoryBean;
+import org.apache.cxf.jaxws.JaxWsServerFactoryBean;
+import org.apache.cxf.transport.local.LocalTransportFactory;
+import org.apache.cxf.ws.eventing.AttributedURIType;
+import org.apache.cxf.ws.eventing.EndpointReferenceType;
+import org.apache.cxf.ws.eventing.NotifyTo;
+import org.apache.cxf.ws.eventing.ReferenceParametersType;
+import org.apache.cxf.ws.eventing.backend.database.SubscriptionTicket;
+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 org.apache.cxf.ws.eventing.base.aux.SingletonSubscriptionManagerContainer;
+import org.apache.cxf.ws.eventing.base.services.TestingEventSource;
+import org.apache.cxf.ws.eventing.base.services.TestingSubscriptionManager;
+import org.apache.cxf.ws.eventing.eventsource.EventSourceEndpoint;
+import org.apache.cxf.ws.eventing.integration.eventsink.TestingEndToEndpointImpl;
+import org.apache.cxf.ws.eventing.integration.eventsink.TestingEventSinkImpl;
+import org.apache.cxf.ws.eventing.integration.eventsink.TestingWrappedEventSinkImpl;
+import org.apache.cxf.ws.eventing.integration.notificationapi.CatastrophicEventSink;
+import org.apache.cxf.ws.eventing.integration.notificationapi.assertions.ReferenceParametersAssertingHandler;
+import org.apache.cxf.ws.eventing.integration.notificationapi.assertions.WSAActionAssertingHandler;
+import org.apache.cxf.ws.eventing.manager.SubscriptionManagerEndpoint;
+import org.apache.cxf.ws.eventing.shared.EventingConstants;
+import org.apache.cxf.ws.eventing.shared.handlers.ReferenceParametersAddingHandler;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+/**
+ * Prepared class for simple development of integration tests for WS-Eventing. Extend it and you will get:
+ * - Event Source web service available at local://SimpleEventSource
+ * - Subscription Manager web service available at local://SimpleSubscriptionManager
+ * - These two services are connected together, using an IN-VM backend/database instance
+ * - JAX-WS client for the Event Source [the eventSourceClient property]
+ * - ability to create a JAX-WS client for the Subscription Manager (the createSubscriptionManagerClient method)
+ */
+public abstract class SimpleEventingIntegrationTest {
+
+ public static final String URL_EVENT_SOURCE = "local://SimpleEventSource";
+ public static final String URL_SUBSCRIPTION_MANAGER = "local://SimpleSubscriptionManager";
+
+ static Server eventSource;
+ static Server subscriptionManager;
+ protected EventSourceEndpoint eventSourceClient;
+
+ protected NotificatorService createNotificatorService() {
+ return new EventSinkInterfaceNotificatorService() {
+ @Override
+ protected SubscriptionManagerInterfaceForNotificators obtainManager() {
+ return SingletonSubscriptionManagerContainer.getInstance();
+ }
+
+ @Override
+ protected Class<?> getEventSinkInterface() {
+ return CatastrophicEventSink.class;
+ }
+ };
+ }
+
+ protected Server createEndToEndpoint(String address) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEndToEndpointImpl());
+ factory.setAddress(address);
+ factory.getHandlers().add(new WSAActionAssertingHandler(EventingConstants.ACTION_SUBSCRIPTION_END));
+ return factory.create();
+ }
+
+ protected Server createEndToEndpointWithReferenceParametersAssertion(String address,
+ ReferenceParametersType params) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEndToEndpointImpl());
+ factory.setAddress(address);
+ factory.getHandlers().add(new ReferenceParametersAssertingHandler(params));
+ factory.getHandlers().add(new WSAActionAssertingHandler(EventingConstants.ACTION_SUBSCRIPTION_END));
+ return factory.create();
+ }
+
+ protected Server createEventSink(String address) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEventSinkImpl());
+ factory.setAddress(address);
+ return factory.create();
+ }
+
+ protected Server createWrappedEventSink(String address) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingWrappedEventSinkImpl());
+ factory.setAddress(address);
+ return factory.create();
+ }
+
+ protected Server createEventSinkWithWSAActionAssertion(String address, String action) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEventSinkImpl());
+ factory.setAddress(address);
+ factory.getHandlers().add(new WSAActionAssertingHandler(action));
+ return factory.create();
+ }
+
+ protected Server createEventSinkWithReferenceParametersAssertion(String address, ReferenceParametersType params) {
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEventSinkImpl());
+ factory.setAddress(address);
+ factory.getHandlers().add(new ReferenceParametersAssertingHandler(params));
+ return factory.create();
+ }
+
+
+ /**
+ * Prepares the Event Source and Subscription Manager services
+ */
+ @BeforeClass
+ public static void setUpBeforeClass() throws Exception {
+ // create and publish event source
+ JaxWsServerFactoryBean factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingEventSource());
+ factory.setAddress(URL_EVENT_SOURCE);
+ factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+ eventSource = factory.create();
+
+ // create and publish subscription manager
+ factory = new JaxWsServerFactoryBean();
+ factory.setServiceBean(new TestingSubscriptionManager());
+ factory.setAddress(URL_SUBSCRIPTION_MANAGER);
+ factory.setTransportId(LocalTransportFactory.TRANSPORT_ID);
+ subscriptionManager = factory.create();
+ }
+
+ @AfterClass
+ public static void tearDownAfterClass() throws Exception {
+ eventSource.destroy();
+ subscriptionManager.destroy();
+ }
+
+ @Before
+ public void createClient() {
+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+ factory.getInInterceptors().add(new LoggingInInterceptor());
+ factory.getOutInterceptors().add(new LoggingOutInterceptor());
+ factory.setServiceClass(EventSourceEndpoint.class);
+ factory.setAddress(URL_EVENT_SOURCE);
+ eventSourceClient = (EventSourceEndpoint)factory.create();
+ }
+
+ @After
+ public void after() {
+ // remove all subscriptions from the database
+ for (SubscriptionTicket ticket : SingletonSubscriptionManagerContainer.getInstance().getTickets()) {
+ SingletonSubscriptionManagerContainer.getInstance().unsubscribeTicket(ticket.getUuid());
+ }
+ }
+
+ /**
+ * Convenience method to create a client for the testing Subscription Manager
+ * which is located at local://SimpleSubscriptionManager.
+ * You have to specify the reference parameters you obtained from the Event Source
+ * when your subscription was created.
+ *
+ * @return a JAX-WS client set up for managing the subscription you had created using the Event Source
+ */
+ public SubscriptionManagerEndpoint createSubscriptionManagerClient(ReferenceParametersType refs) {
+ JaxWsProxyFactoryBean factory = new JaxWsProxyFactoryBean();
+ factory.setServiceClass(SubscriptionManagerEndpoint.class);
+ factory.setAddress(URL_SUBSCRIPTION_MANAGER);
+ factory.getInInterceptors().add(new LoggingInInterceptor());
+ factory.getOutInterceptors().add(new LoggingOutInterceptor());
+ ReferenceParametersAddingHandler handler = new ReferenceParametersAddingHandler(refs);
+ factory.getHandlers().add(handler);
+ return (SubscriptionManagerEndpoint)factory.create();
+ }
+
+ protected NotifyTo createDummyNotifyTo() {
+ NotifyTo ret = new NotifyTo();
+ EndpointReferenceType eventSinkERT = new EndpointReferenceType();
+ AttributedURIType eventSinkAddr = new AttributedURIType();
+ eventSinkAddr.setValue("local://dummy-sink");
+ eventSinkERT.setAddress(eventSinkAddr);
+ ret.setValue(eventSinkERT);
+ return ret;
+ }
+
+ protected static String allocatePort(Class<?> cls) {
+ return org.apache.cxf.testutil.common.TestUtil.getPortNumber(cls);
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/TestUtil.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/TestUtil.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/TestUtil.java (added)
+++ cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/TestUtil.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.base;
+
+import java.util.Random;
+
+public final class TestUtil {
+
+ private TestUtil() {
+
+ }
+
+ public static String generateRandomURLWithLocalTransport() {
+ Integer random = new Random().nextInt(Integer.MAX_VALUE);
+ return "local://endpoint" + random;
+ }
+
+ public static String generateRandomURLWithHttpTransport(String port) {
+ Integer random = new Random().nextInt(Integer.MAX_VALUE);
+ return "http://localhost:" + port + "/endpoint" + random;
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/SingletonSubscriptionManagerContainer.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/SingletonSubscriptionManagerContainer.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/SingletonSubscriptionManagerContainer.java (added)
+++ cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/aux/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 org.apache.cxf.ws.eventing.base.aux;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManager;
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerImpl;
+import org.apache.cxf.ws.eventing.base.SimpleEventingIntegrationTest;
+
+public final class SingletonSubscriptionManagerContainer {
+
+ private static SubscriptionManager instance;
+
+ private SingletonSubscriptionManagerContainer() {
+ // utility class should not have a public constructor
+ }
+
+ public static synchronized SubscriptionManager getInstance() {
+ if (instance == null) {
+ instance = new SubscriptionManagerImpl(SimpleEventingIntegrationTest.URL_SUBSCRIPTION_MANAGER);
+ }
+ return instance;
+ }
+
+ public static synchronized void destroy() {
+ instance = null;
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingEventSource.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingEventSource.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingEventSource.java (added)
+++ cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingEventSource.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.base.services;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerInterfaceForEventSources;
+import org.apache.cxf.ws.eventing.base.aux.SingletonSubscriptionManagerContainer;
+import org.apache.cxf.ws.eventing.eventsource.AbstractEventSource;
+
+/**
+ * Simple Event Source webservice for integration tests
+ */
+@WebService(endpointInterface = "org.apache.cxf.ws.eventing.eventsource.EventSourceEndpoint")
+public class TestingEventSource extends AbstractEventSource {
+
+
+ @Override
+ protected SubscriptionManagerInterfaceForEventSources getSubscriptionManagerBackend() {
+ return SingletonSubscriptionManagerContainer.getInstance();
+ }
+
+}
Added: cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingSubscriptionManager.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingSubscriptionManager.java?rev=1484099&view=auto
==============================================================================
--- cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingSubscriptionManager.java (added)
+++ cxf/trunk/rt/ws/eventing/src/test/java/org/apache/cxf/ws/eventing/base/services/TestingSubscriptionManager.java Sat May 18 12:17:39 2013
@@ -0,0 +1,41 @@
+/**
+ * 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.base.services;
+
+import javax.jws.WebService;
+
+import org.apache.cxf.ws.eventing.backend.manager.SubscriptionManagerInterfaceForManagers;
+import org.apache.cxf.ws.eventing.base.aux.SingletonSubscriptionManagerContainer;
+import org.apache.cxf.ws.eventing.manager.AbstractSubscriptionManager;
+
+
+
+/**
+ * Simple Subscription Manager webservice for integration tests
+ */
+@WebService(endpointInterface = "org.apache.cxf.ws.eventing.manager.SubscriptionManagerEndpoint")
+public class TestingSubscriptionManager extends AbstractSubscriptionManager {
+
+ @Override
+ protected SubscriptionManagerInterfaceForManagers getSubscriptionManagerBackend() {
+ return SingletonSubscriptionManagerContainer.getInstance();
+ }
+
+}
\ No newline at end of file