commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nico...@apache.org
Subject svn commit: r653443 [1/2] - in /commons/sandbox/monitoring/trunk: ./ src/main/java/org/apache/commons/monitoring/ src/main/java/org/apache/commons/monitoring/aop/ src/main/java/org/apache/commons/monitoring/impl/monitors/ src/main/java/org/apache/commo...
Date Mon, 05 May 2008 12:14:26 GMT
Author: nicolas
Date: Mon May  5 05:14:25 2008
New Revision: 653443

URL: http://svn.apache.org/viewvc?rev=653443&view=rev
Log:
basic JSP tag library for the reporting web UI
support for intergation with springframework using AutoProxyCreators

Added:
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AopPerformanceInterceptor.java
      - copied, changed from r648166, commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/SpringPerformanceInterceptor.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java   (with props)
    commons/sandbox/monitoring/trunk/src/main/resources/META-INF/monitoring.tld   (with props)
    commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.handlers
    commons/sandbox/monitoring/trunk/src/main/resources/META-INF/spring.schemas
    commons/sandbox/monitoring/trunk/src/main/resources/monitoring.xsd   (with props)
Removed:
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/SpringPerformanceInterceptor.java
Modified:
    commons/sandbox/monitoring/trunk/pom.xml
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Role.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Unit.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AbstractPerformanceInterceptor.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/monitors/AbstractMonitor.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/repositories/DefaultRepository.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/HtmlRenderer.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringServlet.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/AbstractSelectTag.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/CategoriesTag.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StatValueTag.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/SubsystemsTag.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Boolean.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Class.java
    commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_String.java
    commons/sandbox/monitoring/trunk/src/site/xdoc/instrumentation.xml
    commons/sandbox/monitoring/trunk/src/test/java/org/apache/commons/monitoring/reporting/RendererTest.java

Modified: commons/sandbox/monitoring/trunk/pom.xml
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/pom.xml?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/pom.xml (original)
+++ commons/sandbox/monitoring/trunk/pom.xml Mon May  5 05:14:25 2008
@@ -49,6 +49,18 @@
       <optional>true</optional>
     </dependency>
     <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>2.5.3</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aop</artifactId>
+      <version>2.5.3</version>
+      <optional>true</optional>
+    </dependency>
+    <dependency>
       <groupId>org.apache.commons</groupId>
       <artifactId>commons-proxy</artifactId>
       <version>1.0</version>

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Monitor.java Mon May  5 05:14:25 2008
@@ -119,6 +119,7 @@
      *
      * @return an unmodifiable collection of registered statValues roles
      */
+    @SuppressWarnings("unchecked")
     Collection<Role> getRoles();
 
     /**

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Role.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Role.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Role.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Role.java Mon May  5 05:14:25 2008
@@ -22,12 +22,14 @@
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 
-public class Role<T extends StatValue> implements Comparable<Role>
+@SuppressWarnings("unchecked")
+public class Role<T extends StatValue>
+    implements Comparable<Role>
 {
     private String name;
 
     private Unit unit;
-    
+
     private Class<T> type;
 
     private static final Map<String, Role> ROLES = new ConcurrentHashMap<String, Role>();
@@ -36,26 +38,30 @@
     {
         return ROLES.get( name );
     }
-    
+
     public static Collection<Role> getRoles()
     {
         return Collections.unmodifiableCollection( ROLES.values() );
-    }    
+    }
 
     public Role( String name, Unit unit, Class<T> type )
     {
         super();
-        if (name == null)
+        if ( name == null )
         {
             throw new IllegalArgumentException( "A role name is required" );
         }
-        if (unit == null)
+        if ( unit == null )
         {
             throw new IllegalArgumentException( "A role unit is required" );
         }
-        if (type == null)
+        if ( type == null )
+        {
+            throw new IllegalArgumentException( "A type is required" );
+        }
+        if ( !StatValue.class.isAssignableFrom( type ) )
         {
-            throw new IllegalArgumentException( "A role type is required" );
+            throw new IllegalArgumentException( "The type must extend StatValue" );
         }
         this.name = name;
         this.unit = unit;

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Unit.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Unit.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Unit.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/Unit.java Mon May  5 05:14:25 2008
@@ -20,7 +20,10 @@
 import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.CopyOnWriteArraySet;
 
 /**
@@ -38,6 +41,8 @@
  */
 public class Unit implements Comparable<Unit>
 {
+    private static final Map<String, Unit> UNITS = new ConcurrentHashMap<String,Unit>();
+
     /** Time based units */
     public static final Unit NANOS = new Unit( "ns" );
     public static final Unit MICROS = new Unit( "┬Ás", NANOS, 1000 );
@@ -59,12 +64,12 @@
     // we use International system of unit names to avoid confusion
     // @see http://en.wikipedia.org/wiki/SI
     public static final Unit UNARY = new Unit( "" );
-    public static final Unit DECA = new Unit( "da", UNARY, 10 );
-    public static final Unit HECTO = new Unit( "h", DECA, 10 );
-    public static final Unit KILO = new Unit( "k", HECTO, 10 );
-    public static final Unit MEGA = new Unit( "M", KILO, 1000 );
-    public static final Unit GIGA = new Unit( "G", MEGA, 1000 );
-    public static final Unit TERA = new Unit( "T", GIGA, 1000 );
+    public static final Unit DECA = new Unit( "*10", UNARY, 10 );
+    public static final Unit HECTO = new Unit( "*100", DECA, 10 );
+    public static final Unit KILO = new Unit( "*1000", HECTO, 10 );
+    public static final Unit MEGA = new Unit( "*10^6", KILO, 1000 );
+    public static final Unit GIGA = new Unit( "*10^9", MEGA, 1000 );
+    public static final Unit TERA = new Unit( "*10^12", GIGA, 1000 );
 
     private final String name;
 
@@ -73,24 +78,13 @@
     private Unit primary;
 
     private List<Unit> derived;
-    
+
     public Set<Unit> primaryUnits = new CopyOnWriteArraySet<Unit>();
 
-    public Unit getDerived( String name )
-    {
-        for ( Unit unit : derived )
-        {
-            if (unit.name.equals( name ))
-            {
-                return unit;
-            }
-        }
-        return null;
-    }
 
-    public List<Unit> getDerived()
+    public static Unit get( String name )
     {
-        return Collections.unmodifiableList( derived );
+        return UNITS.get( name );
     }
 
     /**
@@ -105,6 +99,7 @@
         this.derived = new ArrayList<Unit>();
         this.derived.add( this );
         primaryUnits.add( this );
+        UNITS.put( name, this );
     }
 
     /**
@@ -120,8 +115,27 @@
         this.scale = scale * derived.getScale();
         primary.derived.add( this );
         Collections.sort( primary.derived );
+        UNITS.put( name, this );
     }
 
+    public Unit getDerived( String name )
+    {
+        for ( Unit unit : derived )
+        {
+            if (unit.name.equals( name ))
+            {
+                return unit;
+            }
+        }
+        return null;
+    }
+
+    public List<Unit> getDerived()
+    {
+        return Collections.unmodifiableList( derived );
+    }
+
+
     public String getName()
     {
         return name;

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AbstractPerformanceInterceptor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AbstractPerformanceInterceptor.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AbstractPerformanceInterceptor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AbstractPerformanceInterceptor.java Mon May  5 05:14:25 2008
@@ -41,6 +41,8 @@
 
     protected String subsystem;
 
+    protected MonitorNameExtractor monitorNameExtractor;
+
     public AbstractPerformanceInterceptor()
     {
         super();
@@ -97,7 +99,7 @@
      */
     protected String getMonitorName( Method method )
     {
-        return method.getDeclaringClass().getSimpleName() + "." + method.getName();
+        return monitorNameExtractor.getMonitorName( method );
     }
 
     /**
@@ -132,4 +134,12 @@
     {
         this.subsystem = subsystem;
     }
+
+    /**
+     * @param monitorNameExtractor the monitorNameExtractor to set
+     */
+    public void setMonitorNameExtractor( MonitorNameExtractor monitorNameExtractor )
+    {
+        this.monitorNameExtractor = monitorNameExtractor;
+    }
 }
