[esb-java-dev] svn commit r24385 - in branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing: . builders
asankaa at wso2.com
asankaa at wso2.com
Thu Nov 20 10:45:56 PST 2008
Author: asankaa
Date: Thu Nov 20 10:45:56 2008
New Revision: 24385
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=24385
Log:
pick constnts from the eventing-api add the sceleton of the message builder
Added:
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponceMessageBuilder.java
Modified:
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingMessageReceiver.java
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionFactory.java
Modified: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java?rev=24385&r1=24384&r2=24385&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java (original)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java Thu Nov 20 10:45:56 2008
@@ -25,7 +25,7 @@
import org.apache.axis2.description.InOutAxisOperation;
import org.apache.axis2.engine.AxisConfiguration;
import org.apache.synapse.SynapseConstants;
-
+import org.wso2.eventing.EventingConstants;
import javax.xml.namespace.QName;
/**
@@ -67,7 +67,7 @@
EventingMessageReceiver receiver = new EventingMessageReceiver(this);
mediateOperation.setMessageReceiver(receiver);
subscribeOperation.setMessageReceiver(receiver);
- subscribeOperation.setSoapAction(EventingConstants.SUBSCRIBE_ACTION);
+ subscribeOperation.setSoapAction(EventingConstants.WSE_SUBSCRIBE);
eventSourceService.addOperation(mediateOperation);
eventSourceService.addOperation(subscribeOperation);
Modified: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java?rev=24385&r1=24384&r2=24385&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java (original)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java Thu Nov 20 10:45:56 2008
@@ -23,18 +23,5 @@
*
*/
public class EventingConstants {
-
- public static final String WS_EVENTING_NS = "http://schemas.xmlsoap.org/ws/2004/08/eventing";
- public static final String SUBSCRIBE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Subscribe";
- public static final String SUBSCRIBE_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscribeResponse";
- public static final String SUBSCRIPTION_RENEW_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew";
- public static final String SUBSCRIPTION_RENEW_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/RenewResponse";
- public static final String SUBSCRIPTION_GET_STATUS_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus";
- public static final String SUBSCRIPTION_GET_STATUS_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse";
- public static final String UNSUBSCRIBE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe";
- public static final String UNSUBSCRIBE_RESPONSE_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse";
- public static final String SUBSCRIPTION_END_ACTION = "http://schemas.xmlsoap.org/ws/2004/08/eventing/SubscriptionEnd";
-
- public static final String PUSH_DELIVERY_MODE = "http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push";
public static final String TOPIC_FILTER_DIALECT = "http://synapse.apache.org/eventing/dialect/topicFilter";
}
Modified: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingMessageReceiver.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingMessageReceiver.java?rev=24385&r1=24384&r2=24385&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingMessageReceiver.java (original)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingMessageReceiver.java Thu Nov 20 10:45:56 2008
@@ -27,7 +27,7 @@
import org.apache.synapse.core.axis2.Axis2MessageContext;
import org.apache.synapse.core.axis2.SynapseMessageReceiver;
import org.apache.synapse.util.MessageHelper;
-
+import org.wso2.eventing.EventingConstants;
import java.util.List;
/**
@@ -47,7 +47,7 @@
SynapseEnvironment synEnv = (SynapseEnvironment) mc.getConfigurationContext()
.getAxisConfiguration().getParameter(SynapseConstants.SYNAPSE_ENV).getValue();
org.apache.synapse.MessageContext smc = new Axis2MessageContext(mc, synCfg, synEnv);
- if (EventingConstants.SUBSCRIBE_ACTION.equals(mc.getWSAAction())) {
+ if (EventingConstants.WSE_SUBSCRIBE.equals(mc.getWSAAction())) {
Subscription subscription = SubscriptionFactory.createSubscription(smc);
eventSource.getSubscriptionManager().addSubscription(subscription);
String replyAddress = mc.getOptions().getTo().getAddress();
Modified: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java?rev=24385&r1=24384&r2=24385&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java (original)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java Thu Nov 20 10:45:56 2008
@@ -21,6 +21,7 @@
import org.apache.synapse.endpoints.Endpoint;
import org.apache.synapse.util.UUIDGenerator;
+import org.wso2.eventing.EventingConstants;
import java.util.Date;
@@ -37,7 +38,7 @@
public Subscription() {
this.id = UUIDGenerator.getUUID();
- this.deliveryMode = EventingConstants.PUSH_DELIVERY_MODE;
+ this.deliveryMode = EventingConstants.WSE_DEFAULT_DELIVERY_MODE;
}
public Subscription(String deliveryMode) {
Modified: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionFactory.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionFactory.java?rev=24385&r1=24384&r2=24385&view=diff
==============================================================================
--- branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionFactory.java (original)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionFactory.java Thu Nov 20 10:45:56 2008
@@ -33,7 +33,7 @@
import org.apache.synapse.eventing.filters.XPathBasedEventFilter;
import org.apache.synapse.util.xpath.SynapseXPath;
import org.jaxen.JaxenException;
-
+import org.wso2.eventing.EventingConstants;
import javax.xml.namespace.QName;
/**
@@ -43,10 +43,10 @@
private static final Log log = LogFactory.getLog(SubscriptionFactory.class);
- private static final QName SUBSCRIBE_QNAME = new QName(EventingConstants.WS_EVENTING_NS, "Subscribe");
- private static final QName DELIVERY_QNAME = new QName(EventingConstants.WS_EVENTING_NS, "Delivery");
- private static final QName FILTER_QNAME = new QName(EventingConstants.WS_EVENTING_NS, "Filter");
- private static final QName NOTIFY_TO_QNAME = new QName(EventingConstants.WS_EVENTING_NS, "NotifyTo");
+ private static final QName SUBSCRIBE_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, "Subscribe");
+ private static final QName DELIVERY_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, "Delivery");
+ private static final QName FILTER_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, "Filter");
+ private static final QName NOTIFY_TO_QNAME = new QName(EventingConstants.WSE_EVENTING_NS, "NotifyTo");
private static final QName ATT_DIALECT = new QName(XMLConfigConstants.NULL_NAMESPACE, "Dialect");
private static final QName ATT_XPATH = new QName(XMLConfigConstants.NULL_NAMESPACE, "XPath");
@@ -61,7 +61,7 @@
if (notifyToElem != null) {
Endpoint ep = getEndpointFromWSAAddress(notifyToElem.getFirstElement());
if (ep != null) {
- subscription = new Subscription(EventingConstants.PUSH_DELIVERY_MODE);
+ subscription = new Subscription(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
subscription.setEndpoint(ep);
}
} else {
@@ -75,7 +75,7 @@
if (subscription != null && filterElem != null) {
OMAttribute dialectAttr = filterElem.getAttribute(ATT_DIALECT);
if (dialectAttr != null && dialectAttr.getAttributeValue() != null) {
- if (EventingConstants.TOPIC_FILTER_DIALECT.equals(dialectAttr.getAttributeValue())) {
+ if (org.apache.synapse.eventing.EventingConstants.TOPIC_FILTER_DIALECT.equals(dialectAttr.getAttributeValue())) {
XPathBasedEventFilter filter = new XPathBasedEventFilter();
filter.setResultValue(filterElem.getText());
if (filterElem.getAttribute(ATT_XPATH) != null) {
Added: branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponceMessageBuilder.java
URL: http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponceMessageBuilder.java?pathrev=24385
==============================================================================
--- (empty file)
+++ branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponceMessageBuilder.java Thu Nov 20 10:45:56 2008
@@ -0,0 +1,45 @@
+package org.apache.synapse.eventing.builders;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.synapse.eventing.Subscription;
+import org.apache.axis2.addressing.EndpointReference;
+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 ResponceMessageBuilder {
+ private SOAPFactory factory;
+ public ResponceMessageBuilder(){
+ factory =(SOAPFactory) OMAbstractFactory.getOMFactory();
+ }
+ public SOAPEnvelope genSunscriptionResponce(Subscription subscription){
+ SOAPEnvelope message = factory.getDefaultEnvelope();
+ EndpointReference subscriptionManagerEPR = new EndpointReference("http://localhost:8280/soap/eventing"); //TODO: add subscription url to subscription object
+ subscriptionManagerEPR.addReferenceParameter(new QName(EventingConstants.WSE_EVENTING_NS,
+ "Identifier", EventingConstants.WSE_EVENTING_PREFIX),subscription.getId());
+
+ return message;
+ }
+}
More information about the Esb-java-dev
mailing list