Author: scamp
Date: Thu Aug 4 09:38:33 2005
New Revision: 227428
URL: http://svn.apache.org/viewcvs?rev=227428&view=rev
Log: (empty)
Modified:
webservices/muse/trunk/src/site/content/xdocs/dev_guide/muws_topics.xml
Modified:
webservices/muse/trunk/src/site/content/xdocs/dev_guide/muws_topics.xml
URL:
http://svn.apache.org/viewcvs/webservices/muse/trunk/src/site/content/xdocs/dev_guide/muws_topics.xml?rev=227428&r1=227427&r2=227428&view=diff
==============================================================================
--- webservices/muse/trunk/src/site/content/xdocs/dev_guide/muws_topics.xml
(original)
+++ webservices/muse/trunk/src/site/content/xdocs/dev_guide/muws_topics.xml Thu
Aug 4 09:38:33 2005
@@ -63,7 +63,7 @@
getTopicSpaceSet().addTopicSpace( muwsTopicSpace );
</source>
</li>
- <li>For each MIUWS capability that your
resource supports, add a topic to the resource's topic set in the MUWS topic
space. The topic should be of the type
+ <li>For each MUWS capability that your resource
supports, add a topic to the resource's topic set in the MUWS topic space. The
topic should be of the type
<code>org.apache.ws.muws.v1_0.topics.ManagementEventTopic</code>.
<source>
org.apache.ws.muws.v1_0.topics.ManagementEventTopic
operationalStatusCapabilityTopic;
@@ -73,7 +73,7 @@
muwsTopicSpace.addTopic( operationalStatusCapabilityTopic );
</source>
</li>
- <li>Initialize each topic property
+ <li>Initialize the resource property to be
associated with the topic
<source>
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument
operationalStatusCapabilityPropElem =
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManageabilityCapabilityDocument.Factory.newInstance();
@@ -81,7 +81,7 @@
resourceProperty.add( operationalStatusCapabilityPropElem );
</source>
</li>
- <li>Add a change listener for each topic.
+ <li>Add the topic as a resource property change
listener for the resource property. This will automatically emit
ManagementEvent-wrapped resource property change events as they occur.
<source>
resourceProperty = resourcePropertySet.get(
FilesystemPropertyQNames.OPERATIONALSTATUS );
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart2.OperationalStatusDocument
statusDoc =
@@ -109,7 +109,7 @@
</li>
</ul>
<p>Muse implements these topics as part of the
<code>ResourceAdvertiser</code> service that is deployed by default in Muse.
Therefore, it does not have to be
- defined in a MUWS WSDL or directly implemented by
your WS Resource. See the <a href="site:adv">Using the Resource Advertiser
Service</a> section for more
+ defined in a MUWS WSDL or directly implemented by your
WS Resource. See the <a href="site:adv">Using the Resource Advertiser
Service</a> section for more
information on subscribing to the Advertiser Topics.
</p>
</section>
@@ -137,7 +137,11 @@
<p>The <code>RelationshipCreated</code>,
<code>RelationshipDeleted</code>, and
<code>RelationshipResourceCapability</code> topics are implemented in Muse by
default. Therefore, you only need to add these topics
to the topic set in your resource class. For example:</p>
<source>
-muwsutils addRelatshipTopcis pass in topic set returns topics space and then
add your stuff to that.
+ try {
+ org.apache.ws.notification.topics.TopicSpace muws2topics =
org.apache.ws.muws.MuwsUtils.addRelationshipTopics( getTopicSpaceSet() );
+ } catch ( Exception e ) {
+ throw new RuntimeException( "Failed to add the MUWS
RelationshipAdded/Removed topics to the topic set.", e );
+ }
</source>
<p>For more information Relationships, see the <a
href="site:rel">Creating Relationships</a> section.</p>
@@ -148,11 +152,66 @@
specification, it may give WSDM notification consumers
the ability to process your notification, even if they are unaware of the
resource as a managed resource.</p>
<p>Muse provides several utility classes that can be
used to wrap a notification.
- managmentevent, Impl, mgmteventTopic (impl?)
- </p>
+ <ol>
+ <li>Define a ManagementTopic.
+ <p>Utilizing ManagementEventTopic provides the
framework for publishing ManagementEvents.</p>
+ <source>
+ //add/create a TopicSpace for your custom Topics
+ TopicSpace fooTopicSpace =
getTopicSpaceSet().addTopicSpace("http://foo/topicspace");
+
+ /**
+ * Provide a Topic name (i.e. FooCapability ) for your new Management
Event Topic during creation, this is the
+ * name consumers will use when subscribing to the Topic.
+ */
+ ManagementEventTopic fooCapabilityTopic = new
XmlBeansManagementEventTopicImpl("FooCapability");
+
+ //make sure to add the ManagementEventTopic to your defined TopicSpace
+ fooTopicSpace.addTopic(fooCapabilityTopic);
+ </source>
+ </li>
+
+
+ <li>Building a ManagementEvent to publish.
+ <p>In cases where you want to emit an event which is
not triggered via a ResourcePropertyValueChangeEvent, you will need to
explictly build the ManagementEvent and call publish on the Topic. A custom
event is wrapped as a ManagementEvent by adding the custom event XML as a child
of the ManagementEventType. Below is an example of adding a custom
XmlBean-generated object to a ManagementEventType for a custom notification.</p>
<source>
-need code
+ //define the situation as per spec
+ Situation situation =
+ new SituationImpl(new
CategoryImpl(MuwsConstants.SITUATION_OTHER));
+
+ //build a ManagementEventDocument using the Situation using a helper
class
+ XmlBeansManagementEvent xme = new XmlBeansManagementEvent(situation);
+ //extract the XmlBean-generated ManagementEventDocument
+ ManagementEventDocument managementEventDocument =
(ManagementEventDocument) ((XmlObjectWrapper) xme).getXmlObject();
+
+ //pull the ManagementEventType from the ManagementEventDocument in
order to add your custom event object
+
org.oasisOpen.docs.wsdm.x2004.x12.muws.wsdmMuwsPart1.ManagementEventType
managementEvent =
+ managementEventDocument.getManagementEvent();
+
+ //add your custom XmlBean-generated object to the ManagementEvent
+ XmlBeanUtils.addChildElement(managementEvent,
fooXmlBeanGeneratedObject);
+ </source>
+ </li>
+
+
+ <li>Publishing ManagementNotifications.
+ <p>The use of ManagementEventTopic as the Topic for
exposing Notifications provides the ability to publish ManagementEvents. Once
you have built the notification you would like to send, you will need to
publish the event to the ManagementTopic.</p>
+ <source>
+ //retrieve the Topic from the Resource
+ ManagementEventTopic fooTopic =
(ManagementEventTopic)getTopicSpaceSet().getTopicSpace("http://foo/topicspace").getTopic("FooCapability");
+ try
+ {
+ fooTopic.publish(managementEventDocument);
+ }
+ catch (Exception e)
+ {
+ //handle exception
+ }
</source>
+ </li>
+
+ </ol>
+ </p>
+
</section>
</body>
</document>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]