\ No newline at end of file

Copied: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AopPerformanceInterceptor.java (from r648166, commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/SpringPerformanceInterceptor.java)
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AopPerformanceInterceptor.java?p2=commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AopPerformanceInterceptor.java&p1=commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/SpringPerformanceInterceptor.java&r1=648166&r2=653443&rev=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/SpringPerformanceInterceptor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/AopPerformanceInterceptor.java Mon May  5 05:14:25 2008
@@ -25,7 +25,7 @@
  *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
-public class SpringPerformanceInterceptor
+public class AopPerformanceInterceptor
     extends AbstractPerformanceInterceptor<MethodInvocation>
     implements MethodInterceptor
 {

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java Mon May  5 05:14:25 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.aop;
+
+import java.lang.reflect.Method;
+
+/**
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class DefaultMonitorNameExtractor
+    implements MonitorNameExtractor
+{
+
+    /**
+     * {@inheritDoc}
+     * @see org.apache.commons.monitoring.aop.MonitorNameExtractor#getMonitorName(java.lang.reflect.Method)
+     */
+    public String getMonitorName( Method method )
+    {
+        return method.getDeclaringClass().getSimpleName() + "." + method.getName();
+    }
+
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/DefaultMonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java Mon May  5 05:14:25 2008
@@ -0,0 +1,36 @@
+/*
+ * 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.aop;
+
+import java.lang.reflect.Method;
+
+/**
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public interface MonitorNameExtractor
+{
+
+    /**
+     * Compute the monitor name associated to this method invocation
+     *
+     * @param method method being invoked
+     * @return monitor name. If <code>null</code>, nothing will be monitored
+     */
+    String getMonitorName( Method method );
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/aop/MonitorNameExtractor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/monitors/AbstractMonitor.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/monitors/AbstractMonitor.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/monitors/AbstractMonitor.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/monitors/AbstractMonitor.java Mon May  5 05:14:25 2008
@@ -36,9 +36,11 @@
 public abstract class AbstractMonitor implements Monitor
 {
 
+    @SuppressWarnings("unchecked")
     private final ConcurrentMap<Role, StatValue> values;
     private final Key key;
 
+    @SuppressWarnings("unchecked")
     public AbstractMonitor( Key key )
     {
         super();
@@ -62,11 +64,13 @@
         return values.get( role );
     }
 
+    @SuppressWarnings("unchecked")
     public final <T extends StatValue> T getValue( Role<T> role )
     {
         return (T) values.get( role );
     }
 
+    @SuppressWarnings("unchecked")
     public final Collection<Role> getRoles()
     {
         return Collections.unmodifiableCollection( values.keySet() );
@@ -107,6 +111,7 @@
         return getValue( role );
     }
 
+    @SuppressWarnings("unchecked")
     public Counter getCounter( String role )
     {
         return getCounter( (Role<Counter>) Role.getRole( role ) );
@@ -117,6 +122,7 @@
         return getValue( role );
     }
 
+    @SuppressWarnings("unchecked")
     public Gauge getGauge( String role )
     {
         return getGauge( (Role<Gauge>) Role.getRole( role ) );

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/repositories/DefaultRepository.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/repositories/DefaultRepository.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/repositories/DefaultRepository.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/impl/repositories/DefaultRepository.java Mon May  5 05:14:25 2008
@@ -17,6 +17,7 @@
 
 package org.apache.commons.monitoring.impl.repositories;
 
+import org.apache.commons.monitoring.StopWatch;
 import org.apache.commons.monitoring.impl.monitors.CompositeValuesMonitor;
 import org.apache.commons.monitoring.impl.stopwatches.DefaultStopWatch;
 
@@ -31,4 +32,9 @@
     {
         super( DefaultStopWatch.class, CompositeValuesMonitor.class );
     }
+
+    public DefaultRepository( Class<? extends StopWatch> stopwatchClass )
+    {
+        super( stopwatchClass, CompositeValuesMonitor.class );
+    }
 }

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/AbstractRenderer.java Mon May  5 05:14:25 2008
@@ -114,6 +114,7 @@
         renderStatValues( ctx, monitor, options, roles );
     }
 
+    @SuppressWarnings("unchecked")
     protected void renderStatValues( Context ctx, Monitor monitor, Options options, List<Role> roles )
     {
         for ( Iterator<Role> iterator = roles.iterator(); iterator.hasNext(); )
@@ -141,6 +142,7 @@
      * @param ctx
      * @param role
      */
+    @SuppressWarnings("unchecked")
     protected void renderMissingValue( Context ctx, Role role )
     {
         // Nop
@@ -167,6 +169,7 @@
         return values;
     }
 
+    @SuppressWarnings("unchecked")
     protected void render( Context ctx, StatValue value, Options options )
     {
         Role role = value.getRole();
@@ -276,6 +279,7 @@
      * @param monitors
      * @return
      */
+    @SuppressWarnings("unchecked")
     protected List<Role> getRoles( Collection<Monitor> monitors, Options options )
     {
         Set<Role> roles = new HashSet<Role>();

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/HtmlRenderer.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/HtmlRenderer.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/HtmlRenderer.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/HtmlRenderer.java Mon May  5 05:14:25 2008
@@ -45,9 +45,10 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.commons.monitoring.reporting.AbstractRenderer#render(java.io.Context, java.util.Collection,
-     *      org.apache.commons.monitoring.reporting.Renderer.Options)
+     *
+     * @see org.apache.commons.monitoring.reporting.AbstractRenderer#render(java.io.Context,
+     * java.util.Collection,
+     * org.apache.commons.monitoring.reporting.Renderer.Options)
      */
     @Override
     public void render( Context ctx, Collection<Monitor> monitors, Options options )
@@ -110,8 +111,20 @@
         ctx.println( "<th rowspan='2'>subsystem</th>" );
         for ( Role role : roles )
         {
+            int span = 0;
+            if ( role.getType() == Counter.class )
+            {
+                span += options.render( role, "hits" ) ? 1 : 0;
+                span += options.render( role, "sum" ) ? 1 : 0;
+            }
+            span += options.render( role, "min" ) ? 1 : 0;
+            span += options.render( role, "max" ) ? 1 : 0;
+            span += options.render( role, "mean" ) ? 1 : 0;
+            span += options.render( role, "deviation" ) ? 1 : 0;
+            span += options.render( role, "value" ) ? 1 : 0;
+
             ctx.print( "<td colspan='" );
-            ctx.print( role.getType() == Counter.class ? "7" : "5" );
+            ctx.print( String.valueOf( span ) );
             ctx.print( "'>" );
             ctx.print( role.getName() );
             Unit unit = options.unitFor( role );
@@ -120,6 +133,7 @@
                 renderUnit( ctx, unit );
             }
             ctx.print( "</td>" );
+            columns.put( role.getName(), span );
         }
         ctx.print( "</tr>" );
 
@@ -147,6 +161,7 @@
         ctx.put( COLUMNS, columns );
     }
 
