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/03/21 01:29:29 UTC
svn commit: r158382 - in
incubator/hermes/trunk/src/java/org/apache/ws/eventing: ./ app/
porttype/impl/ pubsub/ services/ services/broker/ services/publisher/
services/subscriber/
Author: lischke
Date: Sun Mar 20 16:29:26 2005
New Revision: 158382
URL: http://svn.apache.org/viewcvs?view=rev&rev=158382
Log:
added pubsub package which contains client impl for pubsub API
Added:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardEndConsumer.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/simpleNotificationPortTypeImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Publisher.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/BrokerService.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/PublisherService.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriberService.java
Removed:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Filter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Publisher.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/RemoteSubscriptionHome.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscriber.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/TopicFilter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/XPathFilter.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/app/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/broker/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/publisher/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/subscriber/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/wsaSOAPConnection.java
Modified:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java
Modified: 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=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/AbstractSubscription.java Sun Mar 20 16:29:26 2005
@@ -11,7 +11,7 @@
* 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.
+ * limitations under the License.
*/
package org.apache.ws.eventing;
@@ -30,39 +30,34 @@
public abstract class AbstractSubscription implements org.apache.ws.pubsub.Subscription, org.apache.ws.resource.Resource {
- private NotificationConsumer consumer;
- private EndpointReference epr;
- private String QueryID;
+ protected NotificationConsumer consumer;
+ protected SubscriptionEndConsumer endconsumer;
+ protected EndpointReference epr;
+
protected String m_id;
protected Calendar m_terminationTime;
protected Calendar m_creationTime;
protected ResourceHome rH;
protected ResourceKey rK;
+ protected boolean m_usenotify;
+
public EndpointReference getEpr(){
return this.epr;
}
+
public void setResourceKey(ResourceKey rK){
this.rK=rK;
}
+ public ResourceKey getResourceKey(){
+ return(this.rK);
+ }
public void setResourceHome(ResourceHome rH){
this.rH=rH;
}
public void setEpr(EndpointReference epr){
this.epr=epr;
}
-
- 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 Object getID(){
return this.m_id;
@@ -70,22 +65,21 @@
public void setID(Object id){
this.m_id=(String)id;
}
-
public void setNotificationConsumer(NotificationConsumer consumer) {
this.consumer = consumer;
}
- public void pause() {
+ public void setSubscriptionEndConsumer(SubscriptionEndConsumer endconsumer) {
+ this.endconsumer = endconsumer;
}
-
- public void resume() {
- }
-
-
+
public NotificationConsumer getNotificationConsumer() {
return this.consumer;
}
+ public SubscriptionEndConsumer getSubscriptionEndConsumer() {
+ return this.endconsumer;
+ }
public NotificationProducer getNotificationProducer() {
return null;
}
@@ -93,12 +87,8 @@
return m_creationTime;
}
- public Object getSubscriptionPolicy() {
- return null;
- }
-
- public java.net.URI getDeliveryMode(){
- return null;
+ public boolean getUseNotify(){
+ return m_usenotify;
}
public org.apache.ws.pubsub.Filter getFilters(){
return null;
@@ -106,13 +96,9 @@
public java.util.Calendar getTerminationTime(){
return m_terminationTime;
- }
-
+ }
public void addTerminationListener(ResourceTerminationListener resourceTerminationListener)
{
- ;//this is a no op todo Stefan I need to know if you want to leverege this
- }
- public boolean isPaused(){return false;}
-
- public abstract void notify(String xml);
+ //this is a no op todo Stefan I need to know if you want to leverege this
+ }
}
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=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardConsumer.java Sun Mar 20 16:29:26 2005
@@ -17,56 +17,55 @@
import org.apache.ws.addressing.*;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ws.pubsub.emitter.EmitterTask;
+
+import org.apache.ws.pubsub.*;
+
import javax.xml.soap.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+
public class ForwardConsumer implements org.apache.ws.pubsub.NotificationConsumer {
private static final Log LOG = LogFactory.getLog( ForwardConsumer.class.getName() );
- public EndpointReference notifyTOepr;
- public EndpointReference endTOepr;
+ public EndpointReference epr;
- public ForwardConsumer(EndpointReference ntepr, EndpointReference etepr){
- this.notifyTOepr=ntepr;
- if(etepr!=null)
- this.endTOepr=etepr;
- else
- this.endTOepr=ntepr;
+ public ForwardConsumer(EndpointReference epr){
+ this.epr=epr;
}
public EndpointReference getEPR(){
- return this.notifyTOepr;
+ return this.epr;
}
public void setEPR( EndpointReference epr ){
- this.notifyTOepr=epr;
- }
-
- public int getMode(){
- return 0;
+ this.epr=epr;
}
- public void setMode( int mode ){
-
- }
public void notify( org.apache.ws.pubsub.Subscription subscription, Object message ){
- LOG.info("ForwardConsumer ");
+ LOG.info("ForwardConsumer :"+this.epr.getAddress());
try{
+ //now call
+ wsaSOAPConnection sconn = wsaSOAPConnection.newInstance();
MessageFactory mf = MessageFactory.newInstance();
SOAPMessage soapm = mf.createMessage();
- //put SOAPBody
- soapm.getSOAPBody().addDocument((org.w3c.dom.Document) message);
+
+ //DocumentBuilder builder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ //org.w3c.dom.Document dom = builder.parse(new java.io.ByteArrayInputStream(((String) message).getBytes()));
+
+ //put Message into SOAPBody
+ if(subscription.getUseNotify()==true){
+ SOAPElement se = soapm.getSOAPBody().addChildElement("http://schemas.xmlsoap.org/ws/2004/08/eventing","Notify");
+ se.addChildElement((SOAPElement)((org.apache.axis.message.SOAPBody)message).getChildElements().next());
+ }else
+ soapm.getSOAPBody().addChildElement((SOAPElement)((org.apache.axis.message.SOAPBody)message).getChildElements().next());
- EmitterTask.createEmitterTask( soapm, new java.net.URL( this.notifyTOepr.getAddress().toString() ) );
+ sconn.call(soapm, epr);
}catch(Exception e){
e.printStackTrace();
- }
+ }
}
- public void end(org.apache.ws.pubsub.Subscription subscription, java.net.URI status, String reason){
-
- }
-
-
}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardEndConsumer.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardEndConsumer.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardEndConsumer.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/ForwardEndConsumer.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,76 @@
+/*
+ * 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.addressing.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.ws.pubsub.*;
+
+import javax.xml.soap.*;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument.SubscriptionEnd;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.LanguageSpecificStringType;
+
+public class ForwardEndConsumer implements org.apache.ws.pubsub.SubscriptionEndConsumer {
+ private static final Log LOG = LogFactory.getLog( ForwardEndConsumer.class.getName() );
+
+ public EndpointReference epr;
+
+
+ public ForwardEndConsumer(EndpointReference epr){
+ this.epr=epr;
+ }
+
+ public EndpointReference getEPR(){
+ return this.epr;
+ }
+
+ public void setEPR( EndpointReference epr ){
+ this.epr=epr;
+ }
+
+ public void end(org.apache.ws.pubsub.Subscription subscription, String reason){
+ //TODO maybe unsubscribe myself
+ if(epr==null){
+ LOG.info("SubscriptionEnd without notification");
+ return;
+ }
+ //send SubscriptionEnd Notification
+ SubscriptionEndDocument sedom = SubscriptionEndDocument.Factory.newInstance();
+ SubscriptionEndDocument.SubscriptionEnd se = sedom.addNewSubscriptionEnd();
+ LanguageSpecificStringType reasont = se.addNewReason();
+ reasont.setStringValue(reason);
+ 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) sedom.newDomNode());
+
+ sconn.call(soapm, epr);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+
+}
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=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/Subscription.java Sun Mar 20 16:29:26 2005
@@ -12,94 +12,77 @@
* 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.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument.Unsubscribe;
-import org.xmlsoap.schemas.ws.x2004.x08.addressing.*;
+
+import org.apache.ws.util.uuid.UuidGenerator;
+import org.apache.ws.util.uuid.UuidGeneratorFactory;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import java.util.Calendar;
-import org.apache.xmlbeans.XmlCursor;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.lifetime.ResourceTerminationListener;
-import org.apache.ws.addressing.*;
import javax.xml.soap.*;
+
+import java.util.Calendar;
+
+import org.apache.ws.pubsub.*;
/**
*
* @author Stefan Lischke
*/
-public class Subscription extends AbstractSubscription{
- private static final Log LOG = LogFactory.getLog( Subscriber.class.getName() );
-
- private EndpointReferenceType sMan;
+public class Subscription extends AbstractSubscription implements ScheduledResourceTerminationResource{
+ private static final Log LOG = LogFactory.getLog( Subscription.class.getName() );
- /** Creates a new instance of Subscription */
- public Subscription(SubscribeResponseDocument.SubscribeResponse sresdom) {
- sMan = sresdom.getSubscriptionManager();
- super.setEpr(new XmlBeansEndpointReference(sMan));
- //get id with XmlCursor;
- XmlCursor xc = sMan.getReferenceProperties().newCursor();
- xc.toChild("http://schemas.xmlsoap.org/ws/2004/08/eventing","Identifier");
- setID(xc.getTextValue());
- if(getID()==null)
- throw new RuntimeException("There is no Subscription Id");
-
- this.m_creationTime = Calendar.getInstance();
- LOG.info("new local Subscription : "+getID()+" SubscriptionManager: "+ sMan.getAddress());
- //TODO HACK
+ private static final UuidGenerator UUID_GEN = UuidGeneratorFactory.createUUIdGenerator();
+ private String QueryID;
+ private Filter m_filter;
+ private java.net.URI m_delivery;
+ public Subscription(Filter filter, Calendar expires, java.net.URI delivery){
+ m_id = UUID_GEN.generateUuid();
+ m_creationTime= Calendar.getInstance();
+ m_filter = filter;
+ setTerminationTime(expires);
+ m_delivery=delivery;
+ }
+ public Filter getFilter()throws Exception{
+// LOG.info("getFilterString : "+this.subdom.getSubscribe().getFilter().newCursor().getTextValue());
+ return this.m_filter;
+ }
+ public String getQueryID(){
+ return QueryID;
+ }
+ public void setQueryID(String q){
+ this.QueryID = q;
}
-
public void unsubscribe(){
- UnsubscribeDocument usdom= UnsubscribeDocument.Factory.newInstance();
- UnsubscribeDocument.Unsubscribe us = usdom.addNewUnsubscribe();
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) usdom.newDomNode());
-
- sconn.call(soapm,sMan.getAddress().getStringValue(),(String) getID());
+ this.rH.remove(this.rK);
}catch(Exception e){
e.printStackTrace();
- }
+ //TODO
+ }
+ destroy();
}
- public void setTerminationTime( java.util.Calendar terminationTime ){
- //TODO call SubscriptionManager
- RenewDocument rdom = RenewDocument.Factory.newInstance();
- RenewDocument.Renew r = rdom.addNewRenew();
- r.setExpires(terminationTime);
- 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) rdom.newDomNode());
-
- sconn.call(soapm,sMan.getAddress().getStringValue(),(String) getID());
- }catch(Exception e){
- e.printStackTrace();
- }
- }
- public java.util.Calendar getTerminationTime(){
- //TODO maybe call GetStatus to get Termination time
- return m_terminationTime;
- }
public void destroy() {
- System.out.println("local destroy");
+ getSubscriptionEndConsumer().end(this,"killya");
+ LOG.info("destroyed");
}
public void init() {
- System.out.println("local init");
- }
-
- public void notify(String xml) {
- getNotificationConsumer().notify(this,xml);
+ LOG.info("init");
+ }
+
+ public void setTerminationTime(java.util.Calendar terminationTime) {
+ LOG.info("Remote setTerminationTime "+terminationTime);
+ m_terminationTime = terminationTime;
}
+ public Calendar getCurrentTime()
+ {
+ return Calendar.getInstance();
+ }
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java?view=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/SubscriptionHome.java Sun Mar 20 16:29:26 2005
@@ -13,40 +13,180 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
package org.apache.ws.eventing;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
-
+import edu.berkeley.cs.db.yfilter.filter.EXfilterBasic;
+import edu.berkeley.cs.db.yfilter.filter.SystemGlobals;
+import edu.berkeley.cs.db.yfilterplus.queryparser.Query;
+import edu.berkeley.cs.db.yfilterplus.queryparser.XPQuery;
+import edu.berkeley.cs.db.yfilterplus.xmltree.XMLTree;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.resource.InvalidResourceKeyException;
import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.RemoveCallback;
+import org.apache.ws.resource.RemoveNotSupportedException;
+import org.apache.ws.resource.Resource;
+import org.apache.ws.resource.ResourceException;
+import org.apache.ws.resource.ResourceKey;
+import org.apache.ws.resource.ResourceUnknownException;
import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.AttributedURI;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
import javax.xml.namespace.QName;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-/**
- *
- * @author Stefan Lischke
- */
-public class SubscriptionHome extends org.apache.ws.resource.impl.AbstractResourceHome {
- private static final String SERVICE_NAME = "NotificationPort";
- public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
- private static final Log LOG = LogFactory.getLog( RemoteSubscriptionHome.class.getName() );
-
- public Subscription create(SubscribeResponseDocument.SubscribeResponse sresdom){
- Subscription s = new Subscription(sresdom);
- String id = (String) s.getID();
+import java.util.Calendar;
- SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), id);
- add(resourceKey,s);
- return s;
+import org.apache.ws.pubsub.*;
+
+public class SubscriptionHome extends org.apache.ws.resource.impl.AbstractResourceHome{
+ private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
+
+ private static final String SERVICE_NAME = "SubscriptionManager";
+ public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
+
+ public int c=0;
+
+// private java.util.HashMap subs;
+ private java.util.HashMap queriesBack;
+ private String[] queries;
+
+ EXfilterBasic yfilter;
+
+ /** Creates a new instance of ResourceHome */
+ public SubscriptionHome() {
+ yfilter = new EXfilterBasic();
+ // subs= new java.util.HashMap();
+ queriesBack= new java.util.HashMap();
+ queries= new String[1000000];
+ LOG.info("ResourceHome"+this.toString());
}
public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
- LOG.info("getInstance SubscriptionHome");
+ LOG.info("getInstance ResourceHome");
return find( resourceContext.getResourceKey() );
- }
+ }
+
+ public Subscription create(Filter filter, Calendar expires, java.net.URI delivery){
+ Subscription rs = new Subscription(filter,expires, delivery);
+ rs.setResourceHome(this);
+ String id = (String) rs.getID();
+
+ SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), id);
+ rs.setEpr(getEPR(resourceKey));
+ rs.setResourceKey(resourceKey);
+
+ addSubscription(rs);
+ return rs;
+ }
+
+/*
+ *-------------------------------------------------------------------
+ */
+
+ private void addSubscription(Subscription s){
+ try{
+ c++;
+ Query query = XPQuery.parseQuery((String)s.getFilter().getExpression(),c);
+ LOG.info("addSubscription "+s.getID()+" query :"+query);
+ yfilter.addQuery(query);
+
+ add(s.getResourceKey(),s);
+ queriesBack.put(s.getID(),query);
+ queries[c]=(String)s.getID();
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ /*
+ public Resource find( ResourceKey key ) throws ResourceException {
+ LOG.info("find "+ key.getValue()+" have "+subs.size());
+ if(subs.containsKey(key.getValue())){
+ RemoteSubscription s = (RemoteSubscription)subs.get(key.getValue());
+ return s;
+ }else
+ throw new ResourceUnknownException();
+ }
+ */
+ /**
+ * Removes a resource. If the resource implements the {@link RemoveCallback RemoveCallback} interface, the
+ * implementation must invoke the remove() operation on the resource itself.
+ *
+ * @throws ResourceUnknownException if no resource exists with the given key
+ * @throws InvalidResourceKeyException if the resource key is invalid.
+ * @throws RemoveNotSupportedException if remove operation is not supported.
+ * @throws ResourceException if any other error occurs.
+ */
+ public void remove( ResourceKey key ) throws ResourceException {
+ LOG.info("removeSubscription : "+key.getValue());
+ Query q=(Query)queriesBack.get(key.getValue());
+ yfilter.deleteQuery(q,q.getQueryId());
+ //TODO remove from Hashmap
+ super.remove(key);
+ }
+
+ public void notify(Object message) {
+ //first check dialect
+ try{
+ org.apache.axis.message.SOAPEnvelope env = (org.apache.axis.message.SOAPEnvelope)message;
+ String xml = org.apache.axis.utils.XMLUtils.ElementToString(env.getBody());
+ LOG.info("Notify: ");
+ LOG.info("--"+xml+"--");
+ //copy
+
+ //first parse and drive YFilter,
+ XMLTree tree = new XMLTree(new java.io.StringReader(xml));
+ yfilter.setEventSequence(tree.getEvents());
+ yfilter.startParsing();
+
+ // print the matched queries //
+ if (SystemGlobals.hasQueries) {
+ yfilter.printQueryResults(System.out);
+ }else{
+ LOG.info("no match");
+ }
+ //get matches
+ java.util.Iterator it= yfilter.getMatchedQueries().iterator();
+ while(it.hasNext()){
+ Integer qid = (Integer) it.next();
+ String sid = queries[qid.intValue()];
+ SimpleTypeResourceKey rk = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), sid);
+ Subscription s = (Subscription)super.find(rk);
+ //notify matches
+ LOG.info("notify : "+sid);
+ s.getNotificationConsumer().notify(s,env.getBody());
+ }
+ yfilter.clear();
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ public EndpointReference getEPR( ResourceKey resourceKey) {
+ //TODO !!!!! woher kommt publisher epr url ???
+ //TODO HACK for tcpmon 12345-8080
+ String subscriptionAddress = "http://localhost:12345/axis/services/SubscriptionManager";
+
+ EndpointReferenceDocument eprDoc = EndpointReferenceDocument.Factory.newInstance();
+ EndpointReferenceType epr = eprDoc.addNewEndpointReference();
+ AttributedURI address = epr.addNewAddress();
+ address.setStringValue( subscriptionAddress );
+ // TODO: set portType and serviceName! (read from config file)
+ ReferencePropertiesType refProps = epr.addNewReferenceProperties();
+
+ XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps, resourceKey.getName() );
+ XmlCursor xmlCursor = xmlObject.newCursor();
+ xmlCursor.setTextValue(resourceKey.getValue().toString());
+ xmlCursor.dispose();
+ return new XmlBeansEndpointReference(epr);
+ }
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java?view=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java Sun Mar 20 16:29:26 2005
@@ -23,54 +23,93 @@
import org.apache.ws.XmlObjectWrapper;
import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+
import java.rmi.RemoteException;
import org.apache.ws.eventing.porttype.EventSourcePortType;
-import org.apache.ws.eventing.RemoteSubscription;
-import org.apache.ws.eventing.RemoteSubscriptionHome;
-
+import org.apache.ws.eventing.Subscription;
+import org.apache.ws.eventing.SubscriptionHome;
import org.apache.ws.eventing.ForwardConsumer;
+import org.apache.ws.eventing.ForwardEndConsumer;
+import org.apache.ws.pubsub.Filter;
+
+import org.apache.ws.pubsub.TopicFilter;
+import org.apache.ws.pubsub.FilterFactory;
+
+//import org.apache.ws.notification.topics.*;
import org.apache.ws.addressing.*;
import javax.naming.Context;
import javax.naming.InitialContext;
+import java.util.Collection;
+import java.util.Calendar;
-public class EventSourcePortTypeImpl implements EventSourcePortType {
+//ws-topics stuff
+//import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener;
+
+import org.apache.ws.resource.ResourceContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class EventSourcePortTypeImpl /*extends AbstractResourcePropertiesPortType*/ implements EventSourcePortType {
+ private static final Log LOG = LogFactory.getLog( EventSourcePortTypeImpl.class.getName() );
+/* public EventSourcePortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ LOG.info("new EventSourcePortTypeImpl");
+ }
+*/
public SubscribeResponseDocument subscribe(SubscribeDocument body) throws RemoteException {
+ LOG.info("subscribe");
try{
//create Subscription
Context initialContext = new InitialContext( );
//System.out.println("get RemoteResourceSubscriptionHome " + RemoteSubscriptionHome.HOME_LOCATION);
- RemoteSubscriptionHome sH = (RemoteSubscriptionHome) initialContext.lookup( RemoteSubscriptionHome.HOME_LOCATION );
-
- RemoteSubscription subscription = sH.create(body);
+ SubscriptionHome sH = (SubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
+
//create NotifyTO EPR
EndpointReference notifyto=null;
if(body.getSubscribe().getDelivery().getNotifyTo()!=null)
- notifyto= new XmlBeansEndpointReference(body.getSubscribe().getDelivery().getNotifyTo());
+ notifyto= new XmlBeansEndpointReference(body.getSubscribe().getDelivery().getNotifyTo());
+
//create EndTO EPR
- EndpointReference endto=null;
+ EndpointReference endto=null;
if(body.getSubscribe().getEndTo()!=null)
- endto= new XmlBeansEndpointReference(body.getSubscribe().getEndTo());
+ endto= new XmlBeansEndpointReference(body.getSubscribe().getEndTo());
+
+ Filter filter = FilterFactory.createFilter(body.getSubscribe().getFilter());
+ Calendar expires = (Calendar) body.getSubscribe().getExpires();
+
+ //getDeliveryMode
+ java.net.URI delivery = null;
+ if(body.getSubscribe().getDelivery().getMode()!=null)
+ delivery = new java.net.URI(body.getSubscribe().getDelivery().getMode());
+ Subscription subscription = sH.create(filter,expires,delivery);
+ subscription.setNotificationConsumer(new ForwardConsumer(notifyto));
+ subscription.setSubscriptionEndConsumer(new ForwardEndConsumer(endto));
- subscription.setNotificationConsumer(new ForwardConsumer(notifyto,endto));
+
+ //check if topic expression
+// if(filter instanceof TopicFilter == true){
+// Collection collection = evaluateTopicExpression((TopicFilter)filter);
+// SimpleSubscriptionTopicListener simpleSubscriptionTopicListener = new SimpleSubscriptionTopicListener(subscription);
+ //add listeners
+// for (Iterator iterator = collection.iterator(); iterator.hasNext();) {
+// Topic topic = (Topic) iterator.next();
+// topic.addTopicListener(simpleSubscriptionTopicListener);
+// }
+// }
+
//build response
SubscribeResponseDocument responseDom= SubscribeResponseDocument.Factory.newInstance();
SubscribeResponseDocument.SubscribeResponse response = responseDom.addNewSubscribeResponse();
response.setSubscriptionManager((EndpointReferenceType) ((XmlObjectWrapper)subscription.getEpr()).getXmlObject());
-/*
- 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");
+ response.setExpires(new org.apache.xmlbeans.XmlCalendar(subscription.getTerminationTime().getTime()));
return responseDom;
}catch(Exception e){
@@ -79,5 +118,23 @@
}
//TODO error
return null;
- }
+ }
+/*
+ private Collection evaluateTopicExpression(TopicExpression topicExpr)
+ throws SOAPException { /*
+ NotificationProducerResource resource = (NotificationProducerResource) getResource();
+ TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet();
+
+ Collection collection = null;
+ try {
+ collection = topicSpaceSet.evaluateExpression(topicExpr);
+ }
+ catch (TopicExpressionException e) {
+ throw new JAXRPCException("An exception occurred during subscription. ", e);
+ }
+ return collection;
+
+ return null;
+ }
+ */
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java?view=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java Sun Mar 20 16:29:26 2005
@@ -17,15 +17,17 @@
package org.apache.ws.eventing.porttype.impl;
import org.apache.axis.message.SOAPEnvelope;
+
import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
import org.apache.ws.resource.properties.NamespaceVersionHolder;
+
import org.apache.ws.resource.ResourceContext;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.apache.ws.eventing.Subscription;
+import org.apache.ws.eventing.pubsub.Subscription;
import org.apache.axis.utils.XMLUtils;
-import org.apache.ws.eventing.RemoteSubscriptionHome;
+import org.apache.ws.eventing.pubsub.SubscriptionHome;
import javax.naming.Context;
@@ -34,28 +36,20 @@
public class NotificationPortTypeImpl extends AbstractResourcePropertiesPortType implements org.apache.ws.eventing.porttype.NotificationPortType{
private static final Log LOG = LogFactory.getLog( NotificationPortTypeImpl.class.getName() );
- private boolean m_broker;
- public NotificationPortTypeImpl( ResourceContext resourceContext,boolean broker)
- {
+ public NotificationPortTypeImpl( ResourceContext resourceContext) {
super( resourceContext );
- m_broker=broker;
- }
+ }
//TODO maybe remove Axis dep
//TODO use WSRF Provider with Message styler
- public void filter(SOAPEnvelope req, SOAPEnvelope resp){
+ public void filter(SOAPEnvelope req, SOAPEnvelope resp){
try{
- String xml =XMLUtils.ElementToString(req.getBody());
- if(m_broker==false){
- Subscription subscription = (Subscription) getResource();
+ String xml =XMLUtils.ElementToString(req.getBody());
+
+ Subscription subscription = (Subscription) getResource();
LOG.info("notification for subscription : "+ subscription.getID());
- subscription.getNotificationConsumer().notify(subscription,xml);
- }else{
- LOG.info("filtering ");
- Context initialContext = new InitialContext( );
- RemoteSubscriptionHome sH = (RemoteSubscriptionHome) initialContext.lookup( RemoteSubscriptionHome.HOME_LOCATION );
- sH.notify(xml);
- }
+ subscription.getNotificationConsumer().notify(subscription,xml);
+
}catch(Exception e){
//TODO
e.printStackTrace();
@@ -68,4 +62,4 @@
}
}
-
+
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java?view=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java Sun Mar 20 16:29:26 2005
@@ -18,12 +18,17 @@
import java.rmi.RemoteException;
import org.apache.ws.eventing.porttype.SubscriptionEndPortType;
-import org.apache.ws.eventing.Subscription;
+import org.apache.ws.eventing.pubsub.Subscription;
+
import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
import org.apache.ws.resource.properties.NamespaceVersionHolder;
+
import org.apache.ws.resource.ResourceContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class SubscriptionEndPortTypeImpl extends AbstractResourcePropertiesPortType implements SubscriptionEndPortType{
+ private static final Log LOG = LogFactory.getLog( SubscriptionEndPortTypeImpl.class.getName() );
public SubscriptionEndPortTypeImpl( ResourceContext resourceContext )
{
@@ -32,6 +37,8 @@
public void subscriptionEnd(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body) throws RemoteException {
Subscription subscription = (Subscription) getResource();
+ subscription.getSubscriptionEndConsumer().end(subscription, body.getSubscriptionEnd().getReasonArray(0).getStringValue());
+ LOG.info("subscriptionEnd");
subscription.destroy();
}
@@ -39,5 +46,4 @@
{
return null; // not currently used - will be needed once we need to support multiple spec versions
}
-
}
Modified: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java?view=diff&r1=158381&r2=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java (original)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java Sun Mar 20 16:29:26 2005
@@ -15,7 +15,7 @@
*/
package org.apache.ws.eventing.porttype.impl;
-import org.apache.ws.eventing.RemoteSubscription;
+import org.apache.ws.eventing.Subscription;
import org.apache.ws.eventing.porttype.SubscriptionManagerPortType;
import org.apache.ws.resource.ResourceContext;
import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
@@ -26,6 +26,7 @@
import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewResponseDocument;
import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
+
import java.rmi.RemoteException;
public class SubscriptionManagerPortTypeImpl extends AbstractResourcePropertiesPortType implements SubscriptionManagerPortType {
@@ -36,7 +37,7 @@
}
public RenewResponseDocument renew(RenewDocument body) throws RemoteException {
- RemoteSubscription subscription = (RemoteSubscription) getResource();
+ Subscription subscription = (Subscription) getResource();
//TODO why no ExpirationType
org.apache.xmlbeans.XmlCalendar et = (org.apache.xmlbeans.XmlCalendar)body.getRenew().getExpires();
subscription.setTerminationTime(et);
@@ -49,7 +50,7 @@
}
public GetStatusResponseDocument getStatus(GetStatusDocument body) throws RemoteException {
- RemoteSubscription subscription = (RemoteSubscription) getResource();
+ Subscription subscription = (Subscription) getResource();
//build response
GetStatusResponseDocument responseDom = GetStatusResponseDocument.Factory.newInstance();
@@ -60,13 +61,15 @@
}
public void unsubscribe(UnsubscribeDocument body) throws RemoteException {
- RemoteSubscription subscription = (RemoteSubscription) getResource();
+ Subscription subscription = (Subscription) getResource();
subscription.unsubscribe();
}
+
protected NamespaceVersionHolder getNamespaceSet()
{
return null; // not currently used - will be needed once we need to support multiple spec versions
}
+
}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/simpleNotificationPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/simpleNotificationPortTypeImpl.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/simpleNotificationPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/simpleNotificationPortTypeImpl.java Sun Mar 20 16:29:26 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.eventing.porttype.impl;
+
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.eventing.Subscription;
+
+
+import org.apache.ws.eventing.SubscriptionHome;
+
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+
+public class simpleNotificationPortTypeImpl implements org.apache.ws.eventing.porttype.NotificationPortType{
+ private static final Log LOG = LogFactory.getLog( NotificationPortTypeImpl.class.getName() );
+ private boolean m_broker;
+
+ //TODO maybe remove Axis dep
+ //TODO use WSRF Provider with Message styler
+ public void filter(SOAPEnvelope req, SOAPEnvelope resp){
+ try{
+ LOG.info("filtering ");
+ Context initialContext = new InitialContext( );
+ SubscriptionHome sH = (SubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
+ sH.notify(req);
+ }catch(Exception e){
+ //TODO
+ e.printStackTrace();
+ }
+ }
+}
+
+
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Publisher.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Publisher.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Publisher.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Publisher.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,97 @@
+/*
+ * 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.pubsub;
+
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPHeader;
+import org.w3c.dom.Document;
+
+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 implements org.apache.ws.pubsub.Publisher{
+
+
+ private String m_url = "http://localhost:7070/axis/services/NotificationPort";
+
+ public Publisher(String url){
+ m_url=url;
+ }
+
+ private 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));
+ }
+
+ private 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
+ */
+ private 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);
+ }
+ private 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;
+ }
+
+ public void publish(Object msg, org.apache.ws.notification.topics.Topic t) {
+ try{
+ publish(m_url,(String)msg);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ //TODO setupaddressingHeaders
+ /*
+ private static AddressingHeaders setUpAddressing() throws Exception {
+ AddressingHeaders headers = new AddressingHeaders();
+ Action a = new Action(new URI("urn:action2"));
+ headers.setAction(a);
+ EndpointReference epr = new EndpointReference("http://www.apache.org");
+ headers.setFaultTo(epr);
+ return headers;
+ }
+ */
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscriber.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,193 @@
+/*
+ * 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.pubsub;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.DeliveryType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.ExpirationType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.FilterType;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+
+import org.apache.ws.util.XmlBeanUtils;
+
+import org.apache.axis.configuration.FileProvider;
+
+import org.apache.ws.pubsub.NotificationProducer;
+import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+import org.apache.ws.pubsub.TopicFilter;
+import org.apache.ws.pubsub.XPathFilter;
+
+import org.apache.ws.pubsub.wsaSOAPConnection;
+
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.axis.AxisProperties;
+import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
+import java.util.Calendar;
+
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import org.apache.ws.util.jndi.XmlBeanJndiUtils;
+
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.ReferencePropertiesType;
+
+import org.apache.xmlbeans.XmlObject;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.ws.util.XmlBeanUtils;
+
+
+
+public class Subscriber implements NotificationProducer {
+ /**
+ * DOCUMENT_ME
+ */
+ private static final Log LOG = LogFactory.getLog( Subscriber.class.getName() );
+
+ private static String WRAPPED_MODE_URI = "http://incubator.apache.org/hermes/pubsub/wrapped";
+ private EndpointReference epr;
+ private SubscriptionHome sH;
+ // private SubscriberStore store;
+
+ public Subscriber(String url,String configfile){
+ //Axis stuff to enable Addressing HandlerChain
+ AxisProperties.setProperty(EngineConfigurationFactoryDefault.OPTION_CLIENT_CONFIG_FILE,"/org/apache/ws/eventing/client-config.wsdd");
+ try{
+ //read jndi-config.xml
+ init(configfile);
+
+ //create EPR TODO clean
+ 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);
+
+ //getlocal SubscriptionHome from jndi-config
+ Context initialContext = new InitialContext( );
+ sH = (SubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
+
+
+
+ }catch (Exception e){
+ e.printStackTrace();
+ }
+ }
+ /**
+ * runs resource discovery.
+ *
+ */
+ public void init(String configfile)
+ throws Exception {
+ LOG.info(this.getClass().getName()+" : initialize with "+configfile);
+ // XmlBeanJndiUtils.initializeFromInputStream(new java.io.FileInputStream(configfile));
+ XmlBeanJndiUtils.initializeFromInputStream(Thread.currentThread().getContextClassLoader().getResourceAsStream(configfile/*XmlBeanJndiUtils.JNDI_CONFIG_FILENAME*/));
+ }
+
+
+ public org.apache.ws.pubsub.Subscription subscribe(NotificationConsumer notificationConsumer, SubscriptionEndConsumer subscriptionEndConsumer, TopicFilter tf, XPathFilter xf, Calendar initialTerminationTime, boolean UseNotify) {
+ //create local Subscription
+ //add to local SubscriptionHome
+ //create ID
+ Subscription ls = this.sH.create();
+ ls.setNotificationConsumer(notificationConsumer);
+ ls.setSubscriptionEndConsumer(subscriptionEndConsumer);
+
+ SubscribeDocument sdom = SubscribeDocument.Factory.newInstance();
+ SubscribeDocument.Subscribe s = sdom.addNewSubscribe();
+
+ //create notifyTo EPR
+ EndpointReferenceType nepr = (EndpointReferenceType)((XmlObjectWrapper)notificationConsumer.getEPR()).getXmlObject();
+ //add ReferenceProperties
+ ReferencePropertiesType refProps = nepr.addNewReferenceProperties();
+ XmlObject xmlObject = XmlBeanUtils.addChildElement( refProps, ls.getResourceKey().getName());
+ XmlCursor xmlCursor = xmlObject.newCursor();
+ xmlCursor.setTextValue(ls.getResourceKey().getValue().toString());
+ xmlCursor.dispose();
+ //notifications are send to:
+ DeliveryType delivery = s.addNewDelivery();
+ delivery.setNotifyTo(nepr);
+ if(UseNotify==true){
+ delivery.setMode(WRAPPED_MODE_URI);
+ }
+
+
+ //create endto EPR
+ EndpointReferenceType eepr = (EndpointReferenceType)((XmlObjectWrapper)subscriptionEndConsumer.getEPR()).getXmlObject();
+ //add ReferenceProperties we already created
+ eepr.setReferenceProperties(refProps);
+ //subscription ends are send to:
+ s.setEndTo(eepr);
+
+ //TODO check Calendar serializing
+ ExpirationType expires = ExpirationType.Factory.newInstance();
+ expires.setObjectValue(initialTerminationTime);
+ s.setExpires(expires);
+
+ //TODO multiple filters
+ //XPathFilter
+ if(xf!=null){
+ FilterType filter = s.addNewFilter();
+ java.net.URI uri = xf.getURI();
+ if(uri!=null)
+ filter.setDialect(uri.toString());
+ filter.newCursor().setTextValue((String)xf.getExpression());
+ }
+ SubscribeResponseDocument.SubscribeResponse sresres=null;
+ 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.getAddress().toString());
+ java.io.ByteArrayOutputStream os = new java.io.ByteArrayOutputStream();
+ subscribeResponse.writeTo(os);
+ EnvelopeDocument sres = EnvelopeDocument.Factory.parse(new java.io.ByteArrayInputStream(os.toByteArray()));
+
+ //TODO handle faults
+ SubscribeResponseDocument sresdom = SubscribeResponseDocument.Factory.parse(sres.getEnvelope().getBody().xmlText());
+ sresres= sresdom.getSubscribeResponse();
+
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ //set SubscriptionManager
+ ls.setSubscriptionManager(new XmlBeansEndpointReference(sresres.getSubscriptionManager()));
+ ls.setNotificationConsumer(notificationConsumer);
+ return ls;
+ }
+
+ public EndpointReference getEPR() {
+ return epr;
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/Subscription.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,113 @@
+/*
+ * 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.pubsub;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument.Unsubscribe;
+//import org.xmlsoap.schemas.ws.x2004.x08.addressing.*;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.util.Calendar;
+import org.apache.xmlbeans.XmlCursor;
+
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.addressing.EndpointReference;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.MessageFactory;
+
+import org.apache.ws.eventing.AbstractSubscription;
+
+import org.apache.ws.util.uuid.UuidGenerator;
+import org.apache.ws.util.uuid.UuidGeneratorFactory;
+
+import org.apache.ws.pubsub.wsaSOAPConnection;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class Subscription extends AbstractSubscription{
+ private static final Log LOG = LogFactory.getLog( Subscriber.class.getName() );
+ private static final UuidGenerator UUID_GEN = UuidGeneratorFactory.createUUIdGenerator();
+
+
+ public Subscription() {
+ setID(UUID_GEN.generateUuid());
+ this.m_creationTime = Calendar.getInstance();
+ LOG.info("new local Subscription : "+getID());
+ }
+
+ public void unsubscribe(){
+ UnsubscribeDocument usdom= UnsubscribeDocument.Factory.newInstance();
+ UnsubscribeDocument.Unsubscribe us = usdom.addNewUnsubscribe();
+ 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) usdom.newDomNode());
+
+ sconn.call(soapm,getEpr());
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+ public void setTerminationTime( java.util.Calendar terminationTime ){
+ //TODO call SubscriptionManager
+ RenewDocument rdom = RenewDocument.Factory.newInstance();
+ RenewDocument.Renew r = rdom.addNewRenew();
+ r.setExpires(terminationTime);
+ 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) rdom.newDomNode());
+
+ sconn.call(soapm,getEpr());
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+ }
+
+ public java.util.Calendar getTerminationTime(){
+ //TODO maybe call GetStatus to get Termination time
+ return m_terminationTime;
+ }
+ public void destroy() {
+ try{
+ this.rH.remove(this.rK);
+ }catch(Exception e){
+ e.printStackTrace();
+ }
+
+ }
+
+ public void init() {
+ System.out.println("local init");
+ }
+
+ public void notify(String xml) {
+ getNotificationConsumer().notify(this,xml);
+ }
+
+ public void setSubscriptionManager(EndpointReference epr){
+ super.setEpr(epr);
+ }
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,104 @@
+/*
+ * 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.pubsub;
+
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+
+import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.impl.SimpleTypeResourceKey;
+
+import javax.xml.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import java.util.Map;
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class SubscriptionHome extends org.apache.ws.resource.impl.AbstractResourceHome /* implements org.apache.ws.resource.ResourceHome*/{
+ private static final String SERVICE_NAME = "SubscriptionEndPort";
+ //private static Map m_resources=new java.util.HashMap();
+
+ public static final String HOME_LOCATION = JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME + "/" + JndiConstants.ATOMIC_NAME_HOME;
+ private static int num=0;
+ private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
+
+ public void SubscriptionHome(){
+ num++;
+ LOG.info("create SubscriptionHome number : "+num);
+ }
+
+
+ public Subscription create(){
+ Subscription s = new Subscription();
+ SimpleTypeResourceKey resourceKey = new SimpleTypeResourceKey( QName.valueOf( getResourceKeyName()), (String) s.getID());
+ s.setResourceKey(resourceKey);
+ s.setResourceHome(this);
+ LOG.info("before add "+ m_resources.size()+" instance "+this);
+ add(resourceKey,s);
+ // m_resources.put(resourceKey,s);
+
+ LOG.info("after add "+ m_resources.size());
+ return s;
+ }
+
+ public org.apache.ws.resource.Resource getInstance(org.apache.ws.resource.ResourceContext resourceContext) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.ResourceContextException, org.apache.ws.resource.ResourceUnknownException {
+ LOG.info("getInstance "+ m_resources.size()+" SubscriptionHome : "+resourceContext.getResourceKey().getValue()+ " instance "+this);
+ return find( resourceContext.getResourceKey() );
+ }
+ /*
+ public org.apache.ws.resource.Resource find(org.apache.ws.resource.ResourceKey key) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.NoSuchResourceException, org.apache.ws.resource.InvalidResourceKeyException {
+ return((org.apache.ws.resource.Resource)m_resources.get(key));
+ }
+ */
+ /*
+ public String getResourceClassName() {
+ }
+
+ public String getResourceKeyClassName() {
+ }
+
+ public String getResourceKeyName() {
+ }
+
+ public String getServiceClassName() {
+ }
+
+ public String getWsdlTargetNamespace() {
+ }*/
+
+ public void remove(org.apache.ws.resource.ResourceKey key) throws org.apache.ws.resource.ResourceException, org.apache.ws.resource.NoSuchResourceException, org.apache.ws.resource.InvalidResourceKeyException, org.apache.ws.resource.RemoveNotSupportedException {
+ }
+ /*
+ public void setResourceClassName(String className) {
+ }
+
+ public void setResourceKeyClassName(String className) {
+ }
+
+ public void setResourceKeyName(String keyName) {
+ }
+
+ public void setServiceClassName(String className) {
+ }
+
+ public void setWsdlTargetNamespace(String targetNamespace) {
+ }
+ */
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/BrokerService.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/BrokerService.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/BrokerService.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/BrokerService.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,59 @@
+/*
+ * 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.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+import org.apache.ws.eventing.porttype.*;
+import org.apache.ws.eventing.porttype.impl.*;
+
+public class BrokerService extends AbstractService implements SubscriptionEndPortType, NotificationPortType,EventSourcePortType, SubscriptionManagerPortType {
+
+ public BrokerService(){
+ }
+ public BrokerService(ResourceContext resourceContext)
+ {
+ m_resourceContext = resourceContext;
+ init();
+ }
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument subscribe(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument body) throws java.rmi.RemoteException {
+ return new EventSourcePortTypeImpl(/*getResourceContext()*/).subscribe(body);
+ }
+
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusResponseDocument getStatus(org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusDocument body) throws java.rmi.RemoteException {
+ return new SubscriptionManagerPortTypeImpl(getResourceContext()).getStatus(body);
+ }
+
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewResponseDocument renew(org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument body) throws java.rmi.RemoteException {
+ return new SubscriptionManagerPortTypeImpl(getResourceContext()).renew(body);
+ }
+
+
+ public void unsubscribe(org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument body) throws java.rmi.RemoteException {
+ new SubscriptionManagerPortTypeImpl(getResourceContext()).unsubscribe(body);
+ }
+
+ public void subscriptionEnd(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body) throws java.rmi.RemoteException {
+ new SubscriptionEndPortTypeImpl(getResourceContext()).subscriptionEnd(body);
+ }
+
+ public void filter(org.apache.axis.message.SOAPEnvelope req, org.apache.axis.message.SOAPEnvelope resp) {
+ new simpleNotificationPortTypeImpl().filter(req, resp);
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/PublisherService.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/PublisherService.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/PublisherService.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/PublisherService.java Sun Mar 20 16:29:26 2005
@@ -0,0 +1,54 @@
+/*
+ * 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.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+import org.apache.ws.eventing.porttype.EventSourcePortType;
+import org.apache.ws.eventing.porttype.impl.EventSourcePortTypeImpl;
+
+import org.apache.ws.eventing.porttype.SubscriptionManagerPortType;
+import org.apache.ws.eventing.porttype.impl.SubscriptionManagerPortTypeImpl;
+
+public class PublisherService extends AbstractService implements EventSourcePortType, SubscriptionManagerPortType {
+
+ public PublisherService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init();
+ }
+
+
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument subscribe(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument body) throws java.rmi.RemoteException {
+ return new EventSourcePortTypeImpl(/*getResourceContext()*/).subscribe(body);
+ }
+
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusResponseDocument getStatus(org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusDocument body) throws java.rmi.RemoteException {
+ return new SubscriptionManagerPortTypeImpl(getResourceContext()).getStatus(body);
+ }
+
+ public org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewResponseDocument renew(org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument body) throws java.rmi.RemoteException {
+ return new SubscriptionManagerPortTypeImpl(getResourceContext()).renew(body);
+ }
+
+
+ public void unsubscribe(org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument body) throws java.rmi.RemoteException {
+ new SubscriptionManagerPortTypeImpl(getResourceContext()).unsubscribe(body);
+ }
+
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriberService.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriberService.java?view=auto&rev=158382
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriberService.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/services/SubscriberService.java Sun Mar 20 16:29:26 2005
@@ -0,0 +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.eventing.services;
+
+import org.apache.ws.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+import org.apache.ws.eventing.porttype.NotificationPortType;
+import org.apache.ws.eventing.porttype.impl.NotificationPortTypeImpl;
+
+import org.apache.ws.eventing.porttype.SubscriptionEndPortType;
+import org.apache.ws.eventing.porttype.impl.SubscriptionEndPortTypeImpl;
+
+public class SubscriberService extends AbstractService implements SubscriptionEndPortType, NotificationPortType {
+
+ public SubscriberService(ResourceContext resourceContext)
+ {
+ m_resourceContext = resourceContext;
+ init();
+ }
+
+ public void subscriptionEnd(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body) throws java.rmi.RemoteException {
+ new SubscriptionEndPortTypeImpl(getResourceContext()).subscriptionEnd(body);
+ }
+
+ public void filter(org.apache.axis.message.SOAPEnvelope req, org.apache.axis.message.SOAPEnvelope resp) {
+ new NotificationPortTypeImpl(getResourceContext()).filter(req, resp);
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: hermes-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: hermes-dev-help@ws.apache.org