You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-dev@ws.apache.org by li...@apache.org on 2005/02/03 14:46:31 UTC
svn commit: r151154 - in
incubator/hermes/trunk/src/java/org/apache/ws/eventing: ./ app/ base/
services/ services/broker/ services/publisher/ services/subscriber/
Author: lischke
Date: Thu Feb 3 05:46:26 2005
New Revision: 151154
URL: http://svn.apache.org/viewcvs?view=rev&rev=151154
Log:
new version with XMLbeans and Addressing Facade
Added:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSourcePort.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/NotificationPort.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEndPort.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManagerPort.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java
Removed:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/base/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSource.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventingService.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEnd.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManager.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/BrokerWrapper.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/EventSourceBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/EventSourceBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/SubscriptionEndBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/SubscriptionEndBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/SubscriptionManagerBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/SubscriptionManagerBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/EventSourceBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/EventSourceBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/SubscriptionEndBindingStub.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/SubscriptionManagerBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/SubscriptionManagerBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/EventSourceBindingStub.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/Notifier.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/SubscriberService.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/SubscriberServiceLocator.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/SubscriptionEndBindingImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/SubscriptionEndBindingSkeleton.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/SubscriptionManagerBindingStub.java
Modified:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/EchoConsumer.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/YFilterStore.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsemantic.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsyntactic.java
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,119 @@
+/*
+ * 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.eventing;
+
+import org.apache.axis.configuration.FileProvider;
+import org.apache.ws.addressing.*;
+
+//import org.apache.ws.eventing.base.*;
+//import org.apache.ws.eventing.services.*;
+//import org.apache.ws.eventing.services.subscriber.SubscriberServiceLocator;
+
+import org.apache.ws.pubsub.*;
+
+import org.apache.xmlbeans.*;
+import org.w3c.dom.*;
+import edu.berkeley.cs.db.yfilterplus.queryparser.Query;
+
+public abstract class AbstractSubscription implements org.apache.ws.pubsub.Subscription {
+
+// public SubscriptionManager sMan;
+ private NotificationConsumer consumer;
+ private String QueryID;
+ private String id;
+
+ public String getFilterString()throws Exception{
+ //TODO !! have an own Filter
+ return null;
+ }
+
+ public String getQueryID(){
+ return QueryID;
+ }
+ public void setQueryID(String q){
+ this.QueryID = q;
+ }
+
+ public String getID(){
+ return this.id;
+ }
+ public void setID(String id){
+ this.id=id;
+ }
+ public void setSubscriptionManager(EndpointReference epr){
+ try{
+ //extract ew:identifier
+ XmlObject rp[] = (XmlObject[])epr.getReferenceProperties();
+ //TODO iterate over all rps
+ Node n = rp[0].newDomNode();
+ // ("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier"));
+ if(n!=null)
+ this.id= n.getFirstChild().getNodeValue();
+ //Subscription Manager
+ //SubscriberServiceLocator pubsubwsLoc = new SubscriberServiceLocator(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
+ //this.sMan = pubsubwsLoc.getSubscriptionManagerPort(new java.net.URL(epr.getAddress().toString()));
+ System.out.println("got SubscritpionManager "+epr.getAddress().toString());
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public void unsubscribe(){
+ /* try{
+ this.sMan.unsubscribeMsg(new Unsubscribe(new MessageElement[0],this.id));
+ SubscriberStore.instance().removeSubscription(this.getID());
+ }catch(Exception e){
+ e.printStackTrace();
+ }*/
+ }
+
+ public void setNotificationConsumer(NotificationConsumer consumer) {
+ this.consumer = consumer;
+ }
+
+ public void pause() {
+ }
+
+ public void resume() {
+ }
+
+
+ public NotificationConsumer getNotificationConsumer() {
+ return this.consumer;
+ }
+ public NotificationProducer getNotificationProducer() {
+ return null;
+ }
+ public java.util.Calendar getCreationTime() {
+ return null;
+ }
+
+ public Object getSubscriptionPolicy() {
+ return null;
+ }
+
+ public java.net.URI getDeliveryMode(){
+ return null;
+ }
+ public org.apache.ws.pubsub.Filter getFilters(){
+ return null;
+ }
+
+ public void setTerminationTime( java.util.Calendar terminationTime ){}
+ public java.util.Calendar getTerminationTime(){return null;}
+ public boolean isPaused(){return false;}
+
+}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/EchoConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/EchoConsumer.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/EchoConsumer.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/EchoConsumer.java Thu Feb 3 05:46:26 2005
@@ -13,15 +13,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.apache.ws.eventing;
+package org.apache.ws.eventing;
+import org.apache.ws.addressing.*;
import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.addressing.EndpointReference;
public class EchoConsumer implements org.apache.ws.pubsub.NotificationConsumer {
private EndpointReference epr;
public EchoConsumer(String epr)throws org.apache.axis.types.URI.MalformedURIException{
- this.epr=new EndpointReference(epr);
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType e = org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType.Factory.newInstance();
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI auri = org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI.Factory.newInstance();
+ auri.setStringValue(epr);
+ e.setAddress(auri);
+ //wrapper
+ this.epr= new XmlBeansEndpointReference(e);
}
public EndpointReference getEPR(){
return epr;
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java Thu Feb 3 05:46:26 2005
@@ -15,37 +15,38 @@
*/
package org.apache.ws.eventing;
-import org.apache.ws.eventing.base.FilterType;
/**
*
* @author Stefan Lischke
*/
-public class Filter extends FilterType implements org.apache.ws.pubsub.Filter{
- /*
- public Filter(org.apache.ws.pubsub.Filter f){
- org.apache.axis.message.MessageElement[] any=new org.apache.axis.message.MessageElement[1];
- any[0]= new org.apache.axis.message.MessageElement(new org.apache.axis.message.Text(f.getExpression()));
- any[0].addAttribute("","dialect",f.getDialect());
- set_any(any);
- }*/
+public class Filter implements org.apache.ws.pubsub.Filter{
+ private String filterstr;
+ private String dialect;
+
/** Creates a new instance of Filter */
public Filter(String filter) {
- org.apache.axis.message.MessageElement[] any=new org.apache.axis.message.MessageElement[1];
- any[0]= new org.apache.axis.message.MessageElement(new org.apache.axis.message.Text(filter));
- set_any(any);
+ filterstr=filter;
+ dialect=null;
}
public java.net.URI getURI(){
+ if(dialect!=null){
+ try{
+ return new java.net.URI(dialect);
+ }catch(java.net.URISyntaxException e){
+ e.printStackTrace();
+ }}
return null;
}
- public void setURI(String dialect){
+ public void setURI(String uri){
+ this. dialect = uri;
}
public Object getExpression(){
- return null;
+ return filterstr;
}
- public void setExpression(Object value){
-
+ public void setExpression(String value){
+ this.filterstr=value;
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java Thu Feb 3 05:46:26 2005
@@ -14,8 +14,8 @@
* limitations under the License.
*/
package org.apache.ws.eventing;
-import org.apache.axis.message.SOAPEnvelope;
-import org.apache.axis.message.addressing.EndpointReference;
+import org.apache.ws.addressing.*;
+
public class ForwardConsumer implements org.apache.ws.pubsub.NotificationConsumer {
private EndpointReference epr;
/*
@@ -43,8 +43,8 @@
public void notify( org.apache.ws.pubsub.Subscription subscription, Object message ){
System.out.println("ForwardConsumer ");
try{
- SOAPEnvelope env=(SOAPEnvelope)message;
- Publisher.publish((Subscription)subscription, env.getBody());
+// SOAPEnvelope env=(SOAPEnvelope)message;
+// Publisher.publish((Subscription)subscription, env.getBody());
}catch(Exception e){
e.printStackTrace();
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java Thu Feb 3 05:46:26 2005
@@ -16,71 +16,59 @@
package org.apache.ws.eventing;
-import org.apache.axis.client.Call;
-import org.apache.axis.client.Service;
-import org.apache.axis.configuration.FileProvider;
-import org.apache.axis.message.MessageElement;
-import org.apache.axis.message.SOAPBodyElement;
-import org.apache.axis.message.addressing.Action;
-import org.apache.axis.message.addressing.AddressingHeaders;
-import org.apache.axis.message.addressing.Constants;
-import org.apache.axis.message.addressing.EndpointReference;
-import org.apache.axis.types.URI;
-import org.apache.axis.utils.XMLUtils;
+import javax.xml.soap.*;
+import org.w3c.dom.Document;
-import javax.xml.soap.SOAPElement;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.apache.ws.pubsub.emitter.EmitterTask;
+
+import org.apache.ws.addressing.*;
public class Publisher {
- static String url = "http://localhost:7070/axis/services/NotificationPort";
- public static void publish(Subscription s, javax.xml.soap.SOAPBody body){
- try{
- // Service service = new Service(new FileProvider("D:\\pubsubWS\\implementation\\PubSubWS\\src\\org\\wspubsubClient\\client-config.wsdd"));
- Service service = new Service(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
- Call call = (Call) service.createCall();
- AddressingHeaders headers = setUpAddressing();
- //subid
- headers.addReferenceProperty( new MessageElement(XMLUtils.StringToElement("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier", s.getID())));
-
- call.setProperty(Constants.ENV_ADDRESSING_REQUEST_HEADERS, headers);
- call.setTargetEndpointAddress(new java.net.URL(s.getDelivery().getNotifyTo().getAddress().toString()));
- // call.setOperationName(new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing/Notification", "getVersion"));
-
-
- java.util.Iterator it = body.getChildElements();
- SOAPBodyElement[] input = new SOAPBodyElement[1];
- input[0]=new SOAPBodyElement((SOAPElement)it.next());
-
- call.invoke(input);
- }catch(Exception e){
- e.printStackTrace();
- }
+ static String url = "http://localhost:7070/axis/services/NotificationPort";
+
+ public static void publish(String url, String s) throws Exception{
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document dom = builder.parse(new java.io.ByteArrayInputStream(s.getBytes()));
+ publish(url,buildMessage(null,dom));
}
- public static void publish(String url, String content) throws Exception{
- //Service service = new Service(new FileProvider("D:\\pubsubWS\\implementation\\PubSubWS\\src\\org\\wspubsubClient\\client-config.wsdd"));
- Service service = new Service(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
- Call call = (Call) service.createCall();
- AddressingHeaders headers = setUpAddressing();
- call.setProperty(Constants.ENV_ADDRESSING_REQUEST_HEADERS, headers);
- call.setTargetEndpointAddress(new java.net.URL(url));
- // call.setOperationName(new QName("http://schemas.xmlsoap.org/ws/2004/08/eventing/Notification", "getVersion"));
-
-
- // DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- //Document doc = builder.parse(new java.io.ByteArrayInputStream(content.getBytes()));
-
- SOAPBodyElement[] input = new SOAPBodyElement[1];
- //System.out.println(doc.getDocumentElement().toString());
- input[0] = new SOAPBodyElement(new java.io.ByteArrayInputStream(content.getBytes()));
- //input[0] = new SOAPBodyElement(XMLUtils.StringToElement("", "a", "hello"));
- //SOAPElement c = input[0].addChildElement("b");
- //c.addChildElement("c");
- //c.addChildElement("xyz");
- call.invoke(input);
+ public static void publish(String url, SOAPMessage soapMsg) throws Exception{
+ EmitterTask et = EmitterTask.createEmitterTask(soapMsg, new java.net.URL(url));
+ et.run();
+ }
+
+ /*
+ * This Method publishes for a special Subscription, cause it has a
+ * ResourcePropertie in his EPR
+ */
+ public static void publish(EndpointReference epr, String s) throws Exception{
+ DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ Document dom = builder.parse(new java.io.ByteArrayInputStream(s.getBytes()));
+ publish(epr,dom);
+ }
+ public static void publish(EndpointReference epr, Document dom) throws Exception{
+ publish(epr.getAddress().toString(),buildMessage(epr,dom));
}
+ private static SOAPMessage buildMessage(EndpointReference epr, Document dom)throws Exception{
+ //build soap mesage
+ SOAPMessage soapMsg = MessageFactory.newInstance().createMessage();
+
+ SOAPHeader soapHeader = soapMsg.getSOAPHeader();
+ //TODO !!! set the wsa headers
+
+ SOAPBody soapBody = soapMsg.getSOAPBody();
+ //TODO doubt this will work...but lets give it a try using a Document type "notifyDoc"
+ soapBody.addDocument(dom);
+ return soapMsg;
+ }
+ //TODO setupaddressingHeaders
+ /*
private static AddressingHeaders setUpAddressing() throws Exception {
AddressingHeaders headers = new AddressingHeaders();
Action a = new Action(new URI("urn:action2"));
@@ -89,4 +77,5 @@
headers.setFaultTo(epr);
return headers;
}
+ */
}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,32 @@
+/*
+ * 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.eventing;
+
+/**
+ *
+ * @author Administrator
+ */
+public class RemoteSubscription extends AbstractSubscription{
+
+ private org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument subdom;
+
+ public RemoteSubscription(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument subdom){
+ this.subdom =subdom;
+ }
+ public String getFilterString()throws Exception{
+ return this.subdom.getSubscribe().getFilter().xmlText();
+ }
+}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java Thu Feb 3 05:46:26 2005
@@ -15,76 +15,110 @@
*/
package org.apache.ws.eventing;
+//import org.apache.ws.eventing.services.EventSource;
+//import org.apache.ws.eventing.services.subscriber.*;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.*;
+
+import org.apache.ws.addressing.*;
+
+import org.apache.ws.util.XmlBeanUtils;
+
import org.apache.axis.configuration.FileProvider;
-import org.apache.axis.message.addressing.EndpointReference;
-import org.apache.ws.eventing.base.DeliveryType;
-import org.apache.ws.eventing.base.ExpirationType;
-import org.apache.ws.eventing.services.EventSource;
-import org.apache.ws.eventing.services.subscriber.SubscriberServiceLocator;
+
import org.apache.ws.pubsub.NotificationProducer;
+import javax.xml.soap.*;
+
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.axis.AxisProperties;
+import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
import java.util.Calendar;
public class Subscriber implements NotificationProducer {
- private EventSource es;
+// private EventSource es;
private EndpointReference epr;
private SubscriberStore store;
public Subscriber(String url){
+ //Axis stuff to enable Addressing HandlerChain
+ AxisProperties.setProperty(EngineConfigurationFactoryDefault.OPTION_CLIENT_CONFIG_FILE,"/org/apache/ws/eventing/client-config.wsdd");
try{
- SubscriberServiceLocator pubsubwsLoc = new SubscriberServiceLocator(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
-
- es = pubsubwsLoc.getEventSourcePort(new java.net.URL(url));
- epr= new EndpointReference(new org.apache.axis.types.URI(url));
+// SubscriberServiceLocator pubsubwsLoc = new SubscriberServiceLocator(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType e = org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType.Factory.newInstance();
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI auri = org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI.Factory.newInstance();
+ auri.setStringValue(url);
+ e.setAddress(auri);
+ //wrapper
+ this.epr= new XmlBeansEndpointReference(e);
+
store= SubscriberStore.instance();
}catch (Exception e){
e.printStackTrace();
- }
-
+ }
}
-
-/*
- public static void main(String[] args) throws Exception{
- //start jettyaxisserver
- JettyAxisServer jas = new JettyAxisServer();
- jas.setPort(8080);
- jas.setResourceBase("/home/xtmcms/pubsubWS/implementation/Hermes/hermes/trunk/client");
- jas.start();
-
- System.out.println("JAS started"+ jas.log.toString());
-
- Subscriber sub = new Subscriber("http://localhost:7070/axis/services/EventSourcePort");
- Filter[] fs=new Filter[1];
- fs[0] = new XPathFilter("//a[text()=\"hello\"]");
- org.apache.ws.pubsub.Subscription s = sub.subscribe(new EchoConsumer("http://localhost:9090/axis/services/NotificationPort"),fs,Calendar.getInstance(),null,null);
-
- Publisher.publish("http://localhost:7070/axis/services/NotificationPort");
-
-// s.getStatus();
- s.unsubscribe();
-
- Publisher.publish("http://localhost:7070/axis/services/NotificationPort");
- }
- */
+
public Object getCurrentMessage(org.apache.ws.pubsub.Filter[] filters) {
return null;
}
public org.apache.ws.pubsub.Subscription subscribe(org.apache.ws.pubsub.NotificationConsumer notificationConsumer, org.apache.ws.pubsub.Filter[] filters, Calendar initialTerminationTime, org.apache.ws.pubsub.DeliveryMode deliveryMode, Object policy) {
- Subscription s = new Subscription(notificationConsumer.getEPR(),
- new DeliveryType(notificationConsumer.getEPR(),new org.apache.axis.message.MessageElement[0],null),
- new ExpirationType(initialTerminationTime),
- (Filter) filters[0]);
+ SubscribeDocument sdom = SubscribeDocument.Factory.newInstance();
+ SubscribeDocument.Subscribe s = sdom.addNewSubscribe();
+ //notifications are send to:
+ DeliveryType delivery = DeliveryType.Factory.newInstance();
+ delivery.setNotifyTo((org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType)((XmlObjectWrapper)notificationConsumer.getEPR()).getXmlObject());
+ s.setDelivery(delivery);
+
+ //TODO
+ //s.setEndTo(endTo);
+
+ //TODO check Calendar serializing
+ ExpirationType expires = ExpirationType.Factory.newInstance();
+ expires.setObjectValue(initialTerminationTime);
+ s.setExpires(expires);
+
+ //TODO multiple filters
+ FilterType filter = FilterType.Factory.newInstance();
+ java.net.URI uri = filters[0].getURI();
+ if(uri!=null)
+ filter.setDialect(uri.toString());
try{
- es.subscribeMsg(s);
- store.addSubscription(s);
- s.setNotificationConsumer(notificationConsumer);
- }catch(java.rmi.RemoteException e){
+// filter.set(XmlBeanUtils.toXmlObject(filters[0].getExpression()));
+//TODO
+// filter.set(org.apache.xmlbeans.XmlObject.Factory.newInstance().setxmlText());// parse((String)filters[0].getExpression()));
+ }catch(Exception e){
e.printStackTrace();
}
- return s;
+ s.setFilter(filter);
+
+ try{
+ //now call
+ wsaSOAPConnection sconn = wsaSOAPConnection.newInstance();
+ MessageFactory mf = MessageFactory.newInstance();
+ SOAPMessage soapm = mf.createMessage();
+ //put XMLbean into SOAPBody
+ soapm.getSOAPBody().addDocument((org.w3c.dom.Document) sdom.newDomNode());
+ SOAPMessage subscribeResponse = sconn.call(soapm, epr);
+
+ SubscribeResponseDocument.SubscribeResponse sres = SubscribeResponseDocument.SubscribeResponse.Factory.newInstance();
+// sres.
+// subscribeResponse.getSOAPBody().get
+ }catch(javax.xml.soap.SOAPException e){
+ e.printStackTrace();
+ }
+ //create local Subscription
+ org.apache.ws.eventing.Subscription ls = new org.apache.ws.eventing.Subscription();
+ ls.setNotificationConsumer(notificationConsumer);
+
+ //TODO set SubscriptionID from subscribeResponse
+
+ //add to local store
+ store.addSubscription(ls);
+ return ls;
+
}
- public org.apache.axis.message.addressing.EndpointReference getEPR() {
+ public EndpointReference getEPR() {
return epr;
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java Thu Feb 3 05:46:26 2005
@@ -1,134 +1,28 @@
-/*
- * 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.eventing;
-
-import org.apache.axis.configuration.FileProvider;
-import org.apache.axis.message.MessageElement;
-import org.apache.axis.message.addressing.EndpointReferenceType;
-import org.apache.axis.message.addressing.ReferenceParametersType;
-import org.apache.ws.eventing.base.DeliveryType;
-import org.apache.ws.eventing.base.ExpirationType;
-import org.apache.ws.eventing.base.Subscribe;
-import org.apache.ws.eventing.base.Unsubscribe;
-import org.apache.ws.eventing.services.SubscriptionManager;
-import org.apache.ws.eventing.services.subscriber.SubscriberServiceLocator;
-import org.apache.ws.pubsub.NotificationConsumer;
-import org.apache.ws.pubsub.NotificationProducer;
-
-public class Subscription extends Subscribe implements org.apache.ws.pubsub.Subscription{
-
- public SubscriptionManager sMan;
- private NotificationConsumer consumer;
- private String QueryID;
- private String id;
- public Subscription(){
-
- }
- public Subscription(EndpointReferenceType endTo,DeliveryType delivery,ExpirationType expires,Filter filter){
- super(endTo, delivery, expires, filter, new MessageElement[0]);
- }
-
- public String getFilterString()throws Exception{
- MessageElement[] me = super.getFilter().get_any();
- System.out.println("MessageElements : "+me.length+" "+me[0].getNodeValue());
- return me[0].getNodeValue();
- }
-
- public String getQueryID(){
- return QueryID;
- }
- public void setQueryID(String q){
- this.QueryID = q;
- }
-
- public String getID(){
- return this.id;
- }
- public void setID(String id){
- this.id=id;
- }
- public void setSubscriptionManager(EndpointReferenceType epr){
- try{
- //extract esw:identifier
-
- ReferenceParametersType rp = epr.getParameters();
- MessageElement me = rp.get(new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier"));
- if(me!=null)
- this.id= me.getFirstChild().getNodeValue();
- //Subscription Manager
- SubscriberServiceLocator pubsubwsLoc = new SubscriberServiceLocator(new FileProvider("org/apache/ws/eventing/client-config.wsdd"));
-
- this.sMan = pubsubwsLoc.getSubscriptionManagerPort(new java.net.URL(epr.getAddress().toString()));
- System.out.println("got SubscritpionManager "+epr.getAddress().toString());
- }catch(Exception e){
- e.printStackTrace();
- }
- }
-
- public void unsubscribe(){
- try{
- this.sMan.unsubscribeMsg(new Unsubscribe(new MessageElement[0],this.id));
- SubscriberStore.instance().removeSubscription(this.getID());
- }catch(Exception e){
- e.printStackTrace();
- }
- }
-
- public void setNotificationConsumer(NotificationConsumer consumer) {
- this.consumer = consumer;
- }
-
- public void pause() {
- }
-
- public void resume() {
- }
-
-
- public NotificationConsumer getNotificationConsumer() {
- return this.consumer;
- }
- public NotificationProducer getNotificationProducer() {
- return null;
- }
- public java.util.Calendar getCreationTime() {
- return null;
- }
-
- public Object getSubscriptionPolicy() {
- return null;
- }
-
- public java.net.URI getDeliveryMode(){
- return null;
- }
- public org.apache.ws.pubsub.Filter getFilters(){
- return null;
- }
-
- public void setTerminationTime( java.util.Calendar terminationTime ){}
- public java.util.Calendar getTerminationTime(){return null;}
- public boolean isPaused(){return false;}
-
- public String toString(){
- try{
- return(getID()+" "+getFilterString());
- }catch(Exception e){
- e.printStackTrace();
- }
- return("error");
- }
-}
+/*
+ * 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.eventing;
+
+/**
+ *
+ * @author Administrator
+ */
+public class Subscription extends AbstractSubscription{
+
+ /** Creates a new instance of Subscription */
+ public Subscription() {
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java Thu Feb 3 05:46:26 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.eventing;
+import org.apache.ws.eventing.*;
+import org.apache.axis.message.MessageElement;
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class TopicFilter extends Filter {
+
+ /** Creates a new instance of Filter */
+ public TopicFilter(String filter) throws Exception{
+ super(filter);
+ super.
+ setURI("http://www.w3.org/TR/1999/REC-xpath-19991116");
+ }
+
+}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java Thu Feb 3 05:46:26 2005
@@ -15,7 +15,7 @@
*/
package org.apache.ws.eventing;
-
+import org.apache.ws.eventing.*;
/**
*
* @author Stefan Lischke
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/YFilterStore.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/YFilterStore.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/YFilterStore.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/YFilterStore.java Thu Feb 3 05:46:26 2005
@@ -14,10 +14,19 @@
* limitations under the License.
*/
package org.apache.ws.eventing;
+import org.w3c.dom.Element;
+
+import java.util.List;
+
+import org.apache.axis.utils.XMLUtils;
+
+import org.apache.ws.addressing.*;
+
import edu.berkeley.cs.db.yfilter.filter.*;
import edu.berkeley.cs.db.yfilterplus.queryparser.*;
import edu.berkeley.cs.db.yfilterplus.xmltree.*;
-import org.apache.axis.utils.XMLUtils;
+
+import org.apache.ws.pubsub.*;
public class YFilterStore implements org.apache.ws.pubsub.SubscriptionStore{
public int c=0;
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsemantic.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsemantic.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsemantic.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsemantic.java Thu Feb 3 05:46:26 2005
@@ -18,6 +18,7 @@
import org.apache.ws.eventing.Publisher;
import javax.swing.*;
+import javax.swing.tree.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
@@ -33,109 +34,116 @@
public JButton publishButton= null;
public JTextArea pubtext=null;
public JList subs=null;
+ public JTree tree=null;
public SubListModel sublistmodel= new SubListModel();
public JList nots=null;
public SubListModel notlistmodel= new SubListModel();
-
+
private PubSubWSmanager pman;
-
+
public PubSubWSsemantic(JTabbedPane _notebook, PubSubWSmanager _pman) {
try{
this.pman=_pman;
- notebook = _notebook ;
-
- this.setLayout( new BoxLayout(this, BoxLayout.Y_AXIS) );
-
- // 1st component is just a row of labels and 1-line entry fields
- /////////////////////////////////////////////////////////////////////
- JPanel top = new JPanel();
-
- top.setLayout( new FlowLayout() );
- top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
-
- String[] cont= new String[2];
- cont[0]="XPath";
- cont[1]="TopicFilter";
- top.add( new JComboBox(cont));
- top.add( new JLabel("Filter", SwingConstants.RIGHT ) );
- top.add( filterstr = new JTextField("//a/b", 10));
- top.add( Box.createRigidArea(new Dimension(5, 0)) );
- top.add( new JLabel("Name", SwingConstants.RIGHT ) );
- top.add( filtername = new JTextField(10));
- top.add( Box.createRigidArea(new Dimension(5, 0)) );
-
- top.add(subscribeButton = new JButton("Subscribe"));
- subscribeButton.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- //if ( removeSelected.equals(event.getActionCommand()) ) {
- // remove();
- //}
- try{
- org.apache.ws.pubsub.Filter[] fs=new org.apache.ws.pubsub.Filter[1];
- fs[0] = new org.apache.ws.eventing.XPathFilter(filterstr.getText());
- org.apache.ws.pubsub.Subscription s = pman.nprod.subscribe(new PopUpConsumer("http://localhost:9090/axis/services/NotificationPort",notlistmodel),fs,java.util.Calendar.getInstance(),null,null);
- sublistmodel.addData(s);
- }catch(Exception e){
- e.printStackTrace();
+ notebook = _notebook ;
+
+ this.setLayout( new BoxLayout(this, BoxLayout.Y_AXIS) );
+
+ // 1st component is just a row of labels and 1-line entry fields
+ /////////////////////////////////////////////////////////////////////
+ JPanel top = new JPanel();
+
+ top.setLayout( new FlowLayout() );
+ top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
+
+ DefaultTreeCellRenderer renderer2 = new DefaultTreeCellRenderer();
+ renderer2.setOpenIcon(null);
+ renderer2.setClosedIcon(null);
+ renderer2.setLeafIcon(null);
+
+ DefaultMutableTreeNode root = new DefaultMutableTreeNode("Root");
+ DefaultMutableTreeNode child1 = new DefaultMutableTreeNode("Child 1");
+ root.add(child1);
+ DefaultMutableTreeNode child2 = new DefaultMutableTreeNode("Child 2");
+ root.add(child2);
+ tree = new JTree(root);
+ tree.setCellRenderer(renderer2);
+ top.add(tree);
+ top.add(subscribeButton = new JButton("Subscribe"));
+ subscribeButton.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ //if ( removeSelected.equals(event.getActionCommand()) ) {
+ // remove();
+ //}
+ // TreePath[] ts =tree.getSelectionModel().getSelectionPaths();
+ // for(int i=0;i<ts.length;i++)
+ // System.out.println( ts[i].toString());
+ String Tfilterstr = "/"+tree.getSelectionPath().toString();
+ try{
+ org.apache.ws.pubsub.Filter[] fs=new org.apache.ws.pubsub.Filter[1];
+ fs[0] = new org.apache.ws.eventing.TopicFilter(Tfilterstr);
+ org.apache.ws.pubsub.Subscription s = pman.nprod.subscribe(new PopUpConsumer("http://localhost:9090/axis/services/NotificationPort",notlistmodel),fs,java.util.Calendar.getInstance(),null,null);
+ sublistmodel.addData(s);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+
}
-
-
}
- }
- );
-
- this.add(top );
- this.add( Box.createRigidArea(new Dimension(0, 10)) );
- JPanel top2 = new JPanel();
- top2.add( new JLabel("Message", SwingConstants.RIGHT ) );
- top2.add(pubtext = new JTextArea("<?xml version=\"1.0\" ?>\n<a><b/></a>",10,30));
- top2.add(publishButton = new JButton("Publish"));
-
- publishButton.addActionListener( new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- //if ( removeSelected.equals(event.getActionCommand()) ) {
- // remove();
- //}
- try{
- Publisher.publish("http://localhost:7070/axis/services/NotificationPort", pubtext.getText());
- }catch(Exception e){
- e.printStackTrace();
+ );
+
+ this.add(top );
+ this.add( Box.createRigidArea(new Dimension(0, 10)) );
+ JPanel top2 = new JPanel();
+ top2.add( new JLabel("Message", SwingConstants.RIGHT ) );
+ top2.add(pubtext = new JTextArea("<?xml version=\"1.0\" ?>\n<a><b/></a>",10,30));
+ top2.add(publishButton = new JButton("Publish"));
+
+ publishButton.addActionListener( new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ //if ( removeSelected.equals(event.getActionCommand()) ) {
+ // remove();
+ //}
+ try{
+ Publisher.publish("http://localhost:7070/axis/services/NotificationPort", pubtext.getText());
+ }catch(Exception e){
+ e.printStackTrace();
+ }
}
}
- }
- );
-
- this.add( top2);
- this.add( Box.createRigidArea(new Dimension(0, 10)) );
-
- JPanel ls = new JPanel();
- ls.setLayout( new FlowLayout() );
-
- subs = new JList();
- subs.setModel(sublistmodel);
- JScrollPane scrollPane = new JScrollPane(subs);
- ls.add(scrollPane);
-
- ls.add( Box.createRigidArea(new Dimension(0, 10)) );
-
- nots = new JList();
- nots.setModel(notlistmodel);
- JScrollPane scrollPane2 = new JScrollPane(nots);
- MouseListener mouseListener = new MouseAdapter() {
- public void mouseClicked(MouseEvent e) {
- if (e.getClickCount() == 2) {
- int index = nots.locationToIndex(e.getPoint());
- JOptionPane.showMessageDialog(notebook,((notentry)notlistmodel.getElementAt(index)).content,"Notification detail",JOptionPane.INFORMATION_MESSAGE);
- }
- }
- };
- nots.addMouseListener(mouseListener);
- ls.add(scrollPane2);
-
- this.add(ls);
- notebook.addTab( "PubSubWSsemantic", this );
- // start();
+ );
+
+ this.add( top2);
+ this.add( Box.createRigidArea(new Dimension(0, 10)) );
+
+ JPanel ls = new JPanel();
+ ls.setLayout( new FlowLayout() );
+
+ subs = new JList();
+ subs.setModel(sublistmodel);
+ JScrollPane scrollPane = new JScrollPane(subs);
+ ls.add(scrollPane);
+
+ ls.add( Box.createRigidArea(new Dimension(0, 10)) );
+
+ nots = new JList();
+ nots.setModel(notlistmodel);
+ JScrollPane scrollPane2 = new JScrollPane(nots);
+ MouseListener mouseListener = new MouseAdapter() {
+ public void mouseClicked(MouseEvent e) {
+ if (e.getClickCount() == 2) {
+ int index = nots.locationToIndex(e.getPoint());
+ JOptionPane.showMessageDialog(notebook,((notentry)notlistmodel.getElementAt(index)).content,"Notification detail",JOptionPane.INFORMATION_MESSAGE);
+ }
+ }
+ };
+ nots.addMouseListener(mouseListener);
+ ls.add(scrollPane2);
+
+ this.add(ls);
+ notebook.addTab( "PubSubWSsemantic", this );
+ // start();
}catch(Exception e){
e.printStackTrace();
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsyntactic.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsyntactic.java?view=diff&r1=151153&r2=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsyntactic.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/PubSubWSsyntactic.java Thu Feb 3 05:46:26 2005
@@ -56,10 +56,6 @@
top.setLayout( new FlowLayout() );
top.setBorder(BorderFactory.createEmptyBorder(5, 5, 5, 5));
- String[] cont= new String[2];
- cont[0]="XPath";
- cont[1]="TopicFilter";
- top.add( new JComboBox(cont));
top.add( new JLabel("Filter", SwingConstants.RIGHT ) );
top.add( filterstr = new JTextField("//a/b", 10));
top.add( Box.createRigidArea(new Dimension(5, 0)) );
@@ -72,8 +68,8 @@
public void actionPerformed(ActionEvent event) {
//if ( removeSelected.equals(event.getActionCommand()) ) {
// remove();
- //}
- try{
+ //}
+ try{
org.apache.ws.pubsub.Filter[] fs=new org.apache.ws.pubsub.Filter[1];
fs[0] = new org.apache.ws.eventing.XPathFilter(filterstr.getText());
String notifyTo ="http://"+java.net.InetAddress.getLocalHost().getHostAddress()+":"+pman.inportL+"/axis/services/NotificationPort";
@@ -102,7 +98,7 @@
// remove();
//}
try{
- Publisher.publish("http://localhost:"+pman.outport+"/axis/services/NotificationPort", pubtext.getText());
+ // Publisher.publish("http://localhost:"+pman.outport+"/axis/services/NotificationPort", pubtext.getText());
}catch(Exception e){
e.printStackTrace();
}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSourcePort.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSourcePort.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSourcePort.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/EventSourcePort.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,57 @@
+/*
+ * 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.eventing.services;
+import org.apache.ws.addressing.*;
+
+import org.apache.ws.eventing.YFilterStore;
+import org.apache.ws.eventing.RemoteSubscription;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.*;
+
+public class EventSourcePort {
+ public SubscribeResponseDocument subscribeMsg(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument body) throws java.rmi.RemoteException {
+ try{
+ YFilterStore b = YFilterStore.instance();
+ RemoteSubscription s = new RemoteSubscription(body);
+
+ String id = b.addSubscription(s);
+
+ //build response
+ SubscribeResponseDocument responseDom= SubscribeResponseDocument.Factory.newInstance();
+ SubscribeResponseDocument.SubscribeResponse response = responseDom.addNewSubscribeResponse();
+
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType e = response.addNewSubscriptionManager();
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI auri = e.addNewAddress();
+ auri.setStringValue("http://localhost:7070/axis/services/SubscriptionManagerPort");
+ org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType rp = e.addNewReferenceProperties();
+ org.apache.ws.util.XmlBeanUtils.addChildElement(rp,new javax.xml.namespace.QName("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier"));
+ //wrapper
+ //EndpointReference ep= new XmlBeansEndpointReference(e);
+
+ //TODO why not ExpirationType???
+ //ExpirationType et = response.aExpirationType.Factory.("now");
+
+ return responseDom;
+ }catch(Exception e){
+ //TODO error
+ e.printStackTrace();
+ }
+ //TODO error
+ return null;
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/NotificationPort.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/NotificationPort.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/NotificationPort.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/NotificationPort.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,34 @@
+/*
+ * 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.eventing.services;
+
+import org.apache.axis.message.*;
+
+import org.apache.ws.eventing.SubscriberStore;
+
+
+public class NotificationPort{
+
+ //TODO maybe remove Axis dep
+ public void filter(SOAPEnvelope req, SOAPEnvelope resp){
+ SubscriberStore b = SubscriberStore.instance();
+ System.out.println("Notifier.filter()");
+ b.notify(req);
+ }
+}
+
+
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEndPort.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEndPort.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEndPort.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionEndPort.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,23 @@
+/*
+ * 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.eventing.services;
+
+public class SubscriptionEndPort{
+ public void subscriptionEnd(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body) throws java.rmi.RemoteException {
+ System.out.println("SubscriptionEnd"+body.xmlText());
+ }
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManagerPort.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManagerPort.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManagerPort.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriptionManagerPort.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,90 @@
+/**
+ * SubscriptionManagerBindingImpl.java
+ *
+ * This file was auto-generated from WSDL
+ * by the Apache Axis 1.2RC2 Dec 19, 2004 (04:36:14 CET) WSDL2Java emitter.
+ */
+
+package org.apache.ws.eventing.services;
+import org.apache.ws.addressing.*;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import javax.xml.soap.SOAPHeader;
+
+import org.apache.ws.eventing.Subscription;
+import org.apache.ws.eventing.YFilterStore;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.*;
+
+public class SubscriptionManagerPort {
+
+ public static String extractIdentifier() /*throws javax.xml.soap.SOAPException*/{
+ //TODO !!!! extract identifier from Header
+ //first try to become wse:Identifier
+/*
+ MessageContext mC = MessageContext.getCurrentContext();
+ SOAPHeader h =mC.getMessage().getSOAPHeader();
+ NodeList it = h.getElementsByTagNameNS("http://schemas.xmlsoap.org/ws/2004/08/eventing", "Identifier");
+ if(it.getLength()==0)
+ throw new javax.xml.soap.SOAPException("<wse:Identifier> Tag is missing in the Header.... i dunno which Subscription you mean");
+ Node idnode = it.item(0);
+ if((idnode.getFirstChild()!=null)&&(idnode.getFirstChild().getNodeType()==Node.TEXT_NODE))
+ return(idnode.getFirstChild().getNodeValue());
+ else
+ throw new javax.xml.soap.SOAPException("<wse:Identifier> Tag is empty in the Header.... i dunno which Subscription you mean");
+ **/
+ return("1");
+ }
+
+ public RenewResponseDocument renewMsg(RenewDocument body) throws java.rmi.RemoteException {
+ String id = extractIdentifier();
+
+ YFilterStore b = YFilterStore.instance();
+ Subscription s = (org.apache.ws.eventing.Subscription)b.getSubscription(id);
+ //update expiration
+ //TODO test Calendar
+ s.setTerminationTime((java.util.Calendar)body.getRenew().getExpires());
+
+ RenewResponseDocument responseDom = RenewResponseDocument.Factory.newInstance();
+ RenewResponseDocument.RenewResponse response = responseDom.addNewRenewResponse();
+ //TODO test Calendar
+ response.setExpires(s.getTerminationTime());
+
+ return(responseDom);
+ }
+
+ public GetStatusResponseDocument getStatusMsg(GetStatusDocument body) throws java.rmi.RemoteException {
+// try{
+ String id = extractIdentifier();
+ //ask the Broker about the Status
+ YFilterStore b = YFilterStore.instance();
+ Subscription s = (org.apache.ws.eventing.Subscription)b.getSubscription(id);
+
+ //build response
+ GetStatusResponseDocument responseDom = GetStatusResponseDocument.Factory.newInstance();
+ GetStatusResponseDocument.GetStatusResponse response = responseDom.addNewGetStatusResponse();
+ //TODO check calendar
+ response.setExpires(s.getTerminationTime());
+ return(responseDom);
+/* }catch(Exception e){
+ e.printStackTrace();
+ throw new java.rmi.RemoteException("getStatusMsg",e);
+ }
+ **/
+ }
+
+ public void unsubscribeMsg(UnsubscribeDocument body) throws java.rmi.RemoteException {
+ try{
+ String id = extractIdentifier();
+ System.out.println("unsubscribe Subscription: "+id);
+ YFilterStore b = YFilterStore.instance();
+ b.removeSubscription(id);
+
+ }catch(Exception e){
+ e.printStackTrace();
+ throw new java.rmi.RemoteException("unsubscribeMsg",e);
+ }
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java?view=auto&rev=151154
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java Thu Feb 3 05:46:26 2005
@@ -0,0 +1,45 @@
+/*=============================================================================*
+ * Copyright 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.eventing;
+
+/**
+ *
+ * @author Administrator
+ */
+import org.apache.ws.addressing.*;
+import javax.xml.soap.*;
+
+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, EndpointReference epr ) throws SOAPException{
+ SOAPConnectionFactory sconF= SOAPConnectionFactory.newInstance();
+ SOAPConnection scon = sconF.createConnection();
+ return(scon.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