+    @SuppressWarnings("unchecked")
     protected void writeColumnHead( Context ctx, Options options, Role role, String attribute )
     {
         if ( options.render( role, attribute ) )
@@ -159,10 +174,10 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.commons.monitoring.reporting.AbstractRenderer#renderDetached(org.apache.commons.monitoring.reporting.Context,
-     *      org.apache.commons.monitoring.listeners.SecondaryMonitor,
-     *      org.apache.commons.monitoring.reporting.Renderer.Options)
+     * org.apache.commons.monitoring.listeners.SecondaryMonitor,
+     * org.apache.commons.monitoring.reporting.Renderer.Options)
      */
     @Override
     protected void renderDetached( Context ctx, Detachable detached, Options options )
@@ -209,9 +224,9 @@
 
     /**
      * {@inheritDoc}
-     * 
+     *
      * @see org.apache.commons.monitoring.reporting.AbstractRenderer#renderMissingValue(org.apache.commons.monitoring.reporting.Context,
-     *      java.lang.String)
+     * java.lang.String)
      */
     @SuppressWarnings( "unchecked" )
     @Override
@@ -225,8 +240,9 @@
 
     /**
      * {@inheritDoc}
-     * 
-     * @see org.apache.commons.monitoring.reporting.AbstractRenderer#hasNext(java.io.Context, java.lang.Class)
+     *
+     * @see org.apache.commons.monitoring.reporting.AbstractRenderer#hasNext(java.io.Context,
+     * java.lang.Class)
      */
     @Override
     protected void hasNext( Context ctx, Class<?> type )

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java Mon May  5 05:14:25 2008
@@ -0,0 +1,122 @@
+/*
+ * 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.reporting.web;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+
+import javax.servlet.http.HttpServletRequest;
+
+import org.apache.commons.monitoring.Monitor;
+import org.apache.commons.monitoring.Role;
+import org.apache.commons.monitoring.Unit;
+import org.apache.commons.monitoring.Monitor.Key;
+import org.apache.commons.monitoring.reporting.OptionsSupport;
+
+public class HttpSerlvetRequestOptions
+    extends OptionsSupport
+{
+    protected final HttpServletRequest request;
+
+    protected List<String> roles;
+
+    protected List<String> categories;
+
+    protected List<String> subsystems;
+
+    /**
+     * @param request
+     */
+    public HttpSerlvetRequestOptions( HttpServletRequest request )
+    {
+        this.request = request;
+        this.roles = new ArrayList<String>();
+        // Roles set as "role=x&role=y"
+        String[] values = request.getParameterValues( "role" );
+        if ( values != null )
+        {
+            roles.addAll( Arrays.asList( values ) );
+        }
+        // Roles set as "roles=x,y"
+        String value = request.getParameter( "roles" );
+        if ( value != null )
+        {
+            roles.addAll( Arrays.asList( value.split( "," ) ) );
+        }
+
+        values = request.getParameterValues( "category" );
+        categories = values != null ? Arrays.asList( values ) : Collections.<String> emptyList();
+        values = request.getParameterValues( "subsystem" );
+        subsystems = values != null ? Arrays.asList( values ) : Collections.<String> emptyList();
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean renderRole( Role role )
+    {
+        return roles.isEmpty() ? true : roles.contains( role.getName() );
+    }
+
+    @Override
+    public boolean render( Monitor monitor )
+    {
+        Key key = monitor.getKey();
+        return ( categories.isEmpty() || categories.contains( key.getCategory() ) )
+            && ( subsystems.isEmpty() || subsystems.contains( key.getSubsystem() ) );
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public boolean render( Role role, String attribute )
+    {
+        // attribute hidden using "myrole.x=false"
+        String param = request.getParameter( role.getName() + "." + attribute );
+        if (param != null)
+        {
+            return Boolean.parseBoolean( param );
+        }
+        // attribute selected using "myrole.columns=x,y,z"
+        String columns = request.getParameter( role.getName() + ".columns" );
+        if ( columns == null )
+        {
+            return true;
+        }
+        return columns.indexOf( attribute ) >= 0;
+    }
+
+    @Override
+    @SuppressWarnings("unchecked")
+    public Unit unitFor( Role role )
+    {
+        String unitName = request.getParameter( role.getName() + ".unit" );
+        if ( unitName != null )
+        {
+            if ( role.getUnit() != null )
+            {
+                Unit unit = role.getUnit().getDerived( unitName );
+                if ( unit != null )
+                {
+                    return unit;
+                }
+            }
+        }
+        return role.getUnit();
+    }
+}
\ No newline at end of file

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/HttpSerlvetRequestOptions.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringServlet.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringServlet.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringServlet.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/reporting/web/MonitoringServlet.java Mon May  5 05:14:25 2008
@@ -19,7 +19,6 @@
 
 import java.io.IOException;
 import java.util.ArrayList;
-import java.util.Arrays;
 import java.util.Collection;
 import java.util.Collections;
 import java.util.List;
@@ -34,14 +33,10 @@
 
 import org.apache.commons.monitoring.Monitor;
 import org.apache.commons.monitoring.Repository;
-import org.apache.commons.monitoring.Role;
-import org.apache.commons.monitoring.Unit;
-import org.apache.commons.monitoring.Monitor.Key;
 import org.apache.commons.monitoring.reporting.Context;
 import org.apache.commons.monitoring.reporting.FlotRenderer;
 import org.apache.commons.monitoring.reporting.HtmlRenderer;
 import org.apache.commons.monitoring.reporting.JsonRenderer;
-import org.apache.commons.monitoring.reporting.OptionsSupport;
 import org.apache.commons.monitoring.reporting.Renderer;
 import org.apache.commons.monitoring.reporting.Selector;
 import org.apache.commons.monitoring.reporting.XmlRenderer;
@@ -171,76 +166,4 @@
         return mimeTypes;
     }
 
