ws-pubscribe-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lisc...@apache.org
Subject svn commit: r158383 - incubator/hermes/trunk/src/java/org/apache/ws/pubsub
Date Mon, 21 Mar 2005 00:31:37 GMT
Author: lischke
Date: Sun Mar 20 16:31:35 2005
New Revision: 158383

URL: http://svn.apache.org/viewcvs?view=rev&rev=158383
Log:
updated pubsub client-API

Added:
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/AbstractFilter.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/FilterFactory.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducerFactory.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Publisher.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/PublisherFactory.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionEndConsumer.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/TopicFilter.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/wsaSOAPConnection.java
Removed:
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumerFactory.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionStore.java
Modified:
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumer.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducer.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Subscription.java
    incubator/hermes/trunk/src/java/org/apache/ws/pubsub/XPathFilter.java

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/AbstractFilter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/AbstractFilter.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/AbstractFilter.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/AbstractFilter.java Sun Mar 20 16:31:35
2005
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+
+import java.net.URI;
+import org.w3c.dom.Node;
+/**
+ *
+ * @author  Stefan Lischke
+ */
+public abstract class AbstractFilter implements Filter{
+    private Node m_content;
+    private URI m_dialect;
+    
+    public AbstractFilter() {
+        m_content=null;
+        m_dialect=null;
+    }    
+    
+    public AbstractFilter(Node content) {
+        m_content=content;
+        m_dialect=null;
+    }
+    public AbstractFilter(Node content, URI dialect) {
+        m_content=content;
+        m_dialect=dialect;
+    }
+    
+    public java.net.URI getURI(){
+        return m_dialect;
+    }
+    public void setURI(String uri){
+        try{
+            this.m_dialect  = new URI(uri); 
+        }catch(java.net.URISyntaxException e){
+            //TODO
+            e.printStackTrace();
+        }
+    }
+    public void setURI(URI uri){ 
+        this.m_dialect  = uri;
+    }    
+    public Object getExpression(){
+        return m_content.getNodeValue();
+    }
+    public void setContent(Node n){
+        this.m_content=n;
+    }
+    
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/FilterFactory.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/FilterFactory.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/FilterFactory.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/FilterFactory.java Sun Mar 20 16:31:35
2005
@@ -0,0 +1,53 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.FilterType;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+//import org.apache.xmlbeans.XmlObject;
+/**
+ *
+ * @author  Stefan Lischke
+ */
+
+public class FilterFactory { 
+    private static final Log LOG = LogFactory.getLog( FilterFactory.class.getName() );
+
+    public static String xpathuri = "http://www.w3.org/TR/1999/REC-xpath-19991116";
+    public static String topicsuri = "http://docs.oasis-open.org/wsn/2004/06/TopicExpression/Concrete";
+    public static Filter createFilter(FilterType ft){        
+        String dialect = ft.getDialect();
+        Filter f = null;
+         
+        if((dialect==null)||(dialect.equals(xpathuri))){
+            //its an XPathFilter
+            f= new XPathFilter(ft.newCursor().getTextValue(),dialect);
+        }else if(dialect.equals(topicsuri)){
+            //TODO testing if topicexpression is ok
+            try{
+                f= new TopicFilter(ft.newDomNode(),new java.net.URI(dialect));
+            }catch(java.net.URISyntaxException e){
+                //TODO
+                e.printStackTrace();
+            }
+        }
+        LOG.info("FilterFactory : "+dialect+ " FilterExpr: " +f.getExpression());       

+        return f;
+    }
+    
+}

Modified: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumer.java?view=diff&r1=158382&r2=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumer.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationConsumer.java Sun Mar
20 16:31:35 2005
@@ -16,22 +16,12 @@
 package org.apache.ws.pubsub;
 
 import org.apache.ws.addressing.EndpointReference;
-//apache.axis.message.addressing.EndpointReference;
 
 import java.net.URI;
 
 public interface NotificationConsumer
 {
-    EndpointReference getEPR();    
+    EndpointReference getEPR();
 
     void notify( Subscription subscription, Object message );
-
-    void end( Subscription subscription, URI status, String reason );
-    
-    /**
-     * what's this for??
-     *
-     * @return
-     */
-    int getMode();
 }

Modified: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducer.java?view=diff&r1=158382&r2=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducer.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducer.java Sun Mar
20 16:31:35 2005
@@ -18,6 +18,7 @@
 //import org.apache.axis.message.addressing.EndpointReference;
 import org.apache.ws.addressing.EndpointReference;
 import java.util.Calendar;
+import java.net.URI;
 
 public interface NotificationProducer
 {
@@ -32,25 +33,15 @@
      * Subscribe to notifications from this producer.
      *
      * @param notificationConsumer
+     * @param subscriptionEndConsumer the callback Interface for SubscriptionEnd Notifications,
or null if no SubscriptionEnd should be send
      * @param filters
      * @param initialTerminationTime
      * @param deliveryMode the notification delivery mode, or null to use default mode
-     * @param policy a policy to be associated with the subscription, or null if no policy
should be used
      *
      * @return the subscription
      */
-    Subscription subscribe( NotificationConsumer notificationConsumer,
-                            Filter filters[],
+    Subscription subscribe( NotificationConsumer notificationConsumer, SubscriptionEndConsumer
subscriptionEndConsumer,
+                            TopicFilter tf, XPathFilter xf,
                             Calendar initialTerminationTime,
-                            DeliveryMode deliveryMode,
-                            Object policy );
-
-    /**
-     * Returns the last notification message published for the given set of filters.
-     *
-     * @param filters
-     *
-     * @return
-     */
-    Object getCurrentMessage( Filter filters[] );
+                            boolean UseNotify);
 }

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducerFactory.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducerFactory.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducerFactory.java
(added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/NotificationProducerFactory.java
Sun Mar 20 16:31:35 2005
@@ -0,0 +1,38 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+
+/**
+ *
+ * @author  Stefan Lischke
+ */
+public class NotificationProducerFactory {
+    public static NotificationProducerFactory s_ourInstance = new NotificationProducerFactory();
+    
+    public static NotificationProducerFactory getInstance(){
+        return s_ourInstance;
+    }
+    
+    /** Creates a new instance of NotificationProducerFactory */
+    public NotificationProducerFactory() {
+    }
+    
+    public NotificationProducer createNotificationProducer(String url, String configfile){
+        //choose between wse/wsn
+        return new org.apache.ws.notification.pubsub.Subscriber(url,configfile);
+//        return new org.apache.ws.eventing.pubsub.Subscriber(url,configfile);
+    }
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Publisher.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Publisher.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Publisher.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Publisher.java Sun Mar 20 16:31:35
2005
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+import org.apache.ws.notification.topics.Topic;
+public interface Publisher {
+    void publish(Object msg, Topic t); 
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/PublisherFactory.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/PublisherFactory.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/PublisherFactory.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/PublisherFactory.java Sun Mar 20
16:31:35 2005
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+
+public class PublisherFactory {
+    public PublisherFactory() {
+    }
+
+    public static PublisherFactory getInstance(){
+        return s_ourInstance;
+    }
+
+    public Publisher createPublisher(String url){
+        //choose between wse/wsn
+        return new org.apache.ws.notification.pubsub.Publisher(url);
+        //return new org.apache.ws.eventing.pubsub.Publisher(url);
+    }
+
+    public static PublisherFactory s_ourInstance = new PublisherFactory();
+}

Modified: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Subscription.java?view=diff&r1=158382&r2=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/Subscription.java Sun Mar 20 16:31:35
2005
@@ -20,27 +20,10 @@
 
 public interface Subscription
 {
-
-    /**
-     * Pause the subscription.
-     *
-     * @throws Exception
-     */
-    void pause() throws Exception;
-
-    /**
-     * Resume the subscription.
-     *
-     * @throws Exception
-     */
-    void resume() throws Exception;
-
     /**
-     * Is the subscription paused?
-     *
-     * @return true if the subscription is paused, false if not.
+     * Cancel this subscription.
      */
-    boolean isPaused();
+    void unsubscribe();
 
     /**
      * Gets the termination time for this subscription (i.e. the time at which it expires).
@@ -57,11 +40,6 @@
     void setTerminationTime( Calendar terminationTime );
 
     /**
-     * Cancel this subscription.
-     */
-    void unsubscribe();
-
-    /**
      * Returns a list of any notification filters that are associated with this subscription.
The filters are ordered in
      * the order in which they will be applied to notifications.
      *
@@ -82,7 +60,7 @@
      *
      * @return the delivery mode to be used for notifications sent for this subscription
      */
-    URI getDeliveryMode();
+    boolean getUseNotify();
 
     /**
      * Get the notification consumer associated with this subscription.
@@ -99,10 +77,9 @@
     NotificationProducer getNotificationProducer();
 
     /**
-     * Get the policy associated with this subscription.
+     * Get the subscriptionEnd consumer associated with this subscription.
      *
-     * @return the policy, or null if no policy was specified in the subscribe request.
+     * @return the subscriptionEnd consumer
      */
-    Object getSubscriptionPolicy();
-
+    SubscriptionEndConsumer getSubscriptionEndConsumer();
 }

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionEndConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionEndConsumer.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionEndConsumer.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/SubscriptionEndConsumer.java Sun
Mar 20 16:31:35 2005
@@ -0,0 +1,22 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+import org.apache.ws.addressing.EndpointReference;
+
+public interface SubscriptionEndConsumer {
+    void end( Subscription subscription, String reason );
+    EndpointReference getEPR();
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/TopicFilter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/TopicFilter.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/TopicFilter.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/TopicFilter.java Sun Mar 20 16:31:35
2005
@@ -0,0 +1,66 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+import org.apache.ws.notification.topics.Topic;
+
+import org.w3c.dom.Node;
+import java.net.URI;
+/**
+ *
+ * @author  Stefan Lischke
+ */
+public class TopicFilter extends AbstractFilter implements Filter {
+    private String m_targetNamespace;
+    public TopicFilter(Topic t){
+        String topicexpr="";
+        java.util.Iterator it = t.getTopicPath().iterator();
+        while(it.hasNext()){
+            String tt= (String) it.next();
+            topicexpr+="tns:"+tt;
+            if(it.hasNext())
+                topicexpr+="/";
+        }
+        m_targetNamespace=t.getTopicSpace().getNamespaceURI();
+        super.setURI(FilterFactory.topicsuri);
+        super.setContent(parse(topicexpr));
+    }
+    public TopicFilter(String filter){      
+        super.setContent(parse(filter));
+        super.setURI(FilterFactory.topicsuri);
+    }
+    
+    public TopicFilter(Node content, URI dialect){
+        super(content,dialect);
+    }    
+    
+    private Node parse(String s){
+        javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+        try{
+            javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+            org.w3c.dom.Document dom = db.newDocument();
+            return(dom.createTextNode(s));
+        }catch(javax.xml.parsers.ParserConfigurationException e){
+            //TODO
+            e.printStackTrace();
+        }           
+        return null;
+    }
+    
+    public String getNameSpace(){
+        return m_targetNamespace;
+    }
+}

Modified: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/XPathFilter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/XPathFilter.java?view=diff&r1=158382&r2=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/XPathFilter.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/XPathFilter.java Sun Mar 20 16:31:35
2005
@@ -1,20 +1,44 @@
-/*
- * Copyright 2001-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.ws.pubsub;
-
-public interface XPathFilter extends Filter
-{
-}
+/*
+ * Copyright 2001-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.ws.pubsub;
+import org.w3c.dom.Node;
+/**
+ *
+ * @author  Stefan Lischke
+ */
+public class XPathFilter extends AbstractFilter implements Filter { 
+     public XPathFilter(String filter){ 
+        this(filter,FilterFactory.xpathuri);
+     }
+     public XPathFilter(String filter,String dialect){
+        //TODO test pathexepr type
+        //TODO create node
+        javax.xml.parsers.DocumentBuilderFactory dbf = javax.xml.parsers.DocumentBuilderFactory.newInstance();
+        try{
+            javax.xml.parsers.DocumentBuilder db = dbf.newDocumentBuilder();
+
+        org.w3c.dom.Document dom = db.newDocument();
+        super.setContent(dom.createTextNode(filter));
+        super.setURI(FilterFactory.xpathuri);
+        }catch(javax.xml.parsers.ParserConfigurationException e){
+            //TODO
+            e.printStackTrace();
+        }        
+        super.setURI(dialect);
+    }   
+
+}

Added: incubator/hermes/trunk/src/java/org/apache/ws/pubsub/wsaSOAPConnection.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/pubsub/wsaSOAPConnection.java?view=auto&rev=158383
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/pubsub/wsaSOAPConnection.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/pubsub/wsaSOAPConnection.java Sun Mar 20
16:31:35 2005
@@ -0,0 +1,61 @@
+/*
+ * Copyright 2001-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.ws.pubsub;
+
+/**
+ *
+ * @author  Stefan Lischke
+ */
+import org.apache.ws.addressing.EndpointReference;
+import javax.xml.soap.*;
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import javax.xml.namespace.QName;
+
+public class wsaSOAPConnection {
+    
+    /** Creates a new instance of wsaSOAPConnection */
+    public wsaSOAPConnection() {
+    }
+    
+    /**
+     * @return The unique instance of this class.
+     */
+    
+    static public wsaSOAPConnection newInstance() {
+       return new wsaSOAPConnection();
+    }
+    
+    public SOAPMessage call(SOAPMessage request, String url ) throws SOAPException{     
 
+        SOAPConnectionFactory sconF= SOAPConnectionFactory.newInstance();
+        SOAPConnection scon = sconF.createConnection();
+        return(scon.call(request, url));
+    }
+    public SOAPMessage call(SOAPMessage request,EndpointReference epr) throws SOAPException{
+        SOAPHeader sH = request.getSOAPHeader();
+        //if epr contains ReferenceProperty add WSA header
+        XmlObject[] refprops = (XmlObject[])epr.getReferenceProperties(); 
+        if(refprops!=null){
+            for(int i=0;i<refprops.length;i++){
+                XmlCursor xc = refprops[i].newCursor();
+                QName propname = xc.getName(); 
+                sH.addChildElement(propname.getLocalPart(),propname.getPrefix(),propname.getNamespaceURI()).addTextNode(xc.getTextValue());

+                xc.dispose();
+            }
+        }
+        return(call(request,epr.getAddress()));
+    }
+}



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


Mime
View raw message