This is an automated email from the ASF dual-hosted git repository.

billblough pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/axis-axis2-java-savan.git

commit 72f1ea854a2d797e365b71b8fce21927ed9b6b0d
Author: Chamikara Madhusanka Jayalath <chamik...@apache.org>
AuthorDate: Sun May 20 03:11:44 2007 +0000

    Refactored and updated the Savan codebase.
    InHandler and outHander were removed. Now all the processing happens in the 
MessageReceiver level.
    Changed the in-memory Publishing API to void sendPublication (OMElement 
eventData, AxisService service, URI eventName)
---
 src/main/config/savan-config.xml                   |  14 +-
 .../savan/configuration/ConfigurationManager.java  |  19 +--
 .../apache/savan/configuration/MappingRules.java   |  28 ++--
 .../org/apache/savan/configuration/Protocol.java   |   7 +-
 .../eventing/EventingMessageReceiverDeligater.java |  33 +++--
 .../eventing/EventingSubscriptionProcessor.java    |  30 ++--
 .../apache/savan/eventing/EventingUtilFactory.java |   9 +-
 .../subscribers/EventingLeafSubscriber.java        |  85 ------------
 .../eventing/subscribers/EventingSubscriber.java   | 153 ++++++++++++++++++---
 .../subscribers/EventingTopicSubscriber.java       |  46 -------
 .../java/org/apache/savan/filters/EmptyFilter.java |   6 +-
 src/main/java/org/apache/savan/filters/Filter.java |  11 +-
 .../org/apache/savan/filters/XPathBasedFilter.java |   9 +-
 .../org/apache/savan/handlers/SavanInHandler.java  | 102 --------------
 .../org/apache/savan/handlers/SavanOutHandler.java |  88 ------------
 .../messagereceiver/MessageReceiverDeligater.java  | 115 +++++++++++-----
 .../messagereceiver/SavanInOutMessageReceiver.java |  28 ++--
 .../java/org/apache/savan/module/SavanModule.java  |   2 +-
 .../publication/client/PublicationClient.java      |  87 +++++++-----
 .../savan/storage/DefaultSubscriberStore.java      |  37 ++++-
 .../org/apache/savan/storage/SubscriberStore.java  |  13 +-
 .../savan/subscribers/AbstractSubscriber.java      | 105 --------------
 .../savan/subscribers/CompositeSubscriber.java     |  65 ---------
 .../apache/savan/subscribers/LeafSubscriber.java   |  93 -------------
 .../org/apache/savan/subscribers/Subscriber.java   | 102 +++-----------
 .../apache/savan/subscribers/SubscriberGroup.java  |  60 ++++++++
 .../savan/subscription/SubscriptionProcessor.java  |   7 +-
 .../org/apache/savan/util/ProtocolManager.java     |  18 ++-
 .../java/org/apache/savan/util/UtilFactory.java    |   3 +-
 src/main/resources/META-INF/module.xml             |  12 --
 .../axis2/savan/CompositeSubscriberTest.java       |  61 --------
 .../axis2/savan/ConpositeSubscriberTest.java       |  54 --------
 .../savan/EventingSubscripitonProcessorTest.java   |   4 +-
 .../apache/axis2/savan/XPathBasedFilterTest.java   |   2 +-
 src/test/resources/savan-config-test.xml           |  10 +-
 35 files changed, 503 insertions(+), 1015 deletions(-)

diff --git a/src/main/config/savan-config.xml b/src/main/config/savan-config.xml
index 1773586..f3e5760 100644
--- a/src/main/config/savan-config.xml
+++ b/src/main/config/savan-config.xml
@@ -10,7 +10,7 @@
                 
<action>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus</action>
                 
<action>http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</action>
                </mapping-rules>
-               <defaultSubscriber>eventing-leaf</defaultSubscriber>
+               <defaultSubscriber>eventing</defaultSubscriber>
                <defaultFilter>empty</defaultFilter>
                <!--
                <parameters>
@@ -45,16 +45,8 @@
     
     <subscribers>
        <subscriber>
-               <name>composite</name>
-               <class>org.apache.savan.subscribers.CompositeSubscriber</class>
-       </subscriber>
-       <subscriber>
-               <name>eventing-leaf</name>
-               
<class>org.apache.savan.eventing.subscribers.EventingLeafSubscriber</class>
-       </subscriber>
-        <subscriber>
-               <name>eventing-topic</name>
-               
<class>org.apache.savan.eventing.subscribers.EventingTopicSubscriber</class>
+               <name>eventing</name>
+               
<class>org.apache.savan.eventing.subscribers.EventingSubscriber</class>
        </subscriber>
     </subscribers>
     
diff --git 
a/src/main/java/org/apache/savan/configuration/ConfigurationManager.java 
b/src/main/java/org/apache/savan/configuration/ConfigurationManager.java
index a0ee012..2df0066 100644
--- a/src/main/java/org/apache/savan/configuration/ConfigurationManager.java
+++ b/src/main/java/org/apache/savan/configuration/ConfigurationManager.java
@@ -38,7 +38,7 @@ import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
 import org.apache.savan.filters.Filter;
 import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscribers.AbstractSubscriber;
+import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.util.UtilFactory;
 
