You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pubscribe-commits@ws.apache.org by ip...@apache.org on 2005/07/28 17:09:58 UTC
svn commit: r225795 - in /webservices/pubscribe/trunk/src:
java/org/apache/ws/notification/base/
java/org/apache/ws/notification/topics/util/ templates/
Author: ips
Date: Thu Jul 28 08:09:54 2005
New Revision: 225795
URL: http://svn.apache.org/viewcvs?rev=225795&view=rev
Log:
finished callbacks for producer props
Modified:
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java
webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java
webservices/pubscribe/trunk/src/templates/NotificationProducer-AbstractResource_init.txt
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java?rev=225795&r1=225794&r2=225795&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/FixedTopicSetResourcePropertyCallback.java Thu Jul 28 08:09:54 2005
@@ -16,6 +16,7 @@
package org.apache.ws.notification.base;
import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
+import org.apache.ws.notification.topics.TopicSpaceSet;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertyCallback;
import org.apache.ws.resource.properties.impl.CallbackFailedException;
@@ -25,30 +26,32 @@
import javax.xml.namespace.QName;
/**
- * A callback for the FixedTopicSet resource property from the WS-BaseNotification
- * NotificationProducer portType.
+ * A callback for the FixedTopicSet resource property from the WS-BaseNotification NotificationProducer portType.
*/
public class FixedTopicSetResourcePropertyCallback implements ResourcePropertyCallback
{
- private NotificationProducerResource m_resource;
+ private TopicSpaceSet m_topicSet;
/**
- * Creates a new {@link FixedTopicSetResourcePropertyCallback} for the specified notification producer resource.
+ * Creates a new {@link TopicResourcePropertyCallback} for the specified topic set.
*
- * @param resource a notification producer resource
+ * @param topicSet the producer's topic set
*/
- public FixedTopicSetResourcePropertyCallback( NotificationProducerResource resource )
+ public FixedTopicSetResourcePropertyCallback( TopicSpaceSet topicSet )
{
- m_resource = resource;
+ m_topicSet = topicSet;
}
/**
+ * Refreshes the value of the wsnt:FixedTopicSet resource property so that it
+ * reflects the fixed flag on the producer resource's topic set.
+ *
* @param prop the wsnt:FixedTopicSet resource property
*
* @return the wsnt:FixedTopicSet resource property
*
- * @throws org.apache.ws.resource.properties.impl.CallbackFailedException
+ * @throws org.apache.ws.resource.properties.impl.CallbackFailedException
*/
public ResourceProperty refreshProperty( ResourceProperty prop ) throws CallbackFailedException
{
@@ -60,13 +63,13 @@
if ( prop.isEmpty() )
{
FixedTopicSetDocument fixedTopicSetDoc = FixedTopicSetDocument.Factory.newInstance();
- fixedTopicSetDoc.setFixedTopicSet(m_resource.getTopicSpaceSet().isFixed());
- prop.add(fixedTopicSetDoc);
+ fixedTopicSetDoc.setFixedTopicSet( m_topicSet.isFixed() );
+ prop.add( fixedTopicSetDoc );
}
else
{
XmlBoolean fixedTopicSetPropElem = (XmlBoolean) prop.get( 0 );
- fixedTopicSetPropElem.setBooleanValue( m_resource.getTopicSpaceSet().isFixed() );
+ fixedTopicSetPropElem.setBooleanValue( m_topicSet.isFixed() );
}
return prop;
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java?rev=225795&r1=225794&r2=225795&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicExpressionDialectsResourcePropertyCallback.java Thu Jul 28 08:09:54 2005
@@ -32,6 +32,9 @@
{
/**
+ * Initializes the value of the wsnt:TopicExpressionDialects resource property so that it
+ * reflects the topic expression dialects supported by the topic expression engine.
+ *
* @param prop the wsnt:TopicExpressionDialects resource property
*
* @return the wsnt:TopicExpressionDialects resource property
@@ -48,7 +51,6 @@
if ( prop.isEmpty() )
{
String[] supportedDialects = TopicExpressionEngineImpl.getInstance().getSupportedDialects();
- //add a TopicExpressionDialectsDocument for each TopicExpressionDialect.
for ( int i = 0; i < supportedDialects.length; i++ )
{
TopicExpressionDialectsDocument topicExpressionDialectsDocument = TopicExpressionDialectsDocument.Factory.newInstance();
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java?rev=225795&r1=225794&r2=225795&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/base/TopicResourcePropertyCallback.java Thu Jul 28 08:09:54 2005
@@ -18,6 +18,7 @@
import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
import org.apache.ws.notification.topics.Topic;
import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.notification.topics.TopicSpaceSet;
import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertyCallback;
@@ -36,19 +37,22 @@
public class TopicResourcePropertyCallback implements ResourcePropertyCallback
{
- private NotificationProducerResource m_resource;
+ private TopicSpaceSet m_topicSet;
/**
- * Creates a new {@link TopicResourcePropertyCallback} for the specified notification producer resource.
+ * Creates a new {@link TopicResourcePropertyCallback} for the specified topic set.
*
- * @param resource a notification producer resource
+ * @param topicSet the producer's topic set
*/
- public TopicResourcePropertyCallback( NotificationProducerResource resource )
+ public TopicResourcePropertyCallback( TopicSpaceSet topicSet )
{
- m_resource = resource;
+ m_topicSet = topicSet;
}
/**
+ * Refreshes the value of the wsnt:Topic resource property so that it
+ * reflects the topics contained in the producer resource's topic set.
+ *
* @param prop the wsnt:Topic resource property
*
* @return the wsnt:Topic resource property
@@ -63,7 +67,7 @@
throw new IllegalArgumentException( "Unsupported property: " + propName );
}
prop.clear();
- TopicSpace[] topicSpaces = m_resource.getTopicSpaceSet().getTopicSpaces();
+ TopicSpace[] topicSpaces = m_topicSet.getTopicSpaces();
for ( int i = 0; i < topicSpaces.length; i++ )
{
TopicSpace topicSpace = topicSpaces[i];
@@ -77,37 +81,37 @@
if ( topic.isVisible() )
{
- addSimpleTopicExpression( rootTopicQName, prop );
+ addSimpleTopicExpression( prop, rootTopicQName );
}
Iterator subTopics = topic.topicIterator();
while ( subTopics.hasNext() )
{
Topic subTopic = (Topic) subTopics.next();
- addConcreteTopicExpressions( rootTopicQName, subTopic, prop );
+ addConcreteTopicExpressions( prop, rootTopicQName, subTopic );
}
}
}
return prop;
}
- private static void addSimpleTopicExpression(QName rootTopicName, ResourceProperty prop)
+ private static void addSimpleTopicExpression( ResourceProperty topicProp, QName rootTopicName )
{
TopicDocument topicDocument = TopicDocument.Factory.newInstance();
TopicExpressionType topicExpressionType = topicDocument.addNewTopic();
topicExpressionType.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE);
XmlBeanUtils.setValueAsQName(topicExpressionType, rootTopicName);
- prop.add(topicDocument);
+ topicProp.add(topicDocument);
}
/**
- * Recursively adds Concrete Topics to the Topic Document
+ * Recursively adds Concrete topic expressions to the Topic resource property.
*
+ * @param topicProp The ResourceProperty associated with the Topic being added to.
* @param rootTopicName The QName of the parent topic.
* @param subTopic The current topic being added.
- * @param resourceProp The ResourceProperty associated with the Topic being added to.
*/
- private static void addConcreteTopicExpressions(QName rootTopicName, Topic subTopic, ResourceProperty resourceProp)
+ private static void addConcreteTopicExpressions( ResourceProperty topicProp, QName rootTopicName, Topic subTopic )
{
TopicDocument topicDocument = TopicDocument.Factory.newInstance();
String topicName = subTopic.getName();
@@ -117,13 +121,13 @@
TopicExpressionType topicExpressionType = topicDocument.addNewTopic();
topicExpressionType.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_CONCRETE);
XmlBeanUtils.setValueAsQName(topicExpressionType, concreteTopicName);
- resourceProp.add(topicDocument);
+ topicProp.add(topicDocument);
}
Iterator iterator = subTopic.topicIterator();
while (iterator.hasNext())
{
Topic topic = (Topic) iterator.next();
- addConcreteTopicExpressions(concreteTopicName, topic, resourceProp);
+ addConcreteTopicExpressions( topicProp, concreteTopicName, topic );
}
}
Modified: webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java?rev=225795&r1=225794&r2=225795&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java (original)
+++ webservices/pubscribe/trunk/src/java/org/apache/ws/notification/topics/util/TopicUtils.java Thu Jul 28 08:09:54 2005
@@ -15,36 +15,25 @@
*=============================================================================*/
package org.apache.ws.notification.topics.util;
-import org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType;
import org.apache.ws.notification.topics.ResourcePropertyValueChangeTopic;
import org.apache.ws.notification.topics.Topic;
import org.apache.ws.notification.topics.TopicSpace;
import org.apache.ws.notification.topics.TopicSpaceSet;
import org.apache.ws.notification.topics.impl.ResourcePropertyValueChangeTopicImpl;
import org.apache.ws.notification.topics.impl.ResourceTerminationTopicImpl;
-import org.apache.ws.notification.topics.expression.impl.TopicExpressionEngineImpl;
import org.apache.ws.notification.topics.impl.TopicSpaceImpl;
-import org.apache.ws.notification.topics.v2004_06.TopicsConstants;
import org.apache.ws.resource.Resource;
-import org.apache.ws.resource.faults.FaultException;
import org.apache.ws.resource.lifetime.ResourceTerminationListener;
import org.apache.ws.resource.properties.NamespaceVersionHolder;
import org.apache.ws.resource.properties.ResourceProperty;
import org.apache.ws.resource.properties.ResourcePropertySet;
-import org.apache.ws.util.XmlBeanUtils;
-import org.apache.ws.Soap1_1Constants;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.FixedTopicSetDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionDialectsDocument;
-import org.oasisOpen.docs.wsn.x2004.x06.wsnWSBaseNotification12Draft01.TopicExpressionType;
-import javax.xml.namespace.QName;
-import java.util.List;
import java.util.ArrayList;
import java.util.Iterator;
+import java.util.List;
/**
- * A utility class containing static methods used as helpers for working with Topics.
+ * A utility class containing static methods used as helpers for working with WSN Topics.
*
* @author Sal Campana
*/
@@ -137,112 +126,6 @@
}
}
return (Topic[]) topicList.toArray( new Topic[0] );
- }
-
- /**
- * Initializes the Topic, TopicExpressionDialects and FixedTopicSet resource properties
- *
- * </br>
- * <strong>NOTE this MUST be called last in the Resource.init() method to ensure all topics get registered</strong>
- * </br>
- * FixedTopicSet will be set based on the value returned from the {@see TopicSpaceSet#isFixed()} method.
- * </br>
- * Topic will have all root topics in the TopicSpaceSet, set to Simple dialect AND all child topics set ot
- * Concrete dialect.
- * </br>
- *
- * TopicExpressionDialects will be set to the engine's known Topic Dialects acquired from the TopicExpressionEngine
- *
- * @param topicSpaceSet
- * @param propSet
- */
- public static void initNotificationProducerProperties(TopicSpaceSet topicSpaceSet, ResourcePropertySet propSet)
- {
- //setup the FixedTopicSet property
- ResourceProperty resourceProperty = propSet.get(NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET);
- if(resourceProperty == null)
- {
- throw new FaultException(Soap1_1Constants.FAULT_SERVER, "The FixedTopicSet property was null.");
- }
- FixedTopicSetDocument fixedTopicSetDocument = FixedTopicSetDocument.Factory.newInstance();
- fixedTopicSetDocument.setFixedTopicSet(topicSpaceSet.isFixed());
- resourceProperty.add(fixedTopicSetDocument);
-
- //setup the Topic property
- resourceProperty = propSet.get(NotificationProducerPortType.PROP_QNAME_TOPIC);
- TopicSpace[] topicSpaces = topicSpaceSet.getTopicSpaces();
- for (int i = 0; i < topicSpaces.length; i++)
- {
- TopicSpace topicSpace = topicSpaces[i];
- String targetNamespace = topicSpace.getTargetNamespace();
- Iterator iterator = topicSpace.topicIterator();
- while (iterator.hasNext())
- {
- Topic topic = (Topic)iterator.next();
- String topicName = topic.getName();
- QName rootTopicQName = new QName(targetNamespace, topicName);
-
- if (topic.isVisible())
- {
- addSimpleTopic(rootTopicQName, resourceProperty);
- }
-
- Iterator subTopics = topic.topicIterator();
- while (subTopics.hasNext())
- {
- Topic subTopic = (Topic) subTopics.next();
- addConcreteTopics(rootTopicQName, subTopic, resourceProperty);
- }
- }
- }
-
-
- //setup the TopicExpressionDialects property
- resourceProperty = propSet.get(NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS);
- String[] supportedDialects = TopicExpressionEngineImpl.getInstance().getSupportedDialects();
- //add a TopicExpressionDialectsDocument for each TopicExpressionDialect.
- for (int i = 0; i < supportedDialects.length; i++)
- {
- TopicExpressionDialectsDocument topicExpressionDialectsDocument = TopicExpressionDialectsDocument.Factory.newInstance();
- topicExpressionDialectsDocument.setTopicExpressionDialects(supportedDialects[i]);
- resourceProperty.add(topicExpressionDialectsDocument);
- }
- }
-
- private static void addSimpleTopic(QName rootTopicQName, ResourceProperty resourceProp)
- {
- TopicDocument topicDocument = TopicDocument.Factory.newInstance();
- TopicExpressionType topicExpressionType = topicDocument.addNewTopic();
- topicExpressionType.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_SIMPLE);
- XmlBeanUtils.setValueAsQName(topicExpressionType, rootTopicQName);
- resourceProp.add(topicDocument);
- }
-
- /**
- * Recursively adds Concrete Topics to the Topic Document
- *
- * @param rootTopicQName The QName of the parent topic.
- * @param subTopic The current topic being added.
- * @param resourceProp The ResourceProperty associated with the Topic being added to.
- */
- private static void addConcreteTopics(QName rootTopicQName, Topic subTopic, ResourceProperty resourceProp)
- {
- TopicDocument topicDocument = TopicDocument.Factory.newInstance();
- String topicName = subTopic.getName();
- QName concreteTopicName = new QName(rootTopicQName.getNamespaceURI(), rootTopicQName.getLocalPart() + "/" + topicName);
- if (subTopic.isVisible())
- {
- TopicExpressionType topicExpressionType = topicDocument.addNewTopic();
- topicExpressionType.setDialect(TopicsConstants.TOPIC_EXPR_DIALECT_CONCRETE);
- XmlBeanUtils.setValueAsQName(topicExpressionType, concreteTopicName);
- resourceProp.add(topicDocument);
- }
- Iterator iterator = subTopic.topicIterator();
- while (iterator.hasNext())
- {
- Topic topic = (Topic) iterator.next();
- addConcreteTopics(concreteTopicName, topic, resourceProp);
- }
}
}
Modified: webservices/pubscribe/trunk/src/templates/NotificationProducer-AbstractResource_init.txt
URL: http://svn.apache.org/viewcvs/webservices/pubscribe/trunk/src/templates/NotificationProducer-AbstractResource_init.txt?rev=225795&r1=225794&r2=225795&view=diff
==============================================================================
--- webservices/pubscribe/trunk/src/templates/NotificationProducer-AbstractResource_init.txt (original)
+++ webservices/pubscribe/trunk/src/templates/NotificationProducer-AbstractResource_init.txt Thu Jul 28 08:09:54 2005
@@ -1 +1,9 @@
+ org.apache.ws.resource.properties.ResourceProperty topicProp = getResourcePropertySet().get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_TOPIC );
+ topicProp.setCallback( new org.apache.ws.notification.base.TopicResourcePropertyCallback( getTopicSpaceSet() ) );
+ org.apache.ws.resource.properties.ResourceProperty fixedTopicSetProp = getResourcePropertySet().get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_FIXED_TOPIC_SET );
+ fixedTopicSetProp.setCallback( new org.apache.ws.notification.base.FixedTopicSetResourcePropertyCallback( getTopicSpaceSet() ) );
+
+ org.apache.ws.resource.properties.ResourceProperty topicExpressionDialectsProp = getResourcePropertySet().get( org.apache.ws.notification.base.v2004_06.porttype.NotificationProducerPortType.PROP_QNAME_TOPIC_EXPRESSION_DIALECTS );
+ topicExpressionDialectsProp.setCallback( new org.apache.ws.notification.base.TopicExpressionDialectsResourcePropertyCallback() );
+
\ No newline at end of file