Author: scamp
Date: Tue May 3 11:12:51 2005
New Revision: 167945
URL: http://svn.apache.org/viewcvs?rev=167945&view=rev
Log:
special handling for relationship resource property
Added:
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/XmlBeansRelationshipResourceProperty.java
Modified:
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/capability/RelationshipsCapability.java
incubator/muse/trunk/src/webapp/WEB-INF/classes/jndi-config.xml
incubator/muse/trunk/src/webapp/WEB-INF/server-config.wsdd
Modified:
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/capability/RelationshipsCapability.java
URL:
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/capability/RelationshipsCapability.java?rev=167945&r1=167944&r2=167945&view=diff
==============================================================================
---
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/capability/RelationshipsCapability.java
(original)
+++
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/capability/RelationshipsCapability.java
Tue May 3 11:12:51 2005
@@ -53,6 +53,16 @@
QName PROP_NAME_RELATIONSHIP = new QName(
MuwsConstants.NSURI_MUWS_PART2_SCHEMA, "Relationship",
MuwsConstants.NSPREFIX_MUWS_PART2_SCHEMA );
/**
+ * RelationshipCreated subtopic name.
+ */
+ String SUBTOPIC_NAME_RELATIONSHIP_CREATED = "RelationshipCreated";
+
+ /**
+ * RelationshipDeleted subtopic name.
+ */
+ String SUBTOPIC_NAME_RELATIONSHIP_DELETED = "RelationshipDeleted";
+
+ /**
* This operation is a shortcut to query relationships of the same type.
See section 4.1.4.1 of the MUWS Part 2 spec.
*
* @param requestDoc the request document
Added:
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/XmlBeansRelationshipResourceProperty.java
URL:
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/XmlBeansRelationshipResourceProperty.java?rev=167945&view=auto
==============================================================================
---
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/XmlBeansRelationshipResourceProperty.java
(added)
+++
incubator/muse/trunk/src/java/org/apache/ws/muws/v1_0/impl/XmlBeansRelationshipResourceProperty.java
Tue May 3 11:12:51 2005
@@ -0,0 +1,179 @@
+package org.apache.ws.muws.v1_0.impl;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ws.muws.impl.CategoryImpl;
+import org.apache.ws.muws.v1_0.MuwsConstants;
+import org.apache.ws.muws.v1_0.capability.RelationshipsCapability;
+import org.apache.ws.muws.v1_0.events.Situation;
+import org.apache.ws.muws.v1_0.events.impl.SituationImpl;
+import org.apache.ws.muws.v1_0.events.impl.XmlBeansManagementEvent;
+import org.apache.ws.notification.base.NotificationProducerResource;
+import org.apache.ws.notification.topics.Topic;
+import org.apache.ws.notification.topics.TopicSpace;
+import org.apache.ws.resource.properties.ResourcePropertyMetaData;
+import org.apache.ws.resource.properties.impl.XmlBeansResourceProperty;
+import org.apache.ws.resource.properties.impl.XmlBeansResourcePropertySet;
+import org.apache.ws.util.XmlBeanUtils;
+import org.apache.ws.util.i18n.Messages;
+import org.apache.ws.util.i18n.MessagesImpl;
+import org.apache.xmlbeans.XmlObject;
+import
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipCreatedNotificationDocument;
+import
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDeletedNotificationDocument;
+import org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipType;
+import
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.impl.RelationshipDocumentImpl;
+
+import java.util.Iterator;
+
+
+/**
+ * A specialized ResourceProperty for generating RelationshipCreated and
RelationshipDestroyed
+ * events when a Add or Remove is called
+ *
+ * @author Sal Campana
+ */
+public class XmlBeansRelationshipResourceProperty extends
XmlBeansResourceProperty
+{
+ private static final Log LOG = LogFactory.getLog(
XmlBeansRelationshipResourceProperty.class );
+ private static final Messages MSG = MessagesImpl.getInstance();
+ private NotificationProducerResource m_resource;
+
+ public XmlBeansRelationshipResourceProperty(ResourcePropertyMetaData
resourcePropertyMetaData,
+ XmlBeansResourcePropertySet
xmlBeansResourcePropertySet,
+ NotificationProducerResource
resource)
+ {
+ super(resourcePropertyMetaData, xmlBeansResourcePropertySet);
+ m_resource = resource;
+ }
+
+ /**
+ * Overrides add() to generate RelationshipCreated notifications
+ * @see XmlBeansResourceProperty#add(Object)
+ */
+ public void add(Object o)
+ {
+ super.add(o);
+ throwRelationshipCreatedNotif((XmlObject)o);
+ }
+
+ /**
+ * Overrides remove() to generate RelationshipDeleted notifications
+ * @see XmlBeansResourceProperty#remove(Object)
+ */
+ public boolean remove(Object o)
+ {
+ XmlObject copiedRelationship = XmlBeanUtils.copyXmlBean((XmlObject)o);
+ boolean wasRemoved = super.remove(o);
+ if(wasRemoved)
+ {
+ throwRelationshipDeletedNotif(copiedRelationship);
+ }
+ return wasRemoved;
+ }
+
+ /**
+ * Returns the RelationshipCreated Topic or null
+ *
+ * @return RelationshipCreated Topic or null
+ */
+ private Topic getCreatedTopic()
+ {
+ return
getRelationshipsCapabilitySubTopic(RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_CREATED);
+ }
+
+ /**
+ * Returns the RelationshipDeleted Topic or null
+ *
+ * @return RelationshipDeleted Topic or null
+ */
+ private Topic getDeletedTopic()
+ {
+ return
getRelationshipsCapabilitySubTopic(RelationshipsCapability.SUBTOPIC_NAME_RELATIONSHIP_DELETED);
+ }
+
+ /**
+ * Returns a given RelationshipsCapability-SubTopic
+ *
+ * @param subtopicName
+ * @return The sub topic or null if undefined
+ */
+ private Topic getRelationshipsCapabilitySubTopic(String subtopicName)
+ {
+ Topic subTopic=null;
+ TopicSpace topicSpace =
m_resource.getTopicSpaceSet().getTopicSpace(MuwsConstants.NSURI_MUWS_PART2_TOPICS);
+ if (topicSpace != null)
+ {
+ Topic relationshipCapTopic =
topicSpace.getTopic(RelationshipsCapability.TOPIC_NAME);
+ if(relationshipCapTopic != null)
+ {
+ subTopic = relationshipCapTopic.getTopic(subtopicName);
+ }
+ }
+ return subTopic;
+ }
+
+ private void throwRelationshipCreatedNotif(XmlObject o)
+ {
+ Topic createdTopic = getCreatedTopic();
+ if(createdTopic != null)
+ {
+ //if its there then build a notif and publish
+
+ try
+ {
+ Situation situation = new SituationImpl( new CategoryImpl(
MuwsConstants.SITUATION_CREATE ) );
+ XmlBeansManagementEvent xme = new XmlBeansManagementEvent(
situation );
+ RelationshipCreatedNotificationDocument relationshipCreatedDoc
= RelationshipCreatedNotificationDocument.Factory.newInstance();
+
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipCreatedNotificationDocument.RelationshipCreatedNotification
relationshipCreatedNotification =
relationshipCreatedDoc.addNewRelationshipCreatedNotification();
+
relationshipCreatedNotification.setRelationship((RelationshipType)o);
+ xme.setAny(new Object[]{relationshipCreatedDoc});
+ //publish!
+ createdTopic.publish(xme.getXmlObject());
+ }
+ catch (Exception e)
+ {
+ LOG.debug("Unable to throw RelationshipCreated notification.
Cause:" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ private void throwRelationshipDeletedNotif(XmlObject copiedRelationship)
+ {
+ Topic deletedTopic = getDeletedTopic();
+ if(deletedTopic != null)
+ {
+ //if its there then build a notif and publish
+ try
+ {
+ Situation situation = new SituationImpl( new CategoryImpl(
MuwsConstants.SITUATION_DESTROY ) );
+ XmlBeansManagementEvent xme = new XmlBeansManagementEvent(
situation );
+ RelationshipDeletedNotificationDocument relationshipDeletedDoc
= RelationshipDeletedNotificationDocument.Factory.newInstance();
+
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.RelationshipDeletedNotificationDocument.RelationshipDeletedNotification
relationshipDeletedNotification =
relationshipDeletedDoc.addNewRelationshipDeletedNotification();
+
relationshipDeletedNotification.setRelationship(((RelationshipDocumentImpl)copiedRelationship).getRelationship());
+ xme.setAny(new Object[]{relationshipDeletedDoc});
+ //publish!
+ deletedTopic.publish(xme.getXmlObject());
+ }
+ catch (Exception e)
+ {
+ LOG.debug("Unable to throw RelationshipDeleted notification.
Cause:" + e.getLocalizedMessage(), e);
+ }
+ }
+ }
+
+ /**
+ * Overrides clear() to generate RelationshipDeleted notifications
+ * @see XmlBeansResourceProperty#clear()
+ */
+ public synchronized void clear()
+ {
+ //get iterator and throw notif for each...do a copy
+ Iterator iterator = iterator();
+ while (iterator.hasNext())
+ {
+ Object relationship = iterator.next();
+
throwRelationshipDeletedNotif(XmlBeanUtils.copyXmlBean((XmlObject)relationship));
+ }
+ super.clear();
+ }
+}
Modified: incubator/muse/trunk/src/webapp/WEB-INF/classes/jndi-config.xml
URL:
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/webapp/WEB-INF/classes/jndi-config.xml?rev=167945&r1=167944&r2=167945&view=diff
==============================================================================
--- incubator/muse/trunk/src/webapp/WEB-INF/classes/jndi-config.xml (original)
+++ incubator/muse/trunk/src/webapp/WEB-INF/classes/jndi-config.xml Tue May 3
11:12:51 2005
@@ -34,6 +34,24 @@
</parameter>
</resourceParams>
</resource>
+
+ <resource name="topic/eval/concrete"
type="org.apache.ws.notification.topics.impl.ConcreteTopicExpressionEvaluator">
+ <resourceParams>
+ <parameter>
+ <name>factory</name>
+ <value>org.apache.ws.util.jndi.BeanFactory</value>
+ </parameter>
+ </resourceParams>
+ </resource>
+
+ <resource name="topic/eval/full"
type="org.apache.ws.notification.topics.impl.FullTopicExpressionEvaluator">
+ <resourceParams>
+ <parameter>
+ <name>factory</name>
+ <value>org.apache.ws.util.jndi.BeanFactory</value>
+ </parameter>
+ </resourceParams>
+ </resource>
<resource name="topic/ContainerTopicExpressionEngine"
type="org.apache.ws.notification.topics.impl.TopicExpressionEngineImpl">
<resourceParams>
Modified: incubator/muse/trunk/src/webapp/WEB-INF/server-config.wsdd
URL:
http://svn.apache.org/viewcvs/incubator/muse/trunk/src/webapp/WEB-INF/server-config.wsdd?rev=167945&r1=167944&r2=167945&view=diff
==============================================================================
--- incubator/muse/trunk/src/webapp/WEB-INF/server-config.wsdd (original)
+++ incubator/muse/trunk/src/webapp/WEB-INF/server-config.wsdd Tue May 3
11:12:51 2005
@@ -25,7 +25,25 @@
<parameter name="allowedMethods" value="getVersion"/>
<parameter name="className" value="org.apache.axis.Version"/>
</service>
-
+ <service name="SubscriptionManager" provider="java:WSRF" style="document"
use="literal">
+
+ <wsdlFile>/wsdl/SubscriptionManager.wsdl</wsdlFile>
+
+ <requestFlow>
+ <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+ <parameter name="className"
value="org.apache.axis.message.addressing.handler.AxisServerSideAddressingHandler"
/>
+ <parameter name="referencePropertyNames" value="*" />
+ </handler>
+ </requestFlow>
+
+ <responseFlow>
+ <handler type="java:org.apache.axis.handlers.JAXRPCHandler">
+ <parameter name="className"
value="org.apache.axis.message.addressing.handler.AxisServerSideAddressingHandler"
/>
+ <parameter name="referencePropertyNames" value="*" />
+ </handler>
+ </responseFlow>
+
+ </service>
<transport name="http">
<requestFlow>
<handler type="URLMapper"/>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]