[jboss-cvs] JBossAS SVN: r107703 - in projects/ejb3/tags: jboss-ejb3-metrics-deployer-1.1.0 and 1 other directories.

jboss-cvs-commits at lists.jboss.org jboss-cvs-commits at lists.jboss.org
Thu Aug 19 15:49:18 EDT 2010


Author: wolfc
Date: 2010-08-19 15:49:17 -0400 (Thu, 19 Aug 2010)
New Revision: 107703

Added:
   projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/
   projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml
   projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java
Removed:
   projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml
   projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java
Log:
[maven-release-plugin]  copy for tag jboss-ejb3-metrics-deployer-1.1.0

Copied: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0 (from rev 107628, projects/ejb3/trunk/metrics-deployer)


Property changes on: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0
___________________________________________________________________
Name: svn:ignore
   + target
eclipse-target
.settings

Name: svn:mergeinfo
   + 

Deleted: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml
===================================================================
--- projects/ejb3/trunk/metrics-deployer/pom.xml	2010-08-15 18:45:14 UTC (rev 107628)
+++ projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml	2010-08-19 19:49:17 UTC (rev 107703)
@@ -1,73 +0,0 @@
-<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/maven-v4_0_0.xsd">
-
-  <!-- Define Parent -->
-  <parent>
-    <groupId>org.jboss.ejb3</groupId>
-    <artifactId>jboss-ejb3-build</artifactId>
-    <version>1.0.3</version>
-    <relativePath>../build/pom.xml</relativePath>
-  </parent>
-
-  <!-- Maven POM Model Version -->
-  <modelVersion>4.0.0</modelVersion>
-
-  <!-- Artifact Information -->
-  <groupId>org.jboss.ejb3</groupId>
-  <artifactId>jboss-ejb3-metrics-deployer</artifactId>
-  <version>1.0.3-SNAPSHOT</version>
-  <packaging>jar</packaging>
-  <name>JBoss EJB 3.x Metrics Implementation</name>
-  <description>Metrics Implementation for EJB 3.x Containers</description>
-
-  <!-- Build Configuration -->
-  <build>
-    
-  </build>
-  
-  <properties>
-  
-    <!-- Versioning -->
-    <version.org.jboss.deployers.jboss_deployers_spi>2.0.7.GA</version.org.jboss.deployers.jboss_deployers_spi>
-    <version.org.jboss.ejb3_jboss.ejb3.core>1.1.10</version.org.jboss.ejb3_jboss.ejb3.core>
-    <version.org.jboss.man_jboss.managed>2.1.0.SP1</version.org.jboss.man_jboss.managed>
-    <version.org.jboss.microcontainer_jboss.jmx.mc.int>2.2.0.M2</version.org.jboss.microcontainer_jboss.jmx.mc.int>
-  
-  </properties>
-
-  <dependencies>
-
-    <!-- 
-    Dependencies: org.jboss.ejb3 
-    -->
-
-    <dependency>
-      <groupId>org.jboss.ejb3</groupId>
-      <artifactId>jboss-ejb3-core</artifactId>
-      <version>${version.org.jboss.ejb3_jboss.ejb3.core}</version>
-    </dependency>
-
-    <!-- 
-    Dependencies: External to EJB3 
-    -->
-
-    <dependency>
-      <groupId>org.jboss.deployers</groupId>
-      <artifactId>jboss-deployers-spi</artifactId>
-      <version>${version.org.jboss.deployers.jboss_deployers_spi}</version>
-    </dependency>
-
-    <dependency>
-      <groupId>org.jboss.man</groupId>
-      <artifactId>jboss-managed</artifactId>
-      <version>${version.org.jboss.man_jboss.managed}</version>
-    </dependency>
-
-    <!-- For compilation -->
-    <dependency>
-      <groupId>org.jboss.microcontainer</groupId>
-      <artifactId>jboss-jmx-mc-int</artifactId>
-      <version>${version.org.jboss.microcontainer_jboss.jmx.mc.int}</version>
-    </dependency>
-
-  </dependencies>
-</project>