-    protected class HttpSerlvetRequestOptions
-        extends OptionsSupport
-    {
-        protected final HttpServletRequest request;
-
-        protected List<String> roles;
-
-        protected List<String> categories;
-
-        protected List<String> subsystems;
-
-        /**
-         * @param request
-         */
-        public HttpSerlvetRequestOptions( HttpServletRequest request )
-        {
-            this.request = request;
-            String[] values = request.getParameterValues( "role" );
-            if (values != null)
-            {
-                roles = Arrays.asList( values );
-            }
-            values = request.getParameterValues( "category" );
-            categories = values != null ? Arrays.asList( values ) : Collections.<String> emptyList();
-            values = request.getParameterValues( "subsystem" );
-            subsystems = values != null ? Arrays.asList( values ) : Collections.<String> emptyList();
-        }
-
-        @Override
-        public boolean renderRole( Role role )
-        {
-            return roles != null ? roles.contains( role.getName() ) : true;
-        }
-
-        @Override
-        public boolean render( Monitor monitor )
-        {
-            Key key = monitor.getKey();
-            return ( categories.isEmpty() || categories.contains( key.getCategory() ) )
-                && ( subsystems.isEmpty() || subsystems.contains( key.getSubsystem() ) );
-        }
-
-        @Override
-        public boolean render( Role role, String attribute )
-        {
-            String columns = request.getParameter( role.getName() + ".columns" );
-            if ( columns == null )
-            {
-                return true;
-            }
-            return columns.indexOf( attribute ) >= 0;
-        }
-
-        @Override
-        public Unit unitFor( Role role )
-        {
-            String unitName = request.getParameter( role.getName() + ".unit" );
-            if ( unitName != null )
-            {
-                if ( role.getUnit() != null )
-                {
-                    Unit unit = role.getUnit().getDerived( unitName );
-                    if ( unit != null )
-                    {
-                        return unit;
-                    }
-                }
-            }
-            return role.getUnit();
-        }
-    }
-
 }

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/AbstractSelectTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/AbstractSelectTag.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/AbstractSelectTag.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/AbstractSelectTag.java Mon May  5 05:14:25 2008
@@ -9,72 +9,68 @@
 import javax.servlet.jsp.JspTagException;
 import javax.servlet.jsp.tagext.TagSupport;
 