@@ -59,8 +59,7 @@ public class ConfigurationManager {
        private final String NAME = "name";
        private final String UTIL_FACTORY = "utilFactory";
        private final String MAPPING_RULES = "mapping-rules";
-       private final String ACTION = "mapping-rules";
-       private final String SOAP_ACTION = "mapping-rules";
+       private final String ACTION = "action";
        private final String SUBSCRIBER_STORES = "subscriberStores";
        private final String SUBSCRIBER_STORE = "subscriberStore";
        private final String FILTERS = "filters";
@@ -227,21 +226,15 @@ public class ConfigurationManager {
        
        private void processMappingRules (OMElement element, Protocol protocol) 
{
                
-               MappingRules mappingRules = new MappingRules ();
+               MappingRules mappingRules = protocol.getMappingRules();
                
                Iterator actionsIterator = element.getChildrenWithName(new 
QName (ACTION));
                while (actionsIterator.hasNext()) {
                        OMElement actionElement = (OMElement) 
actionsIterator.next();
                        String action = actionElement.getText();
-                       mappingRules.addAction(action);
+                       mappingRules.addRule(MappingRules.MAPPING_TYPE_ACTION, 
action);
                }
                
-               Iterator SOAPActionsIterator = element.getChildrenWithName(new 
QName (SOAP_ACTION));
-               while (SOAPActionsIterator.hasNext()) {
-                       OMElement SOAPactionElement = (OMElement) 
SOAPActionsIterator.next();
-                       String SOAPaction = SOAPactionElement.getText();
-                       mappingRules.addAction(SOAPaction);
-               }
        }
        
        private void processSubscriberStores (OMElement element) throws 
SavanException {
@@ -410,14 +403,14 @@ public class ConfigurationManager {
                return (SubscriberBean) subscribersMap.get(subscriberName);
        }
        
-       public AbstractSubscriber getSubscriberInstance (String subscriberName) 
throws SavanException {
+       public Subscriber getSubscriberInstance (String subscriberName) throws 
SavanException {
                SubscriberBean subscriberBean = (SubscriberBean) 
subscribersMap.get(subscriberName);
                if (subscriberBean==null) {
                        String message = "A subscriber with the name '" + 
subscriberName + "' was not found.";
                        throw new SavanException (message);
                }
                
-               return (AbstractSubscriber) 
getObject(subscriberBean.getClazz());
+               return (Subscriber) getObject(subscriberBean.getClazz());
        }
        
 }
diff --git a/src/main/java/org/apache/savan/configuration/MappingRules.java 
b/src/main/java/org/apache/savan/configuration/MappingRules.java
index f12c089..9c10a23 100644
--- a/src/main/java/org/apache/savan/configuration/MappingRules.java
+++ b/src/main/java/org/apache/savan/configuration/MappingRules.java
@@ -25,28 +25,24 @@ import java.util.ArrayList;
  */
 public class MappingRules {
 
-       private ArrayList actionMap = null;
-       private ArrayList SOAPActionMap = null;
+       public static final int MAPPING_TYPE_ACTION = 1;
        
-       public MappingRules () {
-               actionMap = new ArrayList ();
-               SOAPActionMap = new ArrayList ();
-       }
+       private ArrayList actionList = null;
        
-       public void addAction (String action) {
-               actionMap.add(action);
-       }
-       
-       public boolean isActionPresent (String action) {
-               return actionMap.contains(action);
+       public MappingRules () {
+               actionList = new ArrayList ();
        }
        
-       public void addSOAPAction (String SOAPAction) {
-               SOAPActionMap.add(SOAPAction);
+       public void addRule (int type,String value) {
+               if (type==MAPPING_TYPE_ACTION)
+                       actionList.add(value);
        }
        
-       public boolean isSOAPActionPresent (String SOAPAction) {
-               return SOAPActionMap.contains(SOAPAction);
+       public boolean ruleMatched (int type, String value) {
+               if (type==MAPPING_TYPE_ACTION)
+                       return actionList.contains(value);
+               
+               return false;
        }
        
 }
diff --git a/src/main/java/org/apache/savan/configuration/Protocol.java 
b/src/main/java/org/apache/savan/configuration/Protocol.java
index c6d1df4..af7ee1d 100644
--- a/src/main/java/org/apache/savan/configuration/Protocol.java
+++ b/src/main/java/org/apache/savan/configuration/Protocol.java
@@ -31,6 +31,10 @@ public class Protocol {
        private String defaultSubscriber;
        private String defaultFilter;
        
+       public Protocol () {
+               this.mappingRules = new MappingRules ();
+       }
+
        public String getDefaultFilter() {
                return defaultFilter;
        }
@@ -67,7 +71,4 @@ public class Protocol {
                return mappingRules;
        }
 
-       public void setMappingRules(MappingRules mappingRule) {
-               this.mappingRules = mappingRule;
-       }
 }
diff --git 
a/src/main/java/org/apache/savan/eventing/EventingMessageReceiverDeligater.java 
b/src/main/java/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
index ab0c6c5..cfe66c8 100644
--- 
a/src/main/java/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
+++ 
b/src/main/java/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
@@ -33,17 +33,30 @@ import org.apache.axis2.databinding.utils.ConverterUtil;
 import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
-import org.apache.savan.eventing.subscribers.EventingLeafSubscriber;
+import org.apache.savan.eventing.subscribers.EventingSubscriber;
 import org.apache.savan.messagereceiver.MessageReceiverDeligater;
 import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscribers.AbstractSubscriber;
+import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.util.CommonUtil;
 
 
-public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligater {
+public class EventingMessageReceiverDeligater extends MessageReceiverDeligater 
{
+       
+       public void doProtocolSpecificProcessing (SavanMessageContext 
inSavanMessage, MessageContext outMessage) throws SavanException {
+               int messageType = inSavanMessage.getMessageType();
+               if 
(messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
+                       handleSubscriptionRequest(inSavanMessage,outMessage);
+               } else if 
(messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
+                       handleRenewRequest (inSavanMessage,outMessage);
+               } else if 
(messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
+                       handleEndSubscriptionRequest 
(inSavanMessage,outMessage);
+               } else if 
(messageType==SavanConstants.MessageTypes.GET_STATUS_MESSAGE) {
+                       handleGetStatusRequest (inSavanMessage,outMessage);
+               }               
+       }
 
-       public void handleSubscriptionRequest(SavanMessageContext 
subscriptionMessage, MessageContext outMessage) throws SavanException {
+       private void handleSubscriptionRequest(SavanMessageContext 
subscriptionMessage, MessageContext outMessage) throws SavanException {
                
                if (outMessage==null)
                        throw new SavanException ("Eventing protocol need to 
sent the SubscriptionResponseMessage. But the outMessage is null");
@@ -98,7 +111,7 @@ public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligate
        
        }
        
-       public void handleRenewRequest(SavanMessageContext renewMessage, 
MessageContext outMessage) throws SavanException {
+       private void handleRenewRequest(SavanMessageContext renewMessage, 
MessageContext outMessage) throws SavanException {
                
                if (outMessage==null)
                        throw new SavanException ("Eventing protocol need to 
sent the SubscriptionResponseMessage. But the outMessage is null");
@@ -136,7 +149,7 @@ public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligate
 
                SubscriberStore store = 
CommonUtil.getSubscriberStore(renewMessage.getMessageContext().getAxisService());
                Subscriber subscriber = store.retrieve(subscriberID);
-               EventingLeafSubscriber eventingSubscriber = 
(EventingLeafSubscriber) subscriber;
+               EventingSubscriber eventingSubscriber = (EventingSubscriber) 
subscriber;
                if (eventingSubscriber==null) {
                        String message = "Cannot find the AbstractSubscriber 
with the given ID";
                        throw new SavanException (message);
@@ -159,7 +172,7 @@ public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligate
                outMessage.setProperty(SavanConstants.MESSAGE_TYPE,new Integer 
(SavanConstants.MessageTypes.RENEW_RESPONSE_MESSAGE));
        }
 
-       public void handleEndSubscriptionRequest(SavanMessageContext 
renewMessage, MessageContext outMessage) throws SavanException {
+       private void handleEndSubscriptionRequest(SavanMessageContext 
renewMessage, MessageContext outMessage) throws SavanException {
                
                if (outMessage==null)
                        throw new SavanException ("Eventing protocol need to 
sent the SubscriptionResponseMessage. But the outMessage is null");
@@ -226,7 +239,7 @@ public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligate
                        throw new SavanException ("AbstractSubscriber Store was 
not found");
                }
                
-               EventingLeafSubscriber subscriber = (EventingLeafSubscriber) 
store.retrieve(id);
+               EventingSubscriber subscriber = (EventingSubscriber) 
store.retrieve(id);
                if (subscriber==null) {
                        throw new SavanException ("AbstractSubscriber not 
found");
                }
@@ -250,6 +263,8 @@ public class EventingMessageReceiverDeligater implements 
MessageReceiverDeligate
                outMessage.setProperty(SavanConstants.MESSAGE_TYPE,new Integer 
(SavanConstants.MessageTypes.GET_STATUS_RESPONSE_MESSAGE));
        }
        
-       
+       public void doProtocolSpecificProcessing(SavanMessageContext 
inSavanMessage) throws SavanException {
+               
+       }
 
 }
diff --git 
a/src/main/java/org/apache/savan/eventing/EventingSubscriptionProcessor.java 
b/src/main/java/org/apache/savan/eventing/EventingSubscriptionProcessor.java
index 106314f..4edd9a3 100644
--- a/src/main/java/org/apache/savan/eventing/EventingSubscriptionProcessor.java
+++ b/src/main/java/org/apache/savan/eventing/EventingSubscriptionProcessor.java
@@ -17,6 +17,8 @@
 
 package org.apache.savan.eventing;
 
+import java.net.URI;
+import java.net.URISyntaxException;
 import java.util.Calendar;
 import java.util.Date;
 
@@ -47,7 +49,7 @@ import org.apache.savan.configuration.Protocol;
 import org.apache.savan.configuration.SubscriberBean;
 import org.apache.savan.eventing.subscribers.EventingSubscriber;
 import org.apache.savan.filters.Filter;
-import org.apache.savan.subscribers.AbstractSubscriber;
+import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscription.ExpirationBean;
 import org.apache.savan.subscription.SubscriptionProcessor;
@@ -86,7 +88,7 @@ public class EventingSubscriptionProcessor extends 
SubscriptionProcessor {
                String subscriberName = protocol.getDefaultSubscriber();
                SubscriberBean subscriberBean = 
configurationManager.getSubscriberBean(subscriberName);
                
-               AbstractSubscriber subscriber = 
configurationManager.getSubscriberInstance(subscriberName);
+               Subscriber subscriber = 
configurationManager.getSubscriberInstance(subscriberName);
                
                if (!(subscriber instanceof EventingSubscriber)) {
                        String message = "Eventing protocol only support 
implementations of eventing subscriber as Subscribers";
@@ -96,8 +98,12 @@ public class EventingSubscriptionProcessor extends 
SubscriptionProcessor {
                EventingSubscriber eventingSubscriber = (EventingSubscriber) 
subscriber;
                String id = UUIDGenerator.getUUID();
                
smc.setProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID,id);
-       
-               eventingSubscriber.setId(id);
+               try {
+                       URI uri = new URI (id);
+                       eventingSubscriber.setId(uri);
+               } catch (URISyntaxException e) {
+                       throw new SavanException (e);
+               }
                
                SOAPBody body = envelope.getBody();
                OMElement subscribeElement = body.getFirstChildWithName(new 
QName 
(EventingConstants.EVENTING_NAMESPACE,EventingConstants.ElementNames.Subscribe));
@@ -304,22 +310,6 @@ public class EventingSubscriptionProcessor extends 
SubscriptionProcessor {
                return bean;
        }
 
-       public void doProtocolSpecificEndSubscription(Subscriber subscriber, 
String reason, ConfigurationContext configurationContext) throws SavanException 
{
-               String SOAPVersion = (String) 
subscriber.getProperty(EventingConstants.Properties.SOAPVersion);
-               if (SOAPVersion==null) 
-                       throw new SavanException ("Cant find the SOAP version 
of the subscriber");
-               
-               SOAPFactory factory = null;
-               if 
(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
-                       factory = OMAbstractFactory.getSOAP11Factory();
-               else if 
(SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(SOAPVersion))
-                       factory = OMAbstractFactory.getSOAP12Factory();
-               else
-                       throw new SavanException ("The subscriber has a unknown 
SOAP version property set");
-               
-               SOAPEnvelope envelope = factory.getDefaultEnvelope();
-       }
-       
        private boolean deliveryModesupported() {
                return true;
        }
diff --git a/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java 
b/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
index 1fd326e..3d7486d 100644
--- a/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
+++ b/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
@@ -19,10 +19,11 @@ package org.apache.savan.eventing;
 
 import org.apache.axis2.context.MessageContext;
 import org.apache.savan.SavanConstants;
+import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
-import org.apache.savan.eventing.subscribers.EventingLeafSubscriber;
+import org.apache.savan.eventing.subscribers.EventingSubscriber;
 import org.apache.savan.messagereceiver.MessageReceiverDeligater;
-import org.apache.savan.subscribers.AbstractSubscriber;
+import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscription.SubscriptionProcessor;
 import org.apache.savan.util.UtilFactory;
 
@@ -64,8 +65,8 @@ public class EventingUtilFactory implements UtilFactory {
                return new EventingMessageReceiverDeligater ();
        }
 
-       public AbstractSubscriber createSubscriber() {
-               return new EventingLeafSubscriber ();
+       public Subscriber createSubscriber() {
+               return new EventingSubscriber ();
        }
        
 }
diff --git 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java
 
b/src/main/java/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java
deleted file mode 100644
index 85ffdf8..0000000
--- 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java
+++ /dev/null
@@ -1,85 +0,0 @@
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed 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.savan.eventing.subscribers;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.client.OperationClient;
-import org.apache.axis2.client.Options;
-import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.MessageContext;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.eventing.Delivery;
-import org.apache.savan.subscribers.LeafSubscriber;
-
-public class EventingLeafSubscriber extends LeafSubscriber implements 
EventingSubscriber {
-
-       private EndpointReference endToEPr;
-       
-       private Delivery delivery;
-       
-       public Delivery getDelivery() {
-               return delivery;
-       }
-
-       public EndpointReference getEndToEPr() {
-               return endToEPr;
-       }
-
-       public void setDelivery(Delivery delivery) {
-               this.delivery = delivery;
-       }
-
-       public void setEndToEPr(EndpointReference errorReportingEPR) {
-               this.endToEPr = errorReportingEPR;
-       }
-       
-       public void doProtocolSpecificPublication(SavanMessageContext 
publication) throws SavanException {
-               
-               EndpointReference deliveryEPR  = delivery.getDeliveryEPR();
-               
-               try {
-                       ServiceClient sc = new ServiceClient 
(publication.getConfigurationContext(),null);
-                       
-                       Options options = 
publication.getMessageContext().getOptions();
-                       if (options==null) {
-                               options = new Options ();
-                       }
-                       
-                       sc.engageModule(new QName ("addressing"));
-                       
-                       options.setProperty("xmppasync", "true");
-                       sc.setOptions(options);
-                       
-                       options.setTo(deliveryEPR);
-                       MessageContext mc = new MessageContext ();
-                       mc.setEnvelope(publication.getEnvelope());
-                       OperationClient client = 
sc.createClient(ServiceClient.ANON_OUT_ONLY_OP);
-                       client.addMessageContext(mc);
-                       client.execute(true);
-               } catch (AxisFault e) {
-                       throw new SavanException (e);
-               }
-               
-               
-       }
-
-}
diff --git 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingSubscriber.java 
b/src/main/java/org/apache/savan/eventing/subscribers/EventingSubscriber.java
index 81059cd..d24e970 100644
--- 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingSubscriber.java
+++ 
b/src/main/java/org/apache/savan/eventing/subscribers/EventingSubscriber.java
@@ -16,37 +16,156 @@
 
 package org.apache.savan.eventing.subscribers;
 
+import java.net.URI;
+import java.util.Calendar;
+import java.util.Date;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.axis2.AxisFault;
 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.MessageContext;
+import org.apache.savan.SavanException;
 import org.apache.savan.eventing.Delivery;
+import org.apache.savan.filters.Filter;
 import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscription.ExpirationBean;
+import org.apache.savan.util.CommonUtil;
 
 /**
  * Defines methods common to all eventing subscribers.
  */
-public interface EventingSubscriber extends Subscriber {
+public class EventingSubscriber implements Subscriber {
        
-       /**
-        * To get the EndTo EPR
-        * @return
-        */
-       EndpointReference getEndToEPr();
        
-       /**
-        * To get the Delivery object
-        * @return
-        */
-       Delivery getDelivery();
+       private URI id;
+       private Filter filter = null;
+       private EndpointReference endToEPr;
+       private Delivery delivery;
+       private ConfigurationContext configurationContext;
        
        /**
-        * To se the Delivery object
-        * @param delivery
+        * The time at which further notification of messages should be avaoded
+        * to this subscriber.
         */
-       void setDelivery(Delivery delivery);
+       private Date subscriptionEndingTime = null;
+
+
+       public Filter getFilter() {
+               return filter;
+       }
+
+       public void setFilter(Filter filter) {
+               this.filter = filter;
+       }
+
+       public URI getId() {
+               return id;
+       }
+       
+       public void setId(URI id) {
+               this.id = id;
+       }
+       
+       public Delivery getDelivery() {
+               return delivery;
+       }
+
+       public EndpointReference getEndToEPr() {
+               return endToEPr;
+       }
+
+       public void setDelivery(Delivery delivery) {
+               this.delivery = delivery;
+       }
+
+       public void setEndToEPr(EndpointReference errorReportingEPR) {
+               this.endToEPr = errorReportingEPR;
+       }
+
+       public Date getSubscriptionEndingTime () {
+               return subscriptionEndingTime;
+       }
+       
+       public void setSubscriptionEndingTime () {
+       }
+       
+       public ConfigurationContext getConfigurationContext() {
+               return configurationContext;
+       }
+
+       public void setConfigurationContext(ConfigurationContext 
configurationContext) {
+               this.configurationContext = configurationContext;
+       }
+
+       public void setSubscriptionEndingTime(Date subscriptionEndingTime) {
+               this.subscriptionEndingTime = subscriptionEndingTime;
+       }
        
        /**
-        * To set the EndTo EPR
-        * @param errorReportingEPR
+        * This method first checks weather the passed message complies with 
the current filter.
+        * If so message is sent, and the subscriberID is added to the 
PublicationReport.
+        * Else message is ignored.
+        * 
+        * @param smc
+        * @param report
+        * @throws SavanException
         */
-       void setEndToEPr(EndpointReference errorReportingEPR);
+       public void sendEventData (OMElement eventData) throws SavanException {
+
+               Date date = new Date ();
+               boolean expired = false;
+               if (subscriptionEndingTime!=null && 
date.after(subscriptionEndingTime))
+                       expired = true;
+               
+               if (expired) {
+                       String message = "Cant notify the listner since the 
subscription has been expired";
+                       throw new SavanException (message);
+               }
+               
+               if (doesEventDataBelongToTheFilter(eventData)) {
+                       sendThePublication (eventData);
+               }
+       }
+
+       private boolean doesEventDataBelongToTheFilter(OMElement eventData) 
throws SavanException {
+               if (filter!=null) {
+                       return filter.checkCompliance (eventData);
+               } else 
+                       return true;
+       }
+       
+       private void sendThePublication(OMElement eventData) throws 
SavanException {
+               
+               EndpointReference deliveryEPR  = delivery.getDeliveryEPR();
+               try {
+                       ServiceClient sc = new ServiceClient 
(configurationContext,null);
+                       Options options = new Options ();
+                       sc.setOptions(options);
+                       options.setTo(deliveryEPR);
+                       
options.setProperty(MessageContext.TRANSPORT_NON_BLOCKING, Boolean.FALSE);
+                       sc.fireAndForget(eventData);
+               } catch (AxisFault e) {
+                       throw new SavanException (e);
+               }
+       }
+       
+       public void renewSubscription (ExpirationBean bean) {
+               if (bean.isDuration()) {
+                       if (subscriptionEndingTime==null) {
+                               Calendar calendar = Calendar.getInstance();
+                               
CommonUtil.addDurationToCalendar(calendar,bean.getDurationValue());
+                               subscriptionEndingTime = calendar.getTime();
+                       } else {
+                               Calendar expiration = Calendar.getInstance();
+                               expiration.setTime(subscriptionEndingTime);
+                               
CommonUtil.addDurationToCalendar(expiration,bean.getDurationValue());
+                               subscriptionEndingTime = expiration.getTime();
+                       }
+               } else
+                       subscriptionEndingTime = bean.getDateValue();
+       }
        
 }
diff --git 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java
 
b/src/main/java/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java
deleted file mode 100644
index b0f7646..0000000
--- 
a/src/main/java/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.savan.eventing.subscribers;
-
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.savan.eventing.Delivery;
-import org.apache.savan.subscribers.CompositeSubscriber;
-
-public class EventingTopicSubscriber extends CompositeSubscriber implements 
EventingSubscriber {
-       
-       private EndpointReference endToEPr;
-       
-       private Delivery delivery;
-       
-       public Delivery getDelivery() {
-               return delivery;
-       }
-
-       public EndpointReference getEndToEPr() {
-               return endToEPr;
-       }
-
-       public void setDelivery(Delivery delivery) {
-               this.delivery = delivery;
-       }
-
-       public void setEndToEPr(EndpointReference errorReportingEPR) {
-               this.endToEPr = errorReportingEPR;
-       }
-       
-       
-}
diff --git a/src/main/java/org/apache/savan/filters/EmptyFilter.java 
b/src/main/java/org/apache/savan/filters/EmptyFilter.java
index 46e2f68..013ca64 100644
--- a/src/main/java/org/apache/savan/filters/EmptyFilter.java
+++ b/src/main/java/org/apache/savan/filters/EmptyFilter.java
@@ -16,17 +16,17 @@
 
 package org.apache.savan.filters;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.savan.SavanException;
 
 /**
  * This filter does not do any affective filtering.
  * May be the default for some protocols.
  */
-public class EmptyFilter extends Filter {
+public class EmptyFilter implements Filter {
 
-       public boolean checkEnvelopeCompliance(SOAPEnvelope envelope) throws 
SavanException {
+       public boolean checkCompliance(OMElement envelope) throws 
SavanException {
                return true;
        }
 
diff --git a/src/main/java/org/apache/savan/filters/Filter.java 
b/src/main/java/org/apache/savan/filters/Filter.java
index 26ccab2..0a60e6c 100644
--- a/src/main/java/org/apache/savan/filters/Filter.java
+++ b/src/main/java/org/apache/savan/filters/Filter.java
@@ -17,15 +17,15 @@
 
 package org.apache.savan.filters;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.axiom.om.OMNode;
-import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.savan.SavanException;
 
 /**
  * Defines a filter used by Savan. 
  *
  */
-public abstract class Filter {
+public interface Filter {
        
        /**
         * To check weather the passed envelope is compliant with the current 
filter.
@@ -33,7 +33,7 @@ public abstract class Filter {
         * @return
         * @throws SavanException
         */
-       public abstract boolean checkEnvelopeCompliance (SOAPEnvelope envelope) 
throws SavanException;
+       public boolean checkCompliance (OMElement element) throws 
SavanException;
        
        /**
         * To initialize the filter. The filter value should be sent to the 
argument
@@ -41,12 +41,13 @@ public abstract class Filter {
         * 
         * @param element
         */
-       public abstract void setUp (OMNode element);
+       public void setUp (OMNode element);
        
        /**
         * Returns a previously set filter value.
         * 
         * @return
         */
-       public abstract Object getFilterValue ();
+       public Object getFilterValue ();
+       
 }
diff --git a/src/main/java/org/apache/savan/filters/XPathBasedFilter.java 
b/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
index 97680b1..cbcacbc 100644
--- a/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
+++ b/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
@@ -48,7 +48,7 @@ import org.jaxen.JaxenException;
  * A filter that does filtering of messages based on a XPath string.
  * 
  */
-public class XPathBasedFilter extends Filter {
+public class XPathBasedFilter implements Filter {
 
        private String XPathString = null;
        
@@ -63,17 +63,14 @@ public class XPathBasedFilter extends Filter {
        /**
         * This method may fail due to the JIRA issues WS-Commons(40) amd 
WS-Commons (41)
         */
-       public boolean checkEnvelopeCompliance(SOAPEnvelope envelope) throws 
SavanException {
-               OMElement firstChild = envelope.getBody().getFirstElement();
-               if (firstChild==null)
-                       return false;
+       public boolean checkCompliance (OMElement element) throws 
SavanException {
                
                if (XPathString==null)
                        return true;
                
                try {
                        AXIOMXPath xpath = new AXIOMXPath (XPathString);
-                       List resultList = xpath.selectNodes(firstChild);
+                       List resultList = xpath.selectNodes(element);
 
             return resultList.size() > 0;
                } catch (JaxenException e) {
diff --git a/src/main/java/org/apache/savan/handlers/SavanInHandler.java 
b/src/main/java/org/apache/savan/handlers/SavanInHandler.java
deleted file mode 100644
index 2b461f5..0000000
--- a/src/main/java/org/apache/savan/handlers/SavanInHandler.java
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed 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.savan.handlers;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.description.Parameter;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.savan.SavanConstants;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.configuration.ConfigurationManager;
-import org.apache.savan.configuration.Protocol;
-import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscription.SubscriptionProcessor;
-import org.apache.savan.util.UtilFactory;
-import org.apache.savan.util.ProtocolManager;
-
-/**
- * The handler of Savan in the InFlow.
- * Will handle the control messages like subscription, renew, unsubscription.
- * 
- */
-public class SavanInHandler extends AbstractHandler  {
-
-       public InvocationResponse invoke(MessageContext msgContext) throws 
AxisFault {
-               
-               SavanMessageContext smc = new SavanMessageContext (msgContext);
-               
-               //setting the Protocol
-               Protocol protocol = ProtocolManager.getMessageProtocol(smc);
-               smc.setProtocol(protocol);
-               
-               AxisService axisService = msgContext.getAxisService();
-               if (axisService==null)
-                       throw new SavanException ("Service context is null");
-               
-               //setting the AbstractSubscriber Store
-               Parameter parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE);
-               if (parameter==null){
-                       setSubscriberStore (smc);
-                       parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE);
-               }
-               
-               UtilFactory utilFactory = smc.getProtocol().getUtilFactory();
-               utilFactory.initializeMessage (smc);
-               
-               int messageType = smc.getMessageType ();
-
-               SubscriptionProcessor processor = 
utilFactory.createSubscriptionProcessor ();
-               processor.init (smc);
-               if 
(messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
-                  processor.subscribe(smc);
-               } else if 
(messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
-                       processor.unsubscribe(smc);
-               } else if 
(messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
-                       processor.renewSubscription(smc);
-               }
-        return InvocationResponse.CONTINUE;        
-       }
-       
-       private void setSubscriberStore (SavanMessageContext smc) throws 
SavanException {
-               MessageContext msgContext = smc.getMessageContext();
-               AxisService axisService = msgContext.getAxisService();
-               
-               Parameter parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE_KEY);
-               String subscriberStoreKey = 
SavanConstants.DEFAULT_SUBSCRIBER_STORE_KEY;
-               if (parameter!=null)
-                       subscriberStoreKey = (String) parameter.getValue();
-               
-               ConfigurationManager configurationManager = 
(ConfigurationManager) 
smc.getConfigurationContext().getProperty(SavanConstants.CONFIGURATION_MANAGER);
-               SubscriberStore store = 
configurationManager.getSubscriberStoreInstance(subscriberStoreKey);
-
-               parameter = new Parameter ();
-               parameter.setName(SavanConstants.SUBSCRIBER_STORE);
-               parameter.setValue(store);
-               
-               try {
-                       axisService.addParameter(parameter);
-               } catch (AxisFault e) {
-                       throw new SavanException (e);
-               }
-               
-       }
-       
-}
diff --git a/src/main/java/org/apache/savan/handlers/SavanOutHandler.java 
b/src/main/java/org/apache/savan/handlers/SavanOutHandler.java
deleted file mode 100644
index 12bae9c..0000000
--- a/src/main/java/org/apache/savan/handlers/SavanOutHandler.java
+++ /dev/null
@@ -1,88 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.savan.handlers;
-
-import java.util.Iterator;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.AddressingConstants;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.handlers.AbstractHandler;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.savan.SavanConstants;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.publication.PublicationReport;
-import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscribers.AbstractSubscriber;
-import org.apache.savan.util.CommonUtil;
-
-/**
- * Handler of Savan in the outFlow.
- * Notification messages should go through this handler and this will sent 
them to
- * each subscriber based on their filter.
- * 
- */
-public class SavanOutHandler extends AbstractHandler {
-
-       Log log = LogFactory.getLog(SavanOutHandler.class);
-       
-       public InvocationResponse invoke(MessageContext msgContext) throws 
AxisFault {
-
-               SavanMessageContext smc = new SavanMessageContext (msgContext);
-               int messagetype = smc.getMessageType();
-       
-               //TODO hv a better method to identify publication messages
-               if (messagetype == SavanConstants.MessageTypes.UNKNOWN) {
-                       SavanMessageContext publication = new 
SavanMessageContext(msgContext);
-                       SubscriberStore store = 
CommonUtil.getSubscriberStore(msgContext.getAxisService());
-                       if (store != null) {
-                               
-                               //building the publication envelope
-                               msgContext.getEnvelope().build();
-                               
-                               //this tell addressing to polulate the SOAP 
envelope with the new values set in the options object
-                               //(i.e. by removing old headers) every time the 
message sent through it.
-                               
msgContext.setProperty(AddressingConstants.REPLACE_ADDRESSING_HEADERS, 
Boolean.TRUE);
-                               
-                               PublicationReport report = new 
PublicationReport();
-                               Iterator iterator = store.retrieveAll();
-                               while (iterator.hasNext()) {
-                                       AbstractSubscriber subscriber = 
(AbstractSubscriber) iterator.next();
-                                       try {
-                                               subscriber.processPublication 
(publication, report);
-                                       } catch (SavanException e) {
-                                               
report.addErrorReportEntry(subscriber.getId(),e);
-                                               e.printStackTrace();
-                                       }
-                                       
-                                       //TODO do something with the report.
-                               }
-                       } else {
-                               String message = "Couldnt send the message 
since the subscriber storage was not found";
-                               log.debug(message);
-                       }
-                       
-            msgContext.pause();
-            return InvocationResponse.SUSPEND;        
-               }
-        return InvocationResponse.CONTINUE;        
-
-       }
-
-}
diff --git 
a/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java 
b/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
index 614001f..0a8e4a5 100644
--- 
a/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
+++ 
b/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
@@ -17,53 +17,94 @@
 
 package org.apache.savan.messagereceiver;
 
+import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisService;
+import org.apache.axis2.description.Parameter;
+import org.apache.axis2.engine.Handler.InvocationResponse;
+import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
+import org.apache.savan.configuration.ConfigurationManager;
+import org.apache.savan.configuration.Protocol;
+import org.apache.savan.storage.SubscriberStore;
+import org.apache.savan.subscription.SubscriptionProcessor;
+import org.apache.savan.util.ProtocolManager;
+import org.apache.savan.util.UtilFactory;
 
 /**
  * Provide abstract functions that may be done by protocols at the 
MessageReceiver level.
  *
  */
-public interface MessageReceiverDeligater {
+public abstract class MessageReceiverDeligater {
        
-       /**
-        * Handles a subscription request at the MessageReceiver level.
-        * (may possibly send a subscription response).
-        * 
-        * @param subscriptionMessage
-        * @param outMessage
-        * @throws SavanException
-        */
-       void handleSubscriptionRequest (SavanMessageContext 
subscriptionMessage, MessageContext outMessage) throws SavanException ;
        
-       /**
-        * Handles a renew request at the MessageReceiver level.
-        * (may possibly send a renew response)
-        * 
-        * @param renewMessage
-        * @param outMessage
-        * @throws SavanException
-        */
-       void handleRenewRequest(SavanMessageContext renewMessage, 
MessageContext outMessage) throws SavanException;
+       public void processMessage (SavanMessageContext smc) throws 
SavanException {
+               MessageContext msgContext = smc.getMessageContext();
+               
+               //setting the Protocol
+               Protocol protocol = smc.getProtocol();
+               
+               if (protocol==null) {
+                       //this message does not have a matching protocol
+                       //so let it go
+                       throw new SavanException ("Cannot find a matching 
protocol");
+               }
+               
+               smc.setProtocol(protocol);
+               
+               AxisService axisService = msgContext.getAxisService();
+               if (axisService==null)
+                       throw new SavanException ("Service context is null");
+               
+               //setting the AbstractSubscriber Store
+               Parameter parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE);
+               if (parameter==null){
+                       setSubscriberStore (smc);
+                       parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE);
+               }
+               
+               UtilFactory utilFactory = smc.getProtocol().getUtilFactory();
+               utilFactory.initializeMessage (smc);
+               
+               int messageType = smc.getMessageType ();
+
+               SubscriptionProcessor processor = 
utilFactory.createSubscriptionProcessor ();
+               processor.init (smc);
+               if 
(messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
+                  processor.subscribe(smc);
+               } else if 
(messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
+                       processor.unsubscribe(smc);
+               } else if 
(messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
+                       processor.renewSubscription(smc);
+               }
+       }
+       
+       private void setSubscriberStore (SavanMessageContext smc) throws 
SavanException {
+               MessageContext msgContext = smc.getMessageContext();
+               AxisService axisService = msgContext.getAxisService();
+               
+               Parameter parameter = 
axisService.getParameter(SavanConstants.SUBSCRIBER_STORE_KEY);
+               String subscriberStoreKey = 
SavanConstants.DEFAULT_SUBSCRIBER_STORE_KEY;
+               if (parameter!=null)
+                       subscriberStoreKey = (String) parameter.getValue();
+               
+               ConfigurationManager configurationManager = 
(ConfigurationManager) 
smc.getConfigurationContext().getProperty(SavanConstants.CONFIGURATION_MANAGER);
+               SubscriberStore store = 
configurationManager.getSubscriberStoreInstance(subscriberStoreKey);
+
+               parameter = new Parameter ();
+               parameter.setName(SavanConstants.SUBSCRIBER_STORE);
+               parameter.setValue(store);
+               
+               try {
+                       axisService.addParameter(parameter);
+               } catch (AxisFault e) {
+                       throw new SavanException (e);
+               }
+               
+       }
        
-       /**
-        * Handles an EndSubscription request at the MessageReceiver level.
-        * (may possibly send a EndSubscription response)
-        * 
-        * @param renewMessage
-        * @param outMessage
-        * @throws SavanException
-        */
-       void handleEndSubscriptionRequest(SavanMessageContext renewMessage, 
MessageContext outMessage) throws SavanException;
+       public abstract void doProtocolSpecificProcessing (SavanMessageContext 
inSavanMessage, MessageContext outMessage) throws SavanException;
        
-       /**
-        * Handles a GetStatus request at the MessageReceiver level.
-        * (may possibly send a GetStatus response).
-        * 
-        * @param renewMessage
-        * @param outMessage
-        * @throws SavanException
-        */
-       void handleGetStatusRequest (SavanMessageContext renewMessage, 
MessageContext outMessage) throws SavanException;
+       public abstract void doProtocolSpecificProcessing (SavanMessageContext 
inSavanMessage) throws SavanException;
 }
diff --git 
a/src/main/java/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java 
b/src/main/java/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java
index 45ae436..3233dc3 100644
--- 
a/src/main/java/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java
+++ 
b/src/main/java/org/apache/savan/messagereceiver/SavanInOutMessageReceiver.java
@@ -20,10 +20,10 @@ package org.apache.savan.messagereceiver;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.receivers.AbstractInOutSyncMessageReceiver;
-import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.configuration.Protocol;
+import org.apache.savan.util.ProtocolManager;
 import org.apache.savan.util.UtilFactory;
 
 /**
@@ -36,27 +36,21 @@ public class SavanInOutMessageReceiver extends 
AbstractInOutSyncMessageReceiver
 
                SavanMessageContext savanInMessage = new SavanMessageContext 
(inMessage);
                
-//             Integer protocolVersion = (Integer) 
inMessage.getProperty(SavanConstants.PROTOCOL_VERSION);
-//             UtilFactory utilFactory = 
AbstractSavanUtilFactory.getUtilFactory(protocolVersion.intValue());
-               
-               Protocol protocol = savanInMessage.getProtocol();
+               //setting the Protocol
+               Protocol protocol = 
ProtocolManager.getMessageProtocol(savanInMessage);
                if (protocol==null) {
-                       throw new SavanException ("Protocol not found");
+                       //this message does not have a matching protocol
+                       //so let it go
+                       throw new SavanException ("Cannot find a matching 
protocol");
                }
                
+               savanInMessage.setProtocol(protocol);
+               
                UtilFactory utilFactory = protocol.getUtilFactory();
                MessageReceiverDeligater deligator = 
utilFactory.createMessageReceiverDeligater();
-
-               int messageType = savanInMessage.getMessageType();
-               if 
(messageType==SavanConstants.MessageTypes.SUBSCRIPTION_MESSAGE) {
-                       
deligator.handleSubscriptionRequest(savanInMessage,outMessage);
-               } else if 
(messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
-                       deligator.handleRenewRequest 
(savanInMessage,outMessage);
-               } else if 
(messageType==SavanConstants.MessageTypes.UNSUBSCRIPTION_MESSAGE) {
-                       deligator.handleEndSubscriptionRequest 
(savanInMessage,outMessage);
-               } else if 
(messageType==SavanConstants.MessageTypes.GET_STATUS_MESSAGE) {
-                       deligator.handleGetStatusRequest 
(savanInMessage,outMessage);
-               }
+               
+               deligator.processMessage(savanInMessage);
+               deligator.doProtocolSpecificProcessing (savanInMessage, 
outMessage);
                
        }
 
diff --git a/src/main/java/org/apache/savan/module/SavanModule.java 
b/src/main/java/org/apache/savan/module/SavanModule.java
index 16a7ab4..3193ad4 100644
--- a/src/main/java/org/apache/savan/module/SavanModule.java
+++ b/src/main/java/org/apache/savan/module/SavanModule.java
@@ -56,7 +56,7 @@ public class SavanModule implements Module  {
                ConfigurationManager configurationManager = new 
ConfigurationManager ();
                try {
                        ClassLoader moduleClassLoader = 
module.getModuleClassLoader();
-                       configurationManager.configure(moduleClassLoader);
+                       
configurationManager.configure(getClass().getClassLoader());
                } catch (SavanException e) {
                        log.error ("Exception thrown while trying to configure 
the Savan module",e);
                }
diff --git 
a/src/main/java/org/apache/savan/publication/client/PublicationClient.java 
b/src/main/java/org/apache/savan/publication/client/PublicationClient.java
index db77841..f712b8e 100644
--- a/src/main/java/org/apache/savan/publication/client/PublicationClient.java
+++ b/src/main/java/org/apache/savan/publication/client/PublicationClient.java
@@ -17,6 +17,10 @@
 
 package org.apache.savan.publication.client;
 
+import java.net.URI;
+import java.net.URL;
+import java.util.Iterator;
+
 import javax.xml.namespace.QName;
 
 import org.apache.axiom.om.OMAbstractFactory;
@@ -30,11 +34,15 @@ import org.apache.axis2.client.Options;
 import org.apache.axis2.client.ServiceClient;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
 import org.apache.axis2.description.AxisService;
 import org.apache.axis2.description.Parameter;
 import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
+import org.apache.savan.publication.PublicationReport;
 import org.apache.savan.storage.SubscriberStore;
+import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.SubscriberGroup;
 import org.apache.savan.util.CommonUtil;
 
 /**
@@ -50,58 +58,67 @@ public class PublicationClient {
        public PublicationClient (ConfigurationContext configurationContext) {
                this.configurationContext = configurationContext;
        }
-       
+
        /**
         * This can be used by the Publishers in the same JVM (e.g. a service 
deployed in the same Axis2 instance).
         * 
-        * @param publication - the XML message to be published
+        * @param eventData - The XML message to be published
         * @param service - The service to which this publication is bound to 
(i.e. this will be only sent to the subscribers of this service)
+        * @param eventName - The name of the event, this can be a action which 
represents an out only operation or a Topic ID.
+        * 
         * @throws SavanException
         */
-       public void sendPublication (OMElement publication, AxisService 
service) throws SavanException {
+       public void sendPublication (OMElement eventData, AxisService service, 
URI eventName) throws SavanException {
                
                try {
-                       ServiceClient sc = new ServiceClient 
(configurationContext,null);
-                       Options options = new Options ();
-                       sc.setOptions(options);
-                       
-                       //Just a matter of getting it to the SavanOutHandler
-                       options.setTo(new EndpointReference 
("http://temp.publication.URI";));
-                       
-                       if (options.getAction()==null)
-                               options.setAction(TEMP_PUBLICATION_ACTION);
                        
-                       sc.setOptions(options);
-                       
-                       //this will not be required when the 
-                       Parameter parameter = new Parameter ();
-                       parameter.setName(SavanConstants.SUBSCRIBER_STORE);
-                       SubscriberStore store = 
CommonUtil.getSubscriberStore(service);
-                       parameter.setValue(store);
-                       sc.getAxisService().addParameter(parameter);
+                       SubscriberStore subscriberStore = 
CommonUtil.getSubscriberStore(service);
+                       if (subscriberStore==null)
+                               throw new SavanException ("Cannot find the 
Subscriber Store");
+                               
+                       PublicationReport report = new PublicationReport();
+                       if (eventName!=null) {
+                               //there should be a valid operation or a 
SubscriberGroup to match this event.
+                               AxisOperation operation = 
getAxisOperationFromEventName (eventName);
+                               if (operation!=null) {
+                                       //send to all subscribers with this 
operation.
+                                       throw new UnsupportedOperationException 
("Not implemented");
+                               } else {
+                                       //there should be a valid 
SubscriberGroup to match this eventName
+                                       
+                                       String groupId = eventName.toString();
+                                       SubscriberGroup group = 
(SubscriberGroup) subscriberStore.getSubscriberGroup(groupId);
+                                       if (group!=null)
+                                               
group.sendEventDataToGroup(eventData);
+                                       else
+                                               throw new SavanException 
("Could not find a subscriberGroup or an operation to match the eventName");
+
+                               }
+                       } else {
+                               //no event name, so send it to everybody.
                        
-                       //if already engaged, axis2 will neglect this 
engagement.
-                       sc.engageModule( new QName("savan"));
+                               //sending to all individual subscribers
+                               for (Iterator iter = 
subscriberStore.retrieveAllSubscribers();iter.hasNext();){
+                                       Subscriber subscriber = (Subscriber) 
iter.next();
+                                       subscriber.sendEventData(eventData);
+                               }
+                               
+                               //sending to all Subscriber Groups
+                               for (Iterator iter = 
subscriberStore.retrieveAllSubscriberGroups();iter.hasNext();){
+                                       SubscriberGroup subscriberGroup = 
(SubscriberGroup) iter.next();
+                                       
subscriberGroup.sendEventDataToGroup(eventData);
+                               }                       
+                       }
                        
-                       MessageContext mc = new MessageContext ();
-                       mc.setEnvelope(getEnvelopeFromPublication 
(publication));
-                       OperationClient client = 
sc.createClient(ServiceClient.ANON_OUT_ONLY_OP);
-                       client.addMessageContext(mc);
-                       client.execute(true);
                } catch (AxisFault e) {
                        String message = "Could not send the publication";
                        throw new SavanException (message,e);
                }
        }
        
-       
-       private SOAPEnvelope getEnvelopeFromPublication (OMElement element) {
-               
-               //for now we are sending SOAP 1.1
-               SOAPEnvelope envelope = 
OMAbstractFactory.getSOAP11Factory().getDefaultEnvelope();
-               envelope.getBody().addChild(element);
-               
-               return envelope;
+       private AxisOperation getAxisOperationFromEventName (URI eventName) {
+               //TODO do operation lookup
+               return null;
        }
        
 }
diff --git a/src/main/java/org/apache/savan/storage/DefaultSubscriberStore.java 
b/src/main/java/org/apache/savan/storage/DefaultSubscriberStore.java
index 38cceef..64d610a 100644
--- a/src/main/java/org/apache/savan/storage/DefaultSubscriberStore.java
+++ b/src/main/java/org/apache/savan/storage/DefaultSubscriberStore.java
@@ -17,21 +17,24 @@
 
 package org.apache.savan.storage;
 
+import java.net.URI;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.savan.SavanException;
-import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.SubscriberGroup;
 
 public class DefaultSubscriberStore implements SubscriberStore {
 
        private HashMap subscriberMap = null;
+       private HashMap subscriberGroups = null;
        
        public DefaultSubscriberStore () {
                subscriberMap = new HashMap ();
+               subscriberGroups = new HashMap ();
        }
        
        public void init(ConfigurationContext configurationContext) throws 
SavanException {
@@ -39,18 +42,20 @@ public class DefaultSubscriberStore implements 
SubscriberStore {
        }
 
        public Subscriber retrieve(String id) {
-               return (AbstractSubscriber) subscriberMap.get(id);
+               return (Subscriber) subscriberMap.get(id);
        }
 
        public void store(Subscriber s) {
-               subscriberMap.put(s.getId(),s);
+               URI subscriberID = s.getId();
+               String key = subscriberID.toString();
+               subscriberMap.put(key,s);
        }
 
        public void delete(String subscriberID) {
                subscriberMap.remove(subscriberID);
        }
 
-       public Iterator retrieveAll() {
+       public Iterator retrieveAllSubscribers () {
                ArrayList allSubscribers = new ArrayList ();
                for (Iterator 
iter=subscriberMap.keySet().iterator();iter.hasNext();) {
                        Object key = iter.next();
@@ -59,5 +64,29 @@ public class DefaultSubscriberStore implements 
SubscriberStore {
                return allSubscribers.iterator();
        }
 
+       public Iterator retrieveAllSubscriberGroups () {
+               ArrayList allSubscriberGroups = new ArrayList ();
+               for (Iterator 
iter=subscriberGroups.keySet().iterator();iter.hasNext();) {
+                       Object key = iter.next();
+                       allSubscriberGroups.add(subscriberGroups.get(key));
+               }
+               return allSubscriberGroups.iterator();
+       }
        
+       public void addSubscriberGroup(String groupId) {
+               subscriberGroups.put(groupId, new SubscriberGroup ());
+       }
+
+       public void addSubscriberToGroup(String listId, Subscriber subscriber) 
throws SavanException {
+               SubscriberGroup subscriberGroup = (SubscriberGroup) 
subscriberGroups.get(listId);
+               if (subscriberGroup!=null)
+                       subscriberGroup.addSubscriber (subscriber);
+               else 
+                       throw new SavanException ("Cannot find the Subscriber 
store");
+       }
+
+       public SubscriberGroup getSubscriberGroup(String groupId) {
+               return (SubscriberGroup) subscriberGroups.get(groupId);
+       }
+
 }
diff --git a/src/main/java/org/apache/savan/storage/SubscriberStore.java 
b/src/main/java/org/apache/savan/storage/SubscriberStore.java
index 33995d1..697e6d3 100644
--- a/src/main/java/org/apache/savan/storage/SubscriberStore.java
+++ b/src/main/java/org/apache/savan/storage/SubscriberStore.java
@@ -17,10 +17,12 @@
 package org.apache.savan.storage;
 
 import java.util.Iterator;
+import java.util.List;
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.savan.SavanException;
 import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.SubscriberGroup;
 
 /**
  * Defines the Storage for storing subscribers. 
@@ -58,7 +60,9 @@ public interface SubscriberStore {
         * @return
         * @throws SavanException
         */
-       Iterator retrieveAll () throws SavanException;
+       Iterator retrieveAllSubscribers () throws SavanException;
+
+       Iterator retrieveAllSubscriberGroups () throws SavanException;
        
        /**
         * To delete a previously stored subscriber.
@@ -67,4 +71,11 @@ public interface SubscriberStore {
         * @throws SavanException
         */
        void delete (String subscriberID) throws SavanException;
+       
+       SubscriberGroup getSubscriberGroup (String groupId) throws 
SavanException;
+       
+       void addSubscriberGroup (String subscriberList) throws SavanException;
+       
+       void addSubscriberToGroup (String groupId, Subscriber subscriber) 
throws SavanException;
+       
 }
diff --git a/src/main/java/org/apache/savan/subscribers/AbstractSubscriber.java 
b/src/main/java/org/apache/savan/subscribers/AbstractSubscriber.java
deleted file mode 100644
index e21c77b..0000000
--- a/src/main/java/org/apache/savan/subscribers/AbstractSubscriber.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed 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.savan.subscribers;
-
-import java.util.Date;
-import java.util.HashMap;
-
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.filters.Filter;
-import org.apache.savan.publication.PublicationReport;
-import org.apache.savan.subscription.ExpirationBean;
-
-/**
- * Defines a subscriber which is the entity that define a specific 
subscription 
- * in savan. Independent of the protocol type.
- *
- */
-public abstract class AbstractSubscriber implements Subscriber {
-
-       String id;
-       Filter filter = null;
-       HashMap properties = null;
-       
-       public AbstractSubscriber () {
-               properties = new HashMap ();
-       }
-       
-       public void addProperty (String key, Object value) {
-               properties.put(key,value);
-       }
-       
-       public Object getProperty (String key) {
-               return properties.get(key);
-       }
-       
-       public Filter getFilter() {
-               return filter;
-       }
-
-       public void setFilter(Filter filter) {
-               this.filter = filter;
-       }
-
-       public String getId() {
-               return id;
-       }
-       
-       public void setId(String id) {
-               this.id = id;
-       }
-       
-       public boolean doesMessageBelongToTheFilter(SavanMessageContext smc) 
throws SavanException {
-               if (filter!=null) {
-                       SOAPEnvelope envelope = smc.getEnvelope();
-                       return filter.checkEnvelopeCompliance(envelope);
-               } else 
-                       return true;
-       }
-       
-       /**
-        * This method first checks weather the passed message complies with 
the current filter.
-        * If so message is sent, and the subscriberID is added to the 
PublicationReport.
-        * Else message is ignored.
-        * 
-        * @param smc
-        * @param report
-        * @throws SavanException
-        */
-       public void processPublication (SavanMessageContext 
publication,PublicationReport report) throws SavanException {
-               if (doesMessageBelongToTheFilter(publication)) {
-                       sendPublication(publication,report);
-                       if (getId()!=null)
-                               report.addNotifiedSubscriber(getId());
-               }
-       }
-       
-       public abstract void setSubscriptionEndingTime (Date 
subscriptionEndingTime);
-       public abstract void renewSubscription (ExpirationBean bean);
-       
-       /**
-        * This should be used by based classes to sendThe publication in its 
own manner
-        * 
-        * @param publication
-        * @param report
-        * @throws SavanException
-        */
-       protected abstract void sendPublication (SavanMessageContext 
publication,PublicationReport report) throws SavanException;
-}
diff --git 
a/src/main/java/org/apache/savan/subscribers/CompositeSubscriber.java 
b/src/main/java/org/apache/savan/subscribers/CompositeSubscriber.java
deleted file mode 100644
index adea44a..0000000
--- a/src/main/java/org/apache/savan/subscribers/CompositeSubscriber.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed 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.savan.subscribers;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.Iterator;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.publication.PublicationReport;
-import org.apache.savan.subscription.ExpirationBean;
-
-/**
- * Defines a set of subscribers that are acting as a group or a Topic.
- *
- */
-public class CompositeSubscriber extends AbstractSubscriber {
-
-       ArrayList subscribers = null;
-       
-       public CompositeSubscriber (){
-               subscribers = new ArrayList ();
-       }
-       
-       public void addSubscriber (AbstractSubscriber subscriber) {
-               subscribers.add(subscriber);
-       }
-       
-       public void sendPublication(SavanMessageContext publication, 
PublicationReport report)  throws SavanException {
-               for (Iterator it = subscribers.iterator();it.hasNext();) {
-                       AbstractSubscriber subscriber = (AbstractSubscriber) 
it.next();
-                       subscriber.processPublication(publication,report);
-               }
-       }
-
-       public void renewSubscription(ExpirationBean bean) {
-               for (Iterator it = subscribers.iterator();it.hasNext();) {
-                       AbstractSubscriber subscriber = (AbstractSubscriber) 
it.next();
-                       subscriber.renewSubscription(bean);
-               }
-       }
-
-       public void setSubscriptionEndingTime(Date subscriptionEndingTime) {
-               for (Iterator it = subscribers.iterator();it.hasNext();) {
-                       AbstractSubscriber subscriber = (AbstractSubscriber) 
it.next();
-                       
subscriber.setSubscriptionEndingTime(subscriptionEndingTime);
-               }
-       }
-
-}
diff --git a/src/main/java/org/apache/savan/subscribers/LeafSubscriber.java 
b/src/main/java/org/apache/savan/subscribers/LeafSubscriber.java
deleted file mode 100644
index a7e6fdb..0000000
--- a/src/main/java/org/apache/savan/subscribers/LeafSubscriber.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Copyright  1999-2004 The Apache Software Foundation.
- *
- *  Licensed 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.savan.subscribers;
-
-import java.util.Calendar;
-import java.util.Date;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.module.SavanModule;
-import org.apache.savan.publication.PublicationReport;
-import org.apache.savan.subscription.ExpirationBean;
-import org.apache.savan.util.CommonUtil;
-
-/**
- *Defines a single node subscriber. 
- *
- */
-public abstract class LeafSubscriber extends AbstractSubscriber {
-       
-       private static final Log log = LogFactory.getLog(LeafSubscriber.class);
-       
-       /**
-        * The time at which further notification of messages should be avaoded
-        * to this subscriber.
-        */
-       private Date subscriptionEndingTime = null;
-       
-       public void renewSubscription (ExpirationBean bean) {
-               if (bean.isDuration()) {
-                       if (subscriptionEndingTime==null) {
-                               Calendar calendar = Calendar.getInstance();
-                               
CommonUtil.addDurationToCalendar(calendar,bean.getDurationValue());
-                               subscriptionEndingTime = calendar.getTime();
-                       } else {
-                               Calendar expiration = Calendar.getInstance();
-                               expiration.setTime(subscriptionEndingTime);
-                               
CommonUtil.addDurationToCalendar(expiration,bean.getDurationValue());
-                               subscriptionEndingTime = expiration.getTime();
-                       }
-               } else
-                       subscriptionEndingTime = bean.getDateValue();
-       }
-       
-       public Date getSubscriptionEndingTime () {
-               return subscriptionEndingTime;
-       }
-       
-       public void setSubscriptionEndingTime () {
-               
-       }
-       
-       public void sendPublication(SavanMessageContext 
publication,PublicationReport report) throws SavanException {
-               Date date = new Date ();
-               
-               boolean expired = false;
-               if (subscriptionEndingTime!=null && 
date.after(subscriptionEndingTime))
-                       expired = true;
-               
-               if (expired) {
-                       String message = "Cant notify the listner since the 
subscription has been expired";
-                       log.debug(message);
-                       
-                       //TODO inform in some other manner than sending an 
exception.
-//                     throw new SavanException (message);
-               }
-               
-               doProtocolSpecificPublication (publication);
-       }
-       
-       public void setSubscriptionEndingTime(Date subscriptionEndingTime) {
-               this.subscriptionEndingTime = subscriptionEndingTime;
-       }
-
-       public abstract void doProtocolSpecificPublication (SavanMessageContext 
publication) throws SavanException;
-}
diff --git a/src/main/java/org/apache/savan/subscribers/Subscriber.java 
b/src/main/java/org/apache/savan/subscribers/Subscriber.java
index 17691d7..e768796 100644
--- a/src/main/java/org/apache/savan/subscribers/Subscriber.java
+++ b/src/main/java/org/apache/savan/subscribers/Subscriber.java
@@ -1,100 +1,38 @@
 /*
- * Copyright 2004,2005 The Apache Software Foundation.
+ * Copyright  1999-2004 The Apache Software Foundation.
  *
- * Licensed 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
+ *  Licensed 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.
+ *  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.savan.subscribers;
 
-import java.util.Date;
+import java.net.URI;
 
+import org.apache.axiom.om.OMElement;
 import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.filters.Filter;
-import org.apache.savan.publication.PublicationReport;
 import org.apache.savan.subscription.ExpirationBean;
 
 /**
- * Defines methods common to all subscribers.
+ * Defines a subscriber which is the entity that define a specific 
subscription 
+ * in savan. Independent of the protocol type.
+ *
  */
-public interface Subscriber {
-       
-       /**
-        * To get the Filter object
-        * @return
-        */
-       Filter getFilter ();
-       
-       /**
-        * To set the Filter object
-        * @param filter
-        */
-       void setFilter (Filter filter);
-       
-       /**
-        * To get the subscriber Id.
-        * @return
-        */
-       String getId ();
-       
-       /**
-        * To set the subscriber Id
-        * @param id
-        */
-       void setId (String id);
-       
-       /**
-        * To add a property to the subscriber.
-        * 
-        * @param key
-        * @param value
-        */
-       void addProperty (String key, Object value);
-       
-       /**
-        * To get a property from the Subscriber.
-        * 
-        * @param key
-        * @return
-        */
-       public Object getProperty (String key);
-       
-       /**
-        * To check weather a certain message complies with the filter.
-        * 
-        * @param smc
-        * @return
-        * @throws SavanException
-        */
-       boolean doesMessageBelongToTheFilter (SavanMessageContext smc) throws 
SavanException;
-       
-       
-       void processPublication (SavanMessageContext 
publication,PublicationReport report) throws SavanException;
-       
-       /**
-        * To set the Subscription expiration time.
-        * 
-        * @param subscriptionEndingTime
-        */
-       void setSubscriptionEndingTime (Date subscriptionEndingTime);
-       
-       /**
-        * To renew a subscription.
-        * 
-        * @param bean
-        */
-       void renewSubscription (ExpirationBean bean);
-
+public interface Subscriber  {
        
+       public URI getId();
+       public void setId(URI id);
+       public void sendEventData (OMElement eventData) throws SavanException;
+       public void renewSubscription (ExpirationBean bean);
        
 }
diff --git a/src/main/java/org/apache/savan/subscribers/SubscriberGroup.java 
b/src/main/java/org/apache/savan/subscribers/SubscriberGroup.java
new file mode 100644
index 0000000..1367c0a
--- /dev/null
+++ b/src/main/java/org/apache/savan/subscribers/SubscriberGroup.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright  1999-2004 The Apache Software Foundation.
+ *
+ *  Licensed 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.savan.subscribers;
+
+import java.net.URI;
+import java.util.ArrayList;
+import java.util.Iterator;
+
+import org.apache.axiom.om.OMElement;
+import org.apache.savan.SavanException;
+
+/**
+ * Defines a set of subscribers that are acting as a group or a Topic.
+ *
+ */
+public class SubscriberGroup  {
+
+       protected ArrayList subscribers = null;
+       
+       private URI id;
+       
+       public URI getId() {
+               return id;
+       }
+
+       public void setId(URI id) {
+               this.id = id;
+       }
+
+       public SubscriberGroup (){
+               subscribers = new ArrayList ();
+       }
+       
+       public void addSubscriber (Subscriber subscriber) throws SavanException 
{
+               subscribers.add(subscriber);
+       }
+
+       public void sendEventDataToGroup(OMElement eventData) throws 
SavanException {
+               for (Iterator it = subscribers.iterator();it.hasNext();) {
+                       Subscriber subscriber = (Subscriber) it.next();
+                       subscriber.sendEventData(eventData);
+               }
+       }
+       
+}
diff --git 
a/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java 
b/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
index abb398a..55e1460 100644
--- a/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
+++ b/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
@@ -17,12 +17,10 @@
 
 package org.apache.savan.subscription;
 
-import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.util.CommonUtil;
 
@@ -54,7 +52,7 @@ public abstract class SubscriptionProcessor {
                        throw new SavanException ("AbstractSubscriber store not 
found");
                        
                ExpirationBean bean = getExpirationBean(renewMessage);
-               AbstractSubscriber subscriber = (AbstractSubscriber) 
store.retrieve(bean.getSubscriberID());
+               Subscriber subscriber = (Subscriber) 
store.retrieve(bean.getSubscriberID());
                if (subscriber==null) {
                        throw new SavanException ("Given subscriber is not 
present");
                }
@@ -82,7 +80,7 @@ public abstract class SubscriptionProcessor {
                }
                
                Subscriber subscriber = store.retrieve(subscriberID);
-               
doProtocolSpecificEndSubscription(subscriber,reason,serviceContext.getConfigurationContext());
+//             
doProtocolSpecificEndSubscription(subscriber,reason,serviceContext.getConfigurationContext());
                
                store.delete(subscriberID);
        }
@@ -97,6 +95,5 @@ public abstract class SubscriptionProcessor {
        
        public abstract String getSubscriberID (SavanMessageContext smc) throws 
SavanException;
        
-       public abstract void doProtocolSpecificEndSubscription (Subscriber 
subscriber,String reason,ConfigurationContext configurationContext) throws 
SavanException;
 
 }
diff --git a/src/main/java/org/apache/savan/util/ProtocolManager.java 
b/src/main/java/org/apache/savan/util/ProtocolManager.java
index fa280b5..fe100ea 100644
--- a/src/main/java/org/apache/savan/util/ProtocolManager.java
+++ b/src/main/java/org/apache/savan/util/ProtocolManager.java
@@ -17,10 +17,14 @@
 
 package org.apache.savan.util;
 
+import java.util.HashMap;
+import java.util.Iterator;
+
 import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.configuration.ConfigurationManager;
+import org.apache.savan.configuration.MappingRules;
 import org.apache.savan.configuration.Protocol;
 
 /**
@@ -35,8 +39,20 @@ public class ProtocolManager {
                if (configurationManager==null)
                        throw new SavanException ("Cant find the Configuration 
Manager");
                
-               return (Protocol) 
configurationManager.getProtocolMap().get("eventing");
+               String action = 
smc.getMessageContext().getOptions().getAction();
+               if (action!=null) {
+                       HashMap map = configurationManager.getProtocolMap();
+                       Iterator iter = map.values().iterator();
+                       while (iter.hasNext()) {
+                               Protocol protocol = (Protocol) iter.next();
+                               MappingRules mappingRules = 
protocol.getMappingRules();
+                               if (mappingRules.ruleMatched 
(MappingRules.MAPPING_TYPE_ACTION, action)) {
+                                       return protocol;
+                               }
+                       }
+               }
                
+               return null;
        }
        
 }
diff --git a/src/main/java/org/apache/savan/util/UtilFactory.java 
b/src/main/java/org/apache/savan/util/UtilFactory.java
index 4b73868..2263c19 100644
--- a/src/main/java/org/apache/savan/util/UtilFactory.java
+++ b/src/main/java/org/apache/savan/util/UtilFactory.java
@@ -20,7 +20,7 @@ package org.apache.savan.util;
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.filters.Filter;
 import org.apache.savan.messagereceiver.MessageReceiverDeligater;
-import org.apache.savan.subscribers.AbstractSubscriber;
+import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.subscription.SubscriptionProcessor;
 
 /**
@@ -33,6 +33,5 @@ public interface UtilFactory {
        public abstract SavanMessageContext initializeMessage 
(SavanMessageContext messageContext);
        public abstract SubscriptionProcessor createSubscriptionProcessor ();
        public abstract MessageReceiverDeligater createMessageReceiverDeligater 
();
-//     public abstract AbstractSubscriber createSubscriber ();
        
 }
diff --git a/src/main/resources/META-INF/module.xml 
b/src/main/resources/META-INF/module.xml
index cf5e175..c07acd5 100644
--- a/src/main/resources/META-INF/module.xml
+++ b/src/main/resources/META-INF/module.xml
@@ -1,17 +1,5 @@
 <module name="Savan" class="org.apache.savan.module.SavanModule">
 
-    <InFlow>
-        <handler name="SavanInHandler" 
class="org.apache.savan.handlers.SavanInHandler">
-            <order phase="OperationInPhase"/>
-        </handler>
-    </InFlow>
-    
-    <OutFlow>
-        <handler name="SavanOutHandler" 
class="org.apache.savan.handlers.SavanOutHandler">
-            <order phase="OperationOutPhase"/>
-        </handler>
-    </OutFlow>
-
     <operation name="SavanInOutOperation" 
mep="http://www.w3.org/2004/08/wsdl/in-out";>
         <messageReceiver 
class="org.apache.savan.messagereceiver.SavanInOutMessageReceiver"/>
         
diff --git a/src/test/java/org/apache/axis2/savan/CompositeSubscriberTest.java 
b/src/test/java/org/apache/axis2/savan/CompositeSubscriberTest.java
deleted file mode 100644
index 531bbe1..0000000
--- a/src/test/java/org/apache/axis2/savan/CompositeSubscriberTest.java
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
- * Copyright 2004,2005 The Apache Software Foundation.
- *
- * Licensed 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.axis2.savan;
-
-import junit.framework.TestCase;
-
-import org.apache.axis2.context.MessageContext;
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.publication.PublicationReport;
-import org.apache.savan.subscribers.CompositeSubscriber;
-import org.apache.savan.subscribers.LeafSubscriber;
-
-public class CompositeSubscriberTest extends TestCase {
-
-       public void testSubscribers () throws SavanException {
-               
-               MessageContext mc = new MessageContext ();
-               SavanMessageContext smc = new SavanMessageContext (mc);
-               
-               LeafSubscriberImpl leafSubscriber1 = new LeafSubscriberImpl ();
-               LeafSubscriberImpl leafSubscriber2 = new LeafSubscriberImpl ();
-               CompositeSubscriber compositeSubscriber = new 
CompositeSubscriber ();
-               
-               compositeSubscriber.addSubscriber(leafSubscriber1);
-               compositeSubscriber.addSubscriber(leafSubscriber2);
-               
-               PublicationReport report = new PublicationReport ();
-               compositeSubscriber.sendPublication(smc,report);
-               assertTrue(leafSubscriber1.isNotified());
-               assertTrue(leafSubscriber2.isNotified());
-       }
-       
-       class LeafSubscriberImpl extends LeafSubscriber {
-               
-               boolean notified = false;
-               
-               public void doProtocolSpecificPublication(SavanMessageContext 
notificationMessage) {
-                       notified = true;
-               }
-               
-               public boolean isNotified () {
-                       return notified;
-               }
-       }
-       
-}
diff --git a/src/test/java/org/apache/axis2/savan/ConpositeSubscriberTest.java 
b/src/test/java/org/apache/axis2/savan/ConpositeSubscriberTest.java
deleted file mode 100644
index adbccf6..0000000
--- a/src/test/java/org/apache/axis2/savan/ConpositeSubscriberTest.java
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
-* Copyright 2004,2005 The Apache Software Foundation.
-*
-* Licensed 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.axis2.savan;
-
-import org.apache.savan.SavanException;
-import org.apache.savan.SavanMessageContext;
-import org.apache.savan.subscribers.CompositeSubscriber;
-import org.apache.savan.subscribers.LeafSubscriber;
-
-import junit.framework.TestCase;
-
-public class ConpositeSubscriberTest extends TestCase {
-
-       public void testSubscribers () throws SavanException {
-               LeafSubscriberImpl leafSubscriber1 = new LeafSubscriberImpl ();
-               LeafSubscriberImpl leafSubscriber2 = new LeafSubscriberImpl ();
-               CompositeSubscriber compositeSubscriber = new 
CompositeSubscriber ();
-               
-               compositeSubscriber.addSubscriber(leafSubscriber1);
-               compositeSubscriber.addSubscriber(leafSubscriber2);
-               
-               compositeSubscriber.sendPublication(null,null);
-               assertTrue(leafSubscriber1.isNotified());
-               assertTrue(leafSubscriber2.isNotified());
-       }
-       
-       class LeafSubscriberImpl extends LeafSubscriber {
-               
-               boolean notified = false;
-               
-               public void doProtocolSpecificPublication(SavanMessageContext 
notificationMessage) {
-                       notified = true;
-               }
-               
-               public boolean isNotified () {
-                       return notified;
-               }
-       }
-       
-}
diff --git 
a/src/test/java/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java 
b/src/test/java/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java
index 1be93b8..3b5164d 100644
--- 
a/src/test/java/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java
+++ 
b/src/test/java/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java
@@ -31,7 +31,7 @@ import org.apache.savan.configuration.ConfigurationManager;
 import org.apache.savan.configuration.Protocol;
 import org.apache.savan.eventing.EventingConstants;
 import org.apache.savan.eventing.EventingSubscriptionProcessor;
-import org.apache.savan.eventing.subscribers.EventingLeafSubscriber;
+import org.apache.savan.eventing.subscribers.EventingSubscriber;
 import org.apache.savan.storage.DefaultSubscriberStore;
 import org.apache.savan.storage.SubscriberStore;
 import org.apache.savan.subscription.ExpirationBean;
@@ -65,7 +65,7 @@ public class EventingSubscripitonProcessorTest extends 
TestCase {
                smc.setSubscriberStore(store);
                
                EventingSubscriptionProcessor esp = new 
EventingSubscriptionProcessor ();
-               EventingLeafSubscriber eventingSubscriber = 
(EventingLeafSubscriber) esp.getSubscriberFromMessage(smc);
+               EventingSubscriber eventingSubscriber = (EventingSubscriber) 
esp.getSubscriberFromMessage(smc);
                assertNotNull(eventingSubscriber);
                
                assertNotNull(eventingSubscriber.getDelivery());
diff --git a/src/test/java/org/apache/axis2/savan/XPathBasedFilterTest.java 
b/src/test/java/org/apache/axis2/savan/XPathBasedFilterTest.java
index 3e6e45b..8a2b6c6 100644
--- a/src/test/java/org/apache/axis2/savan/XPathBasedFilterTest.java
+++ b/src/test/java/org/apache/axis2/savan/XPathBasedFilterTest.java
@@ -40,7 +40,7 @@ public class XPathBasedFilterTest extends TestCase {
                Filter filter = new XPathBasedFilter ();
                filter.setUp(filterNode);
                
-               assertTrue (filter.checkEnvelopeCompliance(envelope));
+               assertTrue (filter.checkCompliance(envelope));
        }
        
        private SOAPEnvelope createTestEnvelope () {
diff --git a/src/test/resources/savan-config-test.xml 
b/src/test/resources/savan-config-test.xml
index 1773586..437271c 100644
--- a/src/test/resources/savan-config-test.xml
+++ b/src/test/resources/savan-config-test.xml
@@ -45,16 +45,8 @@
     
     <subscribers>
        <subscriber>
-               <name>composite</name>
-               <class>org.apache.savan.subscribers.CompositeSubscriber</class>
-       </subscriber>
-       <subscriber>
                <name>eventing-leaf</name>
-               
<class>org.apache.savan.eventing.subscribers.EventingLeafSubscriber</class>
-       </subscriber>
-        <subscriber>
-               <name>eventing-topic</name>
-               
<class>org.apache.savan.eventing.subscribers.EventingTopicSubscriber</class>
+               
<class>org.apache.savan.eventing.subscribers.EventingSubscriber</class>
        </subscriber>
     </subscribers>
     

Reply via email to