You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@synapse.apache.org by as...@apache.org on 2008/12/31 21:26:51 UTC

svn commit: r730466 [2/3] - in /synapse/trunk/java: ./ modules/core/src/main/java/org/apache/synapse/config/ modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/src/main/java/org/apache/synapse/config/xml/eventing/ modules/core/src/m...

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,292 @@
+package org.apache.synapse.eventing.builders;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.soap.*;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.AddressingConstants;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.EndpointReferenceHelper;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.databinding.utils.ConverterUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.eventing.SynapseSubscription;
+import org.wso2.eventing.EventingConstants;
+
+import javax.xml.namespace.QName;
+
+/*
+*  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.
+*/
+public class ResponseMessageBuilder {
+    private SOAPFactory factory;
+    private static final Log log = LogFactory.getLog(ResponseMessageBuilder.class);
+
+    public ResponseMessageBuilder(MessageContext messageCtx) {
+        factory = (SOAPFactory) messageCtx.getEnvelope().getOMFactory();
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ew="http://www.example.com/warnings"
+     * (06)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (07)   <s12:Header>
+     * (08)     <wsa:Action>
+     * (09) http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse
+     * (10)     </wsa:Action>
+     * (11)     <wsa:RelatesTo>
+     * (12)       uuid:e1886c5c-5e86-48d1-8c77-fc1c28d47180
+     * (13)     </wsa:RelatesTo>
+     * (14)     <wsa:To>http://www.example.com/MyEventSink</wsa:To>
+     * (15)     <ew:MySubscription>2597</ew:MySubscription>
+     * (16)   </s12:Header>
+     * (17)   <s12:Body>
+     * (18)     <wse:SubscribeResponse>
+     * (19)       <wse:SubscriptionManager>
+     * (20)         <wsa:Address>
+     * (21)           http://www.example.org/oceanwatch/SubscriptionManager
+     * (22)         </wsa:Address>
+     * (23)         <wsa:ReferenceParameters>
+     * (24)           <wse:Identifier>
+     * (25)             uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+     * (26)           </wse:Identifier>
+     * (27)         </wsa:ReferenceParameters>
+     * (28)       </wse:SubscriptionManager>
+     * (29)       <wse:Expires>2004-07-01T00:00:00.000-00:00</wse:Expires>
+     * (30)     </wse:SubscribeResponse>
+     * (31)   </s12:Body>
+     * (32) </s12:Envelope>
+     * Generate the subscription responce message
+     *
+     * @param subscription
+     * @return
+     */
+    public SOAPEnvelope genSubscriptionResponse(SynapseSubscription subscription) {
+        SOAPEnvelope message = factory.getDefaultEnvelope();
+        EndpointReference subscriptionManagerEPR = new EndpointReference(subscription.getAddressUrl());
+        subscriptionManagerEPR.addReferenceParameter(new QName(EventingConstants.WSE_EVENTING_NS,
+                EventingConstants.WSE_EN_IDENTIFIER, EventingConstants.WSE_EVENTING_PREFIX), subscription.getId());
+        OMNamespace eventingNamespace = factory.createOMNamespace(EventingConstants.WSE_EVENTING_NS,
+                EventingConstants.WSE_EVENTING_PREFIX);
+        OMElement subscribeResponseElement = factory.createOMElement(EventingConstants.WSE_EN_SUBSCRIBE_RESPONSE, eventingNamespace);
+        try {
+            OMElement subscriptionManagerElement = EndpointReferenceHelper.toOM(
+                    subscribeResponseElement.getOMFactory(),
+                    subscriptionManagerEPR,
+                    new QName(EventingConstants.WSE_EVENTING_NS,
+                            EventingConstants.WSE_EN_SUBSCRIPTION_MANAGER,
+                            EventingConstants.WSE_EVENTING_PREFIX),
+                    AddressingConstants.Submission.WSA_NAMESPACE);
+            subscribeResponseElement.addChild(subscriptionManagerElement);
+            message.getBody().addChild(subscribeResponseElement);
+        } catch (AxisFault axisFault) {
+            handleException("unable to create subscription response", axisFault);
+        }
+        return message;
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing" >
+     * (04)   <s12:Header>
+     * (05)     <wsa:Action>
+     * (06) http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse
+     * (07)     </wsa:Action>
+     * (08)     <wsa:RelatesTo>
+     * (09)       uuid:2653f89f-25bc-4c2a-a7c4-620504f6b216
+     * (10)     </wsa:RelatesTo>
+     * (11)     <wsa:To>http://www.example.com/MyEventSink</wsa:To>
+     * (12)   </s12:Header>
+     * (13)   <s12:Body />
+     * (14) </s12:Envelope>
+     *
+     * @param subscription
+     * @return
+     */
+    public SOAPEnvelope genUnSubscribeResponse(SynapseSubscription subscription) {
+        SOAPEnvelope message = factory.getDefaultEnvelope();
+        OMElement dummyBody = factory.createOMElement("UnSunscribeResponce", null);
+        message.getBody().addChild(dummyBody);
+        return message;
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)      http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse
+     * (09)     </wsa:Action>
+     * (10)     <wsa:RelatesTo>
+     * (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+     * (12)     </wsa:RelatesTo>
+     * (13)     <wsa:To>http://www.example.com/MyEventSink</wsa:To>
+     * (14)   </s12:Header>
+     * (15)   <s12:Body>
+     * (16)     <wse:RenewResponse>
+     * (17)       <wse:Expires>2004-06-26T12:00:00.000-00:00</wse:Expires>
+     * (18)     </wse:RenewResponse>
+     * (19)   </s12:Body>
+     * (20) </s12:Envelope>
+     *
+     * @param subscription
+     * @return
+     */
+    public SOAPEnvelope genRenewSubscriptionResponse(SynapseSubscription subscription) {
+        SOAPEnvelope message = factory.getDefaultEnvelope();
+        OMNamespace eventingNamespace = factory.createOMNamespace(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EVENTING_PREFIX);
+        OMElement renewResponseElement = factory.createOMElement(EventingConstants.WSE_EN_RENEW_RESPONSE, eventingNamespace);
+        OMElement expiresElement = factory.createOMElement(EventingConstants.WSE_EN_EXPIRES, eventingNamespace);
+        factory.createOMText(expiresElement, ConverterUtil.convertToString(subscription.getExpires()));
+        renewResponseElement.addChild(expiresElement);
+        message.getBody().addChild(renewResponseElement);
+        return message;
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)      http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse
+     * (09)     </wsa:Action>
+     * (10)     <wsa:RelatesTo>
+     * (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+     * (12)     </wsa:RelatesTo>
+     * (13)     <wsa:To>http://www.example.com/MyEventSink</wsa:To>
+     * (14)   </s12:Header>
+     * (15)   <s12:Body>
+     * (16)     <wse:GetStatusResponse>
+     * (17)       <wse:Expires>2004-06-26T12:00:00.000-00:00</wse:Expires>
+     * (18)     </wse:GetStatusResponse>
+     * (19)   </s12:Body>
+     * (20) </s12:Envelope>
+     *
+     * @param subscription
+     * @return
+     */
+    public SOAPEnvelope genGetStatusResponse(SynapseSubscription subscription) {
+        SOAPEnvelope message = factory.getDefaultEnvelope();
+        OMNamespace eventingNamespace = factory.createOMNamespace(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EVENTING_PREFIX);
+        OMElement renewResponseElement = factory.createOMElement(EventingConstants.WSE_EN_GET_STATUS_RESPONSE, eventingNamespace);
+        OMElement expiresElement = factory.createOMElement(EventingConstants.WSE_EN_EXPIRES, eventingNamespace);
+        if (subscription.getExpires() != null) {
+            factory.createOMText(expiresElement, ConverterUtil.convertToString(subscription.getExpires()));
+        } else {
+            factory.createOMText(expiresElement, "*");
+        }
+        renewResponseElement.addChild(expiresElement);
+        message.getBody().addChild(renewResponseElement);
+        return message;
+    }
+
+    /**
+     * <S:Envelope>
+     * <S:Header>
+     * <wsa:Action>
+     * http://schemas.xmlsoap.org/ws/2004/08/addressing/fault
+     * </wsa:Action>
+     * <!-- Headers elided for clarity.  -->
+     * </S:Header>
+     * <S:Body>
+     * <S:Fault>
+     * <S:Code>
+     * <S:Value>[Code]</S:Value>
+     * <S:Subcode>
+     * <S:Value>[Subcode]</S:Value>
+     * </S:Subcode>
+     * </S:Code>
+     * <S:Reason>
+     * <S:Text xml:lang="en">[Reason]</S:Text>
+     * </S:Reason>
+     * <S:Detail>
+     * [Detail]
+     * </S:Detail>
+     * </S:Fault>
+     * </S:Body>
+     * </S:Envelope>
+     *
+     * @param code
+     * @param subCode
+     * @param reason
+     * @param detail
+     * @return
+     */
+    public SOAPEnvelope genFaultResponse(MessageContext messageCtx, String code, String subCode, String reason, String detail) {
+        SOAPFactory soapFactory = null;        
+        if (messageCtx.isSOAP11()) {
+            soapFactory = OMAbstractFactory.getSOAP11Factory();
+            SOAPEnvelope message = soapFactory.getDefaultFaultEnvelope();
+            SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
+            soapFaultReason.setText(reason);
+            message.getBody().getFault().setReason(soapFaultReason);
+            SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();            
+            QName qNameSubCode = new QName(EventingConstants.WSE_EVENTING_NS, subCode, EventingConstants.WSE_EVENTING_PREFIX);
+            soapFaultCode.setText(qNameSubCode);
+            message.getBody().getFault().setCode(soapFaultCode);
+            return message;
+        } else {
+            soapFactory = OMAbstractFactory.getSOAP12Factory();
+            SOAPEnvelope message = soapFactory.getDefaultFaultEnvelope();
+            SOAPFaultDetail soapFaultDetail = soapFactory.createSOAPFaultDetail();
+            soapFaultDetail.setText(detail);
+            message.getBody().getFault().setDetail(soapFaultDetail);
+            SOAPFaultReason soapFaultReason = soapFactory.createSOAPFaultReason();
+            SOAPFaultText soapFaultText = soapFactory.createSOAPFaultText();
+            soapFaultText.setText(reason);
+            soapFaultReason.addSOAPText(soapFaultText);
+            message.getBody().getFault().setReason(soapFaultReason);
+            SOAPFaultCode soapFaultCode = soapFactory.createSOAPFaultCode();
+            SOAPFaultValue soapFaultValue = soapFactory.createSOAPFaultValue(soapFaultCode);
+            soapFaultValue.setText(code);
+            soapFaultCode.setValue(soapFaultValue);
+            SOAPFaultSubCode soapFaultSubCode = soapFactory.createSOAPFaultSubCode(soapFaultCode);
+            SOAPFaultValue soapFaultValueSub = soapFactory.createSOAPFaultValue(soapFaultSubCode);
+            QName qNameSubCode = new QName(EventingConstants.WSE_EVENTING_NS, subCode, EventingConstants.WSE_EVENTING_PREFIX);
+            soapFaultValueSub.setText(qNameSubCode);
+            soapFaultSubCode.setValue(soapFaultValueSub);
+            soapFaultCode.setSubCode(soapFaultSubCode);
+            message.getBody().getFault().setCode(soapFaultCode);
+            return message;
+        }
+    }
+
+    private void handleException(String message) {
+        log.error(message);
+        throw new SynapseException(message);
+    }
+
+    private void handleException(String message, Exception e) {
+        log.error(message, e);
+        throw new SynapseException(message, e);
+    }
+
+}

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,391 @@
+/*
+ *  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.synapse.eventing.builders;
+
+import org.apache.axiom.om.OMAttribute;
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.databinding.utils.ConverterUtil;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.config.xml.SynapseXPathFactory;
+import org.apache.synapse.config.xml.XMLConfigConstants;
+import org.apache.synapse.endpoints.AddressEndpoint;
+import org.apache.synapse.endpoints.Endpoint;
+import org.apache.synapse.endpoints.EndpointDefinition;
+import org.apache.synapse.eventing.SynapseEventingConstants;
+import org.apache.synapse.eventing.SynapseSubscription;
+import org.apache.synapse.eventing.filters.XPathBasedEventFilter;
+import org.apache.synapse.util.xpath.SynapseXPath;
+import org.jaxen.JaxenException;
+import org.wso2.eventing.EventingConstants;
+import org.wso2.eventing.SubscriptionData;
+
+import javax.xml.namespace.QName;
+import java.util.Calendar;
+
+/**
+ *
+ */
+public class SubscriptionMessageBuilder {
+
+    private static final Log log = LogFactory.getLog(SubscriptionMessageBuilder.class);
+
+    private static final QName SUBSCRIBE_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_SUBSCRIBE);
+    private static final QName DELIVERY_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_DELIVERY);
+    private static final QName FILTER_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_FILTER);
+    private static final QName NOTIFY_TO_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_NOTIFY_TO);
+    private static final QName ATT_DIALECT = new QName(XMLConfigConstants.NULL_NAMESPACE, EventingConstants.WSE_EN_DIALECT);
+    private static final QName ATT_XPATH = new QName(XMLConfigConstants.NULL_NAMESPACE, EventingConstants.WSE_EN_XPATH);
+    private static final QName IDENTIFIER = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_IDENTIFIER);
+    private static final QName EXPIRES = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_EXPIRES);
+    private static final QName RENEW = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_RENEW);
+
+    private static String errorSubCode = null;
+    private static String errorReason = null;
+    private static String errorCode = null;
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ew="http://www.example.com/warnings" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe
+     * (09)     </wsa:Action>
+     * (10)     <wsa:MessageID>
+     * (11)       uuid:e1886c5c-5e86-48d1-8c77-fc1c28d47180
+     * (12)     </wsa:MessageID>
+     * (13)     <wsa:ReplyTo>
+     * (14)      <wsa:Address>http://www.example.com/MyEvEntsink</wsa:Address>
+     * (15)      <wsa:ReferenceProperties>
+     * (16)        <ew:MySubscription>2597</ew:MySubscription>
+     * (17)      </wsa:ReferenceProperties>
+     * (18)     </wsa:ReplyTo>
+     * (19)     <wsa:To>http://www.example.org/oceanwatch/EventSource</wsa:To>
+     * (20)   </s12:Header>
+     * (21)   <s12:Body>
+     * (22)     <wse:Subscribe>
+     * (23)       <wse:EndTo>
+     * (24)         <wsa:Address>
+     * (25)           http://www.example.com/MyEventSink
+     * (26)         </wsa:Address>
+     * (27)         <wsa:ReferenceProperties>
+     * (28)           <ew:MySubscription>2597</ew:MySubscription>
+     * (29)         </wsa:ReferenceProperties>
+     * (30)       </wse:EndTo>
+     * (31)       <wse:Delivery>
+     * (32)         <wse:NotifyTo>
+     * (33)           <wsa:Address>
+     * (34)             http://www.other.example.com/OnStormWarning
+     * (35)           </wsa:Address>
+     * (36)           <wsa:ReferenceProperties>
+     * (37)             <ew:MySubscription>2597</ew:MySubscription>
+     * (38)           </wsa:ReferenceProperties>
+     * (39)         </wse:NotifyTo>
+     * (40)       </wse:Delivery>
+     * (41)       <wse:Expires>2004-06-26T21:07:00.000-08:00</wse:Expires>
+     * (42)       <wse:Filter xmlns:ow="http://www.example.org/oceanwatch"
+     * (43)           Dialect="http://www.example.org/topicFilter" >
+     * (44)         weather.storms
+     * (45)       </wse:Filter>
+     * (46)     </wse:Subscribe>
+     * (47)   </s12:Body>
+     * (48) </s12:Envelope>
+     *
+     * @param mc
+     * @return
+     */
+    public static SynapseSubscription createSubscription(MessageContext mc) {
+        SynapseSubscription subscription = null;
+        OMElement notifyToElem = null;
+        OMElement elem = mc.getEnvelope().getBody().getFirstChildWithName(SUBSCRIBE_QNAME);
+        if (elem != null) {
+            OMElement deliveryElem = elem.getFirstChildWithName(DELIVERY_QNAME);
+            if (deliveryElem != null) {
+                notifyToElem = deliveryElem.getFirstChildWithName(NOTIFY_TO_QNAME);
+                if (notifyToElem != null) {
+                    Endpoint ep = getEndpointFromWSAAddress(notifyToElem.getFirstElement());
+                    if (ep != null) {
+                        subscription = new SynapseSubscription(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
+                        subscription.setEndpoint(ep);
+                        subscription.setAddressUrl(notifyToElem.getFirstElement().getText());
+                        subscription.setEndpointUrl(notifyToElem.getFirstElement().getText());
+                    }
+                } else {
+                    handleException("NotifyTo element not found in the subscription message");
+                }
+            } else {
+                handleException("Delivery element is not found in the subscription message");
+            }
+
+            OMElement filterElem = elem.getFirstChildWithName(FILTER_QNAME);
+            if (subscription != null && filterElem != null) {
+                OMAttribute dialectAttr = filterElem.getAttribute(ATT_DIALECT);
+                if (dialectAttr != null && dialectAttr.getAttributeValue() != null) {
+                    if (SynapseEventingConstants.TOPIC_FILTER_DIALECT.equals(dialectAttr.getAttributeValue())) {
+                        XPathBasedEventFilter filter = new XPathBasedEventFilter();
+                        filter.setResultValue(filterElem.getText());
+                        if (filterElem.getAttribute(ATT_XPATH) != null) {
+                            try {
+                                SynapseXPath xpath = SynapseXPathFactory.getSynapseXPath(filterElem, ATT_XPATH);
+                                filter.setSourceXpath(xpath);
+                            } catch (JaxenException e) {
+                                handleException("Unable to create the SynapseEventFilter xpath", e);
+                            }
+                        }
+                        subscription.setFilter(filter);
+                                           SubscriptionData subscriptionData = new SubscriptionData();
+                    subscriptionData.setProperty(SynapseEventingConstants.FILTER_VALUE,filterElem.getText());
+                    subscriptionData.setProperty(SynapseEventingConstants.FILTER_DIALECT,dialectAttr.getAttributeValue());
+                    subscription.setSubscriptionData(subscriptionData);
+                    }
+                } else {
+                    handleException("Error in creating subscription. Filter dialect not defined");
+                }
+            }
+            OMElement expiryElem = elem.getFirstChildWithName(EXPIRES);
+            if (expiryElem != null) {
+                Calendar calendarExpires = null;
+                try {
+                    if(expiryElem.getText().startsWith("P")){
+                        calendarExpires = ConverterUtil.convertToDuration(expiryElem.getText()).getAsCalendar();
+                    }else{
+                        calendarExpires = ConverterUtil.convertToDateTime(expiryElem.getText());
+                    }
+                } catch (Exception e) {
+                    log.error("Error converting the expiration date ," + e.toString());
+                    setExpirationFault(subscription);
+                }
+                Calendar calendarNow = Calendar.getInstance();
+                if (calendarNow.before(calendarExpires)) {
+                    subscription.setExpires(calendarExpires);
+                } else {
+                    setExpirationFault(subscription);
+                }
+            }
+        } else {
+            handleException("Subscribe element is required as the payload of the subscription message");
+        }
+        return subscription;
+    }
+
+
+    /**
+     * create request for unsubscribr request
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe
+     * (09)     </wsa:Action>
+     * (10)     <wsa:MessageID>
+     * (11)       uuid:2653f89f-25bc-4c2a-a7c4-620504f6b216
+     * (12)     </wsa:MessageID>
+     * (13)     <wsa:ReplyTo>
+     * (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+     * (15)     </wsa:ReplyTo>
+     * (16)     <wsa:To>
+     * (17)       http://www.example.org/oceanwatch/SubscriptionManager
+     * (18)     </wsa:To>
+     * (19)     <wse:Identifier>
+     * (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+     * (21)     </wse:Identifier>
+     * (22)   </s12:Header>
+     * (23)   <s12:Body>
+     * (24)     <wse:Unsubscribe />
+     * (25)   </s12:Body>
+     * (26) </s12:Envelope>
+     *
+     * @param mc
+     * @return
+     */
+    public static SynapseSubscription createUnSubscribeMessage(MessageContext mc) {
+        SynapseSubscription subscription = new SynapseSubscription();
+        OMElement elem = mc.getEnvelope().getHeader().getFirstChildWithName(IDENTIFIER);
+        String id = elem.getText();
+        subscription.setId(id);
+        subscription.setAddressUrl(mc.getTo().getAddress());
+        return subscription;
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew
+     * (09)     </wsa:Action>
+     * (10)     <wsa:MessageID>
+     * (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+     * (12)     </wsa:MessageID>
+     * (13)     <wsa:ReplyTo>
+     * (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+     * (15)     </wsa:ReplyTo>
+     * (16)     <wsa:To>
+     * (17)       http://www.example.org/oceanwatch/SubscriptionManager
+     * (18)     </wsa:To>
+     * (19)     <wse:Identifier>
+     * (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+     * (21)     </wse:Identifier>
+     * (22)   </s12:Header>
+     * (23)   <s12:Body>
+     * (24)     <wse:Renew>
+     * (25)       <wse:Expires>2004-06-26T21:07:00.000-08:00</wse:Expires>
+     * (26)     </wse:Renew>
+     * (27)   </s12:Body>
+     * (28) </s12:Envelope>
+     *
+     * @param mc
+     * @return
+     */
+    public static SynapseSubscription createRenewSubscribeMessage(MessageContext mc) {
+        SynapseSubscription subscription = new SynapseSubscription();
+        OMElement elem = mc.getEnvelope().getHeader().getFirstChildWithName(IDENTIFIER);
+        String id = elem.getText();
+        subscription.setId(id);
+        subscription.setAddressUrl(mc.getTo().getAddress());
+        OMElement renewElem = mc.getEnvelope().getBody().getFirstChildWithName(RENEW);
+        if (renewElem != null) {
+            OMElement expiryElem = renewElem.getFirstChildWithName(EXPIRES);
+            if (expiryElem != null) {
+                Calendar calendarExpires=null;
+                try{
+                    if(expiryElem.getText().startsWith("P")){
+                        calendarExpires = ConverterUtil.convertToDuration(expiryElem.getText()).getAsCalendar();
+                    }else{
+                        calendarExpires = ConverterUtil.convertToDateTime(expiryElem.getText());
+                    }
+                }catch(Exception e){
+                    setExpirationFault(subscription);
+                }
+                    Calendar calendarNow = Calendar.getInstance();
+                    if (calendarNow.before(calendarExpires)) {
+                        subscription.setExpires(calendarExpires);
+                    } else {
+                        setExpirationFault(subscription);
+                    }
+
+                subscription.setExpires(calendarExpires);
+            } else {
+                setExpirationFault(subscription);
+            }
+        }
+        return subscription;
+    }
+
+    /**
+     * (01) <s12:Envelope
+     * (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+     * (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+     * (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+     * (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+     * (06)   <s12:Header>
+     * (07)     <wsa:Action>
+     * (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus
+     * (09)     </wsa:Action>
+     * (10)     <wsa:MessageID>
+     * (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+     * (12)     </wsa:MessageID>
+     * (13)     <wsa:ReplyTo>
+     * (14)       <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+     * (15)     </wsa:ReplyTo>
+     * (16)     <wsa:To>
+     * (17)       http://www.example.org/oceanwatch/SubscriptionManager
+     * (18)     </wsa:To>
+     * (19)     <wse:Identifier>
+     * (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+     * (21)     </wse:Identifier>
+     * (22)   </s12:Header>
+     * (23)   <s12:Body>
+     * (24)     <wse:GetStatus />
+     * (25)   </s12:Body>
+     * (26) </s12:Envelope>
+     *
+     * @param mc
+     * @return
+     */
+    public static SynapseSubscription createGetStatusMessage(MessageContext mc) {
+        SynapseSubscription subscription = new SynapseSubscription();
+        subscription.setAddressUrl(mc.getTo().getAddress());
+        OMElement elem = mc.getEnvelope().getHeader().getFirstChildWithName(IDENTIFIER);
+        String id = elem.getText();
+        subscription.setId(id);
+        return subscription;
+    }
+
+    private static Endpoint getEndpointFromWSAAddress(OMElement address) {
+        AddressEndpoint endpoint = new AddressEndpoint();
+        EndpointDefinition def = new EndpointDefinition();
+        def.setAddress(address.getText().trim());
+        endpoint.setDefinition(def);
+        return endpoint;
+    }
+
+    private static void handleException(String message) {
+        log.error(message);
+        throw new SynapseException(message);
+    }
+
+    private static void handleException(String message, Exception e) {
+        log.error(message, e);
+        throw new SynapseException(message, e);
+    }
+
+    public static String getErrorSubCode() {
+        return errorSubCode;
+    }
+
+    public static void setErrorSubCode(String errorCode) {
+        errorSubCode = errorCode;
+    }
+
+    public static String getErrorReason() {
+        return errorReason;
+    }
+
+    public static void setErrorReason(String errorReasons) {
+        errorReason = errorReasons;
+    }
+
+    public static String getErrorCode() {
+        return errorCode;
+    }
+
+    public static void setErrorCode(String errorCodes) {
+        errorCode = errorCodes;
+    }
+
+    private static void setExpirationFault(SynapseSubscription subscription) {
+        setErrorCode(EventingConstants.WSE_FAULT_CODE_SENDER);
+        setErrorSubCode("wse:InvalidExpirationTime");
+        setErrorReason("The expiration time requested is invalid");
+        subscription.setId(null);
+    }
+}

Propchange: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
------------------------------------------------------------------------------
    svn:executable = *

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,63 @@
+/*
+ *  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.synapse.eventing.filters;
+
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.eventing.SynapseEventFilter;
+import org.apache.synapse.util.xpath.SynapseXPath;
+
+/**
+ *
+ */
+public class XPathBasedEventFilter implements SynapseEventFilter {
+
+    private SynapseXPath sourceXpath;
+    private String resultValue;
+
+    public boolean isSatisfied(MessageContext mc) {
+        String evaluatedValue = sourceXpath.stringValueOf(mc);
+        if (evaluatedValue.equals(resultValue)) {
+            return true;
+        } else if (evaluatedValue.startsWith(resultValue)) {
+            return true;
+        }
+        return false;
+    }
+
+    public SynapseXPath getSourceXpath() {
+        return sourceXpath;
+    }
+
+    public void setSourceXpath(SynapseXPath sourceXpath) {
+        this.sourceXpath = sourceXpath;
+    }
+
+    public String getResultValue() {
+        return resultValue;
+    }
+
+    public void setResultValue(String resultValue) {
+        this.resultValue = resultValue;
+    }
+
+    public String toString() {
+        return resultValue;
+    }
+}

Propchange: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
------------------------------------------------------------------------------
    svn:executable = *

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,193 @@
+/*
+ *  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.synapse.eventing.managers;
+
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.SynapseException;
+import org.apache.synapse.util.xpath.SynapseXPath;
+import org.apache.synapse.eventing.SynapseSubscription;
+import org.apache.synapse.eventing.SynapseSubscriptionManager;
+import org.apache.synapse.eventing.filters.XPathBasedEventFilter;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.jaxen.JaxenException;
+import org.wso2.eventing.Subscription;
+import org.wso2.eventing.exceptions.EventException;
+
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Calendar;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ *
+ */
+public class DefaultInMemorySubscriptionManager extends SynapseSubscriptionManager {
+
+    private Map<String, SynapseSubscription> store = new ConcurrentHashMap<String, SynapseSubscription>();
+    private String topicHeaderName;
+    private String topicHeaderNS;
+    private SynapseXPath topicXPath;
+    private static final Log log = LogFactory.getLog(DefaultInMemorySubscriptionManager.class);
+
+    public String addSubscription(SynapseSubscription subs) {
+		if (subs.getId() == null) {
+			subs.setId(org.apache.axiom.om.util.UUIDGenerator.getUUID());
+		}
+		store.put(subs.getId(), subs);
+		return subs.getId();
+	}
+
+	public boolean deleteSubscription(String id) {
+		if (store.containsKey(id)) {
+			store.remove(id);
+			return true;
+		} else {
+			return false;
+		}
+	}
+
+    /**
+     * Renew the subscription by setting the expire date time 
+     * @param subscription
+     * @return
+     */
+    public boolean renewSubscription(SynapseSubscription subscription){
+        SynapseSubscription subscriptionOld = getSubscription(subscription.getId());
+        if (subscriptionOld !=null){
+            subscriptionOld.setExpires(subscription.getExpires());
+            return true;
+        }else{
+            return false;
+        }
+    }
+    public List<SynapseSubscription> getSynapseSubscribers() {
+		LinkedList<SynapseSubscription> list = new LinkedList<SynapseSubscription>();
+        for (Map.Entry<String, SynapseSubscription> stringSubscriptionEntry : store.entrySet()) {
+            list.add(stringSubscriptionEntry.getValue());
+        }
+		return list;
+	}
+
+    public List<SynapseSubscription> getMatchingSubscribers(MessageContext mc) {
+        LinkedList<SynapseSubscription> list = new LinkedList<SynapseSubscription>();
+        for (Map.Entry<String, SynapseSubscription> stringSubscriptionEntry : store.entrySet()) {
+            XPathBasedEventFilter filter =(XPathBasedEventFilter) stringSubscriptionEntry.getValue().getSynapseFilter();
+            filter.setSourceXpath(topicXPath);
+            if (filter == null || filter.isSatisfied(mc)) {
+                SynapseSubscription subscription = stringSubscriptionEntry.getValue();
+                Calendar current = Calendar.getInstance(); //Get current date and time
+                if(subscription.getExpires()!=null){
+                    if(current.before(subscription.getExpires())){
+                        // add only valid subscriptions by checking the expiration
+                        list.add(subscription);
+                    }
+                }else{
+                        // If a expiration dosen't exisits treat it as a never expire subscription, valid till unsubscribe
+                        list.add(subscription);
+                }
+
+            }
+        }
+		return list;
+	}
+
+    public List<SynapseSubscription> getStaticSubscribers() {
+		LinkedList<SynapseSubscription> list = new LinkedList<SynapseSubscription>();
+        for (Map.Entry<String, SynapseSubscription> stringSubscriptionEntry : store.entrySet()) {
+            if (stringSubscriptionEntry.getValue().isStaticEntry()){
+                list.add(stringSubscriptionEntry.getValue());
+            }
+        }
+		return list;
+    }
+
+    @Deprecated
+    public String subscribe(Subscription subscription) throws EventException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public boolean unsubscribe(Subscription subscription) throws EventException {
+        return false;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public String renew(Subscription subscription) throws EventException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public List<Subscription> getSubscribers() throws EventException {
+        LinkedList<Subscription> list = new LinkedList<Subscription>();
+        for (Map.Entry<String, SynapseSubscription> stringSubscriptionEntry : store.entrySet()) {
+            list.add(stringSubscriptionEntry.getValue());
+        }
+		return list;       
+    }
+
+    public List<Subscription> getAllSubscribers() throws EventException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public SynapseSubscription getSubscription(String id) {
+		return store.get(id);
+	}
+
+    public Subscription getStatus(Subscription subscription) throws EventException {
+        return null;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public void init() {
+        try {
+            //TODO: pick values from the constants
+            topicXPath = new SynapseXPath("s11:Header/ns:" + topicHeaderName + " | s12:Header/ns:" + topicHeaderName);
+            topicXPath.addNamespace("s11", "http://schemas.xmlsoap.org/soap/envelope/");
+            topicXPath.addNamespace("s12", "http://www.w3.org/2003/05/soap-envelope");
+            topicXPath.addNamespace("ns", topicHeaderNS);
+        } catch (JaxenException e) {
+            handleException("Unable to create the topic header XPath", e);
+        }
+
+
+    }
+    public String getTopicHeaderName() {
+        return topicHeaderName;
+    }
+
+    public void setTopicHeaderName(String topicHeaderName) {
+        this.topicHeaderName = topicHeaderName;
+    }
+
+    public String getTopicHeaderNS() {
+        return topicHeaderNS;
+    }
+
+    public void setTopicHeaderNS(String topicHeaderNS) {
+        this.topicHeaderNS = topicHeaderNS;
+    }    
+    private void handleException(String message) {
+        log.error(message);
+        throw new SynapseException(message);
+    }
+
+    private void handleException(String message, Exception e) {
+        log.error(message, e);
+        throw new SynapseException(message, e);
+    }
+}

Propchange: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
------------------------------------------------------------------------------
    svn:executable = *

Added: synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eventing/EventPublisherMediator.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eventing/EventPublisherMediator.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eventing/EventPublisherMediator.java (added)
+++ synapse/trunk/java/modules/core/src/main/java/org/apache/synapse/mediators/eventing/EventPublisherMediator.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,89 @@
+package org.apache.synapse.mediators.eventing;
+/*
+*  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.
+*/
+import org.apache.synapse.mediators.AbstractMediator;
+import org.apache.synapse.MessageContext;
+import org.apache.synapse.core.axis2.Axis2MessageContext;
+import org.apache.synapse.endpoints.AddressEndpoint;
+import org.apache.synapse.endpoints.EndpointDefinition;
+import org.apache.synapse.util.MessageHelper;
+import org.apache.synapse.eventing.SynapseEventSource;
+import org.apache.synapse.eventing.SynapseSubscriptionManager;
+import org.apache.synapse.eventing.SynapseSubscription;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.addressing.RelatesTo;
+
+import java.util.List;
+
+public class EventPublisherMediator extends AbstractMediator {
+    private static final Log log = LogFactory.getLog(EventPublisherMediator.class);
+    private String eventSourceName=null;
+    public boolean mediate(MessageContext synCtx){
+        if (log.isDebugEnabled()) {
+             log.debug("Mediation for Event Publisher started");
+         }
+        //sendResponce(synCtx); TODO need to investigate this further 
+        SynapseEventSource eventSource = synCtx.getConfiguration().getEventSource(eventSourceName);
+        SynapseSubscriptionManager subscriptionManager = eventSource.getSubscriptionManager();
+            List<SynapseSubscription> subscribers = subscriptionManager.getMatchingSubscribers(synCtx);
+            for (SynapseSubscription subscription : subscribers) {
+                //TODO: send a 202 responce to the client, client wait and time outs
+                synCtx.setProperty("OUT_ONLY", "true");    // Set one way message for events
+                try {
+                    subscription.getEndpoint().send(MessageHelper.cloneMessageContext(synCtx));
+                } catch (AxisFault axisFault) {
+                    log.error("Event sending failure "+axisFault.toString());
+                    return false;
+                }
+                if (log.isDebugEnabled()) {
+                    log.debug("Event push to  : " + subscription.getEndpointUrl());
+                }
+            }
+        return true;  //To change body of implemented methods use File | Settings | File Templates.
+    }
+
+    public String getEventSourceName() {
+        return eventSourceName;
+    }
+
+    public void setEventSourceName(String eventSourceName) {
+        this.eventSourceName = eventSourceName;
+    }
+    private void sendResponce(MessageContext synCtx){
+        MessageContext mc = null;
+        try {
+            mc = MessageHelper.cloneMessageContext(synCtx);
+        String replyAddress = mc.getReplyTo().getAddress();
+        AddressEndpoint endpoint = new AddressEndpoint();
+        EndpointDefinition def = new EndpointDefinition();
+        def.setAddress(replyAddress.trim());
+        def.setAddressingOn(true);
+        endpoint.setDefinition(def);
+        //mc.setEnvelope(null);
+        mc.setTo(new EndpointReference(replyAddress));
+        mc.setResponse(true);
+        endpoint.send(mc);
+            } catch (AxisFault axisFault) {
+            axisFault.printStackTrace();  //To change body of catch statement use File | Settings | File Templates.
+        }
+    }
+}

Added: synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSender.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSender.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSender.java (added)
+++ synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSender.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,116 @@
+/*
+*  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 samples.userguide;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axiom.om.impl.llom.util.AXIOMUtil;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.context.MessageContext;
+
+import java.io.File;
+
+
+public class EventSender {
+
+    public static void main(String[] args) {
+        try {
+            executeClient();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static String getProperty(String name, String def) {
+        String result = System.getProperty(name);
+        if (result == null || result.length() == 0) {
+            result = def;
+        }
+        return result;
+    }
+
+    public static void executeClient() throws Exception {
+        Options options = new Options();
+        ServiceClient serviceClient;
+        ConfigurationContext configContext = null;
+
+        String addUrl = getProperty("addurl", "http://localhost:8280/services/EventingProxy");
+        String trpUrl = getProperty("trpurl", null);
+        String prxUrl = getProperty("prxurl", null);
+        String repo = getProperty("repository", "client_repo");
+        String symbol = getProperty("symbol", "GOOG");
+        String price = getProperty("price", "10.10");
+        String qty = getProperty("qty", "1000");
+        String topic = getProperty("topic", "synapse/event/test");
+        String action = getProperty("action", "urn:event");
+        String topicns = getProperty("topicns","http://apache.org/aip");
+
+        if (repo != null && !"null".equals(repo)) {
+            configContext =
+                    ConfigurationContextFactory.
+                            createConfigurationContextFromFileSystem(repo,
+                                    repo + File.separator + "conf" + File.separator + "axis2.xml");
+            serviceClient = new ServiceClient(configContext, null);
+        } else {
+            serviceClient = new ServiceClient();
+        }
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+
+        OMNamespace nsaip = factory.createOMNamespace(topicns, "aip");
+
+        // set the target topic
+        OMElement topicOm = factory.createOMElement("Topic", nsaip);
+        factory.createOMText(topicOm, topic);
+
+        // set addressing, transport and proxy url
+
+        serviceClient.engageModule("addressing");
+        options.setTo(new EndpointReference(addUrl));
+        options.setAction(action);
+        options.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE); // set for fire and foget
+        serviceClient.setOptions(options);
+        serviceClient.addHeader(topicOm);
+        OMElement payload = AXIOMUtil.stringToOM("<m:placeOrder xmlns:m=\"http://services.samples\">\n" +
+                "    <m:order>\n" +
+                "        <m:price>" + price + "</m:price>\n" +
+                "        <m:quantity>" + qty + "</m:quantity>\n" +
+                "        <m:symbol>" + symbol + "</m:symbol>\n" +
+                "    </m:order>\n" +
+                "</m:placeOrder>");
+
+        System.out.println("Sending Event : \n" + payload.toString());
+        try {
+            serviceClient.fireAndForget(payload);
+            System.out.println("Event sent to topic " + topic);
+            Thread.sleep(1000);
+            if (configContext != null) {
+                configContext.terminate();
+            }
+        } catch (Exception ignore) {
+        }
+
+    }
+}
\ No newline at end of file

Added: synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSubscriber.java
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSubscriber.java?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSubscriber.java (added)
+++ synapse/trunk/java/modules/samples/src/main/java/samples/userguide/EventSubscriber.java Wed Dec 31 12:26:49 2008
@@ -0,0 +1,280 @@
+/*
+*  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 samples.userguide;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.client.Options;
+import org.apache.axis2.client.ServiceClient;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.AxisFault;
+import java.io.File;
+
+
+public class EventSubscriber {
+
+    public static void main(String[] args) {
+        try {
+            executeClient();
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static String getProperty(String name, String def) {
+        String result = System.getProperty(name);
+        if (result == null || result.length() == 0) {
+            result = def;
+        }
+        return result;
+    }
+
+    public static void executeClient() throws Exception {
+        Options options = new Options();
+        ServiceClient serviceClient;
+        ConfigurationContext configContext = null;
+
+        String addUrl = getProperty("addurl", "http://localhost:8280/services/SampleEventSource");
+        String trpUrl = getProperty("trpurl", null);
+        String prxUrl = getProperty("prxurl", null);
+        String repo = getProperty("repository", "client_repo");
+        String topic = getProperty("topic", "synapse/event/test");
+        String address = getProperty("address", "http://localhost:9000/services/SimpleStockQuoteService");
+        String mode = getProperty("mode", "subscribe");
+        String identifier = getProperty("identifier", "90000");
+        String expires = getProperty("expires", "*"); //Format: 2020-12-31T21:07:00.000-08:00
+
+        if (repo != null && !"null".equals(repo)) {
+            configContext =
+                    ConfigurationContextFactory.
+                            createConfigurationContextFromFileSystem(repo,
+                                    repo + File.separator + "conf" + File.separator + "axis2.xml");
+            serviceClient = new ServiceClient(configContext, null);
+        } else {
+            serviceClient = new ServiceClient();
+        }
+        OMFactory factory = OMAbstractFactory.getOMFactory();
+        OMElement message = factory.createOMElement("message", null);
+
+        OMNamespace nsxmlins = factory.createOMNamespace("http://www.w3.org/2001/XMLSchema", "xmlns");
+        OMNamespace nss11 = factory.createOMNamespace("http://schemas.xmlsoap.org/soap/envelope", "s11");
+        OMNamespace nswsa = factory.createOMNamespace("http://schemas.xmlsoap.org/ws/2004/08/addressing", "wsa");
+        OMNamespace nswse = factory.createOMNamespace("http://schemas.xmlsoap.org/ws/2004/08/eventing", "wse");
+
+        if (mode.equals("subscribe")) {
+            OMElement subscribeOm = factory.createOMElement("Subscribe", nswse);
+            OMElement deliveryOm = factory.createOMElement("Delivery", nswse);
+            deliveryOm.addAttribute(factory.createOMAttribute("Mode", null, "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push"));
+            OMElement notifyToOm = factory.createOMElement("NotifyTo", nswse);
+            OMElement addressOm = factory.createOMElement("Address", nswsa);
+            factory.createOMText(addressOm, address);
+            OMElement expiresOm = factory.createOMElement("Expires", nswse);
+            factory.createOMText(expiresOm, expires);
+            OMElement filterOm = factory.createOMElement("Filter", nswse);
+            filterOm.addAttribute(factory.createOMAttribute("Dialect", null, "http://synapse.apache.org/eventing/dialect/topicFilter"));
+            factory.createOMText(filterOm, topic);
+
+
+            notifyToOm.addChild(addressOm);
+            deliveryOm.addChild(notifyToOm);
+            subscribeOm.addChild(deliveryOm);
+            if (!(expires.equals("*"))) {
+                subscribeOm.addChild(expiresOm); // Add only if the value provided 
+            }
+            subscribeOm.addChild(filterOm);
+
+            // set addressing, transport and proxy url
+
+            serviceClient.engageModule("addressing");
+            options.setTo(new EndpointReference(addUrl));
+
+            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe");
+            serviceClient.setOptions(options);
+            System.out.println("Subscribing \n" + subscribeOm.toString());
+            try {
+                OMElement response = serviceClient.sendReceive(subscribeOm);
+                System.out.println("Subscribed to topic " + topic);
+                Thread.sleep(1000);
+                System.out.println("Response Received: " + response.toString());
+            } catch (AxisFault e) {
+                System.out.println("Fault Received : "+e.toString());
+                System.out.println("Fault Code     : "+e.getFaultCode().toString());
+            }
+        } else if (mode.equals("unsubscribe")) {
+            /** Send unsubscribe message
+             (01) <s12:Envelope
+             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+             (06)   <s12:Header>
+             (07)     <wsa:Action>
+             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe
+             (09)     </wsa:Action>
+             (10)     <wsa:MessageID>
+             (11)       uuid:2653f89f-25bc-4c2a-a7c4-620504f6b216
+             (12)     </wsa:MessageID>
+             (13)     <wsa:ReplyTo>
+             (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+             (15)     </wsa:ReplyTo>
+             (16)     <wsa:To>
+             (17)       http://www.example.org/oceanwatch/SubscriptionManager
+             (18)     </wsa:To>
+             (19)     <wse:Identifier>
+             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+             (21)     </wse:Identifier>
+             (22)   </s12:Header>
+             (23)   <s12:Body>
+             (24)     <wse:Unsubscribe />
+             (25)   </s12:Body>
+             (26) </s12:Envelope>*/
+            OMElement subscribeOm = factory.createOMElement("Unsubscribe", nswse);
+            serviceClient.engageModule("addressing");
+            options.setTo(new EndpointReference(addUrl));
+            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe");
+            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
+            factory.createOMText(identifierOm, identifier);
+            serviceClient.addHeader(identifierOm);
+            serviceClient.setOptions(options);
+            System.out.println("UnSubscribing \n" + subscribeOm.toString());
+            try {
+                OMElement response = serviceClient.sendReceive(subscribeOm);
+                System.out.println("UnSubscribed to ID " + identifier);
+                Thread.sleep(1000);
+                System.out.println("UnSubscribe Response Received: " + response.toString());
+            } catch (AxisFault e) {
+                System.out.println("Fault Received : "+e.toString());
+                System.out.println("Fault Code     : "+e.getFaultCode().toString());
+            }
+
+        } else if (mode.equals("renew")) {
+            /**
+             * (01) <s12:Envelope
+             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+             (06)   <s12:Header>
+             (07)     <wsa:Action>
+             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew
+             (09)     </wsa:Action>
+             (10)     <wsa:MessageID>
+             (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+             (12)     </wsa:MessageID>
+             (13)     <wsa:ReplyTo>
+             (14)      <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+             (15)     </wsa:ReplyTo>
+             (16)     <wsa:To>
+             (17)       http://www.example.org/oceanwatch/SubscriptionManager
+             (18)     </wsa:To>
+             (19)     <wse:Identifier>
+             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+             (21)     </wse:Identifier>
+             (22)   </s12:Header>
+             (23)   <s12:Body>
+             (24)     <wse:Renew>
+             (25)       <wse:Expires>2004-06-26T21:07:00.000-08:00</wse:Expires>
+             (26)     </wse:Renew>
+             (27)   </s12:Body>
+             (28) </s12:Envelope>
+             */
+            OMElement subscribeOm = factory.createOMElement("Renew", nswse);
+            OMElement expiresOm = factory.createOMElement("Expires", nswse);
+            factory.createOMText(expiresOm, expires);
+            subscribeOm.addChild(expiresOm);
+            serviceClient.engageModule("addressing");
+            options.setTo(new EndpointReference(addUrl));
+            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew");
+            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
+            factory.createOMText(identifierOm, identifier);
+            serviceClient.addHeader(identifierOm);
+            serviceClient.setOptions(options);
+            System.out.println("SynapseSubscription Renew \n" + subscribeOm.toString());
+            try {
+                OMElement response = serviceClient.sendReceive(subscribeOm);
+                System.out.println("SynapseSubscription Renew to ID " + identifier);
+                Thread.sleep(1000);
+                System.out.println("SynapseSubscription Renew Response Received: " + response.toString());
+            } catch (AxisFault e) {
+                System.out.println("Fault Received : "+e.toString());
+                System.out.println("Fault Code     : "+e.getFaultCode().toString());
+            }
+
+        } else if (mode.equals("getstatus")) {
+            /**
+             * (01) <s12:Envelope
+             (02)     xmlns:s12="http://www.w3.org/2003/05/soap-envelope"
+             (03)     xmlns:wsa="http://schemas.xmlsoap.org/ws/2004/08/addressing"
+             (04)     xmlns:wse="http://schemas.xmlsoap.org/ws/2004/08/eventing"
+             (05)     xmlns:ow="http://www.example.org/oceanwatch" >
+             (06)   <s12:Header>
+             (07)     <wsa:Action>
+             (08)       http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus
+             (09)     </wsa:Action>
+             (10)     <wsa:MessageID>
+             (11)       uuid:bd88b3df-5db4-4392-9621-aee9160721f6
+             (12)     </wsa:MessageID>
+             (13)     <wsa:ReplyTo>
+             (14)       <wsa:Address>http://www.example.com/MyEventSink</wsa:Address>
+             (15)     </wsa:ReplyTo>
+             (16)     <wsa:To>
+             (17)       http://www.example.org/oceanwatch/SubscriptionManager
+             (18)     </wsa:To>
+             (19)     <wse:Identifier>
+             (20)       uuid:22e8a584-0d18-4228-b2a8-3716fa2097fa
+             (21)     </wse:Identifier>
+             (22)   </s12:Header>
+             (23)   <s12:Body>
+             (24)     <wse:GetStatus />
+             (25)   </s12:Body>
+             (26) </s12:Envelope>
+             */
+            OMElement subscribeOm = factory.createOMElement("GetStatus", nswse);
+            serviceClient.engageModule("addressing");
+            options.setTo(new EndpointReference(addUrl));
+            options.setAction("http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus");
+            OMElement identifierOm = factory.createOMElement("Identifier", nswse);
+            factory.createOMText(identifierOm, identifier);
+            serviceClient.addHeader(identifierOm);
+            serviceClient.setOptions(options);
+            System.out.println("GetStatus using \n" + subscribeOm.toString());
+            try {
+                OMElement response = serviceClient.sendReceive(subscribeOm);
+                System.out.println("GetStatus to ID " + identifier);
+                Thread.sleep(1000);
+                System.out.println("GetStatus Response Received: " + response.toString());
+            } catch (AxisFault e) {
+                System.out.println("Fault Received : "+e.toString());
+                System.out.println("Fault Code     : "+e.getFaultCode().toString());
+            } 
+        }
+
+        try {
+            if (configContext != null) {
+                configContext.terminate();
+            }
+        } catch (Exception ignore) {
+        }
+    }
+}
\ No newline at end of file

Modified: synapse/trunk/java/modules/samples/src/main/scripts/build.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/modules/samples/src/main/scripts/build.xml?rev=730466&r1=730465&r2=730466&view=diff
==============================================================================
--- synapse/trunk/java/modules/samples/src/main/scripts/build.xml (original)
+++ synapse/trunk/java/modules/samples/src/main/scripts/build.xml Wed Dec 31 12:26:49 2008
@@ -82,6 +82,31 @@
 
     example:
         ant mddproducer
+
+    ant eventsubscriber
+        A client that subscribe to the Synapse event source
+
+        examples:
+        ant eventsubscriber
+            [-Dmode=subscribe | unsubscribe | getstatus | renew]
+            [-Daddurl=http://localhost:8280/services/eventing]
+            [-Daddress=http://localhost:9000/services/SimpleStockQuoteService]
+            [-Dtopic=/synapse/sample/topic]
+            [-Didentifier=urn:uuid:607498E6483EF9C434122785636889830400199622296]
+            [-Dexpires=2008-12-31T21:07:00.000-08:00]
+
+    ant eventsender
+        A client that sends Events to the Synapse event sink
+
+        examples:
+        ant eventsender
+            [-Daddurl=http://localhost:8280/services/eventing]
+            [-Dtopic=/synapse/sample/topic]
+            [-Dtopicns=http://apache.org/aip]
+            [-Daction=urn:event]
+            [-Dsymbol=DELL]
+            [-Dqty=1000]
+            [-Dprice=100.10]
     </echo>
     </target>
 
@@ -112,6 +137,14 @@
     <property name="price" value=""/>
     <property name="market" value=""/>
     <property name="jms_topic" value=""/>
+    <property name="qty" value=""/>
+    <property name="topic" value=""/>
+    <property name="address" value=""/>
+    <property name="action" value=""/>
+    <property name="topicns" value=""/>
+    <property name="mode" value=""/>
+    <property name="identifier" value=""/>
+    <property name="expires" value=""/>
 
     <target name="clean">
         <delete dir="target" quiet="true"/>
@@ -256,6 +289,39 @@
         </java>
     </target>
 
+    <target name="eventsubscriber" depends="compile">
+        <java classname="samples.userguide.EventSubscriber"
+             classpathref="javac.classpath" fork="true">
+            <sysproperty key="addurl" value="${addurl}"/>
+            <sysproperty key="trpurl" value="${trpurl}"/>
+            <sysproperty key="prxurl" value="${prxurl}"/>
+            <sysproperty key="topic" value="${topic}"/>
+            <sysproperty key="address" value="${address}"/>
+            <sysproperty key="repository" value="${repository}"/>
+            <sysproperty key="mode" value="${mode}"/>
+            <sysproperty key="identifier" value="${identifier}"/>
+            <sysproperty key="expires" value="${expires}"/>
+            <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/>
+        </java>
+    </target>
+
+    <target name="eventsender" depends="compile">
+        <java classname="samples.userguide.EventSender"
+             classpathref="javac.classpath" fork="true">
+            <sysproperty key="symbol" value="${symbol}"/>
+            <sysproperty key="price"   value="${price}"/>
+            <sysproperty key="addurl" value="${addurl}"/>
+            <sysproperty key="trpurl" value="${trpurl}"/>
+            <sysproperty key="prxurl" value="${prxurl}"/>
+            <sysproperty key="qty"    value="${qty}"/>
+            <sysproperty key="repository" value="${repository}"/>
+            <sysproperty key="java.io.tmpdir" value="./../../work/temp/sampleClient"/>
+            <sysproperty key="topic"    value="${topic}"/>
+            <sysproperty key="action"    value="${action}"/>
+            <sysproperty key="topicns"    value="${topicns}"/>
+        </java>
+    </target>
+
     <target name="init">
         <mkdir dir="${class.dir}"/>
         <mkdir dir="./../../work/temp/sampleClient"/>

Modified: synapse/trunk/java/pom.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/pom.xml?rev=730466&r1=730465&r2=730466&view=diff
==============================================================================
--- synapse/trunk/java/pom.xml (original)
+++ synapse/trunk/java/pom.xml Wed Dec 31 12:26:49 2008
@@ -470,6 +470,12 @@
                 <version>${jms-1.1-spec.version}</version>
             </dependency>
 
+            <dependency>
+                <groupId>org.wso2.eventing</groupId>
+                <artifactId>wso2eventing-api</artifactId>
+                <version>${wso2eventing-api.version}</version>
+            </dependency>
+
         </dependencies>
     </dependencyManagement>
 
@@ -845,6 +851,12 @@
                 </exclusion>
             </exclusions>
         </dependency>
+
+        <!-- Eventing dependencies-->
+        <dependency>
+            <groupId>org.wso2.eventing</groupId>
+            <artifactId>wso2eventing-api</artifactId>
+        </dependency>
         
     </dependencies>
 
@@ -991,6 +1003,7 @@
         <wso2commons.version>1.2</wso2commons.version>
         <wso2caching.version>1.6.1</wso2caching.version>
         <wso2throttle.version>1.6</wso2throttle.version>
+        <wso2eventing-api.version>1.1</wso2eventing-api.version>
         <xbean.version>2.2.0</xbean.version>
         <bsf.version>3.0-beta2</bsf.version>
         <groovy.version>1.0</groovy.version>

Added: synapse/trunk/java/repository/conf/sample/resources/transform/transform_eventing.xslt
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/resources/transform/transform_eventing.xslt?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/resources/transform/transform_eventing.xslt (added)
+++ synapse/trunk/java/repository/conf/sample/resources/transform/transform_eventing.xslt Wed Dec 31 12:26:49 2008
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+  ~  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.
+  -->
+<xsl:stylesheet version="2.0"
+	xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+	xmlns:fn="http://www.w3.org/2005/02/xpath-functions">
+	<xsl:output method="xml" omit-xml-declaration="yes" indent="yes" />
+	<xsl:template match="/">
+		<e:placeOrder xmlns:e="http://services.samples">
+			<e:order>
+				<e:price>100.10</e:price>
+				<e:quantity>3000</e:quantity>
+				<e:symbol>SUNW</e:symbol>
+			</e:order>
+		</e:placeOrder>
+	</xsl:template>
+</xsl:stylesheet>
+

Added: synapse/trunk/java/repository/conf/sample/synapse_sample_500.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_500.xml?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_500.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_500.xml Wed Dec 31 12:26:49 2008
@@ -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.
+  -->
+
+<!-- Simple Eventing configuration -->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+     <eventSource name="SampleEventSource">
+           <subscriptionManager class="org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager">
+               <!--property name="registryURL" value="http://localhost:8180/wso2registry"/>
+               <property name="username" value="admin"/>
+               <property name="password" value="admin"/-->
+               <property name="topicHeaderName" value="Topic"/>
+               <property name="topicHeaderNS" value="http://apache.org/aip"/>
+           </subscriptionManager>
+     </eventSource>
+
+    <sequence name="PublicEventSource" >
+           <log level="full"/>
+           <eventPublisher eventSourceName="SampleEventSource"/>
+    </sequence>
+
+    <proxy name="EventingProxy">
+        <target inSequence="PublicEventSource" />
+    </proxy>
+</definitions>
\ No newline at end of file

Added: synapse/trunk/java/repository/conf/sample/synapse_sample_501.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_501.xml?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_501.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_501.xml Wed Dec 31 12:26:49 2008
@@ -0,0 +1,49 @@
+<!--
+  ~  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.
+  -->
+
+<!-- Eventing configuration with static subscriptions-->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+     <eventSource name="SampleEventSource">
+           <subscriptionManager class="org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager">
+               <!--property name="registryURL" value="http://localhost:8180/wso2registry"/>
+               <property name="username" value="admin"/>
+               <property name="password" value="admin"/-->
+               <property name="topicHeaderName" value="Topic"/>
+               <property name="topicHeaderNS" value="http://apache.org/aip"/>
+           </subscriptionManager>
+           <subscription id="mysub1">
+                <filter source ="synapse/event/test" dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/>
+                <endpoint><address uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint>
+           </subscription>
+           <subscription id="mysub2">
+                <filter source ="synapse/event/test" dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/>
+                <endpoint><address uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint>
+                <expires>2020-06-27T21:07:00.000-08:00</expires>
+           </subscription>
+     </eventSource>
+
+    <sequence name="PublicEventSource" >
+           <log level="full"/>
+           <eventPublisher eventSourceName="SampleEventSource"/>
+    </sequence>
+
+    <proxy name="EventingProxy">
+        <target inSequence="PublicEventSource" />
+    </proxy>
+</definitions>
\ No newline at end of file

Added: synapse/trunk/java/repository/conf/sample/synapse_sample_502.xml
URL: http://svn.apache.org/viewvc/synapse/trunk/java/repository/conf/sample/synapse_sample_502.xml?rev=730466&view=auto
==============================================================================
--- synapse/trunk/java/repository/conf/sample/synapse_sample_502.xml (added)
+++ synapse/trunk/java/repository/conf/sample/synapse_sample_502.xml Wed Dec 31 12:26:49 2008
@@ -0,0 +1,49 @@
+<!--
+  ~  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.
+  -->
+
+<!-- Eventing configuration with transformation before publish-->
+<definitions xmlns="http://ws.apache.org/ns/synapse">
+     <eventSource name="SampleEventSource">
+           <subscriptionManager class="org.apache.synapse.eventing.managers.DefaultInMemorySubscriptionManager">
+               <!--property name="registryURL" value="http://localhost:8180/wso2registry"/>
+               <property name="username" value="admin"/>
+               <property name="password" value="admin"/-->
+               <property name="topicHeaderName" value="Topic"/>
+               <property name="topicHeaderNS" value="http://apache.org/aip"/>
+           </subscriptionManager>
+           <subscription id="mysub1">
+                <filter source ="synapse/event/test" dialect="http://synapse.apache.org/eventing/dialect/topicFilter"/>
+                <endpoint><address uri="http://localhost:9000/services/SimpleStockQuoteService"/></endpoint>
+           </subscription>
+     </eventSource>
+
+
+    <sequence name="PublicEventSource">
+           <log level="full"/>
+           <xslt key="xslt-key-req"/>
+           <log level="full"/>
+           <eventPublisher eventSourceName="SampleEventSource"/>
+    </sequence>
+
+    <proxy name="EventingProxy">
+        <target inSequence="PublicEventSource" />
+    </proxy>
+
+    <localEntry key="xslt-key-req" src="file:repository/conf/sample/resources/transform/transform_eventing.xslt"/>    
+</definitions>
\ No newline at end of file



Re: svn commit: r730466 [2/3] - in /synapse/trunk/java: ./ modules/core/src/main/java/org/apache/synapse/config/ modules/core/src/main/java/org/apache/synapse/config/xml/ modules/core/src/main/java/org/apache/synapse/config/xml/eventing/ modules/core/src/m...

Posted by Andreas Veithen <an...@gmail.com>.
Using static fields to store error information here doesn't look
right. BTW, this causes a build failure with Java 1.7 (on Linux)
because the corresponding test cases are executed in a different order
than with Java 1.6.

Andreas

On Wed, Dec 31, 2008 at 9:26 PM,  <as...@apache.org> wrote:
> +public class SubscriptionMessageBuilder {
> +
> +    private static final Log log = LogFactory.getLog(SubscriptionMessageBuilder.class);
> +
> +    private static final QName SUBSCRIBE_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_SUBSCRIBE);
> +    private static final QName DELIVERY_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_DELIVERY);
> +    private static final QName FILTER_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_FILTER);
> +    private static final QName NOTIFY_TO_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_NOTIFY_TO);
> +    private static final QName ATT_DIALECT = new QName(XMLConfigConstants.NULL_NAMESPACE, EventingConstants.WSE_EN_DIALECT);
> +    private static final QName ATT_XPATH = new QName(XMLConfigConstants.NULL_NAMESPACE, EventingConstants.WSE_EN_XPATH);
> +    private static final QName IDENTIFIER = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_IDENTIFIER);
> +    private static final QName EXPIRES = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_EXPIRES);
> +    private static final QName RENEW = new QName(EventingConstants.WSE_EVENTING_NS, EventingConstants.WSE_EN_RENEW);
> +
> +    private static String errorSubCode = null;
> +    private static String errorReason = null;
> +    private static String errorCode = null;

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@synapse.apache.org
For additional commands, e-mail: dev-help@synapse.apache.org