You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by rm...@apache.org on 2013/07/29 08:20:58 UTC

svn commit: r1507950 [8/8] - in /commons/sandbox/monitoring/trunk: ./ aop/ aop/src/main/java/org/apache/commons/monitoring/aop/ aop/src/main/java/org/apache/commons/monitoring/instrumentation/ aop/src/main/resources/ aop/src/test/java/org/ aop/src/test...

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml Mon Jul 29 06:20:54 2013
@@ -18,7 +18,7 @@
 
 <document>
 
-<properties>
+  <properties>
     <title>Instrumentation of the monitored application</title>
   </properties>
 
@@ -27,90 +27,125 @@
     <section name="Introduction">
       <p>
         Before anything can be reported, the application have to expose it's state to the monitoring
-        infrastructure. In Commons Monitoring vocabulary this is called <b>instrumentation</b> of the
+        infrastructure. In Commons Monitoring vocabulary this is called
+        <b>instrumentation</b>
+        of the
         application. Commons Monitoring defines a simple lightweight API for this purpose.
       </p>
     </section>
 
     <section name="Concepts">
       <subsection name="Monitors">
-      <p>
-        The application exposes it's state based on <b>monitors</b>. A monitor is an abstraction for any
-        element in the application that can expose state or resource consumption. This can be a code
-        fragment, a web application URI, a JDBC query, some business object data, etc. It is identified
-        by :
-        <ul>
-            <li>a <b>name</b> that is the human readable representation of the exposed state</li>
-            <li>a <b>category</b> that matches technical layering of the application
-            ("web", "model", "dao"...)</li>
-            <li>a <b>subsystem</b> that associate the monitor to a functional subsystem in the application
-            ("admin", "accounts management" ...)</li>
-        </ul>
-      </p>
-      <p>
-        Only the name is required, but category and subsystem is a nice way to group monitors by technical
-        or functional criteria.
-      </p>
+        <p>
+          The application exposes it's state based on<b>monitors</b>. A monitor is an abstraction for any
+          element in the application that can expose state or resource consumption. This can be a code
+          fragment, a web application URI, a JDBC query, some business object data, etc. It is identified
+          by :
+          <ul>
+            <li>a
+              <b>name</b>
+              that is the human readable representation of the exposed state
+            </li>
+            <li>a
+              <b>category</b>
+              that matches technical layering of the application
+              ("web", "model", "dao"...)
+            </li>
+            <li>a
+              <b>subsystem</b>
+              that associate the monitor to a functional subsystem in the application
+              ("admin", "accounts management" ...)
+            </li>
+          </ul>
+        </p>
+        <p>
+          Only the name is required, but category and subsystem is a nice way to group monitors by technical
+          or functional criteria.
+        </p>
       </subsection>
       <subsection name="Repository">
-      <p>
-        Monitors are registered in a repository, that ensure a monitor is unique for a name/category/subsytem
-        Key. The repository is used to retrieve existing monitors and create new ones. The
-        <a href="xref/org/apache/commons/monitoring/impl/repositories/DefaultRepository">default repository implementation</a>
-        creates new Monitor instance when a non-existing one is requested, so you don't have to wory
-        about monitors management.
-        <pre>
+        <p>
+          Monitors are registered in a repository, that ensure a monitor is unique for a name/category/subsytem
+          Key. The repository is used to retrieve existing monitors and create new ones. The
+          <a href="xref/org/apache/commons/monitoring/impl/repositories/DefaultRepository">default repository
+            implementation
+          </a>
+          creates new Monitor instance when a non-existing one is requested, so you don't have to wory
+          about monitors management.
+          <pre>
             Monitor monitor = repository.getMonitor( "MyService.myMethod" );
             Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
             Monitor monitor = repository.getMonitor( "/admin/userEdit.do", "struts", "user management" );
-        </pre>
-        You can use a custom repository by extending one of the provided implementations. You can also
-        use the <code>ConfigurableImplementationsRepository</code> implementation, when you only want to configure
-        custom implementation classes for StopWatches and Monitors.
-      </p>
+          </pre>
+          You can use a custom repository by extending one of the provided implementations. You can also
+          use the
+          <code>ConfigurableImplementationsRepository</code>
+          implementation, when you only want to configure
+          custom implementation classes for StopWatches and Monitors.
+        </p>
       </subsection>
       <subsection name="Counters and Gauges">
-      <p>
-        Monitors manage a set of <code>Metrics</code> that the application uses to expose state. The
-        monitor only identifies where the data comes from, and the statValues handle the monitored data.
-        There is two types of values that application can use, depending on the data to be exposed :
-        <ul>
-          <li>a <b>Counter</b> is used to expose cumulative events. The value a counter maintains
-            will grow during the application life :  time elapsed by some code to execute, number of bytes or
-            lines proceeded by a batch process, number of requests on a web URI...
-            <br/>
-            A counter is used by application using the <code>add()</code> method
-            to expose how the counter must increment when some operation have proceeded.
-          </li>
-          <li>a <b>Gauge</b> is used to expose an internal state that increases and decreases
-            during application life : concurrent threads, open connections, active users...
-            <br/>
-            A gauge is used by the application using the <code>incremenet()</code> and <code>decrement()</code>
-            methods to expose the application state changes. The <code>set()</code> method can also be used to
-            force an initial value or to expose an absolute value when the application does not compute it's state
-            as a change from a previous value. Typically, a <code>connectionManager</code> component will use
-            increment/decrement to expose active connections, and a <code>fileSystemMonitor</code> will use
-            set to expose free space on disks.
-          </li>
-        </ul>
-      </p>
-      <p>
-        In both cases, the statValues compute statistical information from what the application exposes, like
-        min / max / mean and standard deviation, that in many case is more informative than the current value.
-        Available statistical indicators are limited as a Metric does not maintain all the individual
-        elements as a serie but only aggregates, to avoid memory over-consumption.
-      </p>
-      <p>The <a href="xref/org/apache/commons/monitoring/impl/monitors/CreateValuesOnDemandMonitor">
-        default monitor implementation</a> will create the required Gauge/Counters implementation when a
-        statValue is requested by the application.
-      </p>
+        <p>
+          Monitors manage a set of
+          <code>Metrics</code>
+          that the application uses to expose state. The
+          monitor only identifies where the data comes from, and the statValues handle the monitored data.
+          There is two types of values that application can use, depending on the data to be exposed :
+          <ul>
+            <li>a
+              <b>Counter</b>
+              is used to expose cumulative events. The value a counter maintains
+              will grow during the application life : time elapsed by some code to execute, number of bytes or
+              lines proceeded by a batch process, number of requests on a web URI...
+              <br/>
+              A counter is used by application using the
+              <code>add()</code>
+              method
+              to expose how the counter must increment when some operation have proceeded.
+            </li>
+            <li>a
+              <b>Gauge</b>
+              is used to expose an internal state that increases and decreases
+              during application life : concurrent threads, open connections, active users...
+              <br/>
+              A gauge is used by the application using the
+              <code>incremenet()</code>
+              and
+              <code>decrement()</code>
+              methods to expose the application state changes. The
+              <code>set()</code>
+              method can also be used to
+              force an initial value or to expose an absolute value when the application does not compute it's state
+              as a change from a previous value. Typically, a
+              <code>connectionManager</code>
+              component will use
+              increment/decrement to expose active connections, and a
+              <code>fileSystemMonitor</code>
+              will use
+              set to expose free space on disks.
+            </li>
+          </ul>
+        </p>
+        <p>
+          In both cases, the statValues compute statistical information from what the application exposes, like
+          min / max / mean and standard deviation, that in many case is more informative than the current value.
+          Available statistical indicators are limited as a Metric does not maintain all the individual
+          elements as a serie but only aggregates, to avoid memory over-consumption.
+        </p>
+        <p>The
+          <a href="xref/org/apache/commons/monitoring/impl/monitors/CreateValuesOnDemandMonitor">
+            default monitor implementation
+          </a>
+          will create the required Gauge/Counters implementation when a
+          statValue is requested by the application.
+        </p>
       </subsection>
       <subsection name="Role">
