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 da...@apache.org on 2007/02/28 01:08:20 UTC

svn commit: r512512 - in /webservices/muse/site/docs/2.2.0/manual: how-to/add-metrics-to-properties.html index.html

Author: danj
Date: Tue Feb 27 16:08:19 2007
New Revision: 512512

URL: http://svn.apache.org/viewvc?view=rev&rev=512512
Log:
MUSE-201 - adding metrics how-to to the documentation.

Added:
    webservices/muse/site/docs/2.2.0/manual/how-to/add-metrics-to-properties.html
Modified:
    webservices/muse/site/docs/2.2.0/manual/index.html

Added: webservices/muse/site/docs/2.2.0/manual/how-to/add-metrics-to-properties.html
URL: http://svn.apache.org/viewvc/webservices/muse/site/docs/2.2.0/manual/how-to/add-metrics-to-properties.html?view=auto&rev=512512
==============================================================================
--- webservices/muse/site/docs/2.2.0/manual/how-to/add-metrics-to-properties.html (added)
+++ webservices/muse/site/docs/2.2.0/manual/how-to/add-metrics-to-properties.html Tue Feb 27 16:08:19 2007
@@ -0,0 +1,214 @@
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
+<meta content="Apache Forrest" name="Generator">
+<meta name="Forrest-version" content="0.6">
+<meta name="Forrest-skin-name" content="pelt">
+<title>Apache Muse - Add WSDM Metrics to Resource Properties</title>
+<link type="text/css" href="../../../../skin/basic.css" rel="stylesheet">
+<link media="screen" type="text/css" href="../../../../skin/screen.css" rel="stylesheet">
+<link media="print" type="text/css" href="../../../../skin/print.css" rel="stylesheet">
+<link type="text/css" href="../../../../skin/profile.css" rel="stylesheet">
+<script src="../../../../skin/getBlank.js" language="javascript" type="text/javascript"></script><script src="../../../../skin/getMenu.js" language="javascript" type="text/javascript"></script><script src="../../../../skin/fontsize.js" language="javascript" type="text/javascript"></script>
+<link rel="shortcut icon" href="../../../../images/apache.ico">
+</head>
+<body onload="init()">
+<script type="text/javascript">ndeSetTextSize();</script>
+<div id="top">
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+<a href="http://www.apache.org/">apache</a> &gt; <a href="http://ws.apache.org">ws.apache</a><script src="../../../../skin/breadcrumbs.js" language="JavaScript" type="text/javascript"></script>
+</div>
+<!--+
+    |header
+    +-->
+<div class="header">
+<!--+
+    |start group logo
+    +-->
+<div class="grouplogo">
+<a href="http://ws.apache.org/"><img class="logoImage" alt="Web Services" src="../../../../images/ws-logo.gif"></a>
+</div>
+<!--+
+    |end group logo
+    +-->
+<!--+
+    |start Project Logo
+    +-->
+<div class="projectlogoA1">
+<a href="../../../../index.html"><img class="logoImage" alt="Apache Muse" src="../../../../images/muse-logo.gif"></a>
+</div>
+<!--+
+    |end Project Logo
+    +-->
+<!--+
+    |start Tabs
+    +-->
+<!--+
+    |end Tabs
+    +-->
+</div>
+</div>
+<div id="main">
+<div id="publishedStrip">
+<!--+
+    |start Subtabs
+    +-->
+<div id="level2tabs"></div>
+<!--+
+    |end Endtabs
+    +-->
+<script type="text/javascript" language="JavaScript"><!--
+              document.write("Published: " + document.lastModified);
+              //  --></script>
+</div>
+<!--+
+    |breadtrail
+    +-->
+<div class="breadtrail">
+             
+             &nbsp;
+           </div>
+<!--+
+    |start Menu, mainarea
+    +-->
+<!--+
+    |start Menu
+    +-->
+<div id="menu">
+<div id="menu_1.3Title" class="menutitle">Documentation</div>
+<div id="menu_1.3" class="selectedmenuitemgroup">
+<div class="menuitem">
+<a title="" href="../../tutorial/index.html">Getting Started</a>
+</div>
+<div class="menuitem">
+<a title="" href="../../manual/index.html">Reference Manual</a>
+</div>
+<div class="menuitem">
+<a title="" href="../../javadoc/index.html">JavaDoc</a>
+</div>
+<div class="menuitem">
+<a title="" href="../../specs/index.html">OASIS Standards</a>
+</div>
+</div>
+<div id="roundbottom">
+<img style="display: none" class="corner" height="15" width="15" alt="" src="../../../../skin/images/rc-b-l-15-1body-2menu-3menu.png"></div>
+<!--+
+  |alternative credits
+  +-->
+</div>
+<!--+
+    |end Menu
+    +-->
+<!--+
+    |start content
+    +-->
+<div id="content">
+<div id="skinconf-txtlink"></div>
+
+<p>
+<h2>Apache Muse - Add WSDM Metrics to Resource Properties</h2>
+</p>
+<p>
+You can augment your custom resource properties by adding WSDM Metrics metadata 
+to them; this metadata includes timestamps that tell you when and how frequently 
+a property is updated. Follow the steps below to turn one of your resource 
+properties into a WSDM metric.
+<ul>
+<li>Add the <em>muws2:CurrentTime</em> property to your WSRP document. This is 
+the only property defined by the <a href="../capabilities/wsdm-metrics.html">WSDM Metrics capability</a> 
+and will alert the wsdl2java tool that your resource interface should include that capability. Below 
+is an XML fragment that you can plug into your WSRP document:
+<blockquote>
+<code>
+&lt;xsd:element xmlns:muws2="http://docs.oasis-open.org/wsdm/muws2-2.xsd" ref="muws2:CurrentTime"/&gt;
+</code>
+</blockquote>
+</li>
+<li>Create a WSRMD (metadata) file for your resource properties, if you haven't done so already. 
+Be sure to create a &ltwsrmd:Property/&gt; element for each property in your WSRP document. The 
+<a href="../samples/wsrf.html">WSRF sample project</a> has an RMD file that you can use as a 
+starting point.
+<br/></li><br/>
+<li>For each property that you want to add metrics to, you must add the following XML under 
+its &ltwsrmd:Property/&gt; element:
+<blockquote>
+<code>
+&lt;wsrmd:Property name="myns:MyProperty" mutability="..." modifiability="..."&gt;<br/>
+&nbsp;&nbsp;&nbsp;&lt;muws2:Capability&gt;http://docs.oasis-open.org/wsdm/muws/capabilities/Metrics&lt;/muws2:Capability&gt;<br/>
+&nbsp;&nbsp;&nbsp;&lt;muws2:TimeScope&gt;<b>Interval | PointInTime | SinceReset</b>&lt;/muws2:TimeScope&gt;<br/>
+&nbsp;&nbsp;&nbsp;&lt;muws2:GatheringTime&gt;<b>OnChange | OnDemand | Periodic | Unknown</b>&lt;/muws2:GatheringTime&gt;<br/>
+&nbsp;&nbsp;&nbsp;&lt;muws2:CalculationInterval&gt;<b>an xsd:duration value</b>&lt;/muws2:CalculationInterval&gt;<br/>
+&lt;/wsrmd:Property&gt;
+</code>
+</blockquote>
+In the fragment above, the &lt;muws2:Capability/&gt; element tells Muse that the 
+property must be monitored by the WSDM Metrics capability. You should select the 
+values of the other three element based on the semantics described in the 
+<a href="../../specs/index.html#wsdm">WSDM MUWS Part 2 specification</a>, Section 3.4.
+<br/></li><br/>
+<li>Run wsdl2java and complete your project as normal. You do not have to write any 
+code to ensure that the metrics are added to your properties - this will be done 
+dynamically by the Metrics capability.
+<br/></li><br/>
+<li>Once your endpoint is deployed and running, you can use the 
+<a href="../../javadoc/org/apache/muse/ws/dm/muws/remote/MetricsClient.html"><em>org.apache.muse.ws.dm.muws.remote.MetricsClient</em></a> 
+class to retrieve resource properties and metric values 
+as Java objects (that is, without using the DOM API to get the attribute values). 
+Below is some sample code that illustrates the use of <em>MetricsClient</em> to 
+read the <em>LastUpdated</em> time for the <em>myns:MyProperty</em> property:
+<blockquote>
+<code>
+URI address = URI.create("http://localhost/resources/services/metric-providing-resource");<br/>
+EndpointReference epr = new EndpointReference(address);<br/>
+<br/>
+MetricsClient client = new MetricsClient(epr);<br/>
+Map metrics = new HashMap();<br/>
+<br/>
+QName name = new QName("http://my/namespace", "MyProperty", "myns");<br/>
+String[] values = (String[])client.getPropertyAsObjectAndMetrics(name, String.class, metrics);<br/>
+<br/>
+System.out.println("The property values are: ");<br/>
+<br/>
+for (int n = 0; n < values.length; ++n)<br/>
+&nbsp;&nbsp;&nbsp;&nbsp;System.out.println(values[n]);<br/>
+<br/>
+Date lastUpdated = (Date)metrics.get(MuwsConstants.LAST_UPDATED);<br/>
+System.out.println("The property was last updated on: " + lastUpdated);
+</code>
+</blockquote>
+The <a href="../../javadoc/org/apache/muse/ws/dm/muws/remote/MetricsClient.html">JavaDoc for <em>MetricsClient</em></a> 
+provides details on the names and types of the metrics returned by its methods. Note that in addition to 
+<em>getPropertyAsObjectAndMetrics()</em>, there is also a method named <em>getResourcePropertyAndMetrics()</em> that 
+will give you the raw XML for the resource properties (and metrics) if you really need it.
+<br/></li><br/>
+</ul>
+</p>
+</div>
+
+<div class="clearboth">&nbsp;</div>
+</div>
+<div id="footer">
+<!--+
+    |start bottomstrip
+    +-->
+<div class="lastmodified">
+<script type="text/javascript"><!--
+document.write("Last Published: " + document.lastModified);
+//  --></script>
+</div>
+<div class="copyright">
+ Copyright &copy; 2006 The Apache Software Foundation.</div>
+
+<!--+
+    |end bottomstrip
+    +-->
+</div>
+</body>
+</html>
+
+
+

Modified: webservices/muse/site/docs/2.2.0/manual/index.html
URL: http://svn.apache.org/viewvc/webservices/muse/site/docs/2.2.0/manual/index.html?view=diff&rev=512512&r1=512511&r2=512512
==============================================================================
--- webservices/muse/site/docs/2.2.0/manual/index.html (original)
+++ webservices/muse/site/docs/2.2.0/manual/index.html Tue Feb 27 16:08:19 2007
@@ -288,6 +288,7 @@
 <li><a name="how-to"></a><strong>How to...</strong>
 <p>
 	<ul class="minitoc">
+	<li><a href="how-to/add-metrics-to-properties.html">Add WSDM Metrics to Resource Properties</a></li>
 	<li><a href="how-to/wsrf-add-service-groups.html">Add WSRF Service Groups to an Endpoint</a></li>
 	<li><a href="how-to/create-resource-code.html">Create a Resource (Programmatically)</a></li>
 	<li><a href="how-to/create-resource-persistence.html">Create a Resource (Persistence)</a></li>



---------------------------------------------------------------------
To unsubscribe, e-mail: muse-commits-unsubscribe@ws.apache.org
For additional commands, e-mail: muse-commits-help@ws.apache.org