-import org.apache.commons.monitoring.Monitoring;
 import org.apache.commons.monitoring.Repository;
 import org.apache.commons.monitoring.servlet.ServletContextUtil;
 
 public abstract class AbstractSelectTag
     extends TagSupport
 {
-    protected Repository repository;
-    
     private String id;
-    
+
     private String name;
 
+    String repository;
+
     public AbstractSelectTag()
     {
         super();
     }
 
+    protected Repository getRepository()
+        throws JspException
+    {
+        return TagUtils.getRepository( pageContext, repository );
+    }
+
     @Override
     public int doEndTag()
         throws JspException
     {
-        if (repository == null)
-        {
-            repository = (Repository) pageContext.getAttribute( ServletContextUtil.REPOSITORY_KEY );
-        }
-        
-        StringBuffer stb = new StringBuffer( "<select" );
-        if ( id != null )
-        {
-            stb.append( " id='" ).append( id ).append( "'" );
-        }
-        if ( name != null )
-        {
-            stb.append( " name='" ).append( name ).append( "'" );
-        }
-        stb.append( ">" );
+        StringBuffer out = new StringBuffer( "<select" );
+        TagUtils.setAttribute( out, "name", name );
+        TagUtils.setAttribute( out, "id", id );
+        out.append( ">" );
         List<String> categories = new LinkedList<String>( getElements() );
         Collections.sort( categories );
         for ( String category : categories )
         {
-            stb.append( "<option value='" );
-            stb.append( category );
-            stb.append( "'>" );
-            stb.append( category );
-            stb.append( "</option>" );
+            out.append( "<option value='" );
+            out.append( category );
+            out.append( "'>" );
+            out.append( category );
+            out.append( "</option>" );
         }
-        
-        stb.append( "</select>" );
+
+        out.append( "</select>" );
         try
         {
-            pageContext.getOut().print( stb.toString() );
+            pageContext.getOut().print( out.toString() );
         }
         catch ( Exception e )
         {
             throw new JspTagException( "CategoriesTag : " + e.getMessage() );
         }
-    
+
         return EVAL_PAGE;
     }
 
     /**
      * The set of elements to display as a select list
+     *
      * @return
      */
-    protected abstract  Collection<? extends String> getElements();
+    protected abstract Collection<? extends String> getElements()
+        throws JspException;
 
     public void setId( String id )
     {
@@ -86,9 +82,12 @@
         this.name = name;
     }
 
+    /**
+     * @param repository the repository to set
+     */
     public void setRepository( String repository )
     {
-        this.repository = (Repository) pageContext.getAttribute( repository );
+        this.repository = repository;
     }
 
 }
\ No newline at end of file

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/CategoriesTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/CategoriesTag.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/CategoriesTag.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/CategoriesTag.java Mon May  5 05:14:25 2008
@@ -19,18 +19,21 @@
 
 import java.util.Set;
 