-      <p>
-        A monitor can handle many statValues. Metrics are identified in a monitor by a role, that
-        describes the data beeing computed. There is predefined roles for performances, concurrency
-        monitoring and failures count, but any other relevant counter/gauge can be registered to a monitor.
-        <pre>
+        <p>
+          A monitor can handle many statValues. Metrics are identified in a monitor by a role, that
+          describes the data beeing computed. There is predefined roles for performances, concurrency
+          monitoring and failures count, but any other relevant counter/gauge can be registered to a monitor.
+          <pre>
             final static Role BYTES = new Role( "bytes", Unit.BYTES, Counter.class );
 
             static Monitor monitor = repository.getMonitor( "SoapEndpoint.process" );
@@ -118,92 +153,106 @@
 
             public void process( SOAPMessage message )
             {
-                // Process a SOAP message
+            // Process a SOAP message
 
-                // retrieve the custom Counter for the "byte" role
-                bytes.add( SOAPMessage.getSize(), Unit.BYTES );
+            // retrieve the custom Counter for the "byte" role
+            bytes.add( SOAPMessage.getSize(), Unit.BYTES );
             }
-        </pre>
-        A role can be considered as a statValue prototype. It defines :
-        <ul>
+          </pre>
+          A role can be considered as a statValue prototype. It defines :
+          <ul>
             <li>The name of the statValue inside the monitor</li>
             <li>The unit used for data gathered by the statValue</li>
-            <li>The statValue type, beeing either <code>Counter.class</code> or <code>Gauge.class</code></li>
-        </ul>
-      </p>
+            <li>The statValue type, beeing either
+              <code>Counter.class</code>
+              or
+              <code>Gauge.class</code>
+            </li>
+          </ul>
+        </p>
       </subsection>
       <subsection name="Units">
         <p>Counters and Gauge knows the data type they hold, based on the Role used to create them :
-        Any data set/addition is checked for unit to be compatible. "compatible" means the passed values can be
-        converted to the same primary unit, "primary" beeing the finest unit available for a data type.
-        For example, <code>Unit.SECONDS</code>, is compatible with <code>Unit.MILLIS</code>
-        as they share the same primary unit <code>Unit.NANOS</code>.
+          Any data set/addition is checked for unit to be compatible. "compatible" means the passed values can be
+          converted to the same primary unit, "primary" beeing the finest unit available for a data type.
+          For example,<code>Unit.SECONDS</code>, is compatible with
+          <code>Unit.MILLIS</code>
+          as they share the same primary unit<code>Unit.NANOS</code>.
         </p>
         <p>
-        You can define your own units on the same basis, to ensure good usage of your monitors
-        and cleaner reporting. You can also pass data to a statValue with any compatible Unit, as
-        the statValue will internally handle any required conversion.
+          You can define your own units on the same basis, to ensure good usage of your monitors
+          and cleaner reporting. You can also pass data to a statValue with any compatible Unit, as
+          the statValue will internally handle any required conversion.
         </p>
       </subsection>
       <subsection name="StopWatches">
-      <p>Performance monitoring is first-class use case of Commons Monitoring. The
-        <code>org.apache.commons.monitoring.StopWatch</code> class provides the necessary tooling
-        to compute and monitor code or service invocation performances. A StopWatch is created
-        by the repository for a monitor. The stopwatch is initialy "started", and will compute
-        elapsed time until it is stopped by the application. The application MUST ALLWAYS stop
-        the StopWatches it has created ! To ensure this, always use a finally block :
-        <pre>
+        <p>Performance monitoring is first-class use case of Commons Monitoring. The
+          <code>org.apache.commons.monitoring.stopwatches.StopWatch</code>
+          class provides the necessary tooling
+          to compute and monitor code or service invocation performances. A StopWatch is created
+          by the repository for a monitor. The stopwatch is initialy "started", and will compute
+          elapsed time until it is stopped by the application. The application MUST ALLWAYS stop
+          the StopWatches it has created ! To ensure this, always use a finally block :
+          <pre>
             StopWatch stopWatch = repository.start( myMonitor );
             try
             {
-                // Do something that takes time and requires monitoring
+            // Do something that takes time and requires monitoring
             }
             finally
             {
-                stopWatch.stop();
+            stopWatch.stop();
             }
-        </pre>
-      </p>
-      <p>
-        You can nest stopWatches, in many case by monitoring some high-level process (for example web
-        request rendering time) and nested low-level service (remote service invocation, JDBC request...).
-        The monitor maintains statistics about those informations as the PERFORMANCE and RESPONSE_TIME
-        counters. First one only computes performance of the target code, not sub-processes.
-      </p>
-      <p>
-        The <a href="xref/org/apache/commons/monitoring/impl/stopwatches/DefaultStopWatch">default StopWatch implementation</a>
-        can be extended to support some custom features. <code>ExecutionStopWatch</code> for example adds support for
-        a list of all stopwatches beeing used in the current thread, so that you can trace the activity if you
-        detect bad performances of the global process. To use a custom StopWatch class, simply setup the
-        repository using <code>new DefaultRepository( MyCustomStopWatch.class )</code>.
-      </p>
+          </pre>
+        </p>
+        <p>
+          You can nest stopWatches, in many case by monitoring some high-level process (for example web
+          request rendering time) and nested low-level service (remote service invocation, JDBC request...).
+          The monitor maintains statistics about those informations as the PERFORMANCE and RESPONSE_TIME
+          counters. First one only computes performance of the target code, not sub-processes.
+        </p>
+        <p>
+          The
+          <a href="xref/org/apache/commons/monitoring/impl/stopwatches/DefaultStopWatch">default StopWatch
+            implementation
+          </a>
+          can be extended to support some custom features.
+          <code>ExecutionStopWatch</code>
+          for example adds support for
+          a list of all stopwatches beeing used in the current thread, so that you can trace the activity if you
+          detect bad performances of the global process. To use a custom StopWatch class, simply setup the
+          repository using<code>new DefaultRepository( MyCustomStopWatch.class )</code>.
+        </p>
       </subsection>
     </section>
 
     <section name="Helpers">
       <p>
-        The <b>Monitoring</b> class is a convenience utility class to make application instrumentation
+        The
+        <b>Monitoring</b>
+        class is a convenience utility class to make application instrumentation
         as simple as possible. To monitor application performance, simply do :
         <pre>
-        public void myMethodToGetMonitored()
-        {
-            StopWatch stopWatch = Monitoring.start( "MyClass.myMethod" );
-            try
-            {
-                // Do something that takes time and requires monitoring
-            }
-            finally
-            {
-                stopWatch.stop();
-            }
-        }
+          public void myMethodToGetMonitored()
+          {
+          StopWatch stopWatch = Monitoring.start( "MyClass.myMethod" );
+          try
+          {
+          // Do something that takes time and requires monitoring
+          }
+          finally
+          {
+          stopWatch.stop();
+          }
+          }
         </pre>
         The StopWatch class will compute the time elapsed during code execution and report it to the
         monitor "MyClass.myMethod".
       </p>
       <p>
         Other helper classes are provided for simplier use with commons frameworks. The
-        <code>org.apache.commons.monitoring.aop</code> package contains for example classes for use with
+        <code>org.apache.commons.monitoring.aop</code>
+        package contains for example classes for use with
         AOP frameworks to automagically instrument application components.
       </p>
     </section>

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/issue-tracking.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/issue-tracking.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/issue-tracking.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/issue-tracking.xml Mon Jul 29 06:20:54 2013
@@ -48,52 +48,82 @@ limitations under the License.
 
     <section name="Commons Monitoring (Sandbox) Issue tracking">
       <p>
