You are viewing a plain text version of this content. The canonical link for it is here.
Posted to muse-commits@ws.apache.org by sc...@apache.org on 2006/06/02 19:33:13 UTC
svn commit: r411218 [5/34] - in /webservices/muse: branches/1.0/
branches/1.0/src/examples/broker/ branches/1.0/src/examples/broker/WEB-INF/
branches/1.0/src/examples/consumer/ branches/1.0/src/examples/consumer/epr/
branches/1.0/src/examples/consumer/...
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/SubscriptionManagerPortType.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,66 @@
+/*=============================================================================*
+ * 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.porttype;
+
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusResponseDocument;
+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 java.rmi.RemoteException;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public interface SubscriptionManagerPortType
+{
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ GetStatusResponseDocument getStatus( GetStatusDocument body )
+ throws RemoteException;
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ RenewResponseDocument renew( RenewDocument body )
+ throws RemoteException;
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ void unsubscribe( UnsubscribeDocument body )
+ throws RemoteException;
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/EventSourcePortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,155 @@
+/*=============================================================================*
+ * 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.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+
+//import org.apache.ws.notification.topics.*;
+import org.apache.ws.addressing.*;
+import org.apache.ws.eventing.ForwardConsumer;
+import org.apache.ws.eventing.ForwardEndConsumer;
+import org.apache.ws.eventing.Subscription;
+import org.apache.ws.eventing.SubscriptionHome;
+import org.apache.ws.eventing.porttype.EventSourcePortType;
+import org.apache.ws.pubsub.Filter;
+import org.apache.ws.pubsub.FilterFactory;
+import org.apache.ws.pubsub.TopicFilter;
+
+//ws-topics stuff
+//import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener;
+import org.apache.ws.resource.ResourceContext;
+import org.xmlsoap.schemas.ws.x2004.x08.addressing.EndpointReferenceType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.SOAPException;
+import java.rmi.RemoteException;
+import java.util.Calendar;
+import java.util.Collection;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+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);
+ 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( ) );
+ }
+
+ //create EndTO EPR
+ EndpointReference endto = null;
+ if ( body.getSubscribe( ).getEndTo( ) != null )
+ {
+ 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 ) );
+
+ //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
+ .getEndpointReference( ) ).getXmlObject( ) );
+
+ //TODO why not ExpirationType???
+ response.setExpires( new org.apache.xmlbeans.XmlCalendar( subscription.getTerminationTime( ).getTime( ) ) );
+
+ return responseDom;
+ }
+ catch ( Exception e )
+ {
+ //TODO error
+ e.printStackTrace( );
+ }
+
+ //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;
+ }
+ */
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/NotificationPortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,81 @@
+/*=============================================================================*
+ * 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.porttype.impl;
+
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.axis.utils.XMLUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.eventing.pubsub.Subscription;
+import org.apache.ws.eventing.pubsub.SubscriptionHome;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class NotificationPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements org.apache.ws.eventing.porttype.NotificationPortType
+{
+ private static final Log LOG = LogFactory.getLog( NotificationPortTypeImpl.class.getName( ) );
+
+ /**
+ * Creates a new {@link NotificationPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public NotificationPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ //TODO maybe remove Axis dep
+ //TODO use WSRF Provider with Message styler
+ public void filter( SOAPEnvelope req,
+ SOAPEnvelope resp )
+ {
+ try
+ {
+ String xml = XMLUtils.ElementToString( req.getBody( ) );
+
+ Subscription subscription = (Subscription) getResource( );
+ LOG.info( "notification for subscription : " + subscription.getID( ) );
+ subscription.getNotificationConsumer( ).notify( subscription, xml );
+ }
+ catch ( Exception e )
+ {
+ //TODO
+ e.printStackTrace( );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected NamespaceVersionHolder getNamespaceSet( )
+ {
+ return null; // not currently used - will be needed once we need to support multiple spec versions
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SimpleNotificationPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SimpleNotificationPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SimpleNotificationPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SimpleNotificationPortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,55 @@
+/*=============================================================================*
+ * 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.porttype.impl;
+
+import org.apache.axis.message.SOAPEnvelope;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.eventing.SubscriptionHome;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+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( );
+ }
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionEndPortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,76 @@
+/*=============================================================================*
+ * 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.porttype.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.eventing.porttype.SubscriptionEndPortType;
+import org.apache.ws.eventing.pubsub.Subscription;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import java.rmi.RemoteException;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class SubscriptionEndPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements SubscriptionEndPortType
+{
+ private static final Log LOG = LogFactory.getLog( SubscriptionEndPortTypeImpl.class.getName( ) );
+
+ /**
+ * Creates a new {@link SubscriptionEndPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SubscriptionEndPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ 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( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected NamespaceVersionHolder getNamespaceSet( )
+ {
+ return null; // not currently used - will be needed once we need to support multiple spec versions
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/porttype/impl/SubscriptionManagerPortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,122 @@
+/*=============================================================================*
+ * 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.porttype.impl;
+
+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.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.GetStatusResponseDocument;
+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 java.rmi.RemoteException;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class SubscriptionManagerPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements SubscriptionManagerPortType
+{
+ /**
+ * Creates a new {@link SubscriptionManagerPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SubscriptionManagerPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ public GetStatusResponseDocument getStatus( GetStatusDocument body )
+ throws RemoteException
+ {
+ Subscription subscription = (Subscription) getResource( );
+
+ //build response
+ GetStatusResponseDocument responseDom = GetStatusResponseDocument.Factory.newInstance( );
+ GetStatusResponseDocument.GetStatusResponse response = responseDom.addNewGetStatusResponse( );
+
+ //TODO check calendar
+ response.setExpires( subscription.getTerminationTime( ) );
+ return ( responseDom );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ public RenewResponseDocument renew( RenewDocument body )
+ throws RemoteException
+ {
+ Subscription subscription = (Subscription) getResource( );
+
+ //TODO why no ExpirationType
+ org.apache.xmlbeans.XmlCalendar et = (org.apache.xmlbeans.XmlCalendar) body.getRenew( ).getExpires( );
+ subscription.setTerminationTime( et );
+ RenewResponseDocument responseDom = RenewResponseDocument.Factory.newInstance( );
+ RenewResponseDocument.RenewResponse response = responseDom.addNewRenewResponse( );
+
+ //TODO response with new expirationType
+ response.setExpires( subscription.getTerminationTime( ) );
+
+ return ( responseDom );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws RemoteException DOCUMENT_ME
+ */
+ public void unsubscribe( UnsubscribeDocument body )
+ throws RemoteException
+ {
+ Subscription subscription = (Subscription) getResource( );
+ subscription.unsubscribe( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected NamespaceVersionHolder getNamespaceSet( )
+ {
+ return null; // not currently used - will be needed once we need to support multiple spec versions
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Publisher.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Publisher.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Publisher.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Publisher.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,137 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.ws.addressing.*;
+import org.apache.ws.pubsub.emitter.EmitterTask;
+import org.w3c.dom.Document;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPHeader;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class Publisher
+ implements org.apache.ws.pubsub.Publisher
+{
+ private String m_url = "http://localhost:7070/axis/services/NotificationPort";
+
+ /**
+ * Creates a new {@link Publisher} object.
+ *
+ * @param url DOCUMENT_ME
+ */
+ public Publisher( String url )
+ {
+ m_url = url;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param msg DOCUMENT_ME
+ * @param t DOCUMENT_ME
+ */
+ public void publish( Object msg,
+ org.apache.ws.notification.topics.Topic t )
+ {
+ try
+ {
+ publish( m_url, (String) msg );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+ 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;
+ }
+
+ 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 ) );
+ }
+
+ //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;
+ }
+ */
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscriber.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscriber.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscriber.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscriber.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,231 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.axis.AxisProperties;
+import org.apache.axis.configuration.EngineConfigurationFactoryDefault;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.XmlObjectWrapper;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.NotificationProducer;
+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 org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.jndi.XmlBeanJndiUtils;
+import org.apache.xmlbeans.XmlCursor;
+import org.apache.xmlbeans.XmlObject;
+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.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.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscribeResponseDocument;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class Subscriber
+ implements NotificationProducer
+{
+ /**
+ * DOCUMENT_ME
+ */
+ private static final Log LOG = LogFactory.getLog( Subscriber.class.getName( ) );
+ private static String WRAPPED_MODE_URI = "http://ws.apache.org/ws-fx/pubscribe/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( );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public EndpointReference getEPR( )
+ {
+ return epr;
+ }
+
+ /**
+ * runs resource discovery.
+ *
+ */
+ public void init( String configfile )
+ throws Exception
+ {
+ LOG.info( this.getClass( ).getName( ) + " : initialize with " + configfile );
+ XmlBeanJndiUtils.initFromInputStream( Thread.currentThread( ).getContextClassLoader( ).getResourceAsStream( configfile ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param notificationConsumer DOCUMENT_ME
+ * @param subscriptionEndConsumer DOCUMENT_ME
+ * @param tf DOCUMENT_ME
+ * @param xf DOCUMENT_ME
+ * @param initialTerminationTime DOCUMENT_ME
+ * @param UseNotify DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ 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,
+ new QName( "TODO" ) );
+ XmlCursor xmlCursor = xmlObject.newCursor( );
+ xmlCursor.setTextValue( String.valueOf( ls.getID( ) ) );
+ 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;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscription.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscription.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscription.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/Subscription.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,158 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.commons.id.IdentifierUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.eventing.AbstractSubscription;
+import org.apache.ws.pubsub.wsaSOAPConnection;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.RenewDocument;
+import org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class Subscription
+ extends AbstractSubscription
+{
+ private static final Log LOG = LogFactory.getLog( Subscriber.class.getName( ) );
+
+ /**
+ * Creates a new {@link Subscription} object.
+ */
+ public Subscription( )
+ {
+ setID( IdentifierUtils.UUID_VERSION_FOUR_GENERATOR.nextIdentifier( ).toString( ) );
+ this.m_creationTime = Calendar.getInstance( );
+ LOG.info( "new local Subscription : " + getID( ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param epr DOCUMENT_ME
+ */
+ public void setSubscriptionManager( EndpointReference epr )
+ {
+ super.setEpr( epr );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param terminationTime DOCUMENT_ME
+ */
+ 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,
+ getEndpointReference( ) );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public java.util.Calendar getTerminationTime( )
+ {
+ //TODO maybe call GetStatus to get Termination time
+ return m_terminationTime;
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void destroy( )
+ {
+ try
+ {
+ this.rH.remove( getID( ) );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace( );
+ }
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void init( )
+ {
+ System.out.println( "local init" );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param xml DOCUMENT_ME
+ */
+ public void notify( String xml )
+ {
+ getNotificationConsumer( ).notify( this, xml );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void unsubscribe( )
+ {
+ UnsubscribeDocument usdom = UnsubscribeDocument.Factory.newInstance( );
+ 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,
+ getEndpointReference( ) );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace( );
+ }
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/pubsub/SubscriptionHome.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,193 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.resource.IllegalResourceTypeException;
+import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import javax.xml.namespace.QName;
+import java.util.Map;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class SubscriptionHome
+ extends AbstractResourceHome
+{
+ /** The service endpoint name as registered with the SOAP Platform. This is useful for building EPR's. **/
+ public static final javax.xml.namespace.QName SERVICE_NAME =
+ javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/notification/base/service/SubscriptionEndPort}SubscriptionEndPort" );
+
+ /** The management PortType associated with this resource. This is useful for building EPR's.**/
+ public static final javax.xml.namespace.QName PORT_TYPE =
+ javax.xml.namespace.QName.valueOf( "http://ws.apache.org/notification/base/service/SubscriptionEndPort}SubscriptionEndPortPortType" );
+
+ /** The WSDL Port name associated with the resource. This is useful for building EPR's. **/
+ public static final String PORT_NAME = "SubscriptionEndPort";
+
+ /** The name of the resource key for this resource. **/
+ public static final javax.xml.namespace.QName RESOURCE_KEY_NAME =
+ javax.xml.namespace.QName.valueOf( "{http://ws.apache.org/notification/base/service/SubscriptionEndPort}ResourceID" );
+
+ //private static Map m_resources=new java.util.HashMap();
+
+ /** DOCUMENT_ME */
+ public static final String HOME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart( ) + "/"
+ + JndiConstants.ATOMIC_NAME_HOME;
+ private static int num = 0;
+ private static final Log LOG =
+ LogFactory.getLog( SubscriptionHome.class.getName( ) );
+ private static final NamespaceVersionHolder SPEC_NAMESPACE_SET = new WsnNamespaceVersionHolderImpl( );
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * Creates a new {@link SubscriptionHome} object.
+ */
+ public SubscriptionHome( )
+ {
+ num++;
+ LOG.info( "create SubscriptionHome number : " + num );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder( )
+ {
+ return SPEC_NAMESPACE_SET;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getPortType( )
+ {
+ return PORT_TYPE;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getResourceKeyNameQName( )
+ {
+ return RESOURCE_KEY_NAME;
+ }
+
+ /*
+ 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 setResourceClassName(String className) {
+ }
+
+ public void setResourceKeyClassName(String className) {
+ }
+
+ public void setResourceKeyName(String keyName) {
+ }
+
+ public void setServiceClassName(String className) {
+ }
+
+ public void setWsdlTargetNamespace(String targetNamespace) {
+ }
+ */
+ public QName getServiceName( )
+ {
+ return SERVICE_NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServicePortName( )
+ {
+ return PORT_NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Subscription create( )
+ {
+ Subscription s = new Subscription( );
+ s.setResourceHome( this );
+ LOG.info( "before add " + m_resources.size( ) + " instance " + this );
+ try
+ {
+ add( s );
+ }
+ catch ( IllegalResourceTypeException irte )
+ {
+ throw new RuntimeException( irte );
+ }
+
+ LOG.info( "after add " + m_resources.size( ) );
+ return s;
+ }
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link org.apache.ws.resource.impl.AbstractResourceHome}
+ * superclass.
+ */
+ protected final synchronized Map getResourceMap( )
+ {
+ if ( s_resources == null )
+ {
+ s_resources = AbstractResourceHome.createResourceMap( m_resourceIsPersistent );
+ }
+
+ return s_resources;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/AbstractService.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/AbstractService.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/AbstractService.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/AbstractService.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,99 @@
+/*=============================================================================*
+ * 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.services;
+
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.handler.ServiceSoapMethodNameMap;
+import org.apache.ws.resource.handler.SoapMethodNameMap;
+import org.apache.ws.resource.handler.WsrfService;
+import javax.xml.namespace.QName;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class AbstractService
+ implements WsrfService
+{
+ /** DOCUMENT_ME */
+ protected ResourceContext m_resourceContext;
+
+ /**
+ * DOCUMENT_ME
+ */
+ protected ServiceSoapMethodNameMap m_methodNameMap;
+
+ /**
+ * DOCUMENT_ME
+ */
+ protected boolean m_isInitialized;
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestQname DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getMethodName( QName requestQname )
+ {
+ if ( !m_isInitialized )
+ {
+ init( );
+ }
+
+ return m_methodNameMap.getMethodName( requestQname );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public final SoapMethodNameMap getMethodNameMap( )
+ {
+ return m_methodNameMap;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResourceContext getResourceContext( )
+ {
+ return m_resourceContext;
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void init( )
+ {
+ m_methodNameMap = new ServiceSoapMethodNameMap( getResourceContext( ) );
+ m_isInitialized = true;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected final boolean isInitialized( )
+ {
+ return m_isInitialized;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/BrokerService.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/BrokerService.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/BrokerService.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/BrokerService.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,137 @@
+/*=============================================================================*
+ * 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.services;
+
+import org.apache.ws.eventing.porttype.*;
+import org.apache.ws.eventing.porttype.impl.*;
+import org.apache.ws.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class BrokerService
+ extends AbstractService
+ implements SubscriptionEndPortType,
+ NotificationPortType,
+ EventSourcePortType,
+ SubscriptionManagerPortType
+{
+ /**
+ * Creates a new {@link BrokerService} object.
+ */
+ public BrokerService( )
+ {
+ }
+
+ /**
+ * Creates a new {@link BrokerService} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public BrokerService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param req DOCUMENT_ME
+ * @param resp DOCUMENT_ME
+ */
+ public void filter( org.apache.axis.message.SOAPEnvelope req,
+ org.apache.axis.message.SOAPEnvelope resp )
+ {
+ new SimpleNotificationPortTypeImpl( ).filter( req, resp );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ public void subscriptionEnd( org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body )
+ throws java.rmi.RemoteException
+ {
+ new SubscriptionEndPortTypeImpl( getResourceContext( ) ).subscriptionEnd( body );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ public void unsubscribe( org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument body )
+ throws java.rmi.RemoteException
+ {
+ new SubscriptionManagerPortTypeImpl( getResourceContext( ) ).unsubscribe( body );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/PublisherService.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/PublisherService.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/PublisherService.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/PublisherService.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,105 @@
+/*=============================================================================*
+ * 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.services;
+
+import org.apache.ws.eventing.porttype.EventSourcePortType;
+import org.apache.ws.eventing.porttype.SubscriptionManagerPortType;
+import org.apache.ws.eventing.porttype.impl.EventSourcePortTypeImpl;
+import org.apache.ws.eventing.porttype.impl.SubscriptionManagerPortTypeImpl;
+import org.apache.ws.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class PublisherService
+ extends AbstractService
+ implements EventSourcePortType,
+ SubscriptionManagerPortType
+{
+ /**
+ * Creates a new {@link PublisherService} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public PublisherService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ 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 );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ public void unsubscribe( org.xmlsoap.schemas.ws.x2004.x08.eventing.UnsubscribeDocument body )
+ throws java.rmi.RemoteException
+ {
+ new SubscriptionManagerPortTypeImpl( getResourceContext( ) ).unsubscribe( body );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/SubscriberService.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/SubscriberService.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/SubscriberService.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/eventing/services/SubscriberService.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,71 @@
+/*=============================================================================*
+ * 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.services;
+
+import org.apache.ws.eventing.porttype.NotificationPortType;
+import org.apache.ws.eventing.porttype.SubscriptionEndPortType;
+import org.apache.ws.eventing.porttype.impl.NotificationPortTypeImpl;
+import org.apache.ws.eventing.porttype.impl.SubscriptionEndPortTypeImpl;
+import org.apache.ws.eventing.services.AbstractService;
+import org.apache.ws.resource.ResourceContext;
+
+/**
+ * DOCUMENT_ME
+ *
+ * @version $Revision: 1.8 $
+ * @author $author$
+ */
+public class SubscriberService
+ extends AbstractService
+ implements SubscriptionEndPortType,
+ NotificationPortType
+{
+ /**
+ * Creates a new {@link SubscriberService} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SubscriberService( ResourceContext resourceContext )
+ {
+ m_resourceContext = resourceContext;
+ init( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param req DOCUMENT_ME
+ * @param resp DOCUMENT_ME
+ */
+ public void filter( org.apache.axis.message.SOAPEnvelope req,
+ org.apache.axis.message.SOAPEnvelope resp )
+ {
+ new NotificationPortTypeImpl( getResourceContext( ) ).filter( req, resp );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param body DOCUMENT_ME
+ *
+ * @throws java.rmi.RemoteException DOCUMENT_ME
+ */
+ public void subscriptionEnd( org.xmlsoap.schemas.ws.x2004.x08.eventing.SubscriptionEndDocument body )
+ throws java.rmi.RemoteException
+ {
+ new SubscriptionEndPortTypeImpl( getResourceContext( ) ).subscriptionEnd( body );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,78 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.xmlbeans.XmlBoolean;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.FixedTopicSetDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * A callback for the FixedTopicSet resource property from the WS-BaseNotification NotificationProducer portType.
+ */
+public class FixedTopicSetResourcePropertyCallback
+ implements ResourcePropertyCallback
+{
+ private TopicSpaceSet m_topicSet;
+
+ /**
+ * Creates a new {@link TopicResourcePropertyCallback} for the specified topic set.
+ *
+ * @param topicSet the producer's topic set
+ */
+ public FixedTopicSetResourcePropertyCallback( TopicSpaceSet topicSet )
+ {
+ m_topicSet = topicSet;
+ }
+
+ /**
+ * Refreshes the value of the wsnt:FixedTopicSet resource property so that it
+ * reflects the fixed flag on the producer resource's topic set.
+ *
+ * @param prop the wsnt:FixedTopicSet resource property
+ *
+ * @return the wsnt:FixedTopicSet resource property
+ *
+ * @throws org.apache.ws.resource.properties.impl.CallbackFailedException
+ */
+ public ResourceProperty refreshProperty( ResourceProperty prop )
+ throws CallbackFailedException
+ {
+ QName propName = prop.getMetaData( ).getName( );
+ if ( !propName.equals( NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET ) )
+ {
+ throw new IllegalArgumentException( "Unsupported property: " + propName );
+ }
+
+ if ( prop.isEmpty( ) )
+ {
+ FixedTopicSetDocument fixedTopicSetDoc = FixedTopicSetDocument.Factory.newInstance( );
+ fixedTopicSetDoc.setFixedTopicSet( m_topicSet.isFixed( ) );
+ prop.add( fixedTopicSetDoc );
+ }
+ else
+ {
+ XmlBoolean fixedTopicSetPropElem = (XmlBoolean) prop.get( 0 );
+ fixedTopicSetPropElem.setBooleanValue( m_topicSet.isFixed( ) );
+ }
+
+ return prop;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/NotificationProducerResource.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/NotificationProducerResource.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/NotificationProducerResource.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/NotificationProducerResource.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,35 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.resource.PropertiesResource;
+
+/**
+ * A resource that implements the WS-BaseNotification NotificationProducer
+ * portType. Provides access to the resource's {@link TopicSpaceSet} and
+ * {@link org.apache.ws.resource.properties.ResourcePropertySet}.
+ */
+public interface NotificationProducerResource
+ extends PropertiesResource
+{
+ /**
+ * Returns the TopicSpaceSet for the NotificationProducer
+ *
+ * @return the TopicSpaceSet for this NotificationProducer
+ */
+ TopicSpaceSet getTopicSpaceSet( );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/Subscription.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/Subscription.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/Subscription.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/Subscription.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,146 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.addressing.EndpointReference;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.pubsub.NotificationConsumer;
+import org.apache.ws.pubsub.NotificationProducer;
+import org.apache.ws.resource.PropertiesResource;
+import org.apache.ws.resource.lifetime.ScheduledResourceTerminationResource;
+import org.apache.ws.resource.properties.query.QueryExpression;
+
+/**
+ * Interface to be implemented by subscription resources. Exposes the information
+ * associated with a subscription request, as well as resource lifetime-related
+ * state.
+ */
+public interface Subscription
+ extends PropertiesResource,
+ org.apache.ws.pubsub.Subscription,
+ ScheduledResourceTerminationResource
+{
+ /**
+ * Gets the consumer EPR associated with this subscription.
+ *
+ * @return the consumer EPR associated with this subscription
+ */
+ EndpointReference getConsumerReference( );
+
+ //TODO: remove this method once getEPR() method is added to Resource interface
+ void setEndpointReference( EndpointReference epr );
+
+ /**
+ * This method exists for abstraction layer
+ *
+ * @param notificationConsumer
+ */
+ void setNotificationConsumer( NotificationConsumer notificationConsumer );
+
+ /**
+ * This method exists for abstraction layer
+ *
+ * @param notificationProducer
+ */
+ void setNotificationProducer( NotificationProducer notificationProducer );
+
+ /**
+ * Returns true if this subscription is currently paused, or false otherwise.
+ *
+ * @return true if this subscription is currently paused, or false otherwise
+ */
+ boolean isPaused( );
+
+ /**
+ * Sets the policy for the subscription
+ *
+ * @param policy
+ */
+ void setPolicy( Object policy );
+
+ /**
+ * Sets the precondition for the subscription.
+ *
+ * @param precondition
+ */
+ void setPrecondition( QueryExpression precondition );
+
+ /**
+ * Gets the precondition associated with this subscription.
+ *
+ * @return the precondition, or null if no precondition was specified in the subscribe request
+ */
+ QueryExpression getPrecondition( );
+
+ /**
+ * Gets the producer resource associated with this subscription.
+ *
+ * @return the producer resource
+ */
+ NotificationProducerResource getProducerResource( );
+
+ /**
+ * Sets the selector for the subscription
+ *
+ * @param selector
+ */
+ void setSelector( QueryExpression selector );
+
+ /**
+ * Gets the selector associated with this subscription.
+ *
+ * @return the selector, or null if no selector was specified in the subscribe request
+ */
+ QueryExpression getSelector( );
+
+ /**
+ * Gets the topic expression associated with this subscription.
+ *
+ * @return the topic expression
+ */
+ TopicExpression getTopicExpression( );
+
+ /**
+ * Sets the boolean useNotify flag on the subscription to determine if the notification is wrapped
+ * in a Notify element.
+ *
+ * @param useNotify
+ */
+ void setUseNotify( boolean useNotify );
+
+ /**
+ * Wrap notification messages in the notify element?
+ *
+ * @return true (default) if notify should be used, or false if not
+ */
+ boolean getUseNotify( );
+
+ /**
+ * Temporarily suspends the delivery of notification messages for this subscription.
+ *
+ * @throws Exception if unable to suspend message delivery
+ */
+ void pause( )
+ throws Exception;
+
+ /**
+ * Resumes the delivery of notification messages for this subscription.
+ *
+ * @throws Exception if unable to resume message delivery
+ */
+ void resume( )
+ throws Exception;
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,66 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.expression.impl.TopicExpressionEngineImpl;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDialectsDocument;
+import javax.xml.namespace.QName;
+
+/**
+ * A callback for the TopicExpressionDialects resource property from the WS-BaseNotification NotificationProducer
+ * portType.
+ */
+public class TopicExpressionDialectsResourcePropertyCallback
+ implements ResourcePropertyCallback
+{
+ /**
+ * Initializes the value of the wsnt:TopicExpressionDialects resource property so that it
+ * reflects the topic expression dialects supported by the topic expression engine.
+ *
+ * @param prop the wsnt:TopicExpressionDialects resource property
+ *
+ * @return the wsnt:TopicExpressionDialects resource property
+ *
+ * @throws org.apache.ws.resource.properties.impl.CallbackFailedException
+ */
+ public ResourceProperty refreshProperty( ResourceProperty prop )
+ throws CallbackFailedException
+ {
+ QName propName = prop.getMetaData( ).getName( );
+ if ( !propName.equals( NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS ) )
+ {
+ throw new IllegalArgumentException( "Unsupported property: " + propName );
+ }
+
+ if ( prop.isEmpty( ) )
+ {
+ String[] supportedDialects = TopicExpressionEngineImpl.getInstance( ).getSupportedDialects( );
+ for ( int i = 0; i < supportedDialects.length; i++ )
+ {
+ TopicExpressionDialectsDocument topicExpressionDialectsDocument =
+ TopicExpressionDialectsDocument.Factory.newInstance( );
+ topicExpressionDialectsDocument.setTopicExpressionDialects( supportedDialects[i] );
+ prop.add( topicExpressionDialectsDocument );
+ }
+ }
+
+ return prop;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,140 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
+import org.apache.ws.resource.properties.ResourceProperty;
+import org.apache.ws.resource.properties.ResourcePropertyCallback;
+import org.apache.ws.resource.properties.impl.CallbackFailedException;
+import org.apache.ws.util.XmlBeanUtils;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import javax.xml.namespace.QName;
+import java.util.Iterator;
+
+/**
+ * A callback for the Topic resource property from the WS-BaseNotification
+ * NotificationProducer portType.
+ */
+public class TopicResourcePropertyCallback
+ implements ResourcePropertyCallback
+{
+ private TopicSpaceSet m_topicSet;
+
+ /**
+ * Creates a new {@link TopicResourcePropertyCallback} for the specified topic set.
+ *
+ * @param topicSet the producer's topic set
+ */
+ public TopicResourcePropertyCallback( TopicSpaceSet topicSet )
+ {
+ m_topicSet = topicSet;
+ }
+
+ /**
+ * Refreshes the value of the wsnt:Topic resource property so that it
+ * reflects the topics contained in the producer resource's topic set.
+ *
+ * @param prop the wsnt:Topic resource property
+ *
+ * @return the wsnt:Topic resource property
+ *
+ * @throws org.apache.ws.resource.properties.impl.CallbackFailedException
+ */
+ public ResourceProperty refreshProperty( ResourceProperty prop )
+ throws CallbackFailedException
+ {
+ QName propName = prop.getMetaData( ).getName( );
+ if ( !propName.equals( NotificationProducerPortType.PROP_QNAME_TOPIC ) )
+ {
+ throw new IllegalArgumentException( "Unsupported property: " + propName );
+ }
+
+ prop.clear( );
+ TopicSpace[] topicSpaces = m_topicSet.getTopicSpaces( );
+ for ( int i = 0; i < topicSpaces.length; i++ )
+ {
+ TopicSpace topicSpace = topicSpaces[i];
+ String targetNamespace = topicSpace.getTargetNamespace( );
+ Iterator iterator = topicSpace.topicIterator( );
+ while ( iterator.hasNext( ) )
+ {
+ Topic topic = (Topic) iterator.next( );
+ String topicName = topic.getName( );
+ QName rootTopicQName = new QName( targetNamespace, topicName );
+
+ if ( topic.isVisible( ) )
+ {
+ addSimpleTopicExpression( prop, rootTopicQName );
+ }
+
+ Iterator subTopics = topic.topicIterator( );
+ while ( subTopics.hasNext( ) )
+ {
+ Topic subTopic = (Topic) subTopics.next( );
+ addConcreteTopicExpressions( prop, rootTopicQName, subTopic );
+ }
+ }
+ }
+
+ return prop;
+ }
+
+ /**
+ * Recursively adds Concrete topic expressions to the Topic resource property.
+ *
+ * @param topicProp The ResourceProperty associated with the Topic being added to.
+ * @param rootTopicName The QName of the parent topic.
+ * @param subTopic The current topic being added.
+ */
+ private static void addConcreteTopicExpressions( ResourceProperty topicProp,
+ QName rootTopicName,
+ Topic subTopic )
+ {
+ TopicDocument topicDocument = TopicDocument.Factory.newInstance( );
+ String topicName = subTopic.getName( );
+ QName concreteTopicName =
+ new QName( rootTopicName.getNamespaceURI( ), rootTopicName.getLocalPart( ) + "/" + topicName );
+ if ( subTopic.isVisible( ) )
+ {
+ TopicExpressionType topicExpressionType = topicDocument.addNewTopic( );
+ topicExpressionType.setDialect( TopicsConstants.TOPIC_EXPR_DIALECT_CONCRETE );
+ XmlBeanUtils.setValueAsQName( topicExpressionType, concreteTopicName );
+ topicProp.add( topicDocument );
+ }
+
+ Iterator iterator = subTopic.topicIterator( );
+ while ( iterator.hasNext( ) )
+ {
+ Topic topic = (Topic) iterator.next( );
+ addConcreteTopicExpressions( topicProp, concreteTopicName, topic );
+ }
+ }
+
+ private static void addSimpleTopicExpression( ResourceProperty topicProp,
+ QName rootTopicName )
+ {
+ TopicDocument topicDocument = TopicDocument.Factory.newInstance( );
+ TopicExpressionType topicExpressionType = topicDocument.addNewTopic( );
+ topicExpressionType.setDialect( TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE );
+ XmlBeanUtils.setValueAsQName( topicExpressionType, rootTopicName );
+ topicProp.add( topicDocument );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/WsnNamespaceVersionHolder.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/WsnNamespaceVersionHolder.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/WsnNamespaceVersionHolder.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/WsnNamespaceVersionHolder.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,51 @@
+/*=============================================================================*
+ * 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.notification.base;
+
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+
+/**
+ * An extension of the {@link NamespaceVersionHolder} which adds WSN-specific
+ * getters for the WSN namespaces.
+ *
+ * Implementations of this interface are used to provide an object which contains all the
+ * namespaces supported by a given Resource. This allows us to group the properly associated versioned
+ * namespaces together in one place.
+ *
+ * @author Sal Campana
+ */
+public interface WsnNamespaceVersionHolder
+ extends NamespaceVersionHolder
+{
+ /**
+ * Returns the BaseNotification namespace
+ * @return BaseNotification namespace
+ */
+ String getBaseNotificationXsdNamespace( );
+
+ /**
+ * Returns the Brokered Notification namespace
+ * @return Brokered Notification namespace
+ */
+ String getBrokeredNotificationXsdNamespace( );
+
+ /**
+ * Returns the namespace for the Topics Spec
+ *
+ * @return Topic namespace
+ */
+ String getTopicsXsdNamespace( );
+}
\ No newline at end of file
---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org