[jboss-cvs] JBossAS SVN: r69817 - in branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca: statistics and 1 other directory.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Wed Feb 13 04:54:07 EST 2008
Author: vicky.kak at jboss.com
Date: 2008-02-13 04:54:07 -0500 (Wed, 13 Feb 2008)
New Revision: 69817
Added:
branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/
branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatistic.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatisticFormatter.java
branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/StatisticsHelper.java
Log:
JBAS-5210 changes.
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatistic.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatistic.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatistic.java 2008-02-13 09:54:07 UTC (rev 69817)
@@ -0,0 +1,16 @@
+package org.jboss.test.jca.statistics;
+
+import org.jboss.resource.statistic.JBossStatistics;
+
+public class NullStatistic implements JBossStatistics
+{
+
+ /** The serialVersionUID */
+ private static final long serialVersionUID = 4121269296237048914L;
+
+
+ public String toString()
+ {
+ return "Null Statistics";
+ }
+}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatisticFormatter.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatisticFormatter.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/NullStatisticFormatter.java 2008-02-13 09:54:07 UTC (rev 69817)
@@ -0,0 +1,15 @@
+package org.jboss.test.jca.statistics;
+
+import org.jboss.resource.statistic.JBossStatistics;
+import org.jboss.resource.statistic.formatter.StatisticsFormatter;
+
+public class NullStatisticFormatter implements StatisticsFormatter
+{
+
+ public Object formatStatistics(JBossStatistics stats)
+ {
+ // TODO Auto-generated method stub
+ return stats.toString();
+ }
+
+}
Added: branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/StatisticsHelper.java
===================================================================
--- branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/StatisticsHelper.java (rev 0)
+++ branches/Branch_4_2/testsuite/src/main/org/jboss/test/jca/statistics/StatisticsHelper.java 2008-02-13 09:54:07 UTC (rev 69817)
@@ -0,0 +1,88 @@
+/*
+ * JBoss, Home of Professional Open Source
+ * Copyright 2005, JBoss Inc., and individual contributors as indicated
+ * by the @authors tag. See the copyright.txt 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.test.jca.statistics;
+
+import javax.management.Attribute;
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+
+import org.jboss.mx.util.ObjectNameFactory;
+import org.jboss.resource.statistic.formatter.StatisticsFormatter;
+
+/**
+ * A StatisticsHelper.
+ *
+ * @author <a href="weston.price at jboss.com">Weston Price</a>
+ * @version $Revision: 44973 $
+ */
+public class StatisticsHelper
+{
+
+ private static final String DEFAULT_FORMATTER = "org.jboss.resource.statistic.pool.JBossDefaultSubPoolStatisticFormatter";
+ private static final String XML_FORMATTER = "org.jboss.resource.statistic.pool.JBossXmlSubPoolStatisticFormatter";
+
+ private static final ObjectName POOL_NAME = ObjectNameFactory.create("jboss.jca:service=ManagedConnectionPool,name=StatsDS");
+ private static final String ATTRIBUTE_NAME = "StatisticsFormatter";
+ private static final String RAW_STATS_METHOD = "listStatistics";
+ private static final String FORMATTED_STATS_METHOD = "listFormattedSubPoolStatistics";
+
+ //Pool values
+
+ public static final int DEFAULT_MIN_SIZE = 0;
+ public static final int DEFAULT_MAX_SIZE = 20;
+ public static final int DEFAULT_BLOCK_TIMEOUT = 30000;
+ public static final int DEFAULT_IDLE_TIMEOUT = 15;
+
+
+
+
+ public static Object listRawStatistics(MBeanServerConnection server) throws Exception{
+
+ return server.invoke(POOL_NAME, RAW_STATS_METHOD, new Object[0], new String[0]);
+
+ }
+
+ public static void setStatisticsFormatter(MBeanServerConnection server, String formatter) throws Exception{
+
+ server.setAttribute(POOL_NAME, new Attribute(ATTRIBUTE_NAME, formatter));
+
+ }
+
+ public static String getStatisticsFormatter(MBeanServerConnection server) throws Exception{
+
+ return (String)server.getAttribute(POOL_NAME, ATTRIBUTE_NAME);
+
+ }
+
+ public static String listFormattedStatistics(MBeanServerConnection server) throws Exception{
+
+ return (String)server.invoke(POOL_NAME, FORMATTED_STATS_METHOD, new Object[0], new String[0]);
+
+ }
+
+ public static StatisticsFormatter getDefaultFormatter() throws Exception{
+
+ Class clazz = Class.forName(DEFAULT_FORMATTER);
+ return (StatisticsFormatter)clazz.newInstance();
+
+ }
+}
More information about the jboss-cvs-commits
mailing list