-      Commons Monitoring (Sandbox) uses <a href="http://issues.apache.org/jira/">ASF JIRA</a> for tracking issues.
-      See the <a href="http://issues.apache.org/jira/browse/SANDBOX">Sandbox JIRA project page</a>.
-      </p>
-
-      <p>
-      To use JIRA you may need to <a href="http://issues.apache.org/jira/secure/Signup!default.jspa">create an account</a>
-      (if you have previously created/updated Commons issues using Bugzilla an account will have been automatically
-      created and you can use the <a href="http://issues.apache.org/jira/secure/ForgotPassword!default.jspa">Forgot Password</a>
-      page to get a new password).
-      </p>
-
-      <p>
-      If you would like to report a bug, or raise an enhancement request with
-      Commons Monitoring (Sandbox) please do the following:
-      <ol>
-        <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">Search existing open bugs</a>.
-            If you find your issue listed then please add a comment with your details.</li>
-        <li><a href="mail-lists.html">Search the mailing list archive(s)</a>.
-            You may find your issue or idea has already been discussed.</li>
-        <li>Decide if your issue is a bug or an enhancement.</li>
-        <li>Submit either a <a href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310491&amp;components=12312100&amp;issuetype=1&amp;priority=4&amp;assignee=-1">bug report</a>
-            or <a href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310491&amp;components=12312100&amp;issuetype=4&amp;priority=4&amp;assignee=-1">enhancement request</a>.</li>
-      </ol>
-      </p>
-
-      <p>
-      Please also remember these points:
-      <ul>
-        <li>the more information you provide, the better we can help you</li>
-        <li>test cases are vital, particularly for any proposed enhancements</li>
-        <li>the developers of Commons Monitoring (Sandbox) are all unpaid volunteers</li>
-      </ul>
-      </p>
-
-      <p>
-      For more information on subversion and creating patches see the
-      <a href="http://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>.
-      </p>
-
-      <p>
-      You may also find these links useful:
-      <ul>
-        <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">All Open Commons Monitoring (Sandbox) bugs</a></li>
-        <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=5&amp;status=6">All Resolved Commons Monitoring (Sandbox) bugs</a></li>
-        <li><a href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC">All Commons Monitoring (Sandbox) bugs</a></li>
-      </ul>
+        Commons Monitoring (Sandbox) uses
+        <a href="http://issues.apache.org/jira/">ASF JIRA</a>
+        for tracking issues.
+        See the<a href="http://issues.apache.org/jira/browse/SANDBOX">Sandbox JIRA project page</a>.
+      </p>
+
+      <p>
+        To use JIRA you may need to
+        <a href="http://issues.apache.org/jira/secure/Signup!default.jspa">create an account</a>
+        (if you have previously created/updated Commons issues using Bugzilla an account will have been automatically
+        created and you can use the
+        <a href="http://issues.apache.org/jira/secure/ForgotPassword!default.jspa">Forgot Password</a>
+        page to get a new password).
+      </p>
+
+      <p>
+        If you would like to report a bug, or raise an enhancement request with
+        Commons Monitoring (Sandbox) please do the following:
+        <ol>
+          <li><a
+            href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">
+            Search existing open bugs</a>.
+            If you find your issue listed then please add a comment with your details.
+          </li>
+          <li><a href="mail-lists.html">Search the mailing list archive(s)</a>.
+            You may find your issue or idea has already been discussed.
+          </li>
+          <li>Decide if your issue is a bug or an enhancement.</li>
+          <li>Submit either a
+            <a
+              href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310491&amp;components=12312100&amp;issuetype=1&amp;priority=4&amp;assignee=-1">
+              bug report
+            </a>
+            or<a
+              href="http://issues.apache.org/jira/secure/CreateIssueDetails!init.jspa?pid=12310491&amp;components=12312100&amp;issuetype=4&amp;priority=4&amp;assignee=-1">
+              enhancement request</a>.
+          </li>
+        </ol>
+      </p>
+
+      <p>
+        Please also remember these points:
+        <ul>
+          <li>the more information you provide, the better we can help you</li>
+          <li>test cases are vital, particularly for any proposed enhancements</li>
+          <li>the developers of Commons Monitoring (Sandbox) are all unpaid volunteers</li>
+        </ul>
+      </p>
+
+      <p>
+        For more information on subversion and creating patches see the
+        <a href="http://www.apache.org/dev/contributors.html">Apache Contributors Guide</a>.
+      </p>
+
+      <p>
+        You may also find these links useful:
+        <ul>
+          <li>
+            <a
+              href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=1&amp;status=3&amp;status=4">
+              All Open Commons Monitoring (Sandbox) bugs
+            </a>
+          </li>
+          <li>
+            <a
+              href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC&amp;status=5&amp;status=6">
+              All Resolved Commons Monitoring (Sandbox) bugs
+            </a>
+          </li>
+          <li>
+            <a
+              href="http://issues.apache.org/jira/secure/IssueNavigator.jspa?reset=true&amp;pid=12310491&amp;component=12312100&amp;sorter/field=issuekey&amp;sorter/order=DESC">
+              All Commons Monitoring (Sandbox) bugs
+            </a>
+          </li>
+        </ul>
       </p>
     </section>
   </body>

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/listeners.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/listeners.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/listeners.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/listeners.xml Mon Jul 29 06:20:54 2013
@@ -18,7 +18,7 @@
 
 <document>
 
-<properties>
+  <properties>
     <title>Monitoring listeners</title>
   </properties>
 
@@ -32,23 +32,31 @@
         For example, the application can switch between two implementations of a component depending
         on the business process load. A monitor that computes this load can be used by the application to
         detect the overload and switch to a lightweight implementation. To implement this, the application
-        may use the monitor and programmatically (in a <code>if then else</code> block) select the
+        may use the monitor and programmatically (in a
+        <code>if then else</code>
+        block) select the
         implementation to use. A more elegant way is to attach a Listener to the Gauge that monitors the load.
       </p>
       <p>
-        Repository, Monitors and Metrics support listeners. The <code>Metric.Listener</code> interface
+        Repository, Monitors and Metrics support listeners. The
+        <code>Metric.Listener</code>
+        interface
         allows custom code to get notified when a value is updated. This is a nice way to detect some
         value to increase abnormally and to adapt application behavior. The main advantage is that such
         listener can be reused and don't require code intrusive changes in the monitored components.
       </p>
       <p>
