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 243fd6a5108a267bd771bf8f46e57ec204fbd6c5
Author: Hemapani Srinath Perera <hemap...@apache.org>
AuthorDate: Mon May 28 04:41:10 2007 +0000

    make feeds accessible via GET
---
 modules/core/src/main/config/savan-config.xml      |   1 +
 .../main/java/org/apache/savan/SavanConstants.java |   3 +
 .../org/apache/savan/atom/AtomEventingClient.java  |  18 +-
 .../org/apache/savan/atom/AtomMessageReceiver.java | 120 ++++++++++++++
 .../savan/atom/AtomSubscriptionProcessor.java      | 181 ++++-----------------
 .../src/main/java/org/apache/savan/atom/Feed.java  |   6 +-
 .../apache/savan/eventing/EventingConstants.java   |   2 +
 .../apache/savan/eventing/EventingUtilFactory.java |   2 +
 .../org/apache/savan/filters/XPathBasedFilter.java |   2 +
 .../messagereceiver/MessageReceiverDeligater.java  |   2 +
 .../savan/subscription/SubscriptionProcessor.java  |  12 ++
 modules/mar/module.xml                             |   5 +
 12 files changed, 205 insertions(+), 149 deletions(-)

diff --git a/modules/core/src/main/config/savan-config.xml 
b/modules/core/src/main/config/savan-config.xml
index 484aae9..5ceb16d 100644
--- a/modules/core/src/main/config/savan-config.xml
+++ b/modules/core/src/main/config/savan-config.xml
@@ -9,6 +9,7 @@
                 
<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>
+                <action>http://wso2.com/ws/2007/05/eventing/Publish</action>
                </mapping-rules>
                <defaultSubscriber>eventing</defaultSubscriber>
                <defaultFilter>empty</defaultFilter>
diff --git a/modules/core/src/main/java/org/apache/savan/SavanConstants.java 
b/modules/core/src/main/java/org/apache/savan/SavanConstants.java
index 2ffc465..10e77ae 100644
--- a/modules/core/src/main/java/org/apache/savan/SavanConstants.java
+++ b/modules/core/src/main/java/org/apache/savan/SavanConstants.java
@@ -51,12 +51,15 @@ public interface SavanConstants {
                int RENEW_RESPONSE_MESSAGE = 6;
                int GET_STATUS_MESSAGE = 7;
                int GET_STATUS_RESPONSE_MESSAGE = 8;
+               int PUBLISH = 9;
        }
        
        interface Properties {
                String SUBSCRIBER_STORE = "SubscriberStore";
        }
        
+       
+       
 
        
 }
diff --git 
a/modules/core/src/main/java/org/apache/savan/atom/AtomEventingClient.java 
b/modules/core/src/main/java/org/apache/savan/atom/AtomEventingClient.java
index 46ff65f..701f663 100644
--- a/modules/core/src/main/java/org/apache/savan/atom/AtomEventingClient.java
+++ b/modules/core/src/main/java/org/apache/savan/atom/AtomEventingClient.java
@@ -1,5 +1,6 @@
 package org.apache.savan.atom;
 
+import java.util.Calendar;
 import java.util.Iterator;
 
 import javax.xml.namespace.QName;
@@ -10,11 +11,13 @@ import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.client.ServiceClient;
+import org.apache.savan.filters.XPathBasedFilter;
 import org.apache.savan.util.CommonUtil;
 import org.apache.xmlbeans.XmlException;
 
 import com.wso2.eventing.atom.CreateFeedDocument;
 import com.wso2.eventing.atom.CreateFeedResponseDocument;
+import com.wso2.eventing.atom.FilterType;
 import com.wso2.eventing.atom.CreateFeedDocument.CreateFeed;
 import com.wso2.eventing.atom.CreateFeedResponseDocument.CreateFeedResponse;
 