Copied: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml (from rev 107702, projects/ejb3/trunk/metrics-deployer/pom.xml)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/pom.xml	2010-08-19 19:49:17 UTC (rev 107703)
@@ -0,0 +1,79 @@
+<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/maven-v4_0_0.xsd">
+
+  <!-- Define Parent -->
+  <parent>
+    <groupId>org.jboss.ejb3</groupId>
+    <artifactId>jboss-ejb3-build</artifactId>
+    <version>1.0.13</version>
+    <relativePath>../build/pom.xml</relativePath>
+  </parent>
+
+  <!-- Maven POM Model Version -->
+  <modelVersion>4.0.0</modelVersion>
+
+  <!-- Artifact Information -->
+  <groupId>org.jboss.ejb3</groupId>
+  <artifactId>jboss-ejb3-metrics-deployer</artifactId>
+  <version>1.1.0</version>
+  <packaging>jar</packaging>
+  <name>JBoss EJB 3.x Metrics Implementation</name>
+  <description>Metrics Implementation for EJB 3.x Containers</description>
+
+  <!-- Build Configuration -->
+  <build>
+    
+  </build>
+  
+  <properties>
+  
+    <!-- Versioning -->
+    <version.org.jboss.deployers.jboss_deployers_spi>2.0.7.GA</version.org.jboss.deployers.jboss_deployers_spi>
+    <version.org.jboss.ejb3_jboss.ejb3.core>1.3.6</version.org.jboss.ejb3_jboss.ejb3.core>
+    <version.org.jboss.man_jboss.managed>2.1.0.SP1</version.org.jboss.man_jboss.managed>
+    <version.org.jboss.microcontainer_jboss.jmx.mc.int>2.2.0.M2</version.org.jboss.microcontainer_jboss.jmx.mc.int>
+  
+  </properties>
+
+  <dependencies>
+
+    <!-- 
+    Dependencies: org.jboss.ejb3 
+    -->
+
+    <dependency>
+      <groupId>org.jboss.ejb3</groupId>
+      <artifactId>jboss-ejb3-core</artifactId>
+      <version>${version.org.jboss.ejb3_jboss.ejb3.core}</version>
+    </dependency>
+
+    <!-- 
+    Dependencies: External to EJB3 
+    -->
+
+    <dependency>
+      <groupId>org.jboss.deployers</groupId>
+      <artifactId>jboss-deployers-spi</artifactId>
+      <version>${version.org.jboss.deployers.jboss_deployers_spi}</version>
+    </dependency>
+
+    <dependency>
+      <groupId>org.jboss.man</groupId>
+      <artifactId>jboss-managed</artifactId>
+      <version>${version.org.jboss.man_jboss.managed}</version>
+    </dependency>
+
+    <!-- For compilation -->
+    <dependency>
+      <groupId>org.jboss.microcontainer</groupId>
+      <artifactId>jboss-jmx-mc-int</artifactId>
+      <version>${version.org.jboss.microcontainer_jboss.jmx.mc.int}</version>
+    </dependency>
+
+  </dependencies>
+
+  <scm>
+    <connection>scm:svn:http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0</connection>
+    <developerConnection>scm:svn:https://svn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0</developerConnection>
+    <url>http://anonsvn.jboss.org/repos/jbossas/projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0</url>
+  </scm>
+</project>

