Author: asankaa
Date: Thu Nov 27 08:52:15 2008
New Revision: 25108
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=25108

Log:
Rename the synapse related eventing impl with a prefix use subscription in the 
API


Added:
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventFilter.java
   (contents, props changed)
      - copied, changed from r25048, 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventFilter.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventSource.java
   (contents, props changed)
      - copied, changed from r25076, 
/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/SynapseEventingConstants.java
   (contents, props changed)
      - copied, changed from r25048, 
/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/SynapseSubscription.java
   (contents, props changed)
      - copied, changed from r25048, 
/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/SynapseSubscriptionManager.java
   (contents, props changed)
      - copied, changed from r25048, 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionManager.java
Removed:
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventFilter.java
   
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/Subscription.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionManager.java
Modified:
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceFactory.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceSerializer.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
   
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
   
branches/synapse/1.2.wso2v1/modules/samples/src/main/java/samples/userguide/EventSubscriber.java

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
  (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/SynapseConfiguration.java
  Thu Nov 27 08:52:15 2008
@@ -25,7 +25,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.*;
-import org.apache.synapse.eventing.EventSource;
+import org.apache.synapse.eventing.SynapseEventSource;
 import org.apache.synapse.commons.util.RMIRegistryController;
 import org.apache.synapse.commons.util.datasource.InMemoryDataSourceRepository;
 import 
org.apache.synapse.commons.util.datasource.JNDIBasedDataSourceRepository;
@@ -113,7 +113,7 @@
     /**
      * Holds Event Sources defined through Synapse
      */
-    private Map<String, EventSource> eventSources = new HashMap<String, 
EventSource>();
+    private Map<String, SynapseEventSource> eventSources = new HashMap<String, 
SynapseEventSource>();
 
     /**
         * Add a named sequence into the local registry
@@ -923,11 +923,11 @@
     public TaskDescriptionRepository getTaskDescriptionRepository() {
         return repository;
     }
-    public void addEventSource(String name, EventSource eventSource) {
+    public void addEventSource(String name, SynapseEventSource eventSource) {
         eventSources.put(name, eventSource);
     }
 
-    public EventSource getEventSource(String name) {
+    public SynapseEventSource getEventSource(String name) {
         return eventSources.get(name);
     }
 
@@ -935,11 +935,11 @@
         eventSources.remove(name);
     }
 
-    public Collection<EventSource> getEventSources() {
+    public Collection<SynapseEventSource> getEventSources() {
         return eventSources.values();
     }
 
-    public void setEventSources(Map<String, EventSource> eventSources) {
+    public void setEventSources(Map<String, SynapseEventSource> eventSources) {
         this.eventSources = eventSources;
     }
 }

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
    (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationFactory.java
    Thu Nov 27 08:52:15 2008
@@ -27,7 +27,7 @@
 import org.apache.synapse.Startup;
 import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.eventing.EventSource;
+import org.apache.synapse.eventing.SynapseEventSource;
 import org.apache.synapse.config.Entry;
 import org.apache.synapse.config.SynapseConfigUtils;
 import org.apache.synapse.config.SynapseConfiguration;
@@ -158,7 +158,7 @@
     }
 
     private static void defineEventSource(SynapseConfiguration config, 
OMElement elem) {
-        EventSource eventSource = EventSourceFactory.createEventSource(elem);
+        SynapseEventSource eventSource = 
EventSourceFactory.createEventSource(elem);
         if (config.getEventSource(eventSource.getName()) != null) {
             handleException("Duplicate proxy service with name : " + 
eventSource.getName());
         }

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
 (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/SynapseXMLConfigurationSerializer.java
 Thu Nov 27 08:52:15 2008
@@ -23,7 +23,7 @@
 import org.apache.synapse.core.axis2.ProxyService;
 import org.apache.synapse.endpoints.Endpoint;
 import org.apache.synapse.Startup;
-import org.apache.synapse.eventing.EventSource;
+import org.apache.synapse.eventing.SynapseEventSource;
 
 public class SynapseXMLConfigurationSerializer implements 
ConfigurationSerializer {
 
@@ -62,7 +62,7 @@
             ProxyServiceSerializer.serializeProxy(definitions, service);
         }
 
-        for (EventSource eventSource : synCfg.getEventSources()) {
+        for (SynapseEventSource eventSource : synCfg.getEventSources()) {
             EventSourceSerializer.serializeEventSource(definitions, 
eventSource);
         }
         

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceFactory.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceFactory.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceFactory.java
       (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceFactory.java
       Thu Nov 27 08:52:15 2008
@@ -26,8 +26,8 @@
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.config.xml.PropertyHelper;
 import org.apache.synapse.config.xml.XMLConfigConstants;
-import org.apache.synapse.eventing.EventSource;
-import org.apache.synapse.eventing.SubscriptionManager;
+import org.apache.synapse.eventing.SynapseEventSource;
+import org.apache.synapse.eventing.SynapseSubscriptionManager;
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
@@ -53,15 +53,15 @@
     private static final QName WS_EVENTING_QNAME
             = new QName(XMLConfigConstants.SYNAPSE_NAMESPACE, "wsEventing");
 
-    public static EventSource createEventSource(OMElement elem) {
+    public static SynapseEventSource createEventSource(OMElement elem) {
 
-        EventSource eventSource = null;
+        SynapseEventSource eventSource = null;
 
         OMAttribute name = elem.getAttribute(new 
QName(XMLConfigConstants.NULL_NAMESPACE, "name"));
         if (name == null) {
             handleException("The 'name' attribute is required for a event 
source de");
         } else {
-            eventSource = new EventSource(name.getAttributeValue());
+            eventSource = new SynapseEventSource(name.getAttributeValue());
         }
 
         OMElement subscriptionManagerElem = 
elem.getFirstChildWithName(SUBSCRIPTION_MANAGER_QNAME);
@@ -72,7 +72,7 @@
                 String className = clazz.getAttributeValue();
                 try {
                     Class subscriptionManagerClass = Class.forName(className);
-                    SubscriptionManager manager = (SubscriptionManager) 
subscriptionManagerClass.newInstance();
+                    SynapseSubscriptionManager manager = 
(SynapseSubscriptionManager) subscriptionManagerClass.newInstance();
                     Iterator itr = 
subscriptionManagerElem.getChildrenWithName(PROPERTIES_QNAME);
                     while (itr.hasNext()) {
                         OMElement propElem = (OMElement) itr.next();
@@ -83,17 +83,17 @@
                     }
                     eventSource.setSubscriptionManager(manager);
                 } catch (ClassNotFoundException e) {
-                    handleException("SubscriptionManager class not found", e);
+                    handleException("SynapseSubscriptionManager class not 
found", e);
                 } catch (IllegalAccessException e) {
-                    handleException("Unable to access the SubscriptionManager 
object", e);
+                    handleException("Unable to access the 
SynapseSubscriptionManager object", e);
                 } catch (InstantiationException e) {
-                    handleException("Unable to instantiate the 
SubscriptionManager object", e);
+                    handleException("Unable to instantiate the 
SynapseSubscriptionManager object", e);
                 }
             } else {
-                handleException("Subscription manager class is a required 
attribute");
+                handleException("SynapseSubscription manager class is a 
required attribute");
             }
         } else {
-            handleException("Subscription Manager has not been specified for 
the event source");
+            handleException("SynapseSubscription Manager has not been 
specified for the event source");
         }
 
         return eventSource;

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceSerializer.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceSerializer.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceSerializer.java
    (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/config/xml/eventing/EventSourceSerializer.java
    Thu Nov 27 08:52:15 2008
@@ -23,9 +23,8 @@
 import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMFactory;
 import org.apache.axiom.om.OMNamespace;
-import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.config.xml.XMLConfigConstants;
-import org.apache.synapse.eventing.EventSource;
+import org.apache.synapse.eventing.SynapseEventSource;
 
 /**
  * <eventSource name="blah">
@@ -41,7 +40,7 @@
  */
 public class EventSourceSerializer {
 
-    public static OMElement serializeEventSource(OMElement elem, EventSource 
eventSource) {
+    public static OMElement serializeEventSource(OMElement elem, 
SynapseEventSource eventSource) {
 
         OMFactory fac = OMAbstractFactory.getOMFactory();
         OMNamespace nullNS = 
fac.createOMNamespace(XMLConfigConstants.NULL_NAMESPACE, "");

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
       (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/core/axis2/SynapseInitializationModule.java
       Thu Nov 27 08:52:15 2008
@@ -33,7 +33,7 @@
 import org.apache.synapse.ServerManager;
 import org.apache.synapse.SynapseConstants;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.eventing.EventSource;
+import org.apache.synapse.eventing.SynapseEventSource;
 import 
org.apache.synapse.commons.util.datasource.DataSourceInformationRepositoryHelper;
 import org.apache.synapse.config.SynapseConfiguration;
 import org.apache.synapse.config.SynapseConfigurationBuilder;
@@ -151,7 +151,7 @@
             }
         }
 
-       for (EventSource eventSource : synCfg.getEventSources()) {
+       for (SynapseEventSource eventSource : synCfg.getEventSources()) {
             eventSource.buildService(axisCfg);
             eventSource.getSubscriptionManager().init();
         }

Deleted: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventFilter.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=25107

Deleted: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventSource.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=25107

Deleted: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventingConstants.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=25107

Deleted: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/Subscription.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=25107

Deleted: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionManager.java
URL: http://wso2.org/svn/browse/wso2/None?pathrev=25107

Copied: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventFilter.java
 (from r25048, 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventFilter.java)
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventFilter.java?rev=25108&r1=25048&r2=25108&view=diff
==============================================================================
--- 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/EventFilter.java
        (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventFilter.java
  Thu Nov 27 08:52:15 2008
@@ -24,7 +24,7 @@
 /**
  *
  */
-public interface EventFilter {
+public interface SynapseEventFilter {
 
     public boolean isSatisfied(MessageContext mc);
 }

Copied: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventSource.java
 (from r25076, 
/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/SynapseEventSource.java?rev=25108&r1=25076&r2=25108&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/SynapseEventSource.java
  Thu Nov 27 08:52:15 2008
@@ -48,13 +48,13 @@
 /**
  *
  */
-public class EventSource extends SynapseMessageReceiver {
+public class SynapseEventSource extends SynapseMessageReceiver {
 
     private String name;
-    private SubscriptionManager subscriptionManager;
-    private static final Log log = LogFactory.getLog(EventSource.class);
+    private SynapseSubscriptionManager subscriptionManager;
+    private static final Log log = LogFactory.getLog(SynapseEventSource.class);
 
-    public EventSource(String name) {
+    public SynapseEventSource(String name) {
         this.name = name;
     }
 
@@ -66,11 +66,11 @@
         this.name = name;
     }
 
-    public SubscriptionManager getSubscriptionManager() {
+    public SynapseSubscriptionManager getSubscriptionManager() {
         return subscriptionManager;
     }
 
-    public void setSubscriptionManager(SubscriptionManager 
subscriptionManager) {
+    public void setSubscriptionManager(SynapseSubscriptionManager 
subscriptionManager) {
         this.subscriptionManager = subscriptionManager;
     }
 
@@ -106,16 +106,16 @@
         org.apache.synapse.MessageContext smc = new Axis2MessageContext(mc, 
synCfg, synEnv);
         ResponseMessageBuilder messageBuilder = new ResponseMessageBuilder(mc);
         if (EventingConstants.WSE_SUBSCRIBE.equals(mc.getWSAAction())) {
-            // add new subscription to the Subscription store through 
subscription manager
-            Subscription subscription = 
SubscriptionMessageBuilder.createSubscription(smc);
+            // add new subscription to the SynapseSubscription store through 
subscription manager
+            SynapseSubscription subscription = 
SubscriptionMessageBuilder.createSubscription(smc);
             if (log.isDebugEnabled()) {
-                log.debug("Subscription request recived  : " + 
subscription.getId());
+                log.debug("SynapseSubscription request recived  : " + 
subscription.getId());
             }
             String subID = subscriptionManager.addSubscription(subscription);
             if (subID != null) {
                 // Send the subscription responce
                 if (log.isDebugEnabled()) {
-                    log.debug("Sending sunscription response for Subscription 
ID : " + subscription.getId());
+                    log.debug("Sending sunscription response for 
SynapseSubscription ID : " + subscription.getId());
                 }
                 SOAPEnvelope soapEnvelope = 
messageBuilder.genSubscriptionResponse(subscription);
                 String replyAddress = 
mc.getOptions().getReplyTo().getAddress();
@@ -133,7 +133,7 @@
             } else {
                 // Send the Fault responce
                 if (log.isDebugEnabled()) {
-                    log.debug("Subscription Failed, sending fault response");
+                    log.debug("SynapseSubscription Failed, sending fault 
response");
                 }
                 SOAPEnvelope soapEnvelope = 
messageBuilder.genFaultResponse(EventingConstants.WSE_FAULT_CODE_RECEIVER, 
"wse:EventSourceUnableToProcess", "", "");
                 String replyAddress = 
mc.getOptions().getReplyTo().getAddress();
@@ -151,14 +151,14 @@
             }
         } else if 
(EventingConstants.WSE_UNSUBSCRIBE.equals(mc.getWSAAction())) {
             // Unsubscribe for responce
-            Subscription subscription = 
SubscriptionMessageBuilder.createUnSubscribeMessage(smc);
+            SynapseSubscription subscription = 
SubscriptionMessageBuilder.createUnSubscribeMessage(smc);
             if (log.isDebugEnabled()) {
-                log.debug("UnSubscribe response recived for Subscription ID : 
" + subscription.getId());
+                log.debug("UnSubscribe response recived for 
SynapseSubscription ID : " + subscription.getId());
             }
             if (subscriptionManager.deleteSubscription(subscription.getId())) {
                 //send the response
                 if (log.isDebugEnabled()) {
-                    log.debug("Sending UnSubscribe responce for Subscription 
ID : " + subscription.getId());
+                    log.debug("Sending UnSubscribe responce for 
SynapseSubscription ID : " + subscription.getId());
                 }
                 SOAPEnvelope soapEnvelope = 
messageBuilder.genUnSubscribeResponse(subscription);
                 String replyAddress = 
mc.getOptions().getReplyTo().getAddress();
@@ -196,14 +196,14 @@
             }
         } else if (EventingConstants.WSE_GET_STATUS.equals(mc.getWSAAction())) 
{
             // Get responce status
-            Subscription subscription = 
SubscriptionMessageBuilder.createGetStatusMessage(smc);
+            SynapseSubscription subscription = 
SubscriptionMessageBuilder.createGetStatusMessage(smc);
             if (log.isDebugEnabled()) {
-                log.debug("GetStatus request recived for Subscription ID : " + 
subscription.getId());
+                log.debug("GetStatus request recived for SynapseSubscription 
ID : " + subscription.getId());
             }
             subscription = 
subscriptionManager.getSubscription(subscription.getId());
             if (subscription != null) {
                 if (log.isDebugEnabled()) {
-                    log.debug("Sending GetStatus responce for Subscription ID 
: " + subscription.getId());
+                    log.debug("Sending GetStatus responce for 
SynapseSubscription ID : " + subscription.getId());
                 }
                 //send the responce
                 SOAPEnvelope soapEnvelope = 
messageBuilder.genGetStatusResponse(subscription);
@@ -242,14 +242,14 @@
             }
         } else if (EventingConstants.WSE_RENEW.equals(mc.getWSAAction())) {
             // Renew subscription
-            Subscription subscription = 
SubscriptionMessageBuilder.createRenewSubscribeMessage(smc);
+            SynapseSubscription subscription = 
SubscriptionMessageBuilder.createRenewSubscribeMessage(smc);
             if (log.isDebugEnabled()) {
-                log.debug("ReNew request recived for Subscription ID : " + 
subscription.getId());
+                log.debug("ReNew request recived for SynapseSubscription ID : 
" + subscription.getId());
             }
             if (subscriptionManager.renewSubscription(subscription)) {
                 //send the response
                 if (log.isDebugEnabled()) {
-                    log.debug("Sending ReNew response for Subscription ID : " 
+ subscription.getId());
+                    log.debug("Sending ReNew response for SynapseSubscription 
ID : " + subscription.getId());
                 }
                 SOAPEnvelope soapEnvelope = 
messageBuilder.genRenewSubscriptionResponse(subscription);
                 String replyAddress = 
mc.getOptions().getReplyTo().getAddress();
@@ -290,8 +290,8 @@
             if (log.isDebugEnabled()) {
                 log.debug("Event recived");
             }
-            List<Subscription> subscribers = 
subscriptionManager.getMatchingSubscribers(smc);
-            for (Subscription subscription : subscribers) {
+            List<SynapseSubscription> subscribers = 
subscriptionManager.getMatchingSubscribers(smc);
+            for (SynapseSubscription subscription : subscribers) {
                 //TODO: send a 202 responce to the client, client wait and 
time outs 
                 smc.setProperty("OUT_ONLY", "true");    // Set one way message 
for events
                 
subscription.getEndpoint().send(MessageHelper.cloneMessageContext(smc));

Copied: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseEventingConstants.java
 (from r25048, 
/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/SynapseEventingConstants.java?rev=25108&r1=25048&r2=25108&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/SynapseEventingConstants.java
    Thu Nov 27 08:52:15 2008
@@ -22,6 +22,6 @@
 /**
  *
  */
-public class EventingConstants {
+public class SynapseEventingConstants {
     public static final String TOPIC_FILTER_DIALECT = 
"http://synapse.apache.org/eventing/dialect/topicFilter";;
 }

Copied: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseSubscription.java
 (from r25048, 
/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/SynapseSubscription.java?rev=25108&r1=25048&r2=25108&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/SynapseSubscription.java
 Thu Nov 27 08:52:15 2008
@@ -22,36 +22,33 @@
 import org.apache.synapse.endpoints.Endpoint;
 import org.apache.synapse.util.UUIDGenerator;
 import org.wso2.eventing.EventingConstants;
+import org.wso2.eventing.Subscription;
 
 import java.util.Calendar;
 
 /**
  *
  */
-public class Subscription {
+public class SynapseSubscription extends Subscription {
 
-    private EventFilter filter;
+    private SynapseEventFilter filter;
     private Endpoint endpoint;
-    private String deliveryMode;
-    private String id = null;
-    private Calendar expires = null;
-    private String addressUrl = null;
 
-    public Subscription() {
-        this.id = UUIDGenerator.getUUID();
-        this.deliveryMode = EventingConstants.WSE_DEFAULT_DELIVERY_MODE;
+    public SynapseSubscription() {
+        this.setId(UUIDGenerator.getUUID());
+        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
     }
 
-    public Subscription(String deliveryMode) {
-        this.id = UUIDGenerator.getUUID();
-        this.deliveryMode = deliveryMode;
+    public SynapseSubscription(String deliveryMode) {
+        this.setId(UUIDGenerator.getUUID());
+        this.setDeliveryMode(deliveryMode);
     }
 
-    public EventFilter getFilter() {
+    public SynapseEventFilter getSynapseFilter() {
         return filter;
     }
 
-    public void setFilter(EventFilter filter) {
+    public void setFilter(SynapseEventFilter filter) {
         this.filter = filter;
     }
 
@@ -62,36 +59,4 @@
     public void setEndpoint(Endpoint endpoint) {
         this.endpoint = endpoint;
     }
-
-    public String getDeliveryMode() {
-        return deliveryMode;
-    }
-
-    public void setDeliveryMode(String deliveryMode) {
-        this.deliveryMode = deliveryMode;
-    }
-
-    public String getId() {
-        return id;
-    }
-
-    public void setId(String id) {
-        this.id = id;
-    }
-
-    public Calendar getExpires() {
-        return expires;
-    }
-
-    public void setExpires(Calendar expires) {
-        this.expires = expires;
-    }
-
-    public String getAddressUrl() {
-        return addressUrl;
-    }
-
-    public void setAddressUrl(String addressUrl) {
-        this.addressUrl = addressUrl;
-    }
 }

Copied: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseSubscriptionManager.java
 (from r25048, 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionManager.java)
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseSubscriptionManager.java?rev=25108&r1=25048&r2=25108&view=diff
==============================================================================
--- 
/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SubscriptionManager.java
        (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/SynapseSubscriptionManager.java
  Thu Nov 27 08:52:15 2008
@@ -26,21 +26,21 @@
 import java.util.List;
 import java.util.Map;
 
-public abstract class SubscriptionManager {
+public abstract class SynapseSubscriptionManager {
 
     private Map<String, String> properties = new HashMap<String, String>();
 
-    public abstract List<Subscription> getSubscribers();
+    public abstract List<SynapseSubscription> getSubscribers();
 
-    public abstract List<Subscription> getMatchingSubscribers(MessageContext 
mc);
+    public abstract List<SynapseSubscription> 
getMatchingSubscribers(MessageContext mc);
 
-    public abstract Subscription getSubscription(String id);
+    public abstract SynapseSubscription getSubscription(String id);
 
-    public abstract String addSubscription(Subscription subs);
+    public abstract String addSubscription(SynapseSubscription subs);
 
     public abstract boolean deleteSubscription(String id);
 
-    public abstract boolean renewSubscription(Subscription subscription);
+    public abstract boolean renewSubscription(SynapseSubscription 
subscription);
 
     public abstract void init();
 

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java
     (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/ResponseMessageBuilder.java
     Thu Nov 27 08:52:15 2008
@@ -13,7 +13,7 @@
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.synapse.SynapseException;
-import org.apache.synapse.eventing.Subscription;
+import org.apache.synapse.eventing.SynapseSubscription;
 import org.wso2.eventing.EventingConstants;
 
 import javax.xml.namespace.QName;
@@ -82,7 +82,7 @@
      * @param subscription
      * @return
      */
-    public SOAPEnvelope genSubscriptionResponse(Subscription subscription) {
+    public SOAPEnvelope genSubscriptionResponse(SynapseSubscription 
subscription) {
         SOAPEnvelope message = factory.getDefaultEnvelope();
         EndpointReference subscriptionManagerEPR = new 
EndpointReference(subscription.getAddressUrl());
         subscriptionManagerEPR.addReferenceParameter(new 
QName(EventingConstants.WSE_EVENTING_NS,
@@ -125,7 +125,7 @@
      * @param subscription
      * @return
      */
-    public SOAPEnvelope genUnSubscribeResponse(Subscription subscription) {
+    public SOAPEnvelope genUnSubscribeResponse(SynapseSubscription 
subscription) {
         SOAPEnvelope message = factory.getDefaultEnvelope();
         OMElement dummyBody = factory.createOMElement("UnSunscribeResponce", 
null);
         message.getBody().addChild(dummyBody);
@@ -157,7 +157,7 @@
      * @param subscription
      * @return
      */
-    public SOAPEnvelope genRenewSubscriptionResponse(Subscription 
subscription) {
+    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);
@@ -193,7 +193,7 @@
      * @param subscription
      * @return
      */
-    public SOAPEnvelope genGetStatusResponse(Subscription subscription) {
+    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);

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
 (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/builders/SubscriptionMessageBuilder.java
 Thu Nov 27 08:52:15 2008
@@ -31,7 +31,8 @@
 import org.apache.synapse.endpoints.AddressEndpoint;
 import org.apache.synapse.endpoints.Endpoint;
 import org.apache.synapse.endpoints.EndpointDefinition;
-import org.apache.synapse.eventing.Subscription;
+import org.apache.synapse.eventing.SynapseSubscription;
+import org.apache.synapse.eventing.SynapseEventingConstants;
 import org.apache.synapse.eventing.filters.XPathBasedEventFilter;
 import org.apache.synapse.util.xpath.SynapseXPath;
 import org.jaxen.JaxenException;
@@ -110,8 +111,8 @@
      * @param mc
      * @return
      */
-    public static Subscription createSubscription(MessageContext mc) {
-        Subscription subscription = null;
+    public static SynapseSubscription createSubscription(MessageContext mc) {
+        SynapseSubscription subscription = null;
         OMElement elem = 
mc.getEnvelope().getBody().getFirstChildWithName(SUBSCRIBE_QNAME);
         if (elem != null) {
             OMElement deliveryElem = 
elem.getFirstChildWithName(DELIVERY_QNAME);
@@ -120,7 +121,7 @@
                 if (notifyToElem != null) {
                     Endpoint ep = 
getEndpointFromWSAAddress(notifyToElem.getFirstElement());
                     if (ep != null) {
-                        subscription = new 
Subscription(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
+                        subscription = new 
SynapseSubscription(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
                         subscription.setEndpoint(ep);
                     }
                 } else {
@@ -134,7 +135,7 @@
             if (subscription != null && filterElem != null) {
                 OMAttribute dialectAttr = filterElem.getAttribute(ATT_DIALECT);
                 if (dialectAttr != null && dialectAttr.getAttributeValue() != 
null) {
-                    if 
(org.apache.synapse.eventing.EventingConstants.TOPIC_FILTER_DIALECT.equals(dialectAttr.getAttributeValue()))
 {
+                    if 
(SynapseEventingConstants.TOPIC_FILTER_DIALECT.equals(dialectAttr.getAttributeValue()))
 {
                         XPathBasedEventFilter filter = new 
XPathBasedEventFilter();
                         filter.setResultValue(filterElem.getText());
                         if (filterElem.getAttribute(ATT_XPATH) != null) {
@@ -142,7 +143,7 @@
                                 SynapseXPath xpath = 
SynapseXPathFactory.getSynapseXPath(filterElem, ATT_XPATH);
                                 filter.setSourceXpath(xpath);
                             } catch (JaxenException e) {
-                                handleException("Unable to create the 
EventFilter xpath", e);
+                                handleException("Unable to create the 
SynapseEventFilter xpath", e);
                             }
                         }
                         subscription.setFilter(filter);
@@ -196,8 +197,8 @@
      * @param mc
      * @return
      */
-    public static Subscription createUnSubscribeMessage(MessageContext mc) {
-        Subscription subscription = new Subscription();
+    public static SynapseSubscription createUnSubscribeMessage(MessageContext 
mc) {
+        SynapseSubscription subscription = new SynapseSubscription();
         OMElement elem = 
mc.getEnvelope().getHeader().getFirstChildWithName(IDENTIFIER);
         String id = elem.getText();
         subscription.setId(id);
@@ -238,8 +239,8 @@
      * @param mc
      * @return
      */
-    public static Subscription createRenewSubscribeMessage(MessageContext mc) {
-        Subscription subscription = new Subscription();
+    public static SynapseSubscription 
createRenewSubscribeMessage(MessageContext mc) {
+        SynapseSubscription subscription = new SynapseSubscription();
         OMElement elem = 
mc.getEnvelope().getHeader().getFirstChildWithName(IDENTIFIER);
         String id = elem.getText();
         subscription.setId(id);
@@ -286,8 +287,8 @@
      * @param mc
      * @return
      */
-    public static Subscription createGetStatusMessage(MessageContext mc) {
-        Subscription subscription = new Subscription();
+    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();

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
       (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/filters/XPathBasedEventFilter.java
       Thu Nov 27 08:52:15 2008
@@ -20,13 +20,13 @@
 package org.apache.synapse.eventing.filters;
 
 import org.apache.synapse.MessageContext;
-import org.apache.synapse.eventing.EventFilter;
+import org.apache.synapse.eventing.SynapseEventFilter;
 import org.apache.synapse.util.xpath.SynapseXPath;
 
 /**
  *
  */
-public class XPathBasedEventFilter implements EventFilter {
+public class XPathBasedEventFilter implements SynapseEventFilter {
 
     private SynapseXPath sourceXpath;
     private String resultValue;

Modified: 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
 (original)
+++ 
branches/synapse/1.2.wso2v1/modules/core/src/main/java/org/apache/synapse/eventing/managers/DefaultInMemorySubscriptionManager.java
 Thu Nov 27 08:52:15 2008
@@ -22,9 +22,8 @@
 import org.apache.synapse.MessageContext;
 import org.apache.synapse.SynapseException;
 import org.apache.synapse.util.xpath.SynapseXPath;
-import org.apache.synapse.eventing.EventFilter;
-import org.apache.synapse.eventing.Subscription;
-import org.apache.synapse.eventing.SubscriptionManager;
+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;
@@ -39,15 +38,15 @@
 /**
  *
  */
-public class DefaultInMemorySubscriptionManager extends SubscriptionManager {
+public class DefaultInMemorySubscriptionManager extends 
SynapseSubscriptionManager {
 
-    private Map<String, Subscription> store = new ConcurrentHashMap<String, 
Subscription>();
+    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(Subscription subs) {
+    public String addSubscription(SynapseSubscription subs) {
                if (subs.getId() == null) {
                        
subs.setId(org.apache.axiom.om.util.UUIDGenerator.getUUID());
                }
@@ -69,8 +68,8 @@
      * @param subscription
      * @return
      */
-    public boolean renewSubscription(Subscription subscription){
-        Subscription subscriptionOld = getSubscription(subscription.getId());
+    public boolean renewSubscription(SynapseSubscription subscription){
+        SynapseSubscription subscriptionOld = 
getSubscription(subscription.getId());
         if (subscriptionOld !=null){
             subscriptionOld.setExpires(subscription.getExpires());
             return true;
@@ -78,21 +77,21 @@
             return false;
         }
     }
-    public List<Subscription> getSubscribers() {
-               LinkedList<Subscription> list = new LinkedList<Subscription>();
-        for (Map.Entry<String, Subscription> stringSubscriptionEntry : 
store.entrySet()) {
+    public List<SynapseSubscription> getSubscribers() {
+               LinkedList<SynapseSubscription> list = new 
LinkedList<SynapseSubscription>();
+        for (Map.Entry<String, SynapseSubscription> stringSubscriptionEntry : 
store.entrySet()) {
             list.add(stringSubscriptionEntry.getValue());
         }
                return list;
        }
 
-    public List<Subscription> getMatchingSubscribers(MessageContext mc) {      
  
-        LinkedList<Subscription> list = new LinkedList<Subscription>();
-        for (Map.Entry<String, Subscription> stringSubscriptionEntry : 
store.entrySet()) {
-            XPathBasedEventFilter filter =(XPathBasedEventFilter) 
stringSubscriptionEntry.getValue().getFilter();
+    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)) {
-                Subscription subscription = stringSubscriptionEntry.getValue();
+                SynapseSubscription subscription = 
stringSubscriptionEntry.getValue();
                 Calendar current = Calendar.getInstance(); //Get current date 
and time
                 if(current.before(subscription.getExpires())){
                     // add only valid subscriptions by checking the expiration 
 
@@ -103,7 +102,7 @@
                return list;
        }
 
-    public Subscription getSubscription(String id) {
+    public SynapseSubscription getSubscription(String id) {
                return store.get(id);
        }
 

Modified: 
branches/synapse/1.2.wso2v1/modules/samples/src/main/java/samples/userguide/EventSubscriber.java
URL: 
http://wso2.org/svn/browse/wso2/branches/synapse/1.2.wso2v1/modules/samples/src/main/java/samples/userguide/EventSubscriber.java?rev=25108&r1=25107&r2=25108&view=diff
==============================================================================
--- 
branches/synapse/1.2.wso2v1/modules/samples/src/main/java/samples/userguide/EventSubscriber.java
    (original)
+++ 
branches/synapse/1.2.wso2v1/modules/samples/src/main/java/samples/userguide/EventSubscriber.java
    Thu Nov 27 08:52:15 2008
@@ -198,11 +198,11 @@
             factory.createOMText(identifierOm, identifier);
             serviceClient.addHeader(identifierOm);
             serviceClient.setOptions(options);
-            System.out.println("Subscription Renew \n" + 
subscribeOm.toString());
+            System.out.println("SynapseSubscription Renew \n" + 
subscribeOm.toString());
             OMElement response = serviceClient.sendReceive(subscribeOm);
-            System.out.println("Subscription Renew to ID " + identifier);
+            System.out.println("SynapseSubscription Renew to ID " + 
identifier);
             Thread.sleep(1000);
-            System.out.println("Subscription Renew Response Received: " + 
response.toString());
+            System.out.println("SynapseSubscription Renew Response Received: " 
+ response.toString());
 
         } else if (mode.equals("getstatus")) {
             /**

_______________________________________________
Esb-java-dev mailing list
[email protected]
https://wso2.org/cgi-bin/mailman/listinfo/esb-java-dev

Reply via email to