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 [7/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/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/NotificationProducerPortTypeImpl.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,261 @@
+/*=============================================================================*
+ * 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.v2004_06.porttype.impl;
+
+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.notification.base.NotificationProducerResource;
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.faults.InvalidTopicExpressionFaultException;
+import org.apache.ws.notification.base.faults.NoCurrentMessageOnTopicFaultException;
+import org.apache.ws.notification.base.faults.SubscribeCreationFailedFaultException;
+import org.apache.ws.notification.base.faults.TopicPathDialectUnknownFaultException;
+import org.apache.ws.notification.base.impl.XmlBeansTopicExpression;
+import org.apache.ws.notification.base.v2004_06.impl.SubscriptionHome;
+import org.apache.ws.notification.base.v2004_06.impl.SubscriptionResource;
+import org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+import org.apache.ws.notification.topics.impl.SubscriptionTopicListener;
+import org.apache.ws.resource.ResourceContext;
+import org.apache.ws.resource.faults.BaseFaultException;
+import org.apache.ws.resource.impl.AbstractResourceContext;
+import org.apache.ws.resource.properties.NamespaceVersionHolder;
+import org.apache.ws.resource.properties.impl.AbstractResourcePropertiesPortType;
+import org.apache.ws.resource.properties.query.QueryExpression;
+import org.apache.ws.resource.properties.query.impl.XmlBeansQueryExpression;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.xmlbeans.XmlObject;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageResponseDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.util.Calendar;
+
+/**
+ * An implementation of the WS-BaseNotification NotificationProducer portType.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class NotificationProducerPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements NotificationProducerPortType
+{
+ private static final Log LOG =
+ LogFactory.getLog( NotificationProducerPortTypeImpl.class.getName( ) );
+ private static final WsnNamespaceVersionHolder NAMESPACE_SET = new WsnNamespaceVersionHolderImpl( );
+
+ /**
+ * Creates a new {@link NotificationProducerPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public NotificationProducerPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * @see NotificationProducerPortType#getCurrentMessage(org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.GetCurrentMessageDocument)
+ */
+ public GetCurrentMessageResponseDocument getCurrentMessage( GetCurrentMessageDocument requestDoc )
+ {
+ GetCurrentMessageDocument.GetCurrentMessage request = requestDoc.getGetCurrentMessage( );
+ TopicExpression topicExpr = getTopicExpression( request.getTopic( ) );
+ Topic[] topics = evaluateTopicExpression( topicExpr );
+ if ( topics.length == 0 )
+ {
+ throw new InvalidTopicExpressionFaultException( NAMESPACE_SET,
+ "Given TopicExpression did not match any Topics supported by this NotificationProducer - the WS-BaseN spec mandates that it match exactly one." );
+ }
+
+ if ( topics.length > 1 )
+ {
+ throw new InvalidTopicExpressionFaultException( NAMESPACE_SET,
+ "Given TopicExpression matched more than one Topic supported by this NotificationProducer - the WS-BaseN spec mandates that it match exactly one." );
+ }
+
+ Topic topic = topics[0];
+ XmlObject currentMsg = (XmlObject) topic.getCurrentMessage( );
+ if ( currentMsg == null )
+ {
+ throw new NoCurrentMessageOnTopicFaultException( NAMESPACE_SET );
+ }
+
+ GetCurrentMessageResponseDocument responseDoc =
+ GetCurrentMessageResponseDocument.Factory.newInstance( );
+ GetCurrentMessageResponseDocument.GetCurrentMessageResponse response =
+ responseDoc.addNewGetCurrentMessageResponse( );
+ XmlBeanUtils.addChildElement( response, currentMsg );
+ return responseDoc;
+ }
+
+ /**
+ * @see NotificationProducerPortType#subscribe(org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument)
+ */
+ public SubscribeResponseDocument subscribe( SubscribeDocument requestDoc )
+ {
+ SubscribeDocument.Subscribe request = requestDoc.getSubscribe( );
+ TopicExpression topicExpr = getTopicExpression( request.getTopicExpression( ) );
+ Topic[] topics = evaluateTopicExpression( topicExpr );
+ if ( topics.length == 0 )
+ {
+ throw new InvalidTopicExpressionFaultException( NAMESPACE_SET,
+ "Given TopicExpression did not match any Topics supported by this NotificationProducer - the WS-BaseN spec mandates that it match at least one." );
+ }
+
+ Calendar initialTerminationTime = null;
+ if ( request.isSetInitialTerminationTime( ) )
+ {
+ initialTerminationTime = request.getInitialTerminationTime( );
+ }
+
+ QueryExpression precondition = null;
+ if ( request.isSetPrecondition( ) )
+ {
+ precondition = new XmlBeansQueryExpression( request.getPrecondition( ) );
+ }
+
+ QueryExpression selector = null;
+ if ( request.isSetSelector( ) )
+ {
+ selector = new XmlBeansQueryExpression( request.getSelector( ) );
+ }
+
+ XmlObject subPolicy = null;
+ if ( request.isSetSubscriptionPolicy( ) )
+ {
+ subPolicy = request.getSubscriptionPolicy( );
+ }
+
+ EndpointReferenceType subscriptionEPR = null;
+
+ boolean useNotify = request.isSetUseNotify( ) ? request.getUseNotify( ) : true; // NOTE: we must set the default value ourselves, as XMLBeans does NOT do this for us
+ EndpointReference producerEPR = getResource( ).getEndpointReference( );
+ SubscriptionHome subscriptionHome = null;
+ try
+ {
+ subscriptionHome = (SubscriptionHome) new InitialContext( ).lookup( SubscriptionHome.HOME_LOCATION );
+ }
+ catch ( NamingException ne )
+ {
+ LOG.error( "Subscribe failed due to internal error: " + ne );
+ throw new BaseFaultException( NAMESPACE_SET, "Subscribe failed due to internal server error." );
+ }
+
+ Subscription subscription = null;
+ try
+ {
+ subscription =
+ subscriptionHome.create( SubscriptionResource.class,
+ new XmlBeansEndpointReference( request.getConsumerReference( ) ),
+ producerEPR,
+ initialTerminationTime,
+ subPolicy,
+ precondition,
+ selector,
+ getResource( ).getID( ),
+ ( (AbstractResourceContext) getResourceContext( ) ).getResourceHomeLocation( ),
+ topicExpr,
+ useNotify,
+ (WsnNamespaceVersionHolder) getNamespaceSet( ) );
+ }
+ catch ( Exception e )
+ {
+ LOG.error( "Subscribe failed due to internal error: " + e );
+ if ( LOG.isDebugEnabled( ) )
+ {
+ e.printStackTrace( );
+ }
+
+ throw new SubscribeCreationFailedFaultException( NAMESPACE_SET );
+ }
+
+ SubscriptionTopicListener subscriptionTopicListener = new SubscriptionTopicListener( subscription );
+ for ( int i = 0; i < topics.length; i++ )
+ {
+ topics[i].addTopicListener( subscriptionTopicListener );
+ }
+
+ SubscribeResponseDocument subscribeResponseDoc =
+ SubscribeResponseDocument.Factory.newInstance( );
+ SubscribeResponseDocument.SubscribeResponse subscribeResponse =
+ subscribeResponseDoc.addNewSubscribeResponse( );
+ subscriptionEPR =
+ (EndpointReferenceType) ( (XmlObjectWrapper) subscription.getEndpointReference( ) ).getXmlObject( );
+ subscribeResponse.setSubscriptionReference( subscriptionEPR );
+ return subscribeResponseDoc;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected NamespaceVersionHolder getNamespaceSet( )
+ {
+ return NAMESPACE_SET;
+ }
+
+ private TopicExpression getTopicExpression( TopicExpressionType topicExpressionType )
+ {
+ TopicExpression topicExpr = null;
+ try
+ {
+ topicExpr = new XmlBeansTopicExpression( topicExpressionType );
+ }
+ catch ( InvalidTopicExpressionException ite )
+ {
+ throw new InvalidTopicExpressionFaultException( NAMESPACE_SET,
+ ite.getLocalizedMessage( ) );
+ }
+
+ return topicExpr;
+ }
+
+ private Topic[] evaluateTopicExpression( TopicExpression topicExpr )
+ {
+ try
+ {
+ NotificationProducerResource resource = (NotificationProducerResource) getResource( );
+ TopicSpaceSet topicSpaceSet = resource.getTopicSpaceSet( );
+ return topicSpaceSet.evaluateTopicExpression( topicExpr );
+ }
+ catch ( TopicPathDialectUnknownException tpdue )
+ {
+ throw new TopicPathDialectUnknownFaultException( NAMESPACE_SET,
+ tpdue.getLocalizedMessage( ) );
+ }
+ catch ( TopicExpressionException tee )
+ {
+ throw new BaseFaultException( NAMESPACE_SET,
+ tee.getLocalizedMessage( ) );
+ }
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/porttype/impl/SubscriptionManagerPortTypeImpl.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/base/v2004_06/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.notification.base.v2004_06.porttype.impl;
+
+import org.apache.ws.notification.base.Subscription;
+import org.apache.ws.notification.base.WsnNamespaceVersionHolder;
+import org.apache.ws.notification.base.faults.PauseFailedFaultException;
+import org.apache.ws.notification.base.faults.ResumeFailedFaultException;
+import org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.notification.base.v2004_06.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.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.PauseSubscriptionResponseDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.ResumeSubscriptionResponseDocument;
+
+/**
+ * An implementation of the WS-BaseNotification SubscriptionManager portType.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class SubscriptionManagerPortTypeImpl
+ extends AbstractResourcePropertiesPortType
+ implements SubscriptionManagerPortType
+{
+ private static final WsnNamespaceVersionHolder NAMESPACE_SET = new WsnNamespaceVersionHolderImpl( );
+
+ /**
+ * Creates a new {@link SubscriptionManagerPortTypeImpl} object.
+ *
+ * @param resourceContext DOCUMENT_ME
+ */
+ public SubscriptionManagerPortTypeImpl( ResourceContext resourceContext )
+ {
+ super( resourceContext );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public PauseSubscriptionResponseDocument pauseSubscription( PauseSubscriptionDocument requestDoc )
+ {
+ Subscription subscription = (Subscription) getResource( );
+ try
+ {
+ subscription.pause( );
+ }
+ catch ( Exception e )
+ {
+ throw new PauseFailedFaultException( NAMESPACE_SET,
+ "Pause failed on subscription: " + subscription.getID( ) );
+ }
+
+ return createPauseSubscriptionResponseDocument( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param requestDoc DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public ResumeSubscriptionResponseDocument resumeSubscription( ResumeSubscriptionDocument requestDoc )
+ {
+ Subscription subscription = (Subscription) getResource( );
+ try
+ {
+ subscription.resume( );
+ }
+ catch ( Exception e )
+ {
+ throw new ResumeFailedFaultException( NAMESPACE_SET,
+ "Resume failed on subscription: " + subscription.getID( ) );
+ }
+
+ return createResumeSubscriptionResponseDocument( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ protected NamespaceVersionHolder getNamespaceSet( )
+ {
+ return NAMESPACE_SET;
+ }
+
+ private PauseSubscriptionResponseDocument createPauseSubscriptionResponseDocument( )
+ {
+ PauseSubscriptionResponseDocument responseDoc = PauseSubscriptionResponseDocument.Factory.newInstance( );
+ responseDoc.addNewPauseSubscriptionResponse( );
+ return responseDoc;
+ }
+
+ private ResumeSubscriptionResponseDocument createResumeSubscriptionResponseDocument( )
+ {
+ ResumeSubscriptionResponseDocument responseDoc = ResumeSubscriptionResponseDocument.Factory.newInstance( );
+ responseDoc.addNewResumeSubscriptionResponse( );
+ return responseDoc;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Publisher.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Publisher.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Publisher.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Publisher.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,58 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.ws.pubsub.emitter.EmitterTask;
+import javax.xml.soap.SOAPMessage;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class Publisher
+ implements org.apache.ws.pubsub.Publisher
+{
+ private String m_url;
+
+ /**
+ * 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 )
+ {
+ }
+
+ private void publish( SOAPMessage soapMsg )
+ throws Exception
+ {
+ EmitterTask et = EmitterTask.createEmitterTask( soapMsg,
+ new java.net.URL( m_url ) );
+ et.run( );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscriber.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscriber.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscriber.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscriber.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,208 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+
+//import org.xmlsoap.schemas.ws.x2003.x03.addressing.EEndpointReference;
+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.jndi.XmlBeanJndiUtils;
+import org.apache.xmlbeans.XmlCursor;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
+import org.xmlsoap.schemas.soap.envelope.EnvelopeDocument;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPMessage;
+import java.util.Calendar;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class Subscriber
+ implements NotificationProducer
+{
+ private static final Log LOG = LogFactory.getLog( Subscriber.class.getName( ) );
+ private EndpointReference epr;
+ private SubscriptionHome sH;
+
+ /** Creates a new instance of Subscriber */
+ 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
+ *
+ * @param filters DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public Object getCurrentMessage( org.apache.ws.pubsub.Filter[] filters )
+ {
+ return null;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.apache.ws.addressing.EndpointReference getEPR( )
+ {
+ return this.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 )
+ {
+ SubscribeDocument sdom = SubscribeDocument.Factory.newInstance( );
+ SubscribeDocument.Subscribe s = sdom.addNewSubscribe( );
+
+ //subscription ends are send to:
+ //TODO
+ //notifications are send to:
+ s.setConsumerReference( (org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType) ( (XmlObjectWrapper) notificationConsumer
+ .getEPR( ) )
+ .getXmlObject( ) );
+
+ //TODO check Calendar serializing
+ s.setInitialTerminationTime( initialTerminationTime );
+
+ //TODO multiple filters
+ if ( tf != null )
+ {
+ TopicExpressionType te = s.addNewTopicExpression( );
+ XmlCursor xc = te.newCursor( );
+ xc.toNextToken( );
+ xc.insertNamespace( "tns",
+ tf.getNameSpace( ) );
+ te.newCursor( ).setTextValue( (String) tf.getExpression( ) );
+ te.setDialect( tf.getURI( ).toString( ) );
+ }
+
+ //create Subscription
+ //add to local SubscriptionHome
+ org.apache.ws.notification.pubsub.Subscription ls = this.sH.create( );
+ 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( ) ) );
+
+ //extract SubscribeResponse from SOAPBody
+
+ /*SubscribeResponseDocument sresdom = SubscribeResponseDocument.Factory.newInstance();
+ sresres= sresdom.addNewSubscribeResponse();
+ sresres.set(sres.getEnvelope().getBody());
+ */
+
+ //TODO handle faults
+ SubscribeResponseDocument sresdom =
+ SubscribeResponseDocument.Factory.parse( sres.getEnvelope( ).getBody( ).xmlText( ) );
+ sresres = sresdom.getSubscribeResponse( );
+ }
+ catch ( Exception e )
+ {
+ e.printStackTrace( );
+ }
+
+ //set SubscritpionManager
+ ls.setSubscriptionManager( sresres );
+ ls.setNotificationConsumer( notificationConsumer );
+ return ls;
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscription.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscription.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscription.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/Subscription.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,80 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.commons.id.IdentifierUtils;
+import org.apache.ws.addressing.XmlBeansEndpointReference;
+import org.apache.ws.notification.base.impl.AbstractSubscription;
+import org.apache.ws.pubsub.SubscriptionEndConsumer;
+import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.SubscribeResponseDocument;
+import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType;
+import java.util.Calendar;
+
+/**
+ *
+ * @author Stefan Lischke
+ */
+public class Subscription
+ extends AbstractSubscription
+{
+ private EndpointReferenceType sMan;
+
+ //private static final Log LOG = LogFactory.getLog( Subscriber.class.getName() );
+
+ /** Creates a new instance of Subscription */
+ public Subscription( )
+ {
+ m_id = IdentifierUtils.UUID_VERSION_FOUR_GENERATOR.nextIdentifier( ).toString( );
+ m_creationTime = Calendar.getInstance( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param propSet DOCUMENT_ME
+ */
+ public void setResourcePropertySet( org.apache.ws.resource.properties.ResourcePropertySet propSet )
+ {
+ }
+
+ /**
+ * Get the subscriptionEnd consumer associated with this subscription.
+ *
+ * @return the subscriptionEnd consumer
+ */
+ public SubscriptionEndConsumer getSubscriptionEndConsumer( )
+ {
+ return null; //todo
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @param sresdom DOCUMENT_ME
+ */
+ public void setSubscriptionManager( SubscribeResponseDocument.SubscribeResponse sresdom )
+ {
+ sMan = sresdom.getSubscriptionReference( );
+ super.setEndpointReference( new XmlBeansEndpointReference( sMan ) );
+ }
+
+ /**
+ * DOCUMENT_ME
+ */
+ public void init( )
+ {
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/pubsub/SubscriptionHome.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,136 @@
+/*=============================================================================*
+ * 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.pubsub;
+
+import org.apache.ws.resource.IllegalResourceTypeException;
+import org.apache.ws.resource.JndiConstants;
+import org.apache.ws.resource.impl.AbstractResourceHome;
+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/NotificationPort}NotificationPort" );
+
+ /** 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/NotificationPort}NotificationPortPortType" );
+
+ /** The WSDL Port name associated with the resource. This is useful for building EPR's. **/
+ public static final String PORT_NAME = "NotificationPort";
+
+ /** 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/NotificationPort}ResourceID" );
+
+ /** DOCUMENT_ME */
+ public static final String HOME_LOCATION =
+ JndiConstants.CONTEXT_NAME_SERVICES + "/" + SERVICE_NAME.getLocalPart( ) + "/"
+ + JndiConstants.ATOMIC_NAME_HOME;
+
+ /**
+ * Map containing all FilesystemResource instances - this map <em>must</em> be static for
+ * compatibility with certain JNDI providers.
+ */
+ private static Map s_resources;
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public org.apache.ws.resource.properties.NamespaceVersionHolder getNamespaceVersionHolder( )
+ {
+ return null; //not sure what should go here.
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getPortType( )
+ {
+ return PORT_TYPE;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getResourceKeyNameQName( )
+ {
+ return RESOURCE_KEY_NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getServiceName( )
+ {
+ return SERVICE_NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServicePortName( )
+ {
+ return PORT_NAME;
+ }
+
+ //private static final Log LOG = LogFactory.getLog( SubscriptionHome.class.getName() );
+ public Subscription create( )
+ {
+ Subscription s = new Subscription( );
+ try
+ {
+ add( s );
+ }
+ catch ( IllegalResourceTypeException irte )
+ {
+ throw new RuntimeException( irte );
+ }
+
+ return s;
+ }
+
+ /**
+ * Returns a map of all FilesystemResource instances. Used by the {@link 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/notification/tool/WsnWsdl2Java.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2Java.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,170 @@
+/*=============================================================================*
+ * 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.tool;
+
+import org.apache.velocity.VelocityContext;
+import org.apache.ws.notification.base.v2004_06.impl.WsnNamespaceVersionHolderImpl;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.tool.v2004_06.NotificationConsumerPortType2JavaInfo;
+import org.apache.ws.notification.tool.v2004_06.NotificationProducerPortType2JavaInfo;
+import org.apache.ws.notification.tool.v2004_06.SubscriptionManagerPortType2JavaInfo;
+import org.apache.ws.resource.ResourceDefinition;
+import org.apache.ws.resource.tool.Wsdl2Java;
+import org.apache.ws.resource.tool.velocity.ServiceProperties;
+import java.io.File;
+
+/**
+ * Generates Java Web service types and skeletons from a WSRF/WSN WSDL.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class WsnWsdl2Java
+ extends Wsdl2Java
+{
+ private static final String VCTY_CTX_PROP_CHANGE = "propChange";
+ private static final String VCTY_CTX_RESOURCE_TERMINATION = "resourceTermination";
+ private static final String VCTY_CTX_NOTIF_PRODUCER = "notificationProducer";
+
+ /** DOCUMENT_ME */
+ protected String WEBAPP_NAME = "pubscribe";
+
+ /**
+ * Creates a new {@link WsnWsdl2Java} object.
+ *
+ * @param wsdlFiles DOCUMENT_ME
+ * @param outputDir DOCUMENT_ME
+ * @param classpath DOCUMENT_ME
+ * @param options DOCUMENT_ME
+ *
+ * @throws Exception DOCUMENT_ME
+ */
+ public WsnWsdl2Java( File[] wsdlFiles,
+ File outputDir,
+ File[] classpath,
+ Wsdl2JavaOptions options )
+ throws Exception
+ {
+ super( wsdlFiles, outputDir, classpath, options );
+ initPortTypeInfoMap( );
+ }
+
+ /**
+ * Returns the name of the webapp for use in generating code.
+ *
+ * @return the webapp name.
+ */
+ protected String getWebbappName( )
+ {
+ return WEBAPP_NAME;
+ }
+
+ /**
+ * Adds to the {@link ServiceProperties} object by making a call to super and
+ * then adding anything impl specific to be used by the VelocityContext for code generation.
+ *
+ * {@see Wsdl2Java#buildServiceProperties(ResourceDefinition resourceDefinition, File wsdlfile, File servicedir)}
+ *
+ * @param resourceDefinition The definition we are working on.
+ * @param wsdlfile The wsdl file.
+ * @param servicedir The directory we are generating to for this service.
+ * @return the updated ServiceProperties
+ */
+ protected ServiceProperties buildServiceProperties( ResourceDefinition resourceDefinition,
+ File wsdlfile,
+ File servicedir )
+ {
+ ServiceProperties serviceProperties =
+ super.buildServiceProperties( resourceDefinition, wsdlfile, servicedir );
+ serviceProperties.setNamespaceVersionHolder( WsnNamespaceVersionHolderImpl.class ); //make sure to add different ones as new versions comeout
+
+ //tell service props which properties we handle for the user...
+ if ( hasNotificationProducer( resourceDefinition ) )
+ {
+ serviceProperties.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET );
+ serviceProperties.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_TOPIC );
+ serviceProperties.addImplementedProperty( NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS );
+ }
+
+ return serviceProperties;
+ }
+
+ /**
+ * Provides a hook for adding directly to the Velocity Context.
+ *
+ * @param context
+ * @return VelocityContext
+ */
+ protected VelocityContext updateVelocityContext( VelocityContext context,
+ ResourceDefinition resourceDef )
+ {
+ VelocityContext velocityContext = super.updateVelocityContext( context, resourceDef );
+ if ( hasPropChange( resourceDef ) )
+ {
+ velocityContext.put( VCTY_CTX_PROP_CHANGE, "true" );
+ }
+
+ if ( hasResourceTermination( resourceDef ) )
+ {
+ velocityContext.put( VCTY_CTX_RESOURCE_TERMINATION, "true" );
+ }
+
+ if ( hasNotificationProducer( resourceDef ) )
+ {
+ velocityContext.put( VCTY_CTX_NOTIF_PRODUCER, "true" );
+ }
+
+ return velocityContext;
+ }
+
+ private boolean hasNotificationProducer( ResourceDefinition resourceDef )
+ {
+ return resourceDef.implementsResourceCapability( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.NAME );
+ }
+
+ private boolean hasPropChange( ResourceDefinition resourceDef )
+ {
+ if ( resourceDef.implementsResourceCapability( org.apache.ws.resource.properties.v2004_06.porttype.SetResourcePropertiesPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.properties.v2004_11.porttype.DeleteResourcePropertiesPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.properties.v2004_11.porttype.InsertResourcePropertiesPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.properties.v2004_11.porttype.SetResourcePropertiesPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.properties.v2004_11.porttype.UpdateResourcePropertiesPortType.NAME ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private boolean hasResourceTermination( ResourceDefinition resourceDef )
+ {
+ if ( resourceDef.implementsResourceCapability( org.apache.ws.resource.lifetime.v2004_06.porttype.ImmediateResourceTerminationPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.lifetime.v2004_06.porttype.ScheduledResourceTerminationPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.lifetime.v2004_11.porttype.ImmediateResourceTerminationPortType.NAME )
+ || resourceDef.implementsResourceCapability( org.apache.ws.resource.lifetime.v2004_11.porttype.ScheduledResourceTerminationPortType.NAME ) )
+ {
+ return true;
+ }
+
+ return false;
+ }
+
+ private void initPortTypeInfoMap( )
+ {
+ addPortType2JavaInfo( new NotificationConsumerPortType2JavaInfo( ) );
+ addPortType2JavaInfo( new NotificationProducerPortType2JavaInfo( ) );
+ addPortType2JavaInfo( new SubscriptionManagerPortType2JavaInfo( ) );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2JavaTask.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2JavaTask.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2JavaTask.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/WsnWsdl2JavaTask.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,58 @@
+/*=============================================================================*
+ * 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.tool;
+
+import org.apache.ws.resource.tool.Wsdl2Java;
+import org.apache.ws.resource.tool.Wsdl2JavaTask;
+import java.io.File;
+
+/**
+ * Ant task that wraps {@link WsnWsdl2Java}.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class WsnWsdl2JavaTask
+ extends Wsdl2JavaTask
+{
+ /**
+ * Returns a simple statement of what the task is.
+ *
+ * @return the simple string
+ */
+ public String toString( )
+ {
+ return "WsnWsdl2Java Ant task";
+ }
+
+ /**
+ * Method which builds the implementation of Wsdl2Java, which in this case is {@link WsnWsdl2Java}.
+ *
+ * @param wsdlFiles The wsdl files to be processed.
+ * @param outputDir The directory where the generated code will go.
+ * @param classpathFiles The classpath.
+ * @param options {@link Wsdl2Java.Wsdl2JavaOptions}
+ * @return The implementation of Wsdl2Java
+ * @throws Exception
+ */
+ protected Wsdl2Java createWsdl2Java( File[] wsdlFiles,
+ File outputDir,
+ File[] classpathFiles,
+ Wsdl2Java.Wsdl2JavaOptions options )
+ throws Exception
+ {
+ return new WsnWsdl2Java( wsdlFiles, outputDir, classpathFiles, options );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationConsumerPortType2JavaInfo.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,59 @@
+/*=============================================================================*
+ * 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.tool.v2004_06;
+
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationConsumerPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+import javax.xml.namespace.QName;
+
+/**
+ *
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com), Sal Campana
+ */
+public class NotificationConsumerPortType2JavaInfo
+ extends PortType2JavaInfo
+{
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getName( )
+ {
+ return NotificationConsumerPortType.NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceInterfaceName( )
+ {
+ return NotificationConsumerPortType.class.getName( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceTemplateFileName( )
+ {
+ return "templates/v2004_06/NotificationConsumerPortType.txt";
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/NotificationProducerPortType2JavaInfo.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,101 @@
+/*=============================================================================*
+ * 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.tool.v2004_06;
+
+import org.apache.ws.notification.base.NotificationProducerResource;
+import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+import javax.xml.namespace.QName;
+
+/**
+ * A PortType2Java impl for the NotificationProducer portType which tells WsnWsdl2Java
+ * information on how to implement this portType in the generated code.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class NotificationProducerPortType2JavaInfo
+ extends PortType2JavaInfo
+{
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getAbstractResourceInitMethodIncludeLocation( )
+ {
+ return "templates/NotificationProducer-AbstractResource_init.txt";
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getName( )
+ {
+ return NotificationProducerPortType.NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getResourceInitMethodIncludeLocation( )
+ {
+ return "templates/NotificationProducer-Resource_init.txt";
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getResourceInterfaceName( )
+ {
+ return NotificationProducerResource.class.getName( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getResourceTemplateFileName( )
+ {
+ return "templates/NotificationProducerResource.txt";
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceInterfaceName( )
+ {
+ return NotificationProducerPortType.class.getName( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceTemplateFileName( )
+ {
+ return "templates/v2004_06/NotificationProducerPortType.txt";
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/tool/v2004_06/SubscriptionManagerPortType2JavaInfo.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,60 @@
+/*=============================================================================*
+ * 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.tool.v2004_06;
+
+import org.apache.ws.notification.base.v2004_06.porttype.SubscriptionManagerPortType;
+import org.apache.ws.resource.tool.PortType2JavaInfo;
+import javax.xml.namespace.QName;
+
+/**
+ * A PortType2Java impl for the SubscriptionManager portType which tells WsnWsdl2Java
+ * information on how to implement this portType in the generated code.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public class SubscriptionManagerPortType2JavaInfo
+ extends PortType2JavaInfo
+{
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public QName getName( )
+ {
+ return SubscriptionManagerPortType.NAME;
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceInterfaceName( )
+ {
+ return SubscriptionManagerPortType.class.getName( );
+ }
+
+ /**
+ * DOCUMENT_ME
+ *
+ * @return DOCUMENT_ME
+ */
+ public String getServiceTemplateFileName( )
+ {
+ return "templates/v2004_06/SubscriptionManagerPortType.txt";
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/ResourcePropertyValueChangeTopic.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,29 @@
+/*=============================================================================*
+ * 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.topics;
+
+import org.apache.ws.resource.properties.ResourcePropertyValueChangeListener;
+
+/**
+ * A topic that acts as a listener for resource property value change events.
+ *
+ * @author Sal Campana
+ */
+public interface ResourcePropertyValueChangeTopic
+ extends Topic,
+ ResourcePropertyValueChangeListener
+{
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/Topic.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/Topic.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/Topic.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/Topic.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,112 @@
+/*=============================================================================*
+ * 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.topics;
+
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import java.util.List;
+
+/**
+ * Interface for representing a topic. A topic is either a child of a parent topic or in the case of root topics a
+ * member of a topic list. Non-root topics have names without a namespace component.
+ *
+ * @see TopicSpace
+ */
+public interface Topic
+ extends TopicSet,
+ TopicListenerList
+{
+ /**
+ * Get the latest notification message published to this topic.
+ *
+ * @return an Object representing the latest notification message published to this topic, or null if no messages
+ * have yet been published
+ */
+ Object getCurrentMessage( );
+
+ /**
+ * Get the name of this topic.
+ *
+ * @return the name of this topic
+ */
+ String getName( );
+
+ /**
+ * Is this a topic reference?
+ *
+ * @return true if this topic is a reference to another topic, false if not
+ */
+ boolean isReference( );
+
+ /**
+ * Set the topic path. The topic path is represented as a ordered list of topic names
+ *
+ * @param topicPath The topic path to associate with this topic
+ */
+ void setTopicPath( List topicPath );
+
+ /**
+ * Get the topic path. The topic path is represented as a ordered list of topic names
+ *
+ * @return The topic path of this topic
+ */
+ List getTopicPath( );
+
+ /**
+ * Set the topic expression that resolves to a set of topics that this topic references.
+ * Only used for reference topics.
+ *
+ * @param topicPath The topic expression to set.
+ */
+ void setTopicReference( TopicExpression topicPath );
+
+ /**
+ * Get the topic expression for the topic(s) that this topic references.
+ *
+ * @return The topic expression that this topic reference or null if this topic is not a reference.
+ */
+ TopicExpression getTopicReference( );
+
+ /**
+ * Set the TopicSpace this Topic is part of
+ *
+ * @param topicSpace The TopicSpace this Topic is part of
+ */
+ void setTopicSpace( TopicSpace topicSpace );
+
+ /**
+ * gets the TopicSpace this Topic is part of
+ *
+ * @return The TopicSpace this Topic is part of
+ */
+ TopicSpace getTopicSpace( );
+
+ /**
+ * Returns whether this Topic is visible or not.
+ *
+ * @return true if the Topic is visible, else false.
+ */
+ boolean isVisible( );
+
+ /**
+ * Publish a notification message to this topic.
+ *
+ * @param msg the notification message to be published
+ *
+ * @throws Exception on error
+ */
+ void publish( Object msg )
+ throws Exception;
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListener.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListener.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListener.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListener.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,32 @@
+/*=============================================================================*
+ * 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.topics;
+
+
+/**
+ * Interface that should be implemented by parties interested in changes in topics and the list of root topics. It is
+ * currently used to send notifications when the situation represented by a topic changes and for tracking the list of
+ * currently supported topics (exposed as a resource property)
+ */
+public interface TopicListener
+{
+ /**
+ * Called when the value of the topic changes
+ *
+ * @param topic The topic that changed
+ */
+ void topicChanged( Topic topic );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListenerList.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListenerList.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListenerList.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicListenerList.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,56 @@
+/*=============================================================================*
+ * 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.topics;
+
+import java.util.Iterator;
+
+/**
+ * Interface used for managing a list of topic listeners. Currently inherited by the <code>TopicList</code> and
+ * <code>Topic</code> interfaces.
+ *
+ * @see TopicListener
+ * @see TopicSpace
+ * @see Topic
+ */
+public interface TopicListenerList
+{
+ /**
+ * Add a topic listener
+ *
+ * @param listener The topic listener to add
+ *
+ * @see TopicListener
+ */
+ void addTopicListener( TopicListener listener );
+
+ /**
+ * Remove a topic listener
+ *
+ * @param listener The topic listener to remove.
+ *
+ * @see TopicListener
+ */
+ void removeTopicListener( TopicListener listener );
+
+ /**
+ * Get a iterator for the list of TopicListeners
+ *
+ * @return The iterator
+ *
+ * @see TopicListener
+ */
+ Iterator topicListenerIterator( );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSet.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSet.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSet.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSet.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,77 @@
+/*=============================================================================*
+ * 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.topics;
+
+import java.util.Iterator;
+
+/**
+ * A set of {@link Topic}s.
+ */
+public interface TopicSet
+{
+ /**
+ * Gets the topic with the specified name.
+ *
+ * @param name the name of the topic to get
+ *
+ * @return the topic, or null if no topic with the given name exists in this set
+ */
+ Topic getTopic( String name );
+
+ /**
+ * Adds the specified topic to this set.
+ *
+ * If the Topic already exists it will be overwritten in the underlying Map
+ *
+ * @param topic the topic to add
+ *
+ * @throws IllegalStateException if the Reference TopicExpression is already set and someone attempts to add.
+ */
+ Topic addTopic( Topic topic );
+
+ /**
+ * Creates a new Topic object with the specified name and adds it to this set.
+ *
+ * If the Topic already exists it will be overwritten in the underlying Map
+ *
+ * @param name the name of the topic to add
+ *
+ */
+ Topic addTopic( String name );
+
+ /**
+ * Returns <tt>true</tt> if this set contains a topic with the specified name.
+ *
+ * @param name the name
+ *
+ * @return <tt>true</tt> if this set contains a topic with the specified name
+ */
+ boolean containsTopic( String name );
+
+ /**
+ * Removes the topic with the specified name from this set.
+ *
+ * @param name the name of the topic to remove
+ */
+ void removeTopic( String name );
+
+ /**
+ * Gets an iterator of the topics in this set.
+ *
+ * @return the iterator
+ */
+ Iterator topicIterator( );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpace.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpace.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpace.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpace.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,39 @@
+/*=============================================================================*
+ * 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.topics;
+
+
+/**
+ * A topic space (a hierarchy of topics within a particular namespace).
+ * Provides methods for managing the topics and performing queries on them.
+ */
+public interface TopicSpace
+ extends TopicSet
+{
+ /**
+ * Returns this topic space's name.
+ *
+ * @return this topic space's name
+ */
+ String getName( );
+
+ /**
+ * Returns this topic space's target namespace.
+ *
+ * @return this topic space's target namespace
+ */
+ String getTargetNamespace( );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/TopicSpaceSet.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,82 @@
+/*=============================================================================*
+ * 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.topics;
+
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+
+/**
+ * The set of topics that a particular NotificationProducer supports.
+ */
+public interface TopicSpaceSet
+{
+ /**
+ * Sets the boolean that indicates if this topic set is fixed as defined by
+ * the WS-BaseNotification specification.
+ *
+ * @param fixed
+ */
+ void setFixed( boolean fixed );
+
+ /**
+ * Returns a boolean that indicates if this topic set is fixed as defined by
+ * the WS-BaseNotification specification.
+ */
+ boolean isFixed( );
+
+ /**
+ * Returns a TopicSpace for a given namespace uri.
+ *
+ * @param namespaceURI
+ * @return the TopicSpace for the given uri, or null if there is no TopicSpace found.
+ */
+ TopicSpace getTopicSpace( String namespaceURI );
+
+ /**
+ * Resturns the TopicSpaces maintained by this TopicSpaceSet
+ *
+ * @return An array of TopicSpace objects.
+ */
+ TopicSpace[] getTopicSpaces( );
+
+ /**
+ * Adds the TopicSpace to the TopicSpaceSet.
+ *
+ * Note. If the TopiSpace already exists, this method will add all the known Topics
+ * to the passed-in TopicSpace and set it as the current TopicSpace in the TopicSpaceSet.
+ * This will ensure there is only 1 TopicSpace in the set and it is complete...
+ *
+ * @param topicSpace
+ */
+ TopicSpace addTopicSpace( TopicSpace topicSpace );
+
+ /**
+ * Evaluates a {@link TopicExpression} against the TopicSpaceSet and returns an array of matching Topics.
+ *
+ * @param topicExpr The topicexpression (query) to be used to search againt the TopicSpaceSet.
+ * @return An array of Topics which were found based on the topicexpression
+ * @throws TopicExpressionException
+ */
+ Topic[] evaluateTopicExpression( TopicExpression topicExpr )
+ throws TopicExpressionException;
+
+ /**
+ * Removes a TopicSpace from the TopicSpaceSet for a given namespace uri.
+ *
+ * @param namespaceURI
+ */
+ void removeTopicSpace( String namespaceURI );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/InvalidTopicExpressionException.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/InvalidTopicExpressionException.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/InvalidTopicExpressionException.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/InvalidTopicExpressionException.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,64 @@
+/*=============================================================================*
+ * 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.topics.expression;
+
+
+/**
+ * This exception is raised when the topic expression is invalid.
+ */
+public class InvalidTopicExpressionException
+ extends TopicExpressionException
+{
+ /**
+ * Creates a InvalidTopicExpressionException without error message.
+ */
+ public InvalidTopicExpressionException( )
+ {
+ }
+
+ /**
+ * Creates a InvalidTopicExpressionException with a given error message.
+ *
+ * @param message error message
+ */
+ public InvalidTopicExpressionException( String message )
+ {
+ super( message );
+ }
+
+ /**
+ * Creates a InvalidTopicExpressionException with a given error message
+ * and nested exception.
+ *
+ * @param message error message
+ * @param exception nested exception/
+ */
+ public InvalidTopicExpressionException( String message,
+ Throwable exception )
+ {
+ super( message, exception );
+ }
+
+ /**
+ * Creates a InvalidTopicExpressionException from a nested exception.
+ *
+ * @param exception nested exception
+ */
+ public InvalidTopicExpressionException( Throwable exception )
+ {
+ super( exception );
+ }
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpression.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpression.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpression.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpression.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,42 @@
+/*=============================================================================*
+ * 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.topics.expression;
+
+import java.net.URI;
+
+/**
+ * Java representation of the wsnt:TopicExpressionType XML schema type.
+ *
+ * @author Ian Springer (ian DOT springer AT hp DOT com)
+ */
+public interface TopicExpression
+{
+ /**
+ * Returns the content of this topic expression (typically a String).
+ */
+ Object getContent( );
+
+ /**
+ * Returns the dialect of this topic expression.
+ */
+ URI getDialect( );
+
+ /**
+ * Returns a namespace context that can be used to resolve prefixes within this
+ * query expression's content.
+ */
+ Object getNamespaceContext( );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEngine.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,84 @@
+/*=============================================================================*
+ * 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.topics.expression;
+
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
+import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+
+/**
+ * The <code>TopicExpressionEngine</code> interface is used to map queries on a
+ * topic list to the appropriate <code>TopicExpressionEvaluators</code> and then
+ * return the result. <code>TopicExpressionEvaluators</code> can be
+ * preconfigured or dynamically added at runtime.
+ *
+ * @see TopicExpressionEvaluator
+ */
+public interface TopicExpressionEngine
+{
+ /**
+ * Gets the evaluator currently registered to handle a topic expression of
+ * the specified dialect.
+ *
+ * @return the matching topic expression evaluator or null if none was
+ * found
+ */
+ TopicExpressionEvaluator getEvaluator( String dialect );
+
+ /**
+ * Returns a list of URIs representing the registered topic expression
+ * dialects
+ *
+ * @return the list of supported dialects
+ */
+ String[] getSupportedDialects( );
+
+ /**
+ * Resolves a topic expression using the passed topic list. The appropraite
+ * TopicExpressionEvaluator is used based on the dialect element.
+ *
+ * @param topicSpaceSet the topic list to apply the expression to
+ * @param topicExpression topic expression
+ * @return the set of topics the expression evaluated to
+ * @throws org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException
+ * if the topic expression dialect is not
+ * supported
+ * @throws TopicExpressionResolutionException
+ * if the expression could not be
+ * evaluated
+ * @throws InvalidTopicExpressionException
+ * if the topic expression is invalid
+ * @throws TopicExpressionException if any other error occurs
+ */
+ Topic[] evaluateTopicExpression( TopicSpaceSet topicSpaceSet,
+ TopicExpression topicExpression )
+ throws TopicPathDialectUnknownException,
+ TopicExpressionResolutionException,
+ InvalidTopicExpressionException,
+ TopicExpressionException;
+
+ /**
+ * registers a new evaluator that can be used to evaluate topic expressions
+ *
+ * @param evaluator implementation of evaluator to be used for evaluating
+ * topic expressions
+ */
+ void registerEvaluator( TopicExpressionEvaluator evaluator );
+}
\ No newline at end of file
Added: webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java
URL: http://svn.apache.org/viewvc/webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java?rev=411218&view=auto
==============================================================================
--- webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java (added)
+++ webservices/muse/branches/1.0/src/java/org/apache/ws/notification/topics/expression/TopicExpressionEvaluator.java Fri Jun 2 10:32:46 2006
@@ -0,0 +1,61 @@
+/*=============================================================================*
+ * 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.topics.expression;
+
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpaceSet;
+import org.apache.ws.notification.topics.expression.InvalidTopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpression;
+import org.apache.ws.notification.topics.expression.TopicExpressionException;
+import org.apache.ws.notification.topics.expression.TopicExpressionResolutionException;
+import org.apache.ws.notification.topics.expression.TopicPathDialectUnknownException;
+
+/**
+ * A <code>TopicExpressionEvaluator</code> is used to implement a topic expression evaluation against a
+ * <code>TopicSpaceSet</code>. An evaluator can be registered with a <code>TopicExpressionEngine</code>,
+ * which in turn calls the evaluator when a matching expression is found.
+ */
+public interface TopicExpressionEvaluator
+{
+ /**
+ * Gets the URIs for the dialects that this evaluator can handle
+ *
+ * @return array of URIs supported by this evaluator
+ */
+ String[] getDialects( );
+
+ /**
+ * Evaluates the expression over a TopicSpace and returns the set of matching topics.
+ *
+ * @param topicSpaceSet topic list associated with the service/resource
+ * @param expression object passed by client representing the topic expression
+ * @return the set of topics that matched the specified expression
+ *
+ * @throws TopicPathDialectUnknownException
+ * if the topic expression dialect is not supported
+ * @throws TopicExpressionResolutionException
+ * if the expression could not be evaluated
+ * @throws org.apache.ws.notification.topics.expression.InvalidTopicExpressionException
+ * if the topic expression is invalid
+ * @throws TopicExpressionException if any other error occurs
+ */
+ Topic[] evaluate( TopicSpaceSet topicSpaceSet,
+ TopicExpression expression )
+ throws TopicPathDialectUnknownException,
+ TopicExpressionResolutionException,
+ InvalidTopicExpressionException,
+ TopicExpressionException;
+}
\ 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