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/06 15:23:15 UTC
svn commit: r151587 - in
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype: ./
EventSourcePortType.java SubscriptionEndPortType.java
SubscriptionManagerPortType.java impl/ impl/EventSourcePortTypeImpl.java
impl/NotificationPortTypeImpl.java impl/SubscriptionEndPortTypeImpl.java
impl/SubscriptionManagerPortTypeImpl.java
Author: lischke
Date: Sun Feb 6 06:23:12 2005
New Revision: 151587
URL: http://svn.apache.org/viewcvs?view=rev&rev=151587
Log:
added porttypes (apollo styler)
Added:
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/EventSourcePortType.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionEndPortType.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java
incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/
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
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/EventSourcePortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/EventSourcePortType.java?view=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/EventSourcePortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/EventSourcePortType.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,22 @@
+/* Generated by Together */
+
+package org.apache.ws.eventing.porttype;
+
+import java.rmi.RemoteException;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+
+/**
+ * This is the Port of the Publisher,
+ * it enables Subscriptions.
+ */
+public interface EventSourcePortType {
+ /**
+ *
+ * @param body
+ * @throws RemoteException
+ * @return
+ */
+ SubscribeResponseDocument subscribe(SubscribeDocument body) throws RemoteException;
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionEndPortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionEndPortType.java?view=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionEndPortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionEndPortType.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,10 @@
+/* Generated by Together */
+
+package org.apache.ws.eventing.porttype;
+
+import java.rmi.RemoteException;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument;
+
+public interface SubscriptionEndPortType {
+ void subscriptionEnd(SubscriptionEndDocument body) throws RemoteException;
+}
Added: incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java?view=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,19 @@
+/* Generated by Together */
+
+package org.apache.ws.eventing.porttype;
+
+import java.rmi.RemoteException;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewResponseDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusResponseDocument;
+
+
+public interface SubscriptionManagerPortType {
+ RenewResponseDocument renewMsg(RenewDocument body) throws RemoteException;
+
+ void unsubscribeMsg(UnsubscribeDocument body) throws RemoteException;
+
+ GetStatusResponseDocument getStatusMsg(GetStatusDocument body) throws RemoteException;
+}
Added: 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=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,69 @@
+/*
+ * 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.ws.addressing.*;
+
+import org.apache.ws.eventing.YFilterStore;
+import org.apache.ws.eventing.RemoteSubscription;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+
+import javax.xml.namespace.QName;
+import java.rmi.RemoteException;
+
+import org.apache.ws.eventing.porttype.EventSourcePortType;
+
+public class EventSourcePortTypeImpl implements EventSourcePortType {
+
+ public SubscribeResponseDocument subscribe(SubscribeDocument body) throws RemoteException {
+ //create Subscription
+ Context initialContext = new InitialContext( );
+ RemoteSubscriptionHome sH = (RemoteSubscriptionHome) initialContext.lookup( SubscriptionHome.HOME_LOCATION );
+
+ RemoteSubscription subscription = sH.create(, getResourceKey(), ((AbstractResourceContext)getResourceContext()).getResourceHomeLocation());
+ 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/porttype/impl/NotificationPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java?view=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java Sun Feb 6 06:23:12 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.porttype.impl;
+
+import org.apache.axis.message.*;
+
+import org.apache.ws.eventing.SubscriberStore;
+
+
+public class NotificationPortTypeImpl{
+
+ //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/porttype/impl/SubscriptionEndPortTypeImpl.java
URL: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java?view=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,25 @@
+/*
+ * 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 java.rmi.RemoteException;
+import org.apache.ws.eventing.porttype.SubscriptionEndPortType;
+public class SubscriptionEndPortTypeImpl implements SubscriptionEndPortType{
+ public void subscriptionEnd(org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body) throws RemoteException {
+ System.out.println("SubscriptionEnd"+body.xmlText());
+ }
+}
Added: 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=auto&rev=151587
==============================================================================
--- incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java (added)
+++ incubator/hermes/trunk/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java Sun Feb 6 06:23:12 2005
@@ -0,0 +1,92 @@
+/**
+ * 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.porttype.impl;
+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.*;
+import java.rmi.RemoteException;
+import org.apache.ws.eventing.porttype.SubscriptionManagerPortType;
+
+public class SubscriptionManagerPortTypeImpl implements SubscriptionManagerPortType {
+
+ 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 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 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 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);
+ }
+ }
+
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: hermes-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: hermes-dev-help@ws.apache.org