Deleted: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java
===================================================================
--- projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	2010-08-15 18:45:14 UTC (rev 107628)
+++ projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	2010-08-19 19:49:17 UTC (rev 107703)
@@ -1,200 +0,0 @@
-/*
- * JBoss, Home of Professional Open Source.
- * Copyright 2009, Red Hat Middleware LLC, and individual contributors
- * as indicated by the @author tags. See the copyright.txt file in the
- * distribution for a full listing of individual contributors.
-  *
- * This is free software; you can redistribute it and/or modify it
- * under the terms of the GNU Lesser General Public License as
- * published by the Free Software Foundation; either version 2.1 of
- * the License, or (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this software; if not, write to the Free
- * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
- * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
- */
-package org.jboss.ejb3.metrics.deployer;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Type;
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Set;
-
-import org.jboss.ejb3.statistics.InvocationStatistics;
-import org.jboss.ejb3.statistics.InvocationStatistics.TimeStatistic;
-import org.jboss.metatype.api.types.CompositeMetaType;
-import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
-import org.jboss.metatype.api.types.MapCompositeMetaType;
-import org.jboss.metatype.api.types.MetaType;
-import org.jboss.metatype.api.types.SimpleMetaType;
-import org.jboss.metatype.api.values.MapCompositeValueSupport;
-import org.jboss.metatype.api.values.MetaValue;
-import org.jboss.metatype.api.values.SimpleValueSupport;
-import org.jboss.metatype.spi.values.MetaMapper;
-
-/**
- * InvocationStatisticMetaMapper
- *
- * {@link MetaMapper} for detyped EJB3 invocation statistics.  This
- * is to avoid dependence upon the EJB3 internal implementation
- * classes in possible remote JVMs or outside ClassLoaders.
- *
- * @author Jason T. Greene
- * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
- * @version $Revision: $
- */
-public class InvocationStatisticMetaMapper extends MetaMapper<InvocationStatistics>
-{
-   // --------------------------------------------------------------------------------||
-   // Class Members ------------------------------------------------------------------||
-   // --------------------------------------------------------------------------------||
-
-   public static final CompositeMetaType TYPE;
-
-   public static final CompositeMetaType METHOD_STATS_TYPE;
-
-   private static String[] metaTypePropertyNames;
-
-   /**
-    * The composite type of the method stats; the value for the 
-    * {@link InvocationStatisticMetaMapper#PROP_NAME_ROOT_METHOD_STATS}
-    * property
-    */
-   private static MapCompositeMetaType VALUE_METHOD_STATS_MAP_TYPE;
-
-   /**
-    * Name of the "lastResetTime" property of the returned MetaValue
-    */
-   private static final String PROP_NAME_ROOT_LAST_RESET_TIME = "lastResetTime";
-
-   /**
-    * Name of the "methodStats" property of the returned MetaValue
-    */
-   private static final String PROP_NAME_ROOT_METHOD_STATS = "methodStats";
-
-   /**
-    * Name of the "count" property of the root MetaValue's "methodStats" property
-    */
-   private static final String PROP_NAME_METHODSTATS_COUNT = "count";
-
-   /**
-    * Name of the "minTime" property of the root MetaValue's "methodStats" property
-    */
-   private static final String PROP_NAME_METHODSTATS_MINTIME = "minTime";
-
-   /**
-    * Name of the "maxTime" property of the root MetaValue's "methodStats" property
-    */
-   private static final String PROP_NAME_METHODSTATS_MAXTIME = "maxTime";
-
-   /**
-    * Name of the "totalTime" property of the root MetaValue's "methodStats" property
-    */
-   private static final String PROP_NAME_METHODSTATS_TOTALTIME = "totalTime";
-
-   static
-   {
-      final String[] methodItemNames =
-      {PROP_NAME_METHODSTATS_COUNT, PROP_NAME_METHODSTATS_MINTIME, PROP_NAME_METHODSTATS_MAXTIME,
-            PROP_NAME_METHODSTATS_TOTALTIME};
-      final String[] methodItemDescriptions =
-      {"the number of invocations", "the minimum invocation time", "the maximum invocation time",
-            "the total invocation time",};
-      final MetaType[] methodItemTypes =
-      {SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG,};
-      METHOD_STATS_TYPE = new ImmutableCompositeMetaType("MethodStatistics", "Method invocation statistics",
-            methodItemNames, methodItemDescriptions, methodItemTypes);
-
-      VALUE_METHOD_STATS_MAP_TYPE = new MapCompositeMetaType(METHOD_STATS_TYPE);
-
-      metaTypePropertyNames = new String[]
-      {PROP_NAME_ROOT_LAST_RESET_TIME, PROP_NAME_ROOT_METHOD_STATS};
-
-      final String[] rootItemDescriptions =
-      {"last time statistics were reset", "method statistics",};
-      final MetaType[] rootItemTypes =
-      {SimpleMetaType.LONG, VALUE_METHOD_STATS_MAP_TYPE};
-
-      TYPE = new ImmutableCompositeMetaType("InvocationStatistics", "EJB3 invocation statistics",
-            metaTypePropertyNames, rootItemDescriptions, rootItemTypes);
-   }
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.metatype.spi.values.MetaMapper#getMetaType()
-    */
-   @Override
-   public MetaType getMetaType()
-   {
-      return TYPE;
-   }
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.metatype.spi.values.MetaMapper#mapToType()
-    */
-   @Override
-   public Type mapToType()
-   {
-      return InvocationStatistics.class;
-   }
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.metatype.spi.values.MetaMapper#createMetaValue(org.jboss.metatype.api.types.MetaType, java.lang.Object)
-    */
-   @Override
-   public MetaValue createMetaValue(MetaType metaType, InvocationStatistics object)
-   {
-      // Make the method map from the stats
-      final Map<String, MetaValue> methodMap = new HashMap<String, MetaValue>();
-      @SuppressWarnings("unchecked")
-      final Map<String, TimeStatistic> stats = (Map<String, TimeStatistic>) object.getStats();
-      if (stats != null)
-      {
-         final Set<String> methods = stats.keySet();
-         for (final String method : methods)
-         {
-            // Get the underlying time stat for this method
-            final TimeStatistic stat = stats.get(method);
-
-            // Create a composite view of the stat's state
-            final MapCompositeValueSupport cvs = new MapCompositeValueSupport(METHOD_STATS_TYPE);
-            cvs.put(PROP_NAME_METHODSTATS_COUNT, SimpleValueSupport.wrap(stat.count));
-            cvs.put(PROP_NAME_METHODSTATS_MAXTIME, SimpleValueSupport.wrap(stat.maxTime));
-            cvs.put(PROP_NAME_METHODSTATS_MINTIME, SimpleValueSupport.wrap(stat.minTime));
-            cvs.put(PROP_NAME_METHODSTATS_TOTALTIME, SimpleValueSupport.wrap(stat.totalTime));
-
-            // Add the stat to the method map
-            methodMap.put(method, cvs);
-         }
-      }
-
-      // Make a composite value for the returned MetaType
-      final MapCompositeValueSupport root = new MapCompositeValueSupport(TYPE);
-
-      // Set the properties
-      root.put(PROP_NAME_ROOT_LAST_RESET_TIME, SimpleValueSupport.wrap(object.lastResetTime));
-      root.put(PROP_NAME_ROOT_METHOD_STATS, new MapCompositeValueSupport(methodMap, VALUE_METHOD_STATS_MAP_TYPE));
-
-      // Return
-      return root;
-   }
-
-   /*
-    * (non-Javadoc)
-    * @see org.jboss.metatype.spi.values.MetaMapper#unwrapMetaValue(org.jboss.metatype.api.values.MetaValue)
-    */
-   @Override
-   public InvocationStatistics unwrapMetaValue(MetaValue metaValue)
-   {
-      throw new UnsupportedOperationException(InvocationStatistics.class.getSimpleName() + " is a read-only property");
-   }
-}

