axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chamik...@apache.org
Subject svn commit: r422448 - in /webservices/axis2/trunk/java/modules/savan: conf/ src/org/apache/savan/ src/org/apache/savan/configuration/ src/org/apache/savan/eventing/ src/org/apache/savan/eventing/subscribers/ src/org/apache/savan/filters/ src/org/apache...
Date Sun, 16 Jul 2006 15:39:30 GMT
Author: chamikara
Date: Sun Jul 16 08:39:29 2006
New Revision: 422448

URL: http://svn.apache.org/viewvc?rev=422448&view=rev
Log:
Changes to te Savan Configurations to have Filters and Subscribers.

Subscriber model was changed. 
Subscriber Interface -> Methods common to all subscribers
EventingSubscriber interface -> Methods common to all Subscribers that will belong to the Eventing protocol.

Method createsubscriber was removed from the UtilFactory interface.
Subscribers will be obtained from savan configurations.

Added:
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/FilterBean.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/SubscriberBean.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingSubscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/filters/EmptyFilter.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/AbstractSubscriber.java
Removed:
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriber.java
Modified:
    webservices/axis2/trunk/java/modules/savan/conf/module.xml
    webservices/axis2/trunk/java/modules/savan/conf/savan-config.xml
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/ConfigurationManager.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/Protocol.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/client/PublicationClient.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/storage/DefaultSubscriberStore.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java
    webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/UtilFactory.java
    webservices/axis2/trunk/java/modules/savan/test-resources/savan-config-test.xml
    webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConfigurationManagerTest.java
    webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java

Modified: webservices/axis2/trunk/java/modules/savan/conf/module.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/conf/module.xml?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/conf/module.xml (original)
+++ webservices/axis2/trunk/java/modules/savan/conf/module.xml Sun Jul 16 08:39:29 2006
@@ -2,13 +2,13 @@
 
     <inflow>
         <handler name="SavanInHandler" class="org.apache.savan.handlers.SavanInHandler">
-            <order phase="OperationInPhase"/>
+            <order phase="OpPhase"/>
         </handler>
     </inflow>
     
     <outflow>
         <handler name="SavanOutHandler" class="org.apache.savan.handlers.SavanOutHandler">
-            <order phase="OperationOutPhase"/>
+            <order phase="OpPhase"/>
         </handler>
     </outflow>
 

Modified: webservices/axis2/trunk/java/modules/savan/conf/savan-config.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/conf/savan-config.xml?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/conf/savan-config.xml (original)
+++ webservices/axis2/trunk/java/modules/savan/conf/savan-config.xml Sun Jul 16 08:39:29 2006
@@ -10,6 +10,16 @@
                 <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>
+        	<defaultFilter>empty</defaultFilter>
+        	<!--
+        	<parameters>
+        	    <parameter>
+        	        <name>eventing-topic-subscriber</name>
+        	        <value>eventing-topic</value>
+        	    </parameter>
+        	</parameters>
+        	-->
         </protocol>
     </protocols>
     
@@ -21,10 +31,31 @@
     </subscriberStores>
     
     <filters>
+        <filter>
+            <name>empty</name>
+    		<identifier>empty</identifier>
+    		<class>org.apache.savan.filters.EmptyFilter</class>
+    	</filter>
     	<filter>
+    	    <name>xpath</name>
     		<identifier>http://www.w3.org/TR/1999/REC-xpath-19991116</identifier>
     		<class>org.apache.savan.filters.XPathBasedFilter</class>
     	</filter>
     </filters>
+    
+    <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>
+    	</subscriber>
+    </subscribers>
     
 </savan-config>

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/SavanMessageContext.java Sun Jul 16 08:39:29 2006
@@ -90,7 +90,7 @@
 		try {
 			messageContext.getAxisService().addParameter(parameter);
 		} catch (AxisFault e) {
-			String message = "Could not add the Subscriber Store parameter";
+			String message = "Could not add the AbstractSubscriber Store parameter";
 			throw new SavanException (message,e);
 		}
 	}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/ConfigurationManager.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/ConfigurationManager.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/ConfigurationManager.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/ConfigurationManager.java Sun Jul 16 08:39:29 2006
@@ -23,6 +23,7 @@
 import java.io.InputStream;
 import java.util.HashMap;
 import java.util.Iterator;
+import java.util.Map;
 
 import javax.xml.namespace.QName;
 import javax.xml.stream.XMLInputFactory;