+import javax.servlet.jsp.JspException;
+
 
 
 /**
  * A JSP tag to output a select box for repositoy categories
- * 
+ *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
 public class CategoriesTag
     extends AbstractSelectTag
 {
     protected Set<String> getElements()
+        throws JspException
     {
-        return repository.getCategories();
+        return getRepository().getCategories();
     }
 }

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java Mon May  5 05:14:25 2008
@@ -0,0 +1,118 @@
+/*
+ * 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.servlet.jsp;
+
+import static org.apache.commons.monitoring.servlet.jsp.TagUtils.*;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.monitoring.Monitoring;
+import org.apache.commons.monitoring.Repository;
+import org.apache.commons.monitoring.StopWatch;
+import org.apache.commons.monitoring.servlet.ServletContextUtil;
+
+/**
+ * A JSP tag to monitor JSP rendering performances
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+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 )
+    {
+        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 );
+        }
+        return EVAL_PAGE;
+    }
+
+    /**
+     * @param scope the scope to set
+     */
+    public void setScope( String scope )
+    {
+        this.scope = scope;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+    /**
+     * @param category the category to set
+     */
+    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;
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTag.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java Mon May  5 05:14:25 2008
@@ -0,0 +1,44 @@
+/*
+ * 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.servlet.jsp;
+
+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)
+     */
+    @Override
+    public VariableInfo[] getVariableInfo( TagData data )
+    {
+        VariableInfo info =
+            new VariableInfo( data.getAttributeString( "id" ), StopWatch.class.getName(), true, VariableInfo.AT_END );
+        return new VariableInfo[] { info };
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StartTagTei.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StatValueTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StatValueTag.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StatValueTag.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StatValueTag.java Mon May  5 05:14:25 2008
@@ -20,16 +20,16 @@
 
         String name = role.getName();
         StringBuffer stb = new StringBuffer();
-        checkbox( name, "value", stb );
-        checkbox( name, "min", stb );
-        checkbox( name, "max", stb );
-        checkbox( name, "mean", stb );
-        checkbox( name, "deviation", stb );
         if ( role.getType() == Counter.class )
         {
             checkbox( name, "hits", stb );
             checkbox( name, "total", stb );
         }
+        checkbox( name, "value", stb );
+        checkbox( name, "min", stb );
+        checkbox( name, "max", stb );
+        checkbox( name, "mean", stb );
+        checkbox( name, "deviation", stb );
 
         return EVAL_PAGE;
     }

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java Mon May  5 05:14:25 2008
@@ -0,0 +1,81 @@
+/*
+ * 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.servlet.jsp;
+
+import static org.apache.commons.monitoring.servlet.jsp.TagUtils.*;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.monitoring.Monitoring;
+import org.apache.commons.monitoring.StopWatch;
+
+/**
+ * A JSP tag to monitor JSP rendering performances
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class StopTag
+    extends TagSupport
+{
+    private String id;
+
+    private String scope;
+
+    /**
+     * @param id the id to set
+     */
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
+     */
+    @Override
+    public int doStartTag()
+        throws JspException
+    {
+        StopWatch stopWatch;
+        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 );
+        }
+        stopWatch.stop();
+        return EVAL_PAGE;
+    }
+
+    /**
+     * @param scope the scope to set
+     */
+    public void setScope( String scope )
+    {
+        this.scope = scope;
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/StopTag.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/SubsystemsTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/SubsystemsTag.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/SubsystemsTag.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/SubsystemsTag.java Mon May  5 05:14:25 2008
@@ -19,18 +19,21 @@
 
 import java.util.Set;
 
+import javax.servlet.jsp.JspException;
+
 
 
 /**
- * A JSP tag to output a select box for repositoy categories
- * 
+ * A JSP tag to output a select box for repositoy subsystems
+ *
  * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
  */
 public class SubsystemsTag
     extends AbstractSelectTag
 {
     protected Set<String> getElements()
+        throws JspException
     {
-        return repository.getSubSystems();
+        return getRepository().getSubSystems();
     }
 }

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java Mon May  5 05:14:25 2008
@@ -0,0 +1,82 @@
+/*
+ * 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.servlet.jsp;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.PageContext;
+
+import org.apache.commons.monitoring.Monitoring;
+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 ) );
+    }
+
+    /**
+     * 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).
+     */
+    public static int getScope( String scopeName )
+    {
+        return scopes.get( scopeName.toLowerCase() );
+    }
+
+    /**
+     * @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 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 Monitoring.getRepository();
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/TagUtils.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java Mon May  5 05:14:25 2008
@@ -0,0 +1,112 @@
+/*
+ * 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.servlet.jsp;
+
+import static org.apache.commons.monitoring.servlet.jsp.TagUtils.*;
+
+import java.io.IOException;
+import java.util.List;
+
+import javax.servlet.jsp.JspException;
+import javax.servlet.jsp.tagext.TagSupport;
+
+import org.apache.commons.monitoring.Monitoring;
+import org.apache.commons.monitoring.StopWatch;
+import org.apache.commons.monitoring.Unit;
+
+/**
+ * A JSP tag to monitor JSP rendering performances
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class UnitTag
+    extends TagSupport
+{
+    private String unit;
+
+    private String id;
+
+    private String name;
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see javax.servlet.jsp.tagext.TagSupport#doStartTag()
+     */
+    @Override
+    public int doStartTag()
+        throws JspException
+    {
+        StringBuffer out = new StringBuffer();
+        out.append( "<select" );
+        TagUtils.setAttribute( out, "name", name );
+        TagUtils.setAttribute( out, "id", id );
+        out.append( "'>" );
+        Unit u = Unit.get( unit );
+        for ( Unit derived : u.getPrimary().getDerived() )
+        {
+            out.append( "<option value='" );
+            out.append( derived.getName() );
+            out.append( "'" );
+            if ( derived.equals( u ) )
+            {
+                out.append( " selected='selected'" );
+            }
+            out.append( ">" );
+            out.append( derived.getName() );
+            out.append( "</option>" );
+        }
+        out.append( "</select>" );
+
+        try
+        {
+            pageContext.getOut().append( out.toString() );
+        }
+        catch ( IOException e )
+        {
+            throw new JspException( "UnitTag : " + e.getMessage() );
+        }
+
+        return EVAL_PAGE;
+    }
+
+    /**
+     * @param unit the unit to set
+     */
+    public void setUnit( String unit )
+    {
+        this.unit = unit;
+    }
+
+    /**
+     * @param id the id to set
+     */
+    public void setId( String id )
+    {
+        this.id = id;
+    }
+
+    /**
+     * @param name the name to set
+     */
+    public void setName( String name )
+    {
+        this.name = name;
+    }
+
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/servlet/jsp/UnitTag.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java Mon May  5 05:14:25 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.spring;
+
+import org.springframework.aop.aspectj.AspectJExpressionPointcut;
+
+/**
+ * Creates monitored proxies for beans that match an aspectJ expression.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class AspectJMonitoringAutoProxyCreator
+    extends PointcutMonitoringAutoProxyCreator
+{
+    /**
+     * Set the AspectJ expression to be used to select beans / methods to get monitored
+     */
+    public void setExpression( String expression )
+    {
+        AspectJExpressionPointcut pointcut = new AspectJExpressionPointcut();
+        pointcut.setExpression( expression );
+        setPointcut( pointcut );
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/AspectJMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java Mon May  5 05:14:25 2008
@@ -0,0 +1,107 @@
+/*
+ * 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.spring;
+
+import org.aopalliance.aop.Advice;
+import org.apache.commons.monitoring.aop.MonitorNameExtractor;
+import org.apache.commons.monitoring.spring.MonitoringAdviceFactory.MonitoringConfigSource;
+import org.springframework.aop.TargetSource;
+import org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator;
+
+/**
+ * Creates monitored proxies for beans that match a naming pattern.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class BeanNameMonitoringAutoProxyCreator
+    extends BeanNameAutoProxyCreator implements MonitoringConfigSource
+{
+    private String category;
+
+    private String subsystem;
+
+    private MonitorNameExtractor monitorNameExtractor;
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator#getAdvicesAndAdvisorsForBean(java.lang.Class,
+     * java.lang.String, org.springframework.aop.TargetSource)
+     */
+    @Override
+    protected Object[] getAdvicesAndAdvisorsForBean( Class beanClass, String beanName, TargetSource targetSource )
+    {
+        if ( super.getAdvicesAndAdvisorsForBean( beanClass, beanName, targetSource ) != DO_NOT_PROXY )
+        {
+            Advice advice = MonitoringAdviceFactory.getAdvice( this );
+            return new Object[] { advice };
+        }
+        return DO_NOT_PROXY;
+    }
+
+    /**
+     * @param category the category to set
+     */
+    public void setCategory( String category )
+    {
+        this.category = category;
+    }
+
+    /**
+     * @param subsystem the subsystem to set
+     */
+    public void setSubsystem( String subsystem )
+    {
+        this.subsystem = subsystem;
+    }
+
+    /**
+     * @param monitorNameExtractor the monitorNameExtractor to set
+     */
+    public void setMonitorNameExtractor( MonitorNameExtractor monitorNameExtractor )
+    {
+        this.monitorNameExtractor = monitorNameExtractor;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @see org.apache.commons.monitoring.spring.MonitoringConfigSource#getCategory()
+     */
+    public String getCategory()
+    {
+        return category;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @see org.apache.commons.monitoring.spring.MonitoringConfigSource#getSubsystem()
+     */
+    public String getSubsystem()
+    {
+        return subsystem;
+    }
+
+    /**
+     * {@inheritDoc}
+     * @see org.apache.commons.monitoring.spring.MonitoringConfigSource#getMonitorNameExtractor()
+     */
+    public MonitorNameExtractor getMonitorNameExtractor()
+    {
+        return monitorNameExtractor;
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/BeanNameMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java Mon May  5 05:14:25 2008
@@ -0,0 +1,68 @@
+/*
+ * 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.spring;
+
+import org.aopalliance.aop.Advice;
+import org.apache.commons.monitoring.aop.AopPerformanceInterceptor;
+import org.apache.commons.monitoring.aop.MonitorNameExtractor;
+
+/**
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class MonitoringAdviceFactory
+{
+
+    public static Advice getAdvice( MonitoringConfigSource source )
+    {
+        AopPerformanceInterceptor interceptor = new AopPerformanceInterceptor();
+        if ( source.getCategory() != null )
+        {
+            interceptor.setCategory( source.getCategory() );
+        }
+        if ( source.getSubsystem() != null )
+        {
+            interceptor.setSubsystem( source.getSubsystem() );
+        }
+        if ( source.getMonitorNameExtractor() != null )
+        {
+            interceptor.setMonitorNameExtractor( source.getMonitorNameExtractor() );
+        }
+        return interceptor;
+    }
+
+    public interface MonitoringConfigSource
+    {
+        /**
+         * @return the category
+         */
+        public abstract String getCategory();
+
+        /**
+         * @return the subsystem
+         */
+        public abstract String getSubsystem();
+
+        /**
+         * @return the monitorNameExtractor
+         */
+        public abstract MonitorNameExtractor getMonitorNameExtractor();
+
+    }
+
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringAdviceFactory.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java Mon May  5 05:14:25 2008
@@ -0,0 +1,39 @@
+/*
+ * 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.spring;
+
+import org.springframework.beans.factory.xml.NamespaceHandlerSupport;
+
+/**
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class MonitoringNamespaceHandler
+    extends NamespaceHandlerSupport
+{
+
+    /**
+     * {@inheritDoc}
+     * @see org.springframework.beans.factory.xml.NamespaceHandler#init()
+     */
+    public void init()
+    {
+//        registerBeanDefinitionParser( "auto-proxy", new AutoProxyDefinitionParser());
+    }
+
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/MonitoringNamespaceHandler.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java?rev=653443&view=auto
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java (added)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java Mon May  5 05:14:25 2008
@@ -0,0 +1,129 @@
+/*
+ * 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.spring;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import org.aopalliance.aop.Advice;
+import org.apache.commons.monitoring.aop.MonitorNameExtractor;
+import org.apache.commons.monitoring.spring.MonitoringAdviceFactory.MonitoringConfigSource;
+import org.springframework.aop.Advisor;
+import org.springframework.aop.Pointcut;
+import org.springframework.aop.PointcutAdvisor;
+import org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator;
+import org.springframework.aop.support.DefaultPointcutAdvisor;
+
+/**
+ * Creates monitored proxies for beans that match a pointcut.
+ *
+ * @author <a href="mailto:nicolas@apache.org">Nicolas De Loof</a>
+ */
+public class PointcutMonitoringAutoProxyCreator
+    extends AbstractAdvisorAutoProxyCreator
+    implements MonitoringConfigSource
+{
+    private String category;
+
+    private String subsystem;
+
+    private MonitorNameExtractor monitorNameExtractor;
+
+    private Pointcut pointcut;
+
+    /**
+     * {@inheritDoc}
+     *
+     * @see org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator#findCandidateAdvisors()
+     */
+    @Override
+    protected List<Advisor> findCandidateAdvisors()
+    {
+        List<Advisor> adivisors = new ArrayList<Advisor>( 1 );
+
+        PointcutAdvisor adivsor = createPointcutAdvisor( MonitoringAdviceFactory.getAdvice( this ) );
+
+        adivisors.add( adivsor );
+        return adivisors;
+    }
+
+    /**
+     * @param interceptor
+     * @return
+     */
+    protected PointcutAdvisor createPointcutAdvisor( Advice advice )
+    {
+        return new DefaultPointcutAdvisor( pointcut, advice );
+    }
+
+    /**
+     * @param category the category to set
+     */
+    public void setCategory( String category )
+    {
+        this.category = category;
+    }
+
+    /**
+     * @param subsystem the subsystem to set
+     */
+    public void setSubsystem( String subsystem )
+    {
+        this.subsystem = subsystem;
+    }
+
+    /**
+     * @param monitorNameExtractor the monitorNameExtractor to set
+     */
+    public void setMonitorNameExtractor( MonitorNameExtractor monitorNameExtractor )
+    {
+        this.monitorNameExtractor = monitorNameExtractor;
+    }
+
+    /**
+     * @param pointcut the pointcut to set
+     */
+    public void setPointcut( Pointcut pointcut )
+    {
+        this.pointcut = pointcut;
+    }
+
+    /**
+     * @return the category
+     */
+    public String getCategory()
+    {
+        return category;
+    }
+
+    /**
+     * @return the subsystem
+     */
+    public String getSubsystem()
+    {
+        return subsystem;
+    }
+
+    /**
+     * @return the monitorNameExtractor
+     */
+    public MonitorNameExtractor getMonitorNameExtractor()
+    {
+        return monitorNameExtractor;
+    }
+}

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:keywords = Date Author Id Revision HeadURL

Propchange: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/spring/PointcutMonitoringAutoProxyCreator.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Boolean.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Boolean.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Boolean.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Boolean.java Mon May  5 05:14:25 2008
@@ -26,4 +26,9 @@
     {
         return new Boolean( b );
     }
+
+    public static boolean parseBoolean( String s )
+    {
+        return ( s != null ) && s.equalsIgnoreCase( "true" );
+    }
 }

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Class.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Class.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Class.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_Class.java Mon May  5 05:14:25 2008
@@ -22,6 +22,7 @@
  */
 public class _Class
 {
+    @SuppressWarnings("unchecked")
     public static String getSimpleName( Class c )
     {
         String name = c.getName();

Modified: commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_String.java
URL: http://svn.apache.org/viewvc/commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_String.java?rev=653443&r1=653442&r2=653443&view=diff
==============================================================================
--- commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_String.java (original)
+++ commons/sandbox/monitoring/trunk/src/main/java/org/apache/commons/monitoring/support/java13/java/lang/_String.java Mon May  5 05:14:25 2008
@@ -17,6 +17,10 @@
 
 package org.apache.commons.monitoring.support.java13.java.lang;
 
+import java.util.ArrayList;
+import java.util.List;
+import java.util.StringTokenizer;
+
 /**
  * @author <a href="mailto:nicolas.deloof@gmail.com">Nicolas De Loof</a>
  */
@@ -26,4 +30,15 @@
     {
         return string.indexOf( s.toString() ) > -1;
     }
+
+    public static String[] split( String string, String separator )
+    {
+        List<String> tokens = new ArrayList<String>();
+        StringTokenizer tokenizer = new StringTokenizer( string, "," );
+        while ( tokenizer.hasMoreTokens() )
+        {
+            tokens.add( tokenizer.nextToken() );
+        }
+        return tokens.toArray( new String[tokens.size()] );
+    }
 }



Mime
View raw message