Author: scamp Date: Tue Jan 25 11:40:41 2005 New Revision: 126413 URL: http://svn.apache.org/viewcvs?view=rev&rev=126413 Log: updated Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java
Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java Url: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java?view=diff&rev=126413&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java&r1=126412&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java&r2=126413 ============================================================================== --- incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java (original) +++ incubator/hermes/trunk/src/java/org/apache/ws/notification/base/impl/AbstractSubscription.java Tue Jan 25 11:40:41 2005 @@ -17,14 +17,12 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.apache.ws.notification.base.QueryExpressionFilter; +import org.apache.ws.notification.base.NotificationProducerResource; import org.apache.ws.notification.base.Subscription; import org.apache.ws.notification.topics.TopicExpression; -import org.apache.ws.notification.topics.TopicSpace; -import org.apache.ws.notification.topics.TopicListAccessor; import org.apache.ws.notification.topics.TopicListener; import org.apache.ws.notification.topics.TopicListenerList; -import org.apache.ws.notification.topics.TopicExpression; +import org.apache.ws.notification.topics.TopicSpaceSet; import org.apache.ws.notification.topics.impl.SimpleSubscriptionTopicListener; import org.apache.ws.pubsub.Filter; import org.apache.ws.pubsub.NotificationConsumer; @@ -34,23 +32,15 @@ import org.apache.ws.resource.ResourceException; import org.apache.ws.resource.ResourceHome; import org.apache.ws.resource.ResourceKey; -import org.apache.ws.resource.ResourceContextException; import org.apache.ws.resource.properties.ResourcePropertySet; import org.apache.ws.resource.properties.query.QueryExpression; import org.apache.ws.util.uuid.UuidGenerator; import org.apache.ws.util.uuid.UuidGeneratorFactory; -import org.apache.ws.util.XmlBeanUtils; -import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType; -import org.oasisOpen.docs.wsrf.x2004.x06.wsrfWSResourceProperties12Draft01.QueryExpressionType; import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType; -import org.xmlsoap.schemas.ws.x2003.x03.addressing.AttributedURI; -import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceDocument; -import org.xmlsoap.schemas.ws.x2003.x03.addressing.ReferencePropertiesType; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.directory.SchemaViolationException; -import javax.xml.rpc.JAXRPCException; import java.net.URI; import java.util.Calendar; import java.util.Collection; @@ -138,28 +128,14 @@ return producerHome.find( m_producerKey ); } - public QueryExpressionFilter getSelector() + public QueryExpression getSelector() { - try - { - return new XmlBeansQueryExpressionFilter( m_selector ); - } - catch ( SchemaViolationException sve ) - { - throw new RuntimeException( sve ); - } + return m_selector; } public TopicExpression getTopicExpression() { - try - { - return new XmlBeansTopicExpression( m_topicExpression ); - } - catch ( SchemaViolationException sve ) - { - throw new RuntimeException( sve ); - } + return m_topicExpression; } public boolean isPaused() @@ -184,8 +160,7 @@ public AbstractSubscription() { - this( null, null, null, null, null, null, - null, null, null, false, true ); + } /** @@ -249,16 +224,16 @@ throw new ResourceException( "", e ); } - if ( !( resource instanceof TopicListAccessor ) ) + if ( !( resource instanceof NotificationProducerResource ) ) { return; } - TopicSpace topicSpace = ( (TopicListAccessor) resource ).getTopicList(); + TopicSpaceSet topicSpaceSet = ( (NotificationProducerResource) resource ).getTopicSpaceSet(); Collection topics = null; try - { - topics = topicSpace.getTopics( new XmlBeansTopicExpression( m_topicExpression ) ); + { //todo fix! + // topics = topicSpace.getTopics( new XmlBeansTopicExpression( m_topicExpression ) ); } catch ( Exception e ) { Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java Url: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java?view=diff&rev=126413&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java&r1=126412&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java&r2=126413 ============================================================================== --- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java (original) +++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleSubscriptionTopicListener.java Tue Jan 25 11:40:41 2005 @@ -15,21 +15,15 @@ */ package org.apache.ws.notification.topics.impl; -import org.apache.axis.message.addressing.EndpointReferenceType; + import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; import org.apache.ws.notification.base.Subscription; import org.apache.ws.notification.topics.Topic; import org.apache.ws.notification.topics.TopicListener; -import org.apache.ws.notification.topics.TopicExpressionEngine; -import org.apache.ws.notification.topics.TopicExpressionEvaluator; -import org.apache.ws.notification.topics.TopicExpression; import org.apache.ws.pubsub.NotificationConsumer; -import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotifyDocument; -import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType; -import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.NotificationMessageHolderType; +import org.xmlsoap.schemas.ws.x2003.x03.addressing.EndpointReferenceType; -import javax.xml.rpc.Stub; import java.io.Serializable; import java.util.List; @@ -47,8 +41,7 @@ LogFactory.getLog(SimpleSubscriptionTopicListener.class.getName()); private transient NotificationConsumer consumerPort = null; - private transient WSBaseNotificationServiceAddressingLocator locator = - null; + private Subscription m_subscription; /** @@ -117,7 +110,9 @@ { if(!subscription.isPaused()) { - EndpointReferenceType consumerEPR = + System.out.println("+++++++++++++++++++++We just got notified!!!!! value: " + newValue); + + /* EndpointReferenceType consumerEPR = subscription.getNotificationConsumer().getEPR(); if(subscription.getUseNotify()) { @@ -136,21 +131,32 @@ String dialect = topicExpressionIntf.getDialect().toString(); TopicExpressionEvaluator evaluator = engine.getEvaluator(dialect); - TopicExpressionType topicExpression = - (TopicExpressionType) evaluator.toTopicExpression( - topicPath); + TopicExpression topicExpression = + null; + try + { + topicExpression = (TopicExpression) evaluator.toTopicExpression( + topicPath); + } + catch (TopicExpressionException e) + { + + + } NotificationMessageHolderType[] message = - {new NotificationMessageHolderType()}; + {NotificationMessageHolderType.Factory.newInstance()}; message[0].setProducerReference(producerEndpoint); message[0].setMessage(newValue); message[0].setTopic(topicExpression); notification.setNotificationMessage(message); this.consumerPort.notify(notification); + + } else { // TODO: raw notifications - } + } */ } } } @@ -176,8 +182,8 @@ { return; } - - if(this.locator == null) + //todo decide what to do here... + /* if(this.locator == null) { this.locator = new WSBaseNotificationServiceAddressingLocator(); } @@ -186,6 +192,6 @@ { this.consumerPort = this.locator.getNotificationConsumerPort(consumerEPR); - } + }*/ } } Modified: incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java Url: http://svn.apache.org/viewcvs/incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java?view=diff&rev=126413&p1=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java&r1=126412&p2=incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java&r2=126413 ============================================================================== --- incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java (original) +++ incubator/hermes/trunk/src/java/org/apache/ws/notification/topics/impl/SimpleTopicExpressionEvaluator.java Tue Jan 25 11:40:41 2005 @@ -36,7 +36,9 @@ import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionResolutionException; import org.apache.ws.notification.topics.topicexpression.impl.InvalidTopicExpressionException; import org.apache.ws.notification.topics.topicexpression.impl.TopicExpressionException; +import org.apache.ws.notification.base.impl.XmlBeansTopicExpression; import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType; +import org.w3c.dom.Text; /** * Topic expression evalutor for the "Simple" topic dialect. @@ -57,11 +59,13 @@ InvalidTopicExpressionException, TopicExpressionException { - QName topicName = expr..getValue(); + Text exprValue = (Text) expr.getContent(); + String topicName = exprValue.getNodeValue(); + topicName = topicName.substring(topicName.indexOf(":") - 1);//todo not sure if got index correct here! LOG.debug("Looking for topic with namespace: " + - topicName.getNamespaceURI() + " and local part " + - topicName.getLocalPart()); + topicSpace.getNamespaceURI() + " and local part " + + topicName); Collection result = new Vector(); List topicPath = new LinkedList(); @@ -105,28 +109,26 @@ TopicExpressionException { List result = new LinkedList(); - result.add(((TopicExpressionType) expression).getValue()); + // result.add(((TopicExpressionType) expression).getValue()); return result; } - public TopicExpressionType toTopicExpression(List topicPath) + public TopicExpression toTopicExpression(List topicPath) throws InvalidTopicExpressionException, TopicExpressionException { if(topicPath == null || topicPath.size() != 1) { throw new InvalidTopicExpressionException( - i18n.getMessage("invalidSimpleTopicPath")); + "invalidSimpleTopicPath"); } - TopicExpressionType result = null; - try { - result = new TopicExpressionType( + TopicExpression result = null; + + /* result = new XmlBeansTopicExpression(); ( Topics1_2Constants.TOPIC_EXPR_DIALECT_SIMPLE, - (QName) topicPath.get(0)); - } catch (IOException e) { - throw new TopicExpressionException("", e); - } + (QName) topicPath.get(0));*/ + return result; } } --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