-        <code>Monitor.Listener</code> allows the application to get evolved when a new Metric is registered
-        to the monitor. The application can register new statValues (or <em>automagically</em> creates new ones
+        <code>Monitor.Listener</code>
+        allows the application to get evolved when a new Metric is registered
+        to the monitor. The application can register new statValues (or
+        <em>automagically</em>
+        creates new ones
         when requested) at any moment, and this listener can be used to get notified and pre-configure the
         statValue before it gets used.
       </p>
       <p>
-        <code>Repository.Listener</code> can be used by the application to get notified any time a new monitor
+        <code>Repository.Listener</code>
+        can be used by the application to get notified any time a new monitor
         instance is created, for example to register a Monitor.Listener !
       </p>
     </section>
@@ -59,10 +67,13 @@
         application scalability.
       </p>
       <p>
-        The StopWatches used to monitor execution can be registered in the <code>ExecutionStack</code> utility
+        The StopWatches used to monitor execution can be registered in the
+        <code>ExecutionStack</code>
+        utility
         class that maintain the set of active stopWatches for the current thread. It is recommended
         to let the stopWatches register themselves and cleaning the stack by configuring the Repository to use
-        <code>ExecutionStopWatch</code> StopWatch implementation.
+        <code>ExecutionStopWatch</code>
+        StopWatch implementation.
       </p>
       <p>
         When the Listener on the business process detects some overload, it can look at the ExecutionStack
@@ -74,7 +85,7 @@
     <section name="Secondary monitors">
       <p>
         Listeners are low-level hooks to observe the monitored state and the state exposed by the application.
-        A higher level is provided via the <code>org.apache.commons.monitoring.listeners.SecondaryRepository</code>.
+        A higher level is provided via the<code>org.apache.commons.monitoring.listeners.SecondaryRepository</code>.
         Secondary repositories are used to observe the monitored state for a period of time, where Listeners
         are used to observe individual monitoring events.
       </p>
@@ -87,8 +98,8 @@
         and will then not get notified anymore on application monitoring events.
       </p>
       <p>
-       Secondary repositories are the first-class component for building a time-based monitoring console. See
-       reporting section for more information on there usage for this use case.
+        Secondary repositories are the first-class component for building a time-based monitoring console. See
+        reporting section for more information on there usage for this use case.
       </p>
     </section>
 

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/mail-lists.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/mail-lists.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/mail-lists.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/mail-lists.xml Mon Jul 29 06:20:54 2013
@@ -48,7 +48,8 @@ limitations under the License.
 
     <section name="Overview">
       <p>
-        <a href="index.html">Commons Monitoring (Sandbox)</a> shares mailing lists with all the other 
+        <a href="index.html">Commons Monitoring (Sandbox)</a>
+        shares mailing lists with all the other
         <a href="http://commons.apache.org/components.html">Commons Components</a>.
         To make it easier for people to only read messages related to components they are interested in,
         the convention in Commons is to prefix the subject line of messages with the component's name,
@@ -60,25 +61,34 @@ limitations under the License.
       <p>
         Questions related to the usage of Commons Monitoring (Sandbox) should be posted to the
         <a href="http://mail-archives.apache.org/mod_mbox/commons-user/">User List</a>.
-        <br />
-        The <a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">Developer List</a>
+        <br/>
+        The
+        <a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">Developer List</a>
         is for questions and discussion related to the development of Commons Monitoring (Sandbox).
-        <br />
+        <br/>
         Please do not cross-post; developers are also subscribed to the user list.
       </p>
       <p>
-        <strong>Note:</strong> please don't send patches or attachments to any of the mailing lists.
-        Patches are best handled via the <a href="issue-tracking.html">Issue Tracking</a> system. 
-        Otherwise, please upload the file to a public server and include the URL in the mail. 
+        <strong>Note:</strong>
+        please don't send patches or attachments to any of the mailing lists.
+        Patches are best handled via the
+        <a href="issue-tracking.html">Issue Tracking</a>
+        system.
+        Otherwise, please upload the file to a public server and include the URL in the mail.
       </p>
     </section>
 
     <section name="Commons Monitoring (Sandbox) Mailing Lists">
       <p>
-        <strong>Please prefix the subject line of any messages for <a href="index.html">Commons Monitoring (Sandbox)</a>
-        with <i>[monitoring]</i></strong> - <i>thanks!</i>
-        <br />
-        <br />
+        <strong>Please prefix the subject line of any messages for
+          <a href="index.html">Commons Monitoring (Sandbox)</a>
+          with
+          <i>[monitoring]</i>
+        </strong>
+        -
+        <i>thanks!</i>
+        <br/>
+        <br/>
       </p>
 
       <table>
@@ -95,17 +105,30 @@ limitations under the License.
         <tr>
           <td>
             <strong>Commons User List</strong>
-            <br /><br />
+            <br/>
+            <br/>
             Questions on using Commons Monitoring (Sandbox).
-            <br /><br />
+            <br/>
+            <br/>
           </td>
-          <td><a href="mailto:user-subscribe@commons.apache.org">Subscribe</a></td>
-          <td><a href="mailto:user-unsubscribe@commons.apache.org">Unsubscribe</a></td>
-          <td><a href="mailto:user@commons.apache.org?subject=[monitoring]">Post</a></td>
-          <td><a href="http://mail-archives.apache.org/mod_mbox/commons-user/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.users/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/user@commons.apache.org/">www.mail-archive.com</a><br />
-              <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
+          <td>
+            <a href="mailto:user-subscribe@commons.apache.org">Subscribe</a>
+          </td>
+          <td>
+            <a href="mailto:user-unsubscribe@commons.apache.org">Unsubscribe</a>
+          </td>
+          <td>
+            <a href="mailto:user@commons.apache.org?subject=[monitoring]">Post</a>
+          </td>
+          <td>
+            <a href="http://mail-archives.apache.org/mod_mbox/commons-user/">mail-archives.apache.org</a>
+          </td>
+          <td>
+            <a href="http://markmail.org/list/org.apache.commons.users/">markmail.org</a>
+            <br/>
+            <a href="http://www.mail-archive.com/user@commons.apache.org/">www.mail-archive.com</a>
+            <br/>
+            <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
           </td>
         </tr>
 
@@ -113,17 +136,30 @@ limitations under the License.
         <tr>
           <td>
             <strong>Commons Developer List</strong>
-            <br /><br />
+            <br/>
+            <br/>
             Discussion of development of Commons Monitoring (Sandbox).
-            <br /><br />
+            <br/>
+            <br/>
+          </td>
+          <td>
+            <a href="mailto:dev-subscribe@commons.apache.org">Subscribe</a>
+          </td>
+          <td>
+            <a href="mailto:dev-unsubscribe@commons.apache.org">Unsubscribe</a>
+          </td>
+          <td>
+            <a href="mailto:dev@commons.apache.org?subject=[monitoring]">Post</a>
           </td>
-          <td><a href="mailto:dev-subscribe@commons.apache.org">Subscribe</a></td>
-          <td><a href="mailto:dev-unsubscribe@commons.apache.org">Unsubscribe</a></td>
-          <td><a href="mailto:dev@commons.apache.org?subject=[monitoring]">Post</a></td>
-          <td><a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.dev/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/dev@commons.apache.org/">www.mail-archive.com</a><br />
-              <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
+          <td>
+            <a href="http://mail-archives.apache.org/mod_mbox/commons-dev/">mail-archives.apache.org</a>
+          </td>
+          <td>
+            <a href="http://markmail.org/list/org.apache.commons.dev/">markmail.org</a>
+            <br/>
+            <a href="http://www.mail-archive.com/dev@commons.apache.org/">www.mail-archive.com</a>
+            <br/>
+            <a href="http://news.gmane.org/gmane.comp.jakarta.commons.devel">news.gmane.org</a>
           </td>
         </tr>
 
@@ -131,16 +167,30 @@ limitations under the License.
         <tr>
           <td>
             <strong>Commons Issues List</strong>
-            <br /><br />
-            Only for e-mails automatically generated by the <a href="issue-tracking.html">issue tracking</a> system.
-            <br /><br />
-          </td>
-          <td><a href="mailto:issues-subscribe@commons.apache.org">Subscribe</a></td>
-          <td><a href="mailto:issues-unsubscribe@commons.apache.org">Unsubscribe</a></td>
-          <td><i>read only</i></td>
-          <td><a href="http://mail-archives.apache.org/mod_mbox/commons-issues/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.issues/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/issues@commons.apache.org/">www.mail-archive.com</a>
+            <br/>
+            <br/>
+            Only for e-mails automatically generated by the
+            <a href="issue-tracking.html">issue tracking</a>
+            system.
+            <br/>
+            <br/>
+          </td>
+          <td>
+            <a href="mailto:issues-subscribe@commons.apache.org">Subscribe</a>
+          </td>
+          <td>
+            <a href="mailto:issues-unsubscribe@commons.apache.org">Unsubscribe</a>
+          </td>
+          <td>
+            <i>read only</i>
+          </td>
+          <td>
+            <a href="http://mail-archives.apache.org/mod_mbox/commons-issues/">mail-archives.apache.org</a>
+          </td>
+          <td>
+            <a href="http://markmail.org/list/org.apache.commons.issues/">markmail.org</a>
+            <br/>
+            <a href="http://www.mail-archive.com/issues@commons.apache.org/">www.mail-archive.com</a>
           </td>
         </tr>
 
@@ -148,16 +198,30 @@ limitations under the License.
         <tr>
           <td>
             <strong>Commons Commits List</strong>
-            <br /><br />
-            Only for e-mails automatically generated by the <a href="source-repository.html">source control</a> sytem.
-            <br /><br />
-          </td>
-          <td><a href="mailto:commits-subscribe@commons.apache.org">Subscribe</a></td>
-          <td><a href="mailto:commits-unsubscribe@commons.apache.org">Unsubscribe</a></td>
-          <td><i>read only</i></td>
-          <td><a href="http://mail-archives.apache.org/mod_mbox/commons-commits/">mail-archives.apache.org</a></td>
-          <td><a href="http://markmail.org/list/org.apache.commons.commits/">markmail.org</a><br />
-              <a href="http://www.mail-archive.com/commits@commons.apache.org/">www.mail-archive.com</a>
+            <br/>
+            <br/>
+            Only for e-mails automatically generated by the
+            <a href="source-repository.html">source control</a>
+            sytem.
+            <br/>
+            <br/>
+          </td>
+          <td>
+            <a href="mailto:commits-subscribe@commons.apache.org">Subscribe</a>
+          </td>
+          <td>
+            <a href="mailto:commits-unsubscribe@commons.apache.org">Unsubscribe</a>
+          </td>
+          <td>
+            <i>read only</i>
+          </td>
+          <td>
+            <a href="http://mail-archives.apache.org/mod_mbox/commons-commits/">mail-archives.apache.org</a>
+          </td>
+          <td>
+            <a href="http://markmail.org/list/org.apache.commons.commits/">markmail.org</a>
+            <br/>
+            <a href="http://www.mail-archive.com/commits@commons.apache.org/">www.mail-archive.com</a>
           </td>
         </tr>
 
@@ -181,18 +245,33 @@ limitations under the License.
         <tr>
           <td>
             <strong>Apache Announce List</strong>
-            <br /><br />
+            <br/>
+            <br/>
             General announcements of Apache project releases.
-            <br /><br />
+            <br/>
+            <br/>
+          </td>
+          <td>
+            <a class="externalLink" href="mailto:announce-subscribe@apache.org">Subscribe</a>
+          </td>
+          <td>
+            <a class="externalLink" href="mailto:announce-unsubscribe@apache.org">Unsubscribe</a>
           </td>
-          <td><a class="externalLink" href="mailto:announce-subscribe@apache.org">Subscribe</a></td> 
-          <td><a class="externalLink" href="mailto:announce-unsubscribe@apache.org">Unsubscribe</a></td> 
-          <td><i>read only</i></td>
-          <td><a class="externalLink" href="http://mail-archives.apache.org/mod_mbox/announce/">mail-archives.apache.org</a></td> 
-          <td><a class="externalLink" href="http://markmail.org/list/org.apache.announce/">markmail.org</a><br />
-              <a class="externalLink" href="http://old.nabble.com/Apache-News-and-Announce-f109.html">old.nabble.com</a><br />
-              <a class="externalLink" href="http://www.mail-archive.com/announce@apache.org/">www.mail-archive.com</a><br />
-              <a class="externalLink" href="http://news.gmane.org/gmane.comp.apache.announce">news.gmane.org</a>
+          <td>
+            <i>read only</i>
+          </td>
+          <td>
+            <a class="externalLink" href="http://mail-archives.apache.org/mod_mbox/announce/">mail-archives.apache.org
+            </a>
+          </td>
+          <td>
+            <a class="externalLink" href="http://markmail.org/list/org.apache.announce/">markmail.org</a>
+            <br/>
+            <a class="externalLink" href="http://old.nabble.com/Apache-News-and-Announce-f109.html">old.nabble.com</a>
+            <br/>
+            <a class="externalLink" href="http://www.mail-archive.com/announce@apache.org/">www.mail-archive.com</a>
+            <br/>
+            <a class="externalLink" href="http://news.gmane.org/gmane.comp.apache.announce">news.gmane.org</a>
           </td>
         </tr>
       </table>

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/reporting.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/reporting.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/reporting.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/reporting.xml Mon Jul 29 06:20:54 2013
@@ -18,14 +18,14 @@
 
 <document>
 
-<properties>
+  <properties>
     <title>Repporting</title>
   </properties>
 
   <body>
     <section name="Repporting">
       <p>
-      TODO ...
+        TODO ...
       </p>
     </section>
 

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/tutorial.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/tutorial.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/tutorial.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/tutorial.xml Mon Jul 29 06:20:54 2013
@@ -18,7 +18,7 @@
 
 <document>
 
-<properties>
+  <properties>
     <title>Commons Monitoring tutorial</title>
   </properties>
 
@@ -26,21 +26,23 @@
 
     <section name="Quick introduction">
       <p>
-        The <b>Monitoring</b> class is a convenience utility class to make application instrumentation
+        The
+        <b>Monitoring</b>
+        class is a convenience utility class to make application instrumentation
         as simple as possible. To monitor application performance, simply do :
         <pre>
-        public void myMethodToGetMonitored()
-        {
-            StopWatch stopWatch = Monitoring.start( "MyClass.myMethod" );
-            try
-            {
-                // Do something that takes time and requires monitoring
-            }
-            finally
-            {
-                stopWatch.stop();
-            }
-        }
+          public void myMethodToGetMonitored()
+          {
+          StopWatch stopWatch = Monitoring.start( "MyClass.myMethod" );
+          try
+          {
+          // Do something that takes time and requires monitoring
+          }
+          finally
+          {
+          stopWatch.stop();
+          }
+          }
         </pre>
         The StopWatch class will compute the time elapsed during code execution and report it to the
         monitor "MyClass.myMethod".
@@ -48,28 +50,33 @@
     </section>
     <section name="Instrumentation">
       <p>
-        A <b>Monitor</b> defines a control point in the application. It can be associated to a resource,
+        A
+        <b>Monitor</b>
+        defines a control point in the application. It can be associated to a resource,
         a code fragment or anything relevant for the application. The monitor is unique and retrieved from
-        a <b>Repository</b>. It is identified by a name, a category (technical description of the application
+        a<b>Repository</b>. It is identified by a name, a category (technical description of the application
         component) and a subsystem (functional description). In the previous code sample, only a name was set
         as category and subsystem are optional. We recommend to use them to create monitors as this is a
         convenient and powerful way to group and sort monitors and associated statistics.
       </p>
       <p>
-        The monitor maintains a set of Metrics, that can be either <b>Counters</b> or <b>Gauges</b>.
+        The monitor maintains a set of Metrics, that can be either
+        <b>Counters</b>
+        or<b>Gauges</b>.
         <ul>
           <li>A Counter will get incremented any time the application does its work and expose the result to
-          the monitoring backbone : byte received, lines processed...</li>
+            the monitoring backbone : byte received, lines processed...
+          </li>
           <li>A Gauge allows the application to expose how a resource is used : active connections...</li>
         </ul>
         Each Metric is identified by a ROLE in the monitor. Default roles are defined for PERFORMANCES and
         CONCURRENCY (threads running same code), and you can register Counters/Gauges for custom roles to monitor
-        anything that is relevant for your application (bytes processed, message payload, account balance ...)  :
+        anything that is relevant for your application (bytes processed, message payload, account balance ...) :
         <pre>
-            Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
+          Monitor monitor = repository.getMonitor( "SoapEndpoint.process", "soap" );
 
-            // Process a SOAP message
-            monitor.getCounter( "bytes" ).add( SOAPMessage.getSize() );
+          // Process a SOAP message
+          monitor.getCounter( "bytes" ).add( SOAPMessage.getSize() );
         </pre>
       </p>
       <p>
@@ -82,7 +89,9 @@
       <p>
         You can retrieve statistical datas from your monitors and Metrics to build reports. You can
         programatically acces the repository and iterate on monitors to build a custom output, or rely
-        on Commons Monitoring provided <b>Renderers</b> that support common output formats (XML, TXT, JSON).
+        on Commons Monitoring provided
+        <b>Renderers</b>
+        that support common output formats (XML, TXT, JSON).
       </p>
       <p>
         When used in a webapp, Commons Monitoring provides a simple web UI.

Modified: commons/sandbox/monitoring/trunk/src/site/xdoc/web.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/site/xdoc/web.xml?rev=1507950&r1=1507949&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/site/xdoc/web.xml (original)
+++ commons/sandbox/monitoring/trunk/src/site/xdoc/web.xml Mon Jul 29 06:20:54 2013
@@ -18,7 +18,7 @@
 
 <document>
 
-<properties>
+  <properties>
     <title>use in a web applications</title>
   </properties>
 
@@ -29,64 +29,105 @@
         Monitoring provides support for servlet based web applications.
       </p>
       <subsection name="MonitoringFilter">
-      <p>
-        The monitoringFilter is a Servlet Filter to compute HTTP request serving performance. Simply add
-        the following configuration to your <tt>WEB-INF/web.xml</tt> :
-         <pre>
-    &lt;filter&gt;
-        &lt;filter-name&gt;Monitoring&lt;/filter-name&gt;
-        &lt;filter-class&gt;org.apache.commons.monitoring.servlet.MonitoringFilter&lt;/filter-class&gt;
-    &lt;/filter&gt;
-
-    &lt;filter-mapping&gt;
-        &lt;filter-name&gt;Monitoring&lt;/filter-name&gt;
-        &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
-    &lt;/filter-mapping&gt;
-         </pre>
-        Any incoming request will then be monitored and added to the repository.
-        The monitor name is the requested URI path, and the extension is used to select a category.
-      </p>
+        <p>
+          The monitoringFilter is a Servlet Filter to compute HTTP request serving performance. Simply add
+          the following configuration to your
+          <tt>WEB-INF/web.xml</tt>
+          :
+          <pre>
+            &lt;filter&gt;
+            &lt;filter-name&gt;Monitoring&lt;/filter-name&gt;
+            &lt;filter-class&gt;org.apache.commons.monitoring.servlet.MonitoringFilter&lt;/filter-class&gt;
+            &lt;/filter&gt;
+
+            &lt;filter-mapping&gt;
+            &lt;filter-name&gt;Monitoring&lt;/filter-name&gt;
+            &lt;url-pattern&gt;/*&lt;/url-pattern&gt;
+            &lt;/filter-mapping&gt;
+          </pre>
+          Any incoming request will then be monitored and added to the repository.
+          The monitor name is the requested URI path, and the extension is used to select a category.
+        </p>
       </subsection>
       <subsection name="MonitoringServlet">
-      <p>
-        The monitoring serlvet give you access to the active repository. Using a selector path, you
-        can select a set of monitors and get it rendered in any supported format (HTML, XML, JSON, ...).
-        The selector path is a simple String to point to the expected objects :
-        <ul>
-          <li><tt>/monitors</tt> will select all monitors in the repository.</li>
-          <li><tt>/monitorsFromCategory/services</tt> will select all monitors for the category "services".</li>
-          <li><tt>/monitorsFromSubsystem/admin</tt> will select all monitors for the subsystem "admin".</li>
-        </ul>
-      </p>
-      <p>
-        The monitoring serlvet also accepts parameter to filter the result :
-        <ul>
-          <li>Adding <tt>?format=html</tt> will force the output to be formatted in HTML. By default the
-          user-agent <tt>accept</tt> header is used to find a valid renderer, but this may produce</li>
-          <li>Adding <tt>?role=performances</tt> will select the "performances" counter to get included in
-          the output. By default all roles are displayed. If some <tt>role</tt> parameter is set in the
-          URI, only those roles are displayed. You can specify many <tt>role=*</tt> parameter or use
-          the shortcut <tt>roles=x,y,z</tt>.</li>
-          <li>Addind <tt>?performances.value=false</tt> will remove the "current value" column from the
-          output. You can specify many <tt>[role].[attribute]=[true|false]</tt> parameter or use
-          the shortcut <tt>[role].columns=x,y,z</tt>.</li>
-          <li>Adding <tt>?performances.unit=ms</tt> will format the "performances" counter values to use
-          milliseconds as data unit. The parameter value must be a valid derived unit from the counter unit.
-          For time based counters, this includes <tt>ns</tt> (nanoseconds), <tt>µs</tt> (microseconds),
-          <tt>ms</tt> (milliseconds), <tt>s</tt> (seconds) ... Please refer to the
-          <code>org.apache.commons.monitoring.Unit</code> javadoc for more infos on units.</li>
-        </ul>
-        By combining the request URI path and parameters, you can filter what is relevant for you. Bookmark
-        the valuable URIs ! Example :
-        <tt>http://myserver/monitoring/monitors?performances.unit=ms&amp;performances.value=false&amp;performances.sum=false</tt>
-      </p>
+        <p>
+          The monitoring serlvet give you access to the active repository. Using a selector path, you
+          can select a set of monitors and get it rendered in any supported format (HTML, XML, JSON, ...).
+          The selector path is a simple String to point to the expected objects :
+          <ul>
+            <li>
+              <tt>/monitors</tt>
+              will select all monitors in the repository.
+            </li>
+            <li>
+              <tt>/monitorsFromCategory/services</tt>
+              will select all monitors for the category "services".
+            </li>
+            <li>
+              <tt>/monitorsFromSubsystem/admin</tt>
+              will select all monitors for the subsystem "admin".
+            </li>
+          </ul>
+        </p>
+        <p>
+          The monitoring serlvet also accepts parameter to filter the result :
+          <ul>
+            <li>Adding
+              <tt>?format=html</tt>
+              will force the output to be formatted in HTML. By default the
+              user-agent
+              <tt>accept</tt>
+              header is used to find a valid renderer, but this may produce
+            </li>
+            <li>Adding
+              <tt>?role=performances</tt>
+              will select the "performances" counter to get included in
+              the output. By default all roles are displayed. If some
+              <tt>role</tt>
+              parameter is set in the
+              URI, only those roles are displayed. You can specify many
+              <tt>role=*</tt>
+              parameter or use
+              the shortcut<tt>roles=x,y,z</tt>.
+            </li>
+            <li>Addind
+              <tt>?performances.value=false</tt>
+              will remove the "current value" column from the
+              output. You can specify many
+              <tt>[role].[attribute]=[true|false]</tt>
+              parameter or use
+              the shortcut<tt>[role].columns=x,y,z</tt>.
+            </li>
+            <li>Adding
+              <tt>?performances.unit=ms</tt>
+              will format the "performances" counter values to use
+              milliseconds as data unit. The parameter value must be a valid derived unit from the counter unit.
+              For time based counters, this includes
+              <tt>ns</tt>
+              (nanoseconds),
+              <tt>µs</tt>
+              (microseconds),
+              <tt>ms</tt>
+              (milliseconds),
+              <tt>s</tt>
+              (seconds) ... Please refer to the
+              <code>org.apache.commons.monitoring.counter.Unit</code>
+              javadoc for more infos on units.
+            </li>
+          </ul>
+          By combining the request URI path and parameters, you can filter what is relevant for you. Bookmark
+          the valuable URIs ! Example :
+          <tt>http://myserver/monitoring/monitors?performances.unit=ms&amp;performances.value=false&amp;performances.sum=false</tt>
+        </p>
       </subsection>
       <subsection name="Web UI">
-      <p>
-        The WebUI Servlet extends the monitoring serlvet and the HtmlRenderer to provide a simple
-        Web UI. It uses the same URI filtering as MonitoringServlet, but also includes some
-        CSS to render nicer and <a href="http://www.jquery.com">JQuery</a> to sort data.
-      </p>
+        <p>
+          The WebUI Servlet extends the monitoring serlvet and the HtmlRenderer to provide a simple
+          Web UI. It uses the same URI filtering as MonitoringServlet, but also includes some
+          CSS to render nicer and
+          <a href="http://www.jquery.com">JQuery</a>
+          to sort data.
+        </p>
       </subsection>
     </section>
 

Added: commons/sandbox/monitoring/trunk/web/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/pom.xml?rev=1507950&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/web/pom.xml (added)
+++ commons/sandbox/monitoring/trunk/web/pom.xml Mon Jul 29 06:20:54 2013
@@ -0,0 +1,51 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+  <parent>
+    <artifactId>commons-monitoring-parent</artifactId>
+    <groupId>org.apache.commons.monitoring</groupId>
+    <version>1.0-SNAPSHOT</version>
+  </parent>
+
+  <modelVersion>4.0.0</modelVersion>
+
+  <artifactId>commons-monitoring-web</artifactId>
+  <name>Commons Monitoring (Sandbox) :: Web</name>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-jsp_2.1_spec</artifactId>
+      <version>1.0.1</version>
+      <scope>provided</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.geronimo.specs</groupId>
+      <artifactId>geronimo-servlet_2.5_spec</artifactId>
+    </dependency>
+
+    <dependency>
+      <groupId>org.apache.commons.monitoring</groupId>
+      <artifactId>commons-monitoring-core</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+  </dependencies>
+
+</project>

Modified: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTag.java?rev=1507950&r1=1506987&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTag.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTag.java Mon Jul 29 06:20:54 2013
@@ -15,63 +15,39 @@
  * limitations under the License.
  */
 
-package org.apache.commons.monitoring.instrumentation.servlet.jsp;
+package org.apache.commons.monitoring.web.jsp;
+
+import org.apache.commons.monitoring.repositories.Repository;
+import org.apache.commons.monitoring.stopwatches.StopWatch;
 
-import static org.apache.commons.monitoring.instrumentation.servlet.jsp.TagUtils.getScope;
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.TagSupport;
 
-import org.apache.commons.monitoring.Repository;
-import org.apache.commons.monitoring.StopWatch;
+import static org.apache.commons.monitoring.web.jsp.TagUtils.getScope;
 
 /**
  * A JSP tag to monitor JSP rendering performances
  *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
-public class StartTag
-    extends TagSupport
-{
+public class StartTag extends TagSupport {
     private String id;
-
     private String scope;
-
     private String name;
-
     private String category;
-
-    private String subsystem;
-
     protected String repository;
 
-
-    /**
-     * @param id the id to set
-     */
-    public void setId( String id )
-    {
+    public void setId(String id) {
         this.id = id;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
-     */
     @Override
-    public int doStartTag()
-        throws JspException
-    {
-        Repository repo = TagUtils.getRepository( pageContext, repository );
-
-        StopWatch stopWatch = repo.start( repo.getMonitor( name, category, subsystem ) );
-        if (scope != null)
-        {
-            pageContext.setAttribute( id, stopWatch, getScope( scope ) );
-        }
-        else
-        {
-            pageContext.setAttribute( id, stopWatch );
+    public int doStartTag() throws JspException {
+        final StopWatch stopWatch = Repository.INSTANCE.start(Repository.INSTANCE.getMonitor(name, category));
+        if (scope != null) {
+            pageContext.setAttribute(id, stopWatch, getScope(scope));
+        } else {
+            pageContext.setAttribute(id, stopWatch);
         }
         return EVAL_PAGE;
     }
@@ -79,37 +55,21 @@ public class StartTag
     /**
      * @param scope the scope to set
      */
-    public void setScope( String scope )
-    {
+    public void setScope(String scope) {
         this.scope = scope;
     }
 
     /**
      * @param name the name to set
      */
-    public void setName( String name )
-    {
+    public void setName(String name) {
         this.name = name;
     }
 
     /**
      * @param category the category to set
      */
-    public void setCategory( String category )
-    {
+    public void setCategory(String category) {
         this.category = category;
     }
-
-    /**
-     * @param subsystem the subsystem to set
-     */
-    public void setSubsystem( String subsystem )
-    {
-        this.subsystem = subsystem;
-    }
-
-    public void setRepository( String repository )
-    {
-        this.repository = repository;
-    }
 }

Modified: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTagTei.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTagTei.java?rev=1507950&r1=1506987&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTagTei.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StartTagTei.java Mon Jul 29 06:20:54 2013
@@ -15,30 +15,22 @@
  * limitations under the License.
  */
 
-package org.apache.commons.monitoring.instrumentation.servlet.jsp;
+package org.apache.commons.monitoring.web.jsp;
+
+import org.apache.commons.monitoring.stopwatches.StopWatch;
 
 import javax.servlet.jsp.tagext.TagData;
 import javax.servlet.jsp.tagext.TagExtraInfo;
 import javax.servlet.jsp.tagext.VariableInfo;
 
-import org.apache.commons.monitoring.StopWatch;
-
 /**
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
-public class StartTagTei
-    extends TagExtraInfo
-{
-    /**
-     * {@inheritDoc}
-     *
-     * @see javax.servlet.jsp.tagext.TagExtraInfo#getVariableInfo(javax.servlet.jsp.tagext.TagData)
-     */
+public class StartTagTei extends TagExtraInfo {
     @Override
-    public VariableInfo[] getVariableInfo( TagData data )
-    {
-        VariableInfo info =
-            new VariableInfo( data.getAttributeString( "id" ), StopWatch.class.getName(), true, VariableInfo.AT_END );
-        return new VariableInfo[] { info };
+    public VariableInfo[] getVariableInfo(final TagData data) {
+        return new VariableInfo[] {
+            new VariableInfo(data.getAttributeString("id"), StopWatch.class.getName(), true, VariableInfo.AT_END)
+        };
     }
 }

Modified: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StopTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StopTag.java?rev=1507950&r1=1506987&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StopTag.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/StopTag.java Mon Jul 29 06:20:54 2013
@@ -15,32 +15,28 @@
  * limitations under the License.
  */
 
-package org.apache.commons.monitoring.instrumentation.servlet.jsp;
+package org.apache.commons.monitoring.web.jsp;
 
-import static org.apache.commons.monitoring.instrumentation.servlet.jsp.TagUtils.getScope;
+import org.apache.commons.monitoring.stopwatches.StopWatch;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.TagSupport;
 
-import org.apache.commons.monitoring.StopWatch;
+import static org.apache.commons.monitoring.web.jsp.TagUtils.getScope;
 
 /**
  * A JSP tag to monitor JSP rendering performances
  *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
-public class StopTag
-    extends TagSupport
-{
+public class StopTag extends TagSupport {
     private String id;
-
     private String scope;
 
     /**
      * @param id the id to set
      */
-    public void setId( String id )
-    {
+    public void setId(String id) {
         this.id = id;
     }
 
@@ -50,21 +46,15 @@ public class StopTag
      * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
      */
     @Override
-    public int doStartTag()
-        throws JspException
-    {
+    public int doStartTag() throws JspException {
         StopWatch stopWatch;
-        if (scope != null)
-        {
-            stopWatch = (StopWatch) pageContext.getAttribute( id, getScope( scope ) );
-        }
-        else
-        {
-            stopWatch = (StopWatch) pageContext.getAttribute( id );
+        if (scope != null) {
+            stopWatch = (StopWatch) pageContext.getAttribute(id, getScope(scope));
+        } else {
+            stopWatch = (StopWatch) pageContext.getAttribute(id);
         }
-        if (stopWatch == null)
-        {
-            throw new JspException( "No StopWatch under ID " + id + " and scope " + scope );
+        if (stopWatch == null) {
+            throw new JspException("No StopWatch under ID " + id + " and scope " + scope);
         }
         stopWatch.stop();
         return EVAL_PAGE;
@@ -73,8 +63,7 @@ public class StopTag
     /**
      * @param scope the scope to set
      */
-    public void setScope( String scope )
-    {
+    public void setScope(final String scope) {
         this.scope = scope;
     }
 }

Modified: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/TagUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/TagUtils.java?rev=1507950&r1=1506987&r2=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/TagUtils.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/jsp/TagUtils.java Mon Jul 29 06:20:54 2013
@@ -15,67 +15,29 @@
  * limitations under the License.
  */
 
-package org.apache.commons.monitoring.instrumentation.servlet.jsp;
+package org.apache.commons.monitoring.web.jsp;
 
+import javax.servlet.jsp.PageContext;
 import java.util.HashMap;
 import java.util.Map;
 
-import javax.servlet.jsp.JspException;
-import javax.servlet.jsp.PageContext;
-
-import org.apache.commons.monitoring.Repository;
-
-/**
- * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
- */
-public class TagUtils
-{
-    /** Maps JSP scope names to PageContext constants */
-    private static final Map<String, Integer> scopes = new HashMap<String, Integer>();
-
-    static
-    {
-        scopes.put( "page", new Integer( PageContext.PAGE_SCOPE ) );
-        scopes.put( "request", new Integer( PageContext.REQUEST_SCOPE ) );
-        scopes.put( "session", new Integer( PageContext.SESSION_SCOPE ) );
-        scopes.put( "application", new Integer( PageContext.APPLICATION_SCOPE ) );
-    }
-
+public final class TagUtils {
     /**
-     * Converts the scope name into its corresponding PageContext constant.
-     *
-     * @param scopeName Can be "page", "request", "session", or "application".
-     * @return The constant representing the scope (ie. PageContext.*_SCOPE).
+     * Maps JSP scope names to PageContext constants
      */
-    public static int getScope( String scopeName )
-    {
-        return scopes.get( scopeName.toLowerCase() );
+    private static final Map<String, Integer> scopes = new HashMap<String, Integer>();
+    static {
+        scopes.put("page", PageContext.PAGE_SCOPE);
+        scopes.put("request", PageContext.REQUEST_SCOPE);
+        scopes.put("session", PageContext.SESSION_SCOPE);
+        scopes.put("application", PageContext.APPLICATION_SCOPE);
     }
 
-    /**
-     * @param out
-     * @param name TODO
-     * @param value TODO
-     */
-    public static void setAttribute( StringBuffer out, String name, String value )
-    {
-        if ( value != null )
-        {
-            out.append( " " ).append( name ).append( "='" ).append( value ).append( "'" );
-        }
+    public static int getScope(final String scopeName) {
+        return scopes.get(scopeName.toLowerCase());
     }
 
-    public static Repository getRepository( PageContext pageContext, String key)
-        throws JspException
-    {
-        if ( key != null )
-        {
-            Repository repo = (Repository) pageContext.getAttribute( key );
-            if ( repo == null )
-            {
-                throw new JspException( "No repository on pageContext for key " + key );
-            }
-        }
-        return null; //Monitoring.getRepository();
+    private TagUtils() {
+        // no-op
     }
 }

Added: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/lifecycle/CommonsMonitoringLifecycle.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/lifecycle/CommonsMonitoringLifecycle.java?rev=1507950&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/lifecycle/CommonsMonitoringLifecycle.java (added)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/lifecycle/CommonsMonitoringLifecycle.java Mon Jul 29 06:20:54 2013
@@ -0,0 +1,35 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.monitoring.web.lifecycle;
+
+import org.apache.commons.monitoring.configuration.Configuration;
+
+import javax.servlet.ServletContextEvent;
+import javax.servlet.ServletContextListener;
+
+// needs to be activate when commons-monitoring-core is in a webapp
+public class CommonsMonitoringLifecycle implements ServletContextListener {
+    @Override
+    public void contextInitialized(final ServletContextEvent sce) {
+        // no-op
+    }
+
+    @Override
+    public void contextDestroyed(final ServletContextEvent sce) {
+        Configuration.shutdown();
+    }
+}

Copied: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/CategorizedMonitoringFilter.java (from r1506987, commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/CategorizedMonitoringFilter.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/CategorizedMonitoringFilter.java?p2=commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/CategorizedMonitoringFilter.java&p1=commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/CategorizedMonitoringFilter.java&r1=1506987&r2=1507950&rev=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/CategorizedMonitoringFilter.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/CategorizedMonitoringFilter.java Mon Jul 29 06:20:54 2013
@@ -15,54 +15,63 @@
  * limitations under the License.
  */
 
-package org.apache.commons.monitoring.instrumentation.servlet;
+package org.apache.commons.monitoring.web.servlet;
 
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletException;
+import java.io.IOException;
+import java.io.StringReader;
 import java.util.LinkedHashMap;
 import java.util.Map;
+import java.util.Properties;
 import java.util.regex.Pattern;
 
-import javax.servlet.Filter;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-
 /**
  * Select the category to use for a requested URI by searching a matching pattern
  *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
-public class CategorizedMonitoringFilter
-    extends MonitoringFilter
-    implements Filter
-{
+public class CategorizedMonitoringFilter extends MonitoringFilter {
     /**
      * Ordered Map of patterns that defines categories. First pattern matching the requested URI define the category
      */
-    Map<Pattern, String> categories = new LinkedHashMap<Pattern, String>();
-
-    public void registerCategoryForPattern( String pattern, String category )
-    {
-        categories.put( Pattern.compile( pattern ), category );
-    }
+    private final Map<Pattern, String> categories = new LinkedHashMap<Pattern, String>();
 
     @Override
-    protected String getCategory( String uri )
-    {
-        for ( Map.Entry<Pattern, String> entry : categories.entrySet() )
-        {
-            Pattern pattern = entry.getKey();
-            if ( pattern.matcher( uri ).matches() )
-            {
+    protected String getCategory(final String uri) {
+        for (final Map.Entry<Pattern, String> entry : categories.entrySet()) {
+            final Pattern pattern = entry.getKey();
+            if (pattern.matcher(uri).matches()) {
                 return entry.getValue();
             }
         }
-        return super.getCategory( uri );
+        return super.getCategory(uri);
     }
 
+    /**
+     * read "categories" configuration, format is:
+     *
+     *     &lt;pattern1&gt; = &lt;category1&gt;
+     *     &lt;pattern2&gt; = &lt;category2&gt;
+     *
+     * @param config the filter vconfig
+     * @throws ServletException
+     */
     @Override
-    public void init( FilterConfig config )
-        throws ServletException
-    {
-        super.init( config );
-        // TODO get patterns from configuration
+    public void init(final FilterConfig config) throws ServletException {
+        super.init(config);
+
+        final String rawCat = config.getInitParameter("categories");
+        final StringReader reader = new StringReader(rawCat);
+        final Properties props = new Properties();
+        try {
+            props.load(reader);
+        } catch (final IOException e) {
+            // no-op
+        }
+
+        for (final String key : props.stringPropertyNames()) {
+            categories.put(Pattern.compile(key), props.getProperty(key));
+        }
     }
 }

Copied: commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/MonitoringFilter.java (from r1506987, commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/MonitoringFilter.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/MonitoringFilter.java?p2=commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/MonitoringFilter.java&p1=commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/MonitoringFilter.java&r1=1506987&r2=1507950&rev=1507950&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/instrumentation/src/main/java/org/apache/commons/monitoring/instrumentation/servlet/MonitoringFilter.java (original)
+++ commons/sandbox/monitoring/trunk/web/src/main/java/org/apache/commons/monitoring/web/servlet/MonitoringFilter.java Mon Jul 29 06:20:54 2013
@@ -1,7 +1,25 @@
-package org.apache.commons.monitoring.instrumentation.servlet;
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.commons.monitoring.web.servlet;
 
-import java.io.IOException;
+import org.apache.commons.monitoring.repositories.Repository;
+import org.apache.commons.monitoring.stopwatches.StopWatch;
 
+import javax.servlet.Filter;
 import javax.servlet.FilterChain;
 import javax.servlet.FilterConfig;
 import javax.servlet.ServletException;
@@ -9,105 +27,54 @@ import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
 
-import org.apache.commons.monitoring.Monitor;
-import org.apache.commons.monitoring.Repository;
-import org.apache.commons.monitoring.StopWatch;
-
-public class MonitoringFilter
-{
-
-    private Repository repository;
-    private String subsystem;
+public class MonitoringFilter implements Filter {
     private String category;
 
-    public MonitoringFilter()
-    {
-        super();
-    }
-
-    /**
-     * Delegates to Http based doFilter. {@inheritDoc}
-     *
-     * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse,
-     *      javax.servlet.FilterChain)
-     */
-    public void doFilter( ServletRequest request, ServletResponse response, FilterChain chain )
-        throws IOException, ServletException
-    {
-        if ( request instanceof HttpServletRequest )
-        {
-            HttpServletRequest httpRequest = (HttpServletRequest) request;
-            HttpServletResponse httpResponse = (HttpServletResponse) response;
-            doFilter( httpRequest, httpResponse, chain );
-        }
-        else
-        {
+    @Override
+    public void doFilter(final ServletRequest request, final ServletResponse response, final FilterChain chain) throws IOException, ServletException {
+        if (HttpServletRequest.class.isInstance(request)) {
+            final HttpServletRequest httpRequest = HttpServletRequest.class.cast(request);
+            final HttpServletResponse httpResponse = HttpServletResponse.class.cast(response);
+            doFilter(httpRequest, httpResponse, chain);
+        } else {
             // Not an HTTP request...
-            chain.doFilter( request, response );
+            chain.doFilter(request, response);
         }
     }
 
-    public void doFilter( HttpServletRequest request, HttpServletResponse response, FilterChain chain )
-        throws IOException, ServletException
-    {
-        String uri = getRequestedUri( request );
-        String category = getCategory( uri );
-        Monitor monitor = repository.getMonitor( uri, category, subsystem );
-
-        StopWatch stopWatch = repository.start( monitor );
-        try
-        {
-            chain.doFilter( request, response );
-        }
-        finally
-        {
+    protected void doFilter(final HttpServletRequest request, final HttpServletResponse response, final FilterChain chain) throws IOException, ServletException {
+        final String uri = getRequestedUri(request);
+        final String category = getCategory(uri);
+        final StopWatch stopWatch = Repository.INSTANCE.start(Repository.INSTANCE.getMonitor(uri, category));
+        try {
+            chain.doFilter(request, response);
+        } finally {
             stopWatch.stop();
         }
     }
 
-    /**
-     * @param request
-     * @return
-     */
-    protected String getRequestedUri( HttpServletRequest request )
-    {
-        String uri = request.getRequestURI();
-        String context = request.getContextPath();
-        uri = uri.substring( context.length() );
-        return uri;
-    }
-
-    /**
-     * @param uri
-     * @return
-     */
-    protected String getCategory( String uri )
-    {
+    protected String getRequestedUri(final HttpServletRequest request) {
+        final String uri = request.getRequestURI();
+        final String context = request.getContextPath();
+        return uri.substring(context.length());
+    }
+
+    protected String getCategory(final String uri) {
         return category;
     }
 
-    /**
-     * {@inheritDoc}
-     *
-     * @see javax.servlet.Filter#init(javax.servlet.FilterConfig)
-     */
-    public void init( FilterConfig config )
-        throws ServletException
-    {
-        subsystem = config.getInitParameter( "subsystem" );
-        category = config.getInitParameter( "category" );
-        repository = ServletContextUtil.getRepository( config.getServletContext() );
-    }
-
-    /**
-     * {@inheritDoc}
-     *
-     * @see javax.servlet.Filter#destroy()
-     */
-    public void destroy()
-    {
-        // Nop
+    @Override
+    public void init(final FilterConfig config) throws ServletException {
+        category = config.getInitParameter("category");
+        if (category == null) {
+            category = "web";
+        }
     }
 
+    @Override
+    public void destroy() {
+        // Nop
+    }
 }
\ No newline at end of file