@@ -37,6 +38,8 @@
 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.util.UtilFactory;
 
 /**
@@ -48,27 +51,35 @@
 	private HashMap protocolMap = null;
 	private HashMap subscriberStoreNamesMap = null;
 	private HashMap filterMap = null;
+	private HashMap subscribersMap = null;
+	
+	private final String SAVAN_CONFIG = "savan-config";
+	private final String PROTOCOLS = "protocols";
+	private final String PROTOCOL = "protocol";
+	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 SUBSCRIBER_STORES = "subscriberStores";
+	private final String SUBSCRIBER_STORE = "subscriberStore";
+	private final String FILTERS = "filters";
+	private final String FILTER = "filter";
+	private final String KEY = "key";
+	private final String CLASS = "class";
+	private final String IDENTIFIER = "identifier";
+	private final String SUBSCRIBERS = "subscribers";
+	private final String SUBSCRIBER = "subscriber";
+	private final String URL_APPENDER = "urlAppender";
+	private final String DEFAULT_SUBSCRIBER = "defaultSubscriber";
+	private final String DEFAULT_FILTER = "defaultFilter";
 	
-	private final String SavanConfig = "savan-config";
-	private final String Protocols = "protocols";
-	private final String Protocol = "protocol";
-	private final String Name = "name";
-	private final String UtilFactory = "utilFactory";
-	private final String MappingRules = "mapping-rules";
-	private final String Action = "mapping-rules";
-	private final String SOAPAction = "mapping-rules";
-	private final String SubscriberStores = "subscriberStores";
-	private final String SubscriberStore = "subscriberStore";
-	private final String Filters = "filters";
-	private final String Filter = "filter";
-	private final String Key = "key";
-	private final String Clazz = "class";
-	private final String Identifier = "identifier";
 	
 	public ConfigurationManager () {
 		protocolMap = new HashMap ();
 		subscriberStoreNamesMap = new HashMap ();
 		filterMap = new HashMap ();
+		subscribersMap = new HashMap ();
 	}
 	
 	/**
@@ -77,9 +88,13 @@
 	 * @throws SavanException
 	 */
 	public void configure () throws SavanException {
-		InputStream in = Thread.currentThread().getContextClassLoader().
+		System.out.println("new");
+		InputStream in = getClass().getClassLoader().
 					getResourceAsStream(SavanConstants.CONFIG_FILE);
 
+		if (in==null)
+			throw new SavanException ("Cannot find the savan configuration file. Initialation cannot continue.");
+		
 		configure(in);
 	}
 	
@@ -107,7 +122,7 @@
 	public void configure (InputStream in) throws SavanException {
 
 		if (in==null) {
-			String message = "Cant create an InputStream from the property file";
+			String message = "Invalid InputStream.";
 			throw new SavanException (message);
 		}
 		
@@ -130,31 +145,38 @@
 	
 	
 	private void processSavanConfig (OMElement element) throws SavanException {
-		if (!SavanConfig.equals(element.getLocalName())) {
+		if (!SAVAN_CONFIG.equals(element.getLocalName())) {
 			throw new SavanException ("'savan-config'should be the document element of the savan configuration xml file");
 		}
 		
-		OMElement protocolsElement = element.getFirstChildWithName(new QName (Protocols));
+		OMElement protocolsElement = element.getFirstChildWithName(new QName (PROTOCOLS));
 		if (protocolsElement==null) {
 			throw new SavanException ("'protocols' element should be present, as a sub-element of the 'savan-config' element");
 		}
 		processProtocols(protocolsElement);
 		
-		OMElement subscriberStoresElement = element.getFirstChildWithName(new QName (SubscriberStores));
+		OMElement subscriberStoresElement = element.getFirstChildWithName(new QName (SUBSCRIBER_STORES));
 		if (subscriberStoresElement==null) {
 			throw new SavanException ("'subscriberStores' element should be present, as a sub-element of the 'savan-config' element");
 		}
 		processSubscriberStores(subscriberStoresElement);
 		
-		OMElement filtersElement = element.getFirstChildWithName(new QName (Filters));
+		OMElement filtersElement = element.getFirstChildWithName(new QName (FILTERS));
 		if (subscriberStoresElement==null) {
 			throw new SavanException ("'Filters' element should be present, as a sub-element of the 'savan-config' element");
 		}
 		processFilters (filtersElement);
+		
+		OMElement subscribersElement = element.getFirstChildWithName(new QName (SUBSCRIBERS));
+		if (subscriberStoresElement==null) {
+			throw new SavanException ("'Subscribers' element should be present as a sub-element of the 'savan-config' element");
+		}
+		processSubscribers (subscribersElement);
+		
 	}
 	
 	private void processProtocols (OMElement element) throws SavanException {
-		Iterator protocolElementsIterator = element.getChildrenWithName(new QName (Protocol));
+		Iterator protocolElementsIterator = element.getChildrenWithName(new QName (PROTOCOL));
 		while (protocolElementsIterator.hasNext()) {
 			OMElement protocolElement = (OMElement) protocolElementsIterator.next();
 			processProtocol(protocolElement);
@@ -164,13 +186,13 @@
 	private void processProtocol (OMElement element) throws SavanException {
 		Protocol protocol = new Protocol ();
 		
-		OMElement nameElement = element.getFirstChildWithName(new QName (Name));
+		OMElement nameElement = element.getFirstChildWithName(new QName (NAME));
 		if (nameElement==null)
 			throw new SavanException ("Protocol must have a 'Name' subelement");
 		String name = nameElement.getText();
 		protocol.setName(name);
 		
-		OMElement utilFactoryNameElement = element.getFirstChildWithName(new QName (UtilFactory));
+		OMElement utilFactoryNameElement = element.getFirstChildWithName(new QName (UTIL_FACTORY));
 		if (utilFactoryNameElement==null)
 			throw new SavanException ("Protocol must have a 'UtilFactory' subelement");
 		String utilFactoryName = utilFactoryNameElement.getText();
@@ -179,27 +201,38 @@
 			throw new SavanException ("UtilFactory element" + utilFactoryName + "is not a subtype of the UtilFactory class");
 		protocol.setUtilFactory((UtilFactory) obj);
 		
-		OMElement mappingRulesElement = element.getFirstChildWithName(new QName (MappingRules));
+		OMElement mappingRulesElement = element.getFirstChildWithName(new QName (MAPPING_RULES));
 		if (mappingRulesElement==null)
-			throw new SavanException ("Protocol must have a 'MappingRules' subelement");
+			throw new SavanException ("Protocol must have a 'mappingRules' sub-element");
 		processMappingRules (mappingRulesElement,protocol);
 		
-		protocolMap.put(protocol.getName(),protocol);
+		OMElement defaultSubscriberElement = element.getFirstChildWithName(new QName (DEFAULT_SUBSCRIBER));
+		if (defaultSubscriberElement==null)
+			throw new SavanException ("Protocols must have a 'defaultSubscriber' sub-element");
+		String defaultSubscriber = defaultSubscriberElement.getText();
+		protocol.setDefaultSubscriber(defaultSubscriber);
+		
+		OMElement defaultFilterElement = element.getFirstChildWithName(new QName (DEFAULT_FILTER));
+		if (defaultFilterElement==null)
+			throw new SavanException ("Protocols must have a 'defaultFilter' sub-element");
+		String defaultFilter = defaultFilterElement.getText();
+		protocol.setDefaultFilter(defaultFilter);
 		
+		protocolMap.put(protocol.getName(),protocol);
 	}
 	
 	private void processMappingRules (OMElement element, Protocol protocol) {
 		
 		MappingRules mappingRules = new MappingRules ();
 		
-		Iterator actionsIterator = element.getChildrenWithName(new QName (Action));
+		Iterator actionsIterator = element.getChildrenWithName(new QName (ACTION));
 		while (actionsIterator.hasNext()) {
 			OMElement actionElement = (OMElement) actionsIterator.next();
 			String action = actionElement.getText();
 			mappingRules.addAction(action);
 		}
 		
-		Iterator SOAPActionsIterator = element.getChildrenWithName(new QName (SOAPAction));
+		Iterator SOAPActionsIterator = element.getChildrenWithName(new QName (SOAP_ACTION));
 		while (SOAPActionsIterator.hasNext()) {
 			OMElement SOAPactionElement = (OMElement) SOAPActionsIterator.next();
 			String SOAPaction = SOAPactionElement.getText();
@@ -208,7 +241,7 @@
 	}
 	
 	private void processSubscriberStores (OMElement element) throws SavanException {
-		Iterator subscriberStoreElementsIterator = element.getChildrenWithName(new QName (SubscriberStore));
+		Iterator subscriberStoreElementsIterator = element.getChildrenWithName(new QName (SUBSCRIBER_STORE));
 		while (subscriberStoreElementsIterator.hasNext()) {
 			OMElement subscriberStoreElement = (OMElement) subscriberStoreElementsIterator.next();
 			processSubscriberStore(subscriberStoreElement);
@@ -216,16 +249,25 @@
 	}
 	
 	private void processSubscriberStore (OMElement element) throws SavanException {
-		OMElement keyElement = element.getFirstChildWithName(new QName (Key));
+		OMElement keyElement = element.getFirstChildWithName(new QName (KEY));
 		if (keyElement==null)
 			throw new SavanException ("SubscriberStore must have a 'key' subelement");
 		String key = keyElement.getText();
 		
-		OMElement classElement = element.getFirstChildWithName(new QName (Clazz));
+		OMElement classElement = element.getFirstChildWithName(new QName (CLASS));
 		if (classElement==null)
 			throw new SavanException ("SubscriberStore must have a 'Clazz' subelement'");
 		
 		String clazz = classElement.getText();
+		
+		//initialize the class to check weather it is value
+		Object obj = getObject(clazz);
+		
+		if (!(obj instanceof SubscriberStore)) {
+			String message = "Class " + clazz + " does not implement the  SubscriberStore interface.";
+			throw new SavanException (message);
+		}
+		
 		subscriberStoreNamesMap.put(key,clazz);
 	}
 
@@ -233,8 +275,8 @@
 		return protocolMap;
 	}
 	
-	public HashMap getSubscriberStoreNamesMap () {
-		return subscriberStoreNamesMap;
+	public Protocol getProtocol (String name) {
+		return (Protocol) protocolMap.get(name);
 	}
 	
 	public SubscriberStore getSubscriberStoreInstance (String key) throws SavanException {
@@ -242,8 +284,20 @@
 		return (SubscriberStore) getObject(name);
 	}
 	
-	public Filter getFilterInstance (String key) throws SavanException {
-		String filterClass = (String) filterMap.get(key);
+	public Filter getFilterInstanceFromName (String name) throws SavanException {
+		for (Iterator it=filterMap.keySet().iterator();it.hasNext();) {
+			String key = (String) it.next();
+			FilterBean filterBean = (FilterBean) filterMap.get(key);
+			if (name.equals(filterBean.getName()))
+				return (Filter) getObject(filterBean.getClazz());
+		}
+		
+		return null;
+	}
+	
+	public Filter getFilterInstanceFromId (String id) throws SavanException {
+		FilterBean filterBean = (FilterBean) filterMap.get(id);
+		String filterClass = filterBean.getClazz();
 		if (filterClass==null)
 			return null;
 		
@@ -265,7 +319,7 @@
 	}
 	
 	private void processFilters (OMElement element) throws SavanException {
-		Iterator filterElementsIterator = element.getChildrenWithName(new QName (Filter));
+		Iterator filterElementsIterator = element.getChildrenWithName(new QName (FILTER));
 		while (filterElementsIterator.hasNext()) {
 			OMElement filterElement = (OMElement) filterElementsIterator.next();
 			processFilter (filterElement);
@@ -273,18 +327,93 @@
 	}
 	
 	private void processFilter (OMElement element) throws SavanException {
-		OMElement identifierElement = element.getFirstChildWithName(new QName (Identifier));
-		OMElement classElement = element.getFirstChildWithName(new QName (Clazz));
+		OMElement nameElement = element.getFirstChildWithName(new QName (NAME));
+		OMElement identifierElement = element.getFirstChildWithName(new QName (IDENTIFIER));
+		OMElement classElement = element.getFirstChildWithName(new QName (CLASS));
 		
+		if (nameElement==null)
+			throw new SavanException ("Name element is not present within the Filter");
 		if (identifierElement==null)
 			throw new SavanException ("Identifier element is not present within the Filter");
 		if (classElement==null)
 			throw new SavanException ("Class element is not present within the Filter");
 		
+		String name = nameElement.getText();
 		String identifier = identifierElement.getText();
 		String clazz = classElement.getText();
 		
-		filterMap.put(identifier,clazz);
+		//initialize the class to check weather it is value
+		Object obj = getObject(clazz);
+		
+		if (!(obj instanceof Filter)) {
+			String message = "Class " + clazz + " does not implement the  Filter interface.";
+			throw new SavanException (message);
+		}
+		
+		FilterBean bean = new FilterBean ();
+		bean.setName(name);
+		bean.setIdentifier(identifier);
+		bean.setClazz(clazz);
+		
+		filterMap.put(identifier,bean);
+	}
+	
+	private void processSubscribers (OMElement element) throws SavanException {
+		Iterator subscriberElementsIterator = element.getChildrenWithName(new QName (SUBSCRIBER));
+		while (subscriberElementsIterator.hasNext()) {
+			OMElement subscriberElement = (OMElement) subscriberElementsIterator.next();
+			processSubscriber (subscriberElement);
+		}
+	}
+	
+	private void processSubscriber (OMElement element) throws SavanException {
+		OMElement nameElement = element.getFirstChildWithName(new QName (NAME));
+		OMElement urlAppenderElement = element.getFirstChildWithName(new QName (URL_APPENDER));
+		OMElement classElement = element.getFirstChildWithName(new QName (CLASS));
+		
+		if (nameElement==null)
+			throw new SavanException ("Name element is not present within the AbstractSubscriber");
+		if (classElement==null)
+			throw new SavanException ("Class element is not present within the Filter");
+		
+		String name = nameElement.getText();
+		String clazz = classElement.getText();
+		
+		//initialize the class to check weather it is valid
+		Object obj = getObject(clazz);
+		
+		if (!(obj instanceof Subscriber)) {
+			String message = "Class " + clazz + " does not implement the  Subscriber interface.";
+			throw new SavanException (message);
+		}
+		
+		SubscriberBean bean = new SubscriberBean ();
+		bean.setName(name);
+		bean.setClazz(clazz);
+		
+		subscribersMap.put(name,bean);
+	}
+	
+	public Map getSubscriberBeans () {
+		return subscribersMap;
+	}
+	
+	public Map getFilterBeans () {
+		return filterMap;
+	}
+	
+	public SubscriberBean getSubscriberBean (String subscriberName) {
+		return (SubscriberBean) subscribersMap.get(subscriberName);
+	}
+	
+	public AbstractSubscriber 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());
 	}
 	
 }

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/FilterBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/FilterBean.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/FilterBean.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/FilterBean.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,33 @@
+package org.apache.savan.configuration;
+
+public class FilterBean {
+
+	String name;
+	String identifier;
+	String clazz;
+	
+	public String getClazz() {
+		return clazz;
+	}
+	
+	public String getIdentifier() {
+		return identifier;
+	}
+	
+	public String getName() {
+		return name;
+	}
+	
+	public void setClazz(String clazz) {
+		this.clazz = clazz;
+	}
+	
+	public void setIdentifier(String identifier) {
+		this.identifier = identifier;
+	}
+	
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/Protocol.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/Protocol.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/Protocol.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/Protocol.java Sun Jul 16 08:39:29 2006
@@ -28,7 +28,25 @@
 	private String name;
 	private UtilFactory utilFactory;
 	private MappingRules mappingRules;
+	private String defaultSubscriber;
+	private String defaultFilter;
 	
+	public String getDefaultFilter() {
+		return defaultFilter;
+	}
+
+	public String getDefaultSubscriber() {
+		return defaultSubscriber;
+	}
+
+	public void setDefaultFilter(String defaultFilter) {
+		this.defaultFilter = defaultFilter;
+	}
+
+	public void setDefaultSubscriber(String defaultSubscriber) {
+		this.defaultSubscriber = defaultSubscriber;
+	}
+
 	public String getName() {
 		return name;
 	}

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/SubscriberBean.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/SubscriberBean.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/SubscriberBean.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/configuration/SubscriberBean.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,23 @@
+package org.apache.savan.configuration;
+
+public class SubscriberBean {
+	
+	String name;
+	String clazz;
+	
+	public String getClazz() {
+		return clazz;
+	}
+	public String getName() {
+		return name;
+	}
+
+	public void setClazz(String clazz) {
+		this.clazz = clazz;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	
+	
+}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingMessageReceiverDeligater.java Sun Jul 16 08:39:29 2006
@@ -31,8 +31,10 @@
 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.messagereceiver.MessageReceiverDeligater;
 import org.apache.savan.storage.SubscriberStore;
+import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.util.CommonUtil;
 
@@ -91,7 +93,7 @@
 		
 		//setting the message type
 		outMessage.setProperty(SavanConstants.MESSAGE_TYPE,new Integer (SavanConstants.MessageTypes.SUBSCRIPTION_RESPONSE_MESSAGE));
-		
+	
 	}
 	
 	public void handleRenewRequest(SavanMessageContext renewMessage, MessageContext outMessage) throws SavanException {
@@ -132,9 +134,9 @@
 
 		SubscriberStore store = CommonUtil.getSubscriberStore(renewMessage.getMessageContext().getAxisService());
 		Subscriber subscriber = store.retrieve(subscriberID);
-		EventingSubscriber eventingSubscriber = (EventingSubscriber) subscriber;
+		EventingLeafSubscriber eventingSubscriber = (EventingLeafSubscriber) subscriber;
 		if (eventingSubscriber==null) {
-			String message = "Cannot find the Subscriber with the given ID";
+			String message = "Cannot find the AbstractSubscriber with the given ID";
 			throw new SavanException (message);
 		}
 		
@@ -194,7 +196,7 @@
 		
 		String id = (String) getStatusMessage.getProperty(EventingConstants.TransferedProperties.SUBSCRIBER_UUID);
 		if (id==null)
-			throw new SavanException ("Cannot fulfil request. Subscriber ID not found");
+			throw new SavanException ("Cannot fulfil request. AbstractSubscriber ID not found");
 		
 		//setting the action
 		outMessage.getOptions().setAction(EventingConstants.Actions.UnsubscribeResponse);
@@ -219,12 +221,12 @@
 		
 		
 		if (store==null) {
-			throw new SavanException ("Subscriber Store was not found");
+			throw new SavanException ("AbstractSubscriber Store was not found");
 		}
 		
-		EventingSubscriber subscriber = (EventingSubscriber) store.retrieve(id);
+		EventingLeafSubscriber subscriber = (EventingLeafSubscriber) store.retrieve(id);
 		if (subscriber==null) {
-			throw new SavanException ("Subscriber not found");
+			throw new SavanException ("AbstractSubscriber not found");
 		}
 		
 		OMNamespace ens = factory.createOMNamespace(EventingConstants.EVENTING_NAMESPACE,EventingConstants.EVENTING_PREFIX);

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingSubscriptionProcessor.java Sun Jul 16 08:39:29 2006
@@ -19,7 +19,9 @@
 
 import java.util.Calendar;
 import java.util.Date;
+
 import javax.xml.namespace.QName;
+
 import org.apache.axiom.om.OMAbstractFactory;
 import org.apache.axiom.om.OMAttribute;
 import org.apache.axiom.om.OMElement;
@@ -40,12 +42,15 @@
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.configuration.ConfigurationManager;
 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.subscription.ExpirationBean;
 import org.apache.savan.subscription.SubscriptionProcessor;
-import org.apache.savan.util.UtilFactory;
 import org.apache.savan.util.CommonUtil;
+import org.apache.savan.util.UtilFactory;
 
 public class EventingSubscriptionProcessor extends SubscriptionProcessor {
 
@@ -74,9 +79,15 @@
 		if (envelope==null)
 			return null;
 		
-		Subscriber subscriber = utilFactory.createSubscriber();  //eventing only works on leaf subscriber for now.
+//		AbstractSubscriber subscriber = utilFactory.createSubscriber();  //eventing only works on leaf subscriber for now.
+		
+		String subscriberName = protocol.getDefaultSubscriber();
+		SubscriberBean subscriberBean = configurationManager.getSubscriberBean(subscriberName);
+		
+		AbstractSubscriber subscriber = configurationManager.getSubscriberInstance(subscriberName);
+		
 		if (!(subscriber instanceof EventingSubscriber)) {
-			String message = "Eventing protocol only support EventingSubscribers (or subtypes) as Subscribers";
+			String message = "Eventing protocol only support implementations of eventing subscriber as Subscribers";
 			throw new SavanException (message);
 		}
 		
@@ -167,7 +178,7 @@
 			if (dialectAttr!=null) {
 				filterKey = dialectAttr.getAttributeValue();
 			}
-			filter = configurationManager.getFilterInstance(filterKey);
+			filter = configurationManager.getFilterInstanceFromId(filterKey);
 			if (filter==null)
 				throw new SavanException ("The Filter defined by the dialect is not available");
 			

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/EventingUtilFactory.java Sun Jul 16 08:39:29 2006
@@ -20,8 +20,9 @@
 import org.apache.axis2.context.MessageContext;
 import org.apache.savan.SavanConstants;
 import org.apache.savan.SavanMessageContext;
+import org.apache.savan.eventing.subscribers.EventingLeafSubscriber;
 import org.apache.savan.messagereceiver.MessageReceiverDeligater;
-import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscription.SubscriptionProcessor;
 import org.apache.savan.util.UtilFactory;
 
@@ -63,8 +64,8 @@
 		return new EventingMessageReceiverDeligater ();
 	}
 
-	public Subscriber createSubscriber() {
-		return new EventingSubscriber ();
+	public AbstractSubscriber createSubscriber() {
+		return new EventingLeafSubscriber ();
 	}
 	
 }

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingLeafSubscriber.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,85 @@
+/*
+ * 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);
+		}
+		
+		
+	}
+
+}

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingSubscriber.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingSubscriber.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingSubscriber.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,36 @@
+package org.apache.savan.eventing.subscribers;
+
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.savan.eventing.Delivery;
+import org.apache.savan.subscribers.Subscriber;
+
+/**
+ * Defines methods common to all eventing subscribers.
+ */
+public interface EventingSubscriber extends Subscriber {
+	
+	/**
+	 * To get the EndTo EPR
+	 * @return
+	 */
+	EndpointReference getEndToEPr();
+	
+	/**
+	 * To get the Delivery object
+	 * @return
+	 */
+	Delivery getDelivery();
+	
+	/**
+	 * To se the Delivery object
+	 * @param delivery
+	 */
+	void setDelivery(Delivery delivery);
+	
+	/**
+	 * To set the EndTo EPR
+	 * @param errorReportingEPR
+	 */
+	void setEndToEPr(EndpointReference errorReportingEPR);
+	
+}

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/eventing/subscribers/EventingTopicSubscriber.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,30 @@
+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;
+	}
+	
+	
+}

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/filters/EmptyFilter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/filters/EmptyFilter.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/filters/EmptyFilter.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/filters/EmptyFilter.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,24 @@
+package org.apache.savan.filters;
+
+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 boolean checkEnvelopeCompliance(SOAPEnvelope envelope) throws SavanException {
+		return true;
+	}
+
+	public Object getFilterValue() {
+		return null;
+	}
+
+	public void setUp(OMNode element) {
+	}
+	
+}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanInHandler.java Sun Jul 16 08:39:29 2006
@@ -41,6 +41,8 @@
 
 	public void invoke(MessageContext msgContext) throws AxisFault {
 		
+		System.out.println("SAVAN IN HANDLER CALLED...");
+		
 		SavanMessageContext smc = new SavanMessageContext (msgContext);
 		
 		//setting the Protocol
@@ -51,7 +53,7 @@
 		if (axisService==null)
 			throw new SavanException ("Service context is null");
 		
-		//setting the Subscriber Store
+		//setting the AbstractSubscriber Store
 		Parameter parameter = axisService.getParameter(SavanConstants.SUBSCRIBER_STORE);
 		if (parameter==null){
 			setSubscriberStore (smc);

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/handlers/SavanOutHandler.java Sun Jul 16 08:39:29 2006
@@ -28,7 +28,7 @@
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.publication.PublicationReport;
 import org.apache.savan.storage.SubscriberStore;
-import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.util.CommonUtil;
 
 /**
@@ -43,6 +43,8 @@
 	
 	public void invoke(MessageContext msgContext) throws AxisFault {
 
+		System.out.println("SAVAN OUT HANDLER CALLED...");
+		
 		SavanMessageContext smc = new SavanMessageContext (msgContext);
 		int messagetype = smc.getMessageType();
 	
@@ -51,14 +53,21 @@
 			SavanMessageContext publication = new SavanMessageContext(msgContext);
 			SubscriberStore store = (SubscriberStore) CommonUtil.getSubscriberStore(msgContext.getAxisService());
 			if (store != null) {
+				
+				System.out.println("sending publication:");
+				System.out.println(msgContext.getEnvelope());
 				PublicationReport report = new PublicationReport();
 				Iterator iterator = store.retrieveAll();
 				while (iterator.hasNext()) {
-					Subscriber subscriber = (Subscriber) iterator.next();
+					AbstractSubscriber subscriber = (AbstractSubscriber) iterator.next();
 					try {
+						
+						System.out.println("INVOKING SUBSCRIBER...");
+						
 						subscriber.processPublication (publication, report);
 					} catch (SavanException e) {
 						report.addErrorReportEntry(subscriber.getId(),e);
+						e.printStackTrace();
 					}
 					
 					//TODO do something with the report.

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/client/PublicationClient.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/client/PublicationClient.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/client/PublicationClient.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/publication/client/PublicationClient.java Sun Jul 16 08:39:29 2006
@@ -39,14 +39,30 @@
  */
 public class PublicationClient {
 	
+	public static final String TEMP_PUBLICATION_ACTION = "UUID:TempPublicationAction";
+	
 	public static void sendPublication (SOAPEnvelope publication,ConfigurationContext configurationContext, SubscriberStore store) throws SavanException {
 		
 		try {
+			Options options = new Options ();
+			sendPublication(publication,configurationContext,options,store);
+			
+		} catch (AxisFault e) {
+			String message = "Could not send the publication";
+			throw new SavanException (message,e);
+		}
+	}
+	
+	public static void sendPublication (SOAPEnvelope publication,ConfigurationContext configurationContext, Options options, SubscriberStore store) throws SavanException {
+		
+		try {
 			ServiceClient sc = new ServiceClient (configurationContext,null);
 			
-			Options options = new Options ();
 			options.setTo(new EndpointReference ("http://temp.publication.URI"));
-			options.setAction("UUID:TempPublicationAction");
+			
+			if (options.getAction()==null)
+				options.setAction(TEMP_PUBLICATION_ACTION);
+			
 			sc.setOptions(options);
 			
 			//this will not be required when the 

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/storage/DefaultSubscriberStore.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/storage/DefaultSubscriberStore.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/storage/DefaultSubscriberStore.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/storage/DefaultSubscriberStore.java Sun Jul 16 08:39:29 2006
@@ -23,6 +23,7 @@
 
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.savan.SavanException;
+import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscribers.Subscriber;
 
 public class DefaultSubscriberStore implements SubscriberStore {
@@ -38,7 +39,7 @@
 	}
 
 	public Subscriber retrieve(String id) {
-		return (Subscriber) subscriberMap.get(id);
+		return (AbstractSubscriber) subscriberMap.get(id);
 	}
 
 	public void store(Subscriber s) {

Added: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/AbstractSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/AbstractSubscriber.java?rev=422448&view=auto
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/AbstractSubscriber.java (added)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/AbstractSubscriber.java Sun Jul 16 08:39:29 2006
@@ -0,0 +1,105 @@
+/*
+ * 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;
+}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/CompositeSubscriber.java Sun Jul 16 08:39:29 2006
@@ -29,7 +29,7 @@
  * Defines a set of subscribers that are acting as a group or a Topic.
  *
  */
-public class CompositeSubscriber extends Subscriber {
+public class CompositeSubscriber extends AbstractSubscriber {
 
 	ArrayList subscribers = null;
 	
@@ -37,27 +37,27 @@
 		subscribers = new ArrayList ();
 	}
 	
-	public void addSubscriber (Subscriber subscriber) {
+	public void addSubscriber (AbstractSubscriber subscriber) {
 		subscribers.add(subscriber);
 	}
 	
 	public void sendPublication(SavanMessageContext publication, PublicationReport report)  throws SavanException {
 		for (Iterator it = subscribers.iterator();it.hasNext();) {
-			Subscriber subscriber = (Subscriber) it.next();
+			AbstractSubscriber subscriber = (AbstractSubscriber) it.next();
 			subscriber.processPublication(publication,report);
 		}
 	}
 
 	public void renewSubscription(ExpirationBean bean) {
 		for (Iterator it = subscribers.iterator();it.hasNext();) {
-			Subscriber subscriber = (Subscriber) it.next();
+			AbstractSubscriber subscriber = (AbstractSubscriber) it.next();
 			subscriber.renewSubscription(bean);
 		}
 	}
 
 	public void setSubscriptionEndingTime(Date subscriptionEndingTime) {
 		for (Iterator it = subscribers.iterator();it.hasNext();) {
-			Subscriber subscriber = (Subscriber) it.next();
+			AbstractSubscriber subscriber = (AbstractSubscriber) it.next();
 			subscriber.setSubscriptionEndingTime(subscriptionEndingTime);
 		}
 	}

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/LeafSubscriber.java Sun Jul 16 08:39:29 2006
@@ -30,7 +30,7 @@
  *Defines a single node subscriber. 
  *
  */
-public abstract class LeafSubscriber extends Subscriber {
+public abstract class LeafSubscriber extends AbstractSubscriber {
 	
 	/**
 	 * The time at which further notification of messages should be avaoded
@@ -76,8 +76,6 @@
 		
 		doProtocolSpecificPublication (publication);
 	}
-	
-	
 	
 	public void setSubscriptionEndingTime(Date subscriptionEndingTime) {
 		this.subscriptionEndingTime = subscriptionEndingTime;

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscribers/Subscriber.java Sun Jul 16 08:39:29 2006
@@ -1,26 +1,7 @@
-/*
- * 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;
@@ -28,78 +9,76 @@
 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.
- *
+ * Defines methods common to all subscribers.
  */
-public abstract class Subscriber {
-
-	String id;
-	Filter filter = null;
-	HashMap properties = null;
-	
-	public Subscriber () {
-		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.
+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
-	 * @param report
+	 * @return
 	 * @throws SavanException
 	 */
-	public void processPublication (SavanMessageContext publication,PublicationReport report) throws SavanException {
-		if (doesMessageBelongToTheFilter(publication)) {
-			sendPublication(publication,report);
-			if (getId()!=null)
-				report.addNotifiedSubscriber(getId());
-		}
-	}
+	boolean doesMessageBelongToTheFilter (SavanMessageContext smc) throws SavanException;
 	
-	public abstract void setSubscriptionEndingTime (Date subscriptionEndingTime);
-	public abstract void renewSubscription (ExpirationBean bean);
+	
+	void processPublication (SavanMessageContext publication,PublicationReport report) throws SavanException;
 	
 	/**
-	 * This should be used by based classes to sendThe publication in its own manner
+	 * To set the Subscription expiration time.
 	 * 
-	 * @param publication
-	 * @param report
-	 * @throws SavanException
+	 * @param subscriptionEndingTime
 	 */
-	protected abstract void sendPublication (SavanMessageContext publication,PublicationReport report) throws SavanException;
+	void setSubscriptionEndingTime (Date subscriptionEndingTime);
+	
+	/**
+	 * To renew a subscription.
+	 * 
+	 * @param bean
+	 */
+	void renewSubscription (ExpirationBean bean);
+
+	
+	
 }

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/subscription/SubscriptionProcessor.java Sun Jul 16 08:39:29 2006
@@ -22,6 +22,7 @@
 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;
 
@@ -42,7 +43,7 @@
 		
 		SubscriberStore store = endSubscriptionMessage.getSubscriberStore();
 		if (store==null)
-			throw new SavanException ("Subscriber store not found");
+			throw new SavanException ("AbstractSubscriber store not found");
 		
 		store.delete (subscriberID);
 	}
@@ -50,10 +51,10 @@
 	public void renewSubscription(SavanMessageContext renewMessage)  throws SavanException {
 		SubscriberStore store = renewMessage.getSubscriberStore();
 		if (store==null)
-			throw new SavanException ("Subscriber store not found");
+			throw new SavanException ("AbstractSubscriber store not found");
 			
 		ExpirationBean bean = getExpirationBean(renewMessage);
-		Subscriber subscriber = (Subscriber) store.retrieve(bean.getSubscriberID());
+		AbstractSubscriber subscriber = (AbstractSubscriber) store.retrieve(bean.getSubscriberID());
 		if (subscriber==null) {
 			throw new SavanException ("Given subscriber is not present");
 		}
@@ -64,7 +65,7 @@
 	public void subscribe(SavanMessageContext subscriptionMessage) throws SavanException {
 		SubscriberStore store = subscriptionMessage.getSubscriberStore();
 		if (store==null)
-			throw new SavanException ("Subscriber store not found");
+			throw new SavanException ("AbstractSubscriber store not found");
 			
 		if (store==null)
 			throw new SavanException ("Sabscriber store not found");

Modified: webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/UtilFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/UtilFactory.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/UtilFactory.java (original)
+++ webservices/axis2/trunk/java/modules/savan/src/org/apache/savan/util/UtilFactory.java Sun Jul 16 08:39:29 2006
@@ -20,7 +20,7 @@
 import org.apache.savan.SavanMessageContext;
 import org.apache.savan.filters.Filter;
 import org.apache.savan.messagereceiver.MessageReceiverDeligater;
-import org.apache.savan.subscribers.Subscriber;
+import org.apache.savan.subscribers.AbstractSubscriber;
 import org.apache.savan.subscription.SubscriptionProcessor;
 
 /**
@@ -33,6 +33,6 @@
 	public abstract SavanMessageContext initializeMessage (SavanMessageContext messageContext);
 	public abstract SubscriptionProcessor createSubscriptionProcessor ();
 	public abstract MessageReceiverDeligater createMessageReceiverDeligater ();
-	public abstract Subscriber createSubscriber ();
+//	public abstract AbstractSubscriber createSubscriber ();
 	
 }

Modified: webservices/axis2/trunk/java/modules/savan/test-resources/savan-config-test.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/test-resources/savan-config-test.xml?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/test-resources/savan-config-test.xml (original)
+++ webservices/axis2/trunk/java/modules/savan/test-resources/savan-config-test.xml Sun Jul 16 08:39:29 2006
@@ -9,24 +9,53 @@
                 <action>http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew</action>
                 <action>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus</action>
                 <action>http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</action>
-                <!-- <SOAPAction></SOAPAction> -->
         	</mapping-rules>
+        	<defaultSubscriber>eventing-leaf</defaultSubscriber>
+        	<defaultFilter>empty</defaultFilter>
+        	<!--
+        	<parameters>
+        	    <parameter>
+        	        <name>eventing-topic-subscriber</name>
+        	        <value>eventing-topic</value>
+        	    </parameter>
+        	</parameters>
+        	-->
         </protocol>
     </protocols>
     
     <subscriberStores>
     	<subscriberStore>
     		<key>default</key>
-    		<class>org.apache.savan.subscribers.DefaultSubscriberStore</class>
+    		<class>org.apache.savan.storage.DefaultSubscriberStore</class>
     	</subscriberStore>
     </subscriberStores>
     
     <filters>
+        <filter>
+            <name>empty</name>
+    		<identifier>empty</identifier>
+    		<class>org.apache.savan.filters.EmptyFilter</class>
+    	</filter>
     	<filter>
+    	    <name>xpath</name>
     		<identifier>http://www.w3.org/TR/1999/REC-xpath-19991116</identifier>
     		<class>org.apache.savan.filters.XPathBasedFilter</class>
     	</filter>
     </filters>
     
+    <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>
+    	</subscriber>
+    </subscribers>
     
 </savan-config>

Modified: webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConfigurationManagerTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConfigurationManagerTest.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConfigurationManagerTest.java (original)
+++ webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/ConfigurationManagerTest.java Sun Jul 16 08:39:29 2006
@@ -10,6 +10,7 @@
 public class ConfigurationManagerTest extends TestCase {
 
 	public void testFromXMLFile () throws SavanException {
+		
         File baseDir = new File("");
         String testRource = baseDir.getAbsolutePath() + File.separator + "test-resources";
         String testConfigurationFile = testRource + File.separator + "savan-config-test.xml";

Modified: webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java?rev=422448&r1=422447&r2=422448&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java (original)
+++ webservices/axis2/trunk/java/modules/savan/test/org/apache/axis2/savan/EventingSubscripitonProcessorTest.java Sun Jul 16 08:39:29 2006
@@ -21,9 +21,9 @@
 import org.apache.savan.configuration.ConfigurationManager;
 import org.apache.savan.configuration.Protocol;
 import org.apache.savan.eventing.EventingConstants;
-import org.apache.savan.eventing.EventingSubscriber;
 import org.apache.savan.eventing.EventingSubscriptionProcessor;
 import org.apache.savan.eventing.EventingUtilFactory;
+import org.apache.savan.eventing.subscribers.EventingLeafSubscriber;
 import org.apache.savan.storage.DefaultSubscriberStore;
 import org.apache.savan.storage.SubscriberStore;
 import org.apache.savan.subscription.ExpirationBean;
@@ -32,21 +32,24 @@
 public class EventingSubscripitonProcessorTest extends TestCase {
 
 	private final String TEST_SAVAN_CONFIG = "savan-config-test.xml";
+	private final String EVENTING_PROTOCOL_NAME = "eventing";
 	
 	public void testSubscriberExtraction () throws Exception {
 		SavanMessageContext smc = getSubscriptionMessage();
 		
-		Protocol protocol = new Protocol ();
-		protocol.setName("eventing");
-		protocol.setUtilFactory(new EventingUtilFactory ());
+//		Protocol protocol = new Protocol ();
+//		protocol.setName("eventing");
+//		protocol.setUtilFactory(new EventingUtilFactory ());
+//		protocol.setDefaultSubscriber("org.apache.savan.eventing.subscribers.EventingLeafSubscriber");
 		
 		SubscriberStore store = new DefaultSubscriberStore ();
 		
-		smc.setProtocol(protocol);
+//		smc.setProtocol(protocol);
+		
 		smc.setSubscriberStore(store);
 		
 		EventingSubscriptionProcessor esp = new EventingSubscriptionProcessor ();
-		EventingSubscriber eventingSubscriber = (EventingSubscriber) esp.getSubscriberFromMessage(smc);
+		EventingLeafSubscriber eventingSubscriber = (EventingLeafSubscriber) esp.getSubscriberFromMessage(smc);
 		assertNotNull(eventingSubscriber);
 		
 		assertNotNull(eventingSubscriber.getDelivery());
@@ -112,6 +115,9 @@
 		configurationManager.configure(file);
 		
 		configurationContext.setProperty(SavanConstants.CONFIGURATION_MANAGER,configurationManager);
+		
+		Protocol protocol = configurationManager.getProtocol(EVENTING_PROTOCOL_NAME);
+		smc.setProtocol(protocol);
 		
 		return smc;
 	}



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message