Copied: projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java (from rev 107681, projects/ejb3/trunk/metrics-deployer/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java)
===================================================================
--- projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	                        (rev 0)
+++ projects/ejb3/tags/jboss-ejb3-metrics-deployer-1.1.0/src/main/java/org/jboss/ejb3/metrics/deployer/InvocationStatisticMetaMapper.java	2010-08-19 19:49:17 UTC (rev 107703)
@@ -0,0 +1,199 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2009, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+  *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+package org.jboss.ejb3.metrics.deployer;
+
+import org.jboss.ejb3.statistics.InvocationStatistics;
+import org.jboss.ejb3.statistics.InvocationStatistics.TimeStatistic;
+import org.jboss.metatype.api.types.CompositeMetaType;
+import org.jboss.metatype.api.types.ImmutableCompositeMetaType;
+import org.jboss.metatype.api.types.MapCompositeMetaType;
+import org.jboss.metatype.api.types.MetaType;
+import org.jboss.metatype.api.types.SimpleMetaType;
+import org.jboss.metatype.api.values.MapCompositeValueSupport;
+import org.jboss.metatype.api.values.MetaValue;
+import org.jboss.metatype.api.values.SimpleValueSupport;
+import org.jboss.metatype.spi.values.MetaMapper;
+
+import java.lang.reflect.Type;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * InvocationStatisticMetaMapper
+ *
+ * {@link MetaMapper} for detyped EJB3 invocation statistics.  This
+ * is to avoid dependence upon the EJB3 internal implementation
+ * classes in possible remote JVMs or outside ClassLoaders.
+ *
+ * @author Jason T. Greene
+ * @author <a href="mailto:andrew.rubinger at jboss.org">ALR</a>
+ * @version $Revision: $
+ */
+public class InvocationStatisticMetaMapper extends MetaMapper<InvocationStatistics>
+{
+   // --------------------------------------------------------------------------------||
+   // Class Members ------------------------------------------------------------------||
+   // --------------------------------------------------------------------------------||
+
+   public static final CompositeMetaType TYPE;
+
+   public static final CompositeMetaType METHOD_STATS_TYPE;
+
+   private static String[] metaTypePropertyNames;
+
+   /**
+    * The composite type of the method stats; the value for the 
+    * {@link InvocationStatisticMetaMapper#PROP_NAME_ROOT_METHOD_STATS}
+    * property
+    */
+   private static MapCompositeMetaType VALUE_METHOD_STATS_MAP_TYPE;
+
+   /**
+    * Name of the "lastResetTime" property of the returned MetaValue
+    */
+   private static final String PROP_NAME_ROOT_LAST_RESET_TIME = "lastResetTime";
+
+   /**
+    * Name of the "methodStats" property of the returned MetaValue
+    */
+   private static final String PROP_NAME_ROOT_METHOD_STATS = "methodStats";
+
+   /**
+    * Name of the "count" property of the root MetaValue's "methodStats" property
+    */
+   private static final String PROP_NAME_METHODSTATS_COUNT = "count";
+
+   /**
+    * Name of the "minTime" property of the root MetaValue's "methodStats" property
+    */
+   private static final String PROP_NAME_METHODSTATS_MINTIME = "minTime";
+
+   /**
+    * Name of the "maxTime" property of the root MetaValue's "methodStats" property
+    */
+   private static final String PROP_NAME_METHODSTATS_MAXTIME = "maxTime";
+
+   /**
+    * Name of the "totalTime" property of the root MetaValue's "methodStats" property
+    */
+   private static final String PROP_NAME_METHODSTATS_TOTALTIME = "totalTime";
+
+   static
+   {
+      final String[] methodItemNames =
+      {PROP_NAME_METHODSTATS_COUNT, PROP_NAME_METHODSTATS_MINTIME, PROP_NAME_METHODSTATS_MAXTIME,
+            PROP_NAME_METHODSTATS_TOTALTIME};
+      final String[] methodItemDescriptions =
+      {"the number of invocations", "the minimum invocation time", "the maximum invocation time",
+            "the total invocation time",};
+      final MetaType[] methodItemTypes =
+      {SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG, SimpleMetaType.LONG,};
+      METHOD_STATS_TYPE = new ImmutableCompositeMetaType("MethodStatistics", "Method invocation statistics",
+            methodItemNames, methodItemDescriptions, methodItemTypes);
+
+      VALUE_METHOD_STATS_MAP_TYPE = new MapCompositeMetaType(METHOD_STATS_TYPE);
+
+      metaTypePropertyNames = new String[]
+      {PROP_NAME_ROOT_LAST_RESET_TIME, PROP_NAME_ROOT_METHOD_STATS};
+
+      final String[] rootItemDescriptions =
+      {"last time statistics were reset", "method statistics",};
+      final MetaType[] rootItemTypes =
+      {SimpleMetaType.LONG, VALUE_METHOD_STATS_MAP_TYPE};
+
+      TYPE = new ImmutableCompositeMetaType("InvocationStatistics", "EJB3 invocation statistics",
+            metaTypePropertyNames, rootItemDescriptions, rootItemTypes);
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.metatype.spi.values.MetaMapper#getMetaType()
+    */
+   @Override
+   public MetaType getMetaType()
+   {
+      return TYPE;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.metatype.spi.values.MetaMapper#mapToType()
+    */
+   @Override
+   public Type mapToType()
+   {
+      return InvocationStatistics.class;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.metatype.spi.values.MetaMapper#createMetaValue(org.jboss.metatype.api.types.MetaType, java.lang.Object)
+    */
+   @Override
+   public MetaValue createMetaValue(MetaType metaType, InvocationStatistics object)
+   {
+      // Make the method map from the stats
+      final Map<String, MetaValue> methodMap = new HashMap<String, MetaValue>();
+      @SuppressWarnings("unchecked")
+      final Map<String, TimeStatistic> stats = (Map<String, TimeStatistic>) object.getStats();
+      if (stats != null)
+      {
+         final Set<String> methods = stats.keySet();
+         for (final String method : methods)
+         {
+            // Get the underlying time stat for this method
+            final TimeStatistic stat = stats.get(method);
+
+            // Create a composite view of the stat's state
+            final MapCompositeValueSupport cvs = new MapCompositeValueSupport(METHOD_STATS_TYPE);
+            cvs.put(PROP_NAME_METHODSTATS_COUNT, SimpleValueSupport.wrap(stat.getCount()));
+            cvs.put(PROP_NAME_METHODSTATS_MAXTIME, SimpleValueSupport.wrap(stat.getMaxTime()));
+            cvs.put(PROP_NAME_METHODSTATS_MINTIME, SimpleValueSupport.wrap(stat.getMinTime()));
+            cvs.put(PROP_NAME_METHODSTATS_TOTALTIME, SimpleValueSupport.wrap(stat.getTotalTime()));
+
+            // Add the stat to the method map
+            methodMap.put(method, cvs);
+         }
+      }
+
+      // Make a composite value for the returned MetaType
+      final MapCompositeValueSupport root = new MapCompositeValueSupport(TYPE);
+
+      // Set the properties
+      root.put(PROP_NAME_ROOT_LAST_RESET_TIME, SimpleValueSupport.wrap(object.lastResetTime));
+      root.put(PROP_NAME_ROOT_METHOD_STATS, new MapCompositeValueSupport(methodMap, VALUE_METHOD_STATS_MAP_TYPE));
+
+      // Return
+      return root;
+   }
+
+   /*
+    * (non-Javadoc)
+    * @see org.jboss.metatype.spi.values.MetaMapper#unwrapMetaValue(org.jboss.metatype.api.values.MetaValue)
+    */
+   @Override
+   public InvocationStatistics unwrapMetaValue(MetaValue metaValue)
+   {
+      throw new UnsupportedOperationException(InvocationStatistics.class.getSimpleName() + " is a read-only property");
+   }
+}



More information about the jboss-cvs-commits mailing list