@@ -25,7 +28,11 @@ public class AtomEventingClient {
        public AtomEventingClient(ServiceClient serviceClient){
                this.serviceClient = serviceClient;
        }
+       
        public CreateFeedResponse createFeed(String title,String author) throws 
AxisFault{
+               return createFeed(title, author,null,null);
+       }
+       public CreateFeedResponse createFeed(String title,String 
author,Calendar expiredTime,String xpathFilter) throws AxisFault{
                try {
                        
serviceClient.getOptions().setAction(AtomConstants.Actions.Subscribe);
                        
@@ -34,7 +41,15 @@ public class AtomEventingClient {
                        
                        createFeed.setAuthor(author);
                        createFeed.setTitle(title);
-                       //createFeed.setId("foo");
+                       
+                       if(expiredTime != null){
+                               createFeed.setExpires(expiredTime);     
+                       }
+                       if(xpathFilter != null){
+                               FilterType filter = createFeed.addNewFilter();
+                               
filter.setDialect(XPathBasedFilter.XPATH_BASED_FILTER);
+                               filter.setStringValue(xpathFilter);
+                       }
                        
                        OMElement request = CommonUtil.toOM(createFeedDocument);
                        request.build();
@@ -68,6 +83,7 @@ public class AtomEventingClient {
                serviceClient.sendReceive(request);
        }
        
+       
        public void deleteFeed()throws AxisFault{
                if(feedEpr != null){
                        deleteFeed(feedEpr);
diff --git 
a/modules/core/src/main/java/org/apache/savan/atom/AtomMessageReceiver.java 
b/modules/core/src/main/java/org/apache/savan/atom/AtomMessageReceiver.java
new file mode 100644
index 0000000..1c9acdd
--- /dev/null
+++ b/modules/core/src/main/java/org/apache/savan/atom/AtomMessageReceiver.java
@@ -0,0 +1,120 @@
+package org.apache.savan.atom;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileNotFoundException;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMException;
+import org.apache.axiom.om.impl.builder.StAXBuilder;
+import org.apache.axiom.om.impl.builder.StAXOMBuilder;
+import org.apache.axiom.om.util.StAXUtils;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAP12Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axiom.soap.SOAPProcessingException;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.engine.AxisEngine;
+import org.apache.axis2.engine.AxisError;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.i18n.Messages;
+import org.apache.axis2.transport.http.HTTPConstants;
+import org.apache.axis2.util.MessageContextBuilder;
+import org.apache.savan.storage.SubscriberStore;
+import org.apache.savan.util.CommonUtil;
+
+public class AtomMessageReceiver implements MessageReceiver{
+       
+       public static final String ATOM_NAME = "atom";
+
+       public void receive(MessageContext messageCtx) throws AxisFault {
+               
+               try {
+                       //String resourcePath = messageCtx.getTo().getAddress();
+                       
//http://127.0.0.1:5555/axis2/services/PublisherService/atom?a=urn_uuid_96C2CB953DABC98DFC1179904343537.atom
+
+                       
+                       
+                       HttpServletRequest request = 
(HttpServletRequest)messageCtx.getProperty(HTTPConstants.MC_HTTP_SERVLETREQUEST);
+                       if(request == null || 
HTTPConstants.HEADER_GET.equals(request.getMethod()) || 
HTTPConstants.HEADER_POST.equals(request.getMethod())){
+                               SOAPEnvelope envlope = messageCtx.getEnvelope();
+                               OMElement bodyContent = 
envlope.getBody().getFirstElement();
+                               
+                               OMElement feedID = 
bodyContent.getFirstElement();
+                               String pathWRTRepository = 
"atom/"+feedID.getText();
+
+                               File atomFile = 
messageCtx.getConfigurationContext().getRealPath(pathWRTRepository);
+                               if(!atomFile.exists()){
+                                       throw new AxisFault("no feed exisits 
for "+feedID.getText());
+                               }
+                               FileInputStream atomIn =  new 
FileInputStream(atomFile);
+
+                   SOAPFactory fac = getSOAPFactory(messageCtx);
+                   SOAPEnvelope envelope = fac.getDefaultEnvelope();
+                   
+                   //add the content of the file to the response
+                   XMLStreamReader xmlreader = StAXUtils.createXMLStreamReader
+                           (atomIn, MessageContext.DEFAULT_CHAR_SET_ENCODING);
+                       StAXBuilder builder = new StAXOMBuilder(fac,xmlreader);
+                       OMElement result = (OMElement) 
builder.getDocumentElement();
+                   envelope.getBody().addChild(result);
+                               
+                   //send beck the response
+                                MessageContext outMsgContext = 
MessageContextBuilder.createOutMessageContext(messageCtx);
+                                
outMsgContext.getOperationContext().addMessageContext(outMsgContext);
+                                outMsgContext.setEnvelope(envelope);
+                                
+                                AxisEngine engine =
+                                       new AxisEngine(
+                                                       
outMsgContext.getConfigurationContext());
+                               engine.send(outMsgContext);
+
+                       }else 
if(HTTPConstants.HEADER_POST.equals(request.getMethod())){
+                               SOAPEnvelope envlope = messageCtx.getEnvelope();
+                               OMElement bodyContent = 
envlope.getBody().getFirstElement();
+                               
+                               OMElement feedID = 
bodyContent.getFirstElement();
+                               String pathWRTRepository = 
"atom/"+feedID.getText();
+
+                               //remove the file
+                               File atomFile = 
messageCtx.getConfigurationContext().getRealPath(pathWRTRepository);
+                               atomFile.delete();
+                               
+                               //remove the feed from subscriber store
+                               String feedIDAsUrn = 
feedID.getText().replaceAll("_", ":");
+                               SubscriberStore store = 
CommonUtil.getSubscriberStore(messageCtx.getAxisService());
+                               if (store == null)
+                                       throw new AxisFault ("Cant find the 
Savan subscriber store");
+                               store.delete(feedIDAsUrn);
+                       }
+                       
+               } catch (SOAPProcessingException e) {
+                       throw new AxisFault(e);
+               } catch (OMException e) {
+                       throw new AxisFault(e);
+               } catch (FileNotFoundException e) {
+                       throw new AxisFault(e);
+               } catch (XMLStreamException e) {
+                       throw new AxisFault(e);
+               }
+       }
+       
+        public SOAPFactory getSOAPFactory(MessageContext msgContext) throws 
AxisFault {
+               String nsURI = 
msgContext.getEnvelope().getNamespace().getNamespaceURI();
+               if (SOAP12Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                   return OMAbstractFactory.getSOAP12Factory();
+               } else if 
(SOAP11Constants.SOAP_ENVELOPE_NAMESPACE_URI.equals(nsURI)) {
+                   return OMAbstractFactory.getSOAP11Factory();
+               } else {
+                   throw new 
AxisFault(Messages.getMessage("invalidSOAPversion"));
+               }
+           }
+
+}
diff --git 
a/modules/core/src/main/java/org/apache/savan/atom/AtomSubscriptionProcessor.java
 
b/modules/core/src/main/java/org/apache/savan/atom/AtomSubscriptionProcessor.java
index 9576016..da20656 100644
--- 
a/modules/core/src/main/java/org/apache/savan/atom/AtomSubscriptionProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/savan/atom/AtomSubscriptionProcessor.java
@@ -56,6 +56,17 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                if (id!=null) {
                        
smc.setProperty(AtomConstants.TransferedProperties.SUBSCRIBER_UUID,id);
                }
+               
+               
+               
+//             AtomSubscriber atomSubscriber = new AtomSubscriber();
+//             
smc.setProperty(AtomConstants.TransferedProperties.SUBSCRIBER_UUID,id);
+//             atomSubscriber.setId(new URI(id));
+//             String atomFeedPath = id.replaceAll(":", "_")+ ".atom";
+//             atomSubscriber.setAtomFile(new File(realAtomPath,atomFeedPath));
+//             atomSubscriber.setAuthor("DefaultUser");
+//             atomSubscriber.setTitle("default Feed");
+               
        }
        
        /**
@@ -86,8 +97,6 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                        if (envelope==null)
                                return null;
                        
-//             AbstractSubscriber subscriber = utilFactory.createSubscriber(); 
 //eventing only works on leaf subscriber for now.
-                       
                        String subscriberName = protocol.getDefaultSubscriber();
                        Subscriber subscriber = 
configurationManager.getSubscriberInstance(subscriberName);
                        
@@ -98,7 +107,7 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
 
                        //find the real path for atom feeds
                        File repositoryPath = 
smc.getConfigurationContext().getRealPath("/"); 
-                       File realAtomPath = new 
File(repositoryPath.getAbsoluteFile(),"../atom");
+                       File realAtomPath = new 
File(repositoryPath.getAbsoluteFile(),"atom");
                        
                        //Get the service URL from request
                        String serviceAddress = 
smc.getMessageContext().getTo().getAddress();
@@ -113,18 +122,18 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                        atomSubscriber.setId(new URI(id));
                        String atomFeedPath = id.replaceAll(":", "_")+ ".atom";
                        atomSubscriber.setAtomFile(new 
File(realAtomPath,atomFeedPath));
-                       atomSubscriber.setFeedUrl(serviceAddress +"/atom/"+ 
atomFeedPath);
+                       
atomSubscriber.setFeedUrl(serviceAddress+"/services/"+smc.getMessageContext().getServiceContext().getAxisService().getName()
 +"/atom?feed="+ atomFeedPath);
                        
                        SOAPBody body = envelope.getBody();
                        CreateFeedDocument createFeedDocument = 
CreateFeedDocument.Factory.parse(body.getFirstElement().getXMLStreamReader());
                        CreateFeed createFeed = 
createFeedDocument.getCreateFeed();
-                       //TODO Srinath
-//                     if(createFeed.getEndTo() != null){
-//                             
atomSubscriber.setEndToEPr(createFeed.getEndTo());      
-//                     }
-//                     if(createFeed.getExpires() != null){
-//                             
atomSubscriber.setSubscriptionEndingTime(createFeed.getExpires().getTime());    
-//                     }
+
+                       if(createFeed.getEndTo() != null){
+                               
atomSubscriber.setEndToEPr(createFeed.getEndTo());      
+                       }
+                       if(createFeed.getExpires() != null){
+                               
atomSubscriber.setSubscriptionEndingTime(createFeed.getExpires().getTime());    
+                       }
                        
                        if (createFeed.getFilter() != null) {
                                Filter filter = null;
@@ -141,69 +150,12 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                                }
                                atomSubscriber.setFilter(filter);
                        }
-                       
-                       
-                       
-                       
-                       
                        //TODO -Srinath
                        atomSubscriber.setAuthor(createFeed.getAuthor());
                        atomSubscriber.setTitle(createFeed.getTitle());
                        
                        smc.setProperty(AtomConstants.Properties.feedUrl, 
atomSubscriber.getFeedUrl());
-                       
                        return atomSubscriber;
-                       
-                       
-//                     SOAPBody body = envelope.getBody();
-//                     
-//                     OMElement createFeed = findElement("createFeed", body, 
true) ;
-//                     OMElement endToElement = 
findElement(AtomConstants.ElementNames.EndTo, body, true);
-//                     
-//                     EndpointReference endToEPR = null;
-//                     if(endToElement != null){
-//                             endToEPR = 
EndpointReferenceHelper.fromOM(endToElement);
-//                     }
-//                     atomSubscriber.setEndToEPr(endToEPR);
-//                     
-//                     
-//                     String expiresText = 
findValue(AtomConstants.EXPIRES_ELEMENT, createFeed, true);
-//                     if (expiresText==null){
-//                             String message = "Expires Text is null";
-//                             throw new SavanException (message);
-//                     }
-//                     expiresText = expiresText.trim();
-//                     Date expiration = 
getExpirationBeanFromString(expiresText);
-//                     if (expiration==null) {
-//                             String message = "Cannot understand the given 
date-time value for the Expiration";
-//                             throw new SavanException (message);
-//                     }
-//                     atomSubscriber.setSubscriptionEndingTime(expiration);
-//                     
-//                     OMElement filterElement = 
findElement(AtomConstants.ElementNames.Filter, createFeed, true);
-//                     if (filterElement!= null) {
-//                             OMNode filterNode = 
filterElement.getFirstOMChild();
-//                             OMAttribute dialectAttr = 
filterElement.getAttribute(new QName (AtomConstants.ElementNames.Dialect));
-//                             Filter filter = null;
-//                             String filterKey = 
AtomConstants.DEFAULT_FILTER_IDENTIFIER;
-//                             if (dialectAttr!=null) {
-//                                     filterKey = 
dialectAttr.getAttributeValue();
-//                             }
-//                             filter = 
configurationManager.getFilterInstanceFromId(filterKey);
-//                             if (filter==null)
-//                                     throw new SavanException ("The Filter 
defined by the dialect is not available");
-//                             
-//                             filter.setUp (filterNode);
-//                             atomSubscriber.setFilter(filter);
-//                     }
-//                     
-//                     
atomSubscriber.setId(findValue(AtomConstants.ID_ELEMENT, createFeed,true));
-//                     
atomSubscriber.setAuthor(findValue(AtomConstants.AUTHOR_ELEMENT, 
createFeed,true));
-//                     
atomSubscriber.setTitle(findValue(AtomConstants.TITLE_ELEMENT, 
createFeed,true));
-//                     
-//                     smc.setProperty(AtomConstants.Properties.feedUrl, 
atomSubscriber.getFeedUrl());
-//                     
-//                     return atomSubscriber;
                } catch (AxisFault e) {
                        throw new SavanException(e);
                } catch (OMException e) {
@@ -215,9 +167,9 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                }
        }
        
-       private String findValue(String localName,OMElement parent,boolean 
throwfault) throws SavanException{
-               return findValue(AtomConstants.ATOM_NAMESPACE, localName, 
parent, throwfault);
-       }
+//     private String findValue(String localName,OMElement parent,boolean 
throwfault) throws SavanException{
+//             return findValue(AtomConstants.ATOM_NAMESPACE, localName, 
parent, throwfault);
+//     }
        
        private String findValue(String nsURI,String localName,OMElement 
parent,boolean throwfault) throws SavanException{
                QName name = new QName 
(nsURI,AtomConstants.IDEDNTIFIER_ELEMENT);
@@ -233,19 +185,19 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                }
        }
        
-       private OMElement findElement(String localName,OMElement parent,boolean 
throwfault) throws SavanException{
-               QName name = new QName 
(AtomConstants.ATOM_NAMESPACE,AtomConstants.ID_ELEMENT);
-               OMElement ele = parent.getFirstChildWithName(name);
-               if(ele != null){
-                       return ele;
-               }else{
-                       if(throwfault){
-                               throw new SavanException (localName + " element 
is not defined");       
-                       }else{
-                               return null;
-                       }
-               }
-       }
+//     private OMElement findElement(String localName,OMElement parent,boolean 
throwfault) throws SavanException{
+//             QName name = new QName 
(AtomConstants.ATOM_NAMESPACE,AtomConstants.ID_ELEMENT);
+//             OMElement ele = parent.getFirstChildWithName(name);
+//             if(ele != null){
+//                     return ele;
+//             }else{
+//                     if(throwfault){
+//                             throw new SavanException (localName + " element 
is not defined");       
+//                     }else{
+//                             return null;
+//                     }
+//             }
+//     }
 
        public void pauseSubscription(SavanMessageContext 
pauseSubscriptionMessage) throws SavanException {
                throw new UnsupportedOperationException ("Eventing 
specification does not support this type of messages");
@@ -299,65 +251,4 @@ public class AtomSubscriptionProcessor extends 
SubscriptionProcessor {
                return 
findValue(AtomConstants.ATOM_NAMESPACE,AtomConstants.IDEDNTIFIER_ELEMENT, 
envelope.getHeader(), false);
        }
        
-//     private Date getExpirationBeanFromString (String expiresStr) throws 
SavanException {
-//
-//             
-//             
-//             //expires can be a duration or a date time.
-//             //Doing the conversion using the ConverUtil helper class.
-//             
-//             boolean isDuration = CommonUtil.isDuration(expiresStr);
-//             if (isDuration) {
-//                     try {
-//                             Date currentTime = new Date();
-//                             Duration duration = 
ConverterUtil.convertToDuration(expiresStr);
-//                             return new Date(currentTime.getTime()+ 
(int)(1000* duration.getSeconds()));
-//                     } catch (IllegalArgumentException e) {
-//                             String message = "Cannot convert the Expiration 
value to a valid duration";
-//                             throw new SavanException (message,e);
-//                     }
-//             } else {
-//                     try {
-//                         Calendar calendar = 
ConverterUtil.convertToDateTime(expiresStr);
-//                         return calendar.getTime();
-//                     } catch (Exception e) {
-//                             String message = "Cannot convert the Expiration 
value to a valid DATE/TIME";
-//                             throw new SavanException (message,e);
-//                     }
-//             }
-//     }
-
-       public void doProtocolSpecificEndSubscription(Subscriber subscriber, 
String reason, ConfigurationContext configurationContext) throws SavanException 
{
-               throw new UnsupportedOperationException();
-//             String SOAPVersion = (String) 
subscriber.getProperty(AtomConstants.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;
-//     }
-//     
-//     private boolean isInvalidDiration (Duration duration) {
-//             return false;
-//     }
-//     
-//     private boolean isDateInThePast (Date date) {
-//             return false;
-//     }
-//     
-//     private boolean filterDilalectSupported (String filterDialect){ 
-//             return true;
-//     }
-       
 }
diff --git a/modules/core/src/main/java/org/apache/savan/atom/Feed.java 
b/modules/core/src/main/java/org/apache/savan/atom/Feed.java
index aa990ba..0bdebfb 100644
--- a/modules/core/src/main/java/org/apache/savan/atom/Feed.java
+++ b/modules/core/src/main/java/org/apache/savan/atom/Feed.java
@@ -68,7 +68,7 @@ public class Feed {
                
                factory.createOMElement("id",atomNs,feedEle).setText(id);
                if(title != null){
-                       
factory.createOMElement("title",atomNs,feedEle).setText(id);    
+                       
factory.createOMElement("title",atomNs,feedEle).setText(title); 
                }
                factory.createOMElement("updated",atomNs,feedEle).setText( new 
SimpleDateFormat("dd-mm-yy'T1'HH:MM:ssZ").format(lastUpdated));
                if(author != null){
@@ -81,12 +81,12 @@ public class Feed {
                lastUpdated = new Date();
                OMElement entryEle = 
factory.createOMElement("entry",atomNs,document.getOMDocumentElement());
                factory.createOMElement("id",atomNs,entryEle).setText(id +"/" + 
entryCount);
-               factory.createOMElement("title",atomNs,entryEle).setText(id 
+"/" + entryCount);
+               
factory.createOMElement("title",atomNs,entryEle).setText("entry" + entryCount);
                
                factory.createOMElement("updated",atomNs,entryEle).setText( new 
SimpleDateFormat("dd-mm-yy'T1'HH:MM:ssZ").format(lastUpdated));
                
                OMElement contentEle =  
factory.createOMElement("content",atomNs,entryEle);
-               contentEle.addAttribute("type","xml",null);
+               contentEle.addAttribute("type","text/xml",null);
                contentEle.addChild(entry);
                
                
diff --git 
a/modules/core/src/main/java/org/apache/savan/eventing/EventingConstants.java 
b/modules/core/src/main/java/org/apache/savan/eventing/EventingConstants.java
index 763e1c7..793de80 100644
--- 
a/modules/core/src/main/java/org/apache/savan/eventing/EventingConstants.java
+++ 
b/modules/core/src/main/java/org/apache/savan/eventing/EventingConstants.java
@@ -24,6 +24,7 @@ public interface EventingConstants {
        String DEFAULT_DELIVERY_MODE = 
"http://schemas.xmlsoap.org/ws/2004/08/eventing/DeliveryModes/Push";;
        String DEFAULT_FILTER_IDENTIFIER = FilterDialects.XPath;
        
+       
        interface TransferedProperties {
                String SUBSCRIBER_UUID = "SAVAN_EVENTING_SUBSCRIBER_UUID";
        }
@@ -56,6 +57,7 @@ public interface EventingConstants {
                String UnsubscribeResponse = 
"http://schemas.xmlsoap.org/ws/2004/08/eventing/UnsubscribeResponse";;
                String GetStatus = 
"http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus";;
                String GetStatusResponse = 
"http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatusResponse";;
+               String Publish = "http://wso2.com/ws/2007/05/eventing/Publish";;
        }
        
        interface Properties {
diff --git 
a/modules/core/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java 
b/modules/core/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
index 3d7486d..7420458 100644
--- 
a/modules/core/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
+++ 
b/modules/core/src/main/java/org/apache/savan/eventing/EventingUtilFactory.java
@@ -51,6 +51,8 @@ public class EventingUtilFactory implements UtilFactory {
                        
smc.setMessageType(SavanConstants.MessageTypes.UNSUBSCRIPTION_RESPONSE_MESSAGE);
                else if 
(EventingConstants.Actions.GetStatusResponse.equals(action))
                        
smc.setMessageType(SavanConstants.MessageTypes.GET_STATUS_RESPONSE_MESSAGE);
+               else if (EventingConstants.Actions.Publish.equals(action))
+                       smc.setMessageType(SavanConstants.MessageTypes.PUBLISH);
                else 
                        smc.setMessageType(SavanConstants.MessageTypes.UNKNOWN);
                
diff --git 
a/modules/core/src/main/java/org/apache/savan/filters/XPathBasedFilter.java 
b/modules/core/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
index cbcacbc..4ccb4d5 100644
--- a/modules/core/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
+++ b/modules/core/src/main/java/org/apache/savan/filters/XPathBasedFilter.java
@@ -49,6 +49,8 @@ import org.jaxen.JaxenException;
  * 
  */
 public class XPathBasedFilter implements Filter {
+       
+       public static String XPATH_BASED_FILTER = 
"http://www.w3.org/TR/1999/REC-xpath-19991116";;
 
        private String XPathString = null;
        
diff --git 
a/modules/core/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
 
b/modules/core/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
index 0a8e4a5..13191bd 100644
--- 
a/modules/core/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
+++ 
b/modules/core/src/main/java/org/apache/savan/messagereceiver/MessageReceiverDeligater.java
@@ -77,6 +77,8 @@ public abstract class MessageReceiverDeligater {
                        processor.unsubscribe(smc);
                } else if 
(messageType==SavanConstants.MessageTypes.RENEW_MESSAGE) {
                        processor.renewSubscription(smc);
+               }else if (messageType==SavanConstants.MessageTypes.PUBLISH) {
+                       processor.publish(smc);
                }
        }
        
diff --git 
a/modules/core/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
 
b/modules/core/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
index 55e1460..8088600 100644
--- 
a/modules/core/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
+++ 
b/modules/core/src/main/java/org/apache/savan/subscription/SubscriptionProcessor.java
@@ -17,9 +17,11 @@
 
 package org.apache.savan.subscription;
 
+import org.apache.axiom.soap.SOAPEnvelope;
 import org.apache.axis2.context.ServiceContext;
 import org.apache.savan.SavanException;
 import org.apache.savan.SavanMessageContext;
+import org.apache.savan.publication.client.PublicationClient;
 import org.apache.savan.storage.SubscriberStore;
 import org.apache.savan.subscribers.Subscriber;
 import org.apache.savan.util.CommonUtil;
@@ -85,6 +87,16 @@ public abstract class SubscriptionProcessor {
                store.delete(subscriberID);
        }
        
+       public void publish(SavanMessageContext publishMessage) throws 
SavanException{
+               //TODO handle Topics
+               SOAPEnvelope requestEnvelope = publishMessage.getEnvelope();
+               ServiceContext serviceContext = 
publishMessage.getMessageContext().getServiceContext();
+               PublicationClient client = new 
PublicationClient(serviceContext.getConfigurationContext());
+               
client.sendPublication(requestEnvelope.getBody().getFirstElement(),serviceContext.getAxisService(),null);
+       }
+       
+       
+       
        public abstract void pauseSubscription (SavanMessageContext 
pauseSubscriptionMessage) throws SavanException;
        
        public abstract void resumeSubscription (SavanMessageContext 
resumeSubscriptionMessage) throws SavanException;
diff --git a/modules/mar/module.xml b/modules/mar/module.xml
index 6f20028..70327a7 100644
--- a/modules/mar/module.xml
+++ b/modules/mar/module.xml
@@ -6,10 +6,15 @@
         
<actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Renew</actionMapping>
         
<actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/GetStatus</actionMapping>
         
<actionMapping>http://schemas.xmlsoap.org/ws/2004/08/eventing/Unsubscribe</actionMapping>
+        
<actionMapping>http://wso2.com/ws/2007/05/eventing/Publish</actionMapping>
         <actionMapping>http://wso2.com/eventing/Subscribe</actionMapping>
                <actionMapping>http://wso2.com/eventing/Renew</actionMapping>
                
<actionMapping>http://wso2.com/eventing/Unsubscribe</actionMapping>
                
<actionMapping>http://wso2.com/eventing/GetStatus</actionMapping>
     </operation>
     
+    <operation name="atom" mep="http://www.w3.org/2004/08/wsdl/in-out";>
+        <messageReceiver class="org.apache.savan.atom.AtomMessageReceiver"/>
+    </operation>
+    
 </module>

Reply via email to