// a property is a metric IF it defines a Capability element in
// its RMD definition with the Metrics capability URI
//
if (capability != null && capability.equals(MuwsConstants.METRICS_URI))
{
Metric metric = new SimpleMetric(qname, resource);
_metricsByQName.put(qname, metric);
//
// on demand? update metadata before reads
//
if (metric.isOnDemand())
props.addReadListener(new MetricOnDemandListener(metric));
//
// add metric attributes for all reads
//
props.addReadListener(new MetricDecorationProvider(metric));
//
// update metadata whenever changes occur
//
props.addChangeListener(new MetricUpdateListener(metric));
//
// special case: counters that run on an interval can be
// automated by starting a thread that increments the value
// every N seconds
//
if (metric.isCounter() && metric.isInterval())
{
Thread counter = new CounterThread(props, metric);
_countersByQName.put(qname, counter);
counter.start();
}