Author: asankaa
Date: Wed Dec  3 11:44:10 2008
New Revision: 25690
URL: http://wso2.org/svn/browse/wso2?view=rev&revision=25690

Log:
fixing CARBON-601 (expiration + non expire subscriptions) 


Modified:
   
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/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/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=25690&r1=25689&r2=25690&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
     Wed Dec  3 11:44:10 2008
@@ -198,7 +198,11 @@
         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);
-        factory.createOMText(expiresElement, 
ConverterUtil.convertToString(subscription.getExpires()));
+        if(subscription.getExpires()!=null){
+            factory.createOMText(expiresElement, 
ConverterUtil.convertToString(subscription.getExpires()));
+        }else{
+            factory.createOMText(expiresElement,"*");
+        }
         renewResponseElement.addChild(expiresElement);
         message.getBody().addChild(renewResponseElement);
         return message;

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=25690&r1=25689&r2=25690&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
 Wed Dec  3 11:44:10 2008
@@ -95,10 +95,16 @@
             if (filter == null || filter.isSatisfied(mc)) {
                 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 
 
-                    list.add(subscription);
+                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;

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=25690&r1=25689&r2=25690&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
    Wed Dec  3 11:44:10 2008
@@ -63,7 +63,7 @@
         String address = getProperty("address", 
"http://localhost:9000/services/SimpleStockQuoteService";);
         String mode = getProperty("mode", "subscribe");
         String identifier = getProperty("identifier", "90000");
-        String expires = getProperty("expires", 
"2020-12-31T21:07:00.000-08:00");
+        String expires = getProperty("expires", "*"); //Format: 
2020-12-31T21:07:00.000-08:00
 
         if (repo != null && !"null".equals(repo)) {
             configContext =
@@ -99,7 +99,9 @@
             notifyToOm.addChild(addressOm);
             deliveryOm.addChild(notifyToOm);
             subscribeOm.addChild(deliveryOm);
-            subscribeOm.addChild(expiresOm);
+            if(!(expires.equals("*"))){
+                subscribeOm.addChild(expiresOm); // Add only if the value 
provided 
+            }
             subscribeOm.addChild(filterOm);
 
             // set addressing, transport and proxy url

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

Reply via email to