geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jb...@apache.org
Subject svn commit: r580468 [3/4] - in /geronimo/sandbox/monitoring: ./ mrc-client/ mrc-client/src/ mrc-client/src/main/ mrc-client/src/main/java/ mrc-client/src/main/java/org/ mrc-client/src/main/java/org/apache/ mrc-client/src/main/java/org/apache/geronimo/ ...
Date Fri, 28 Sep 2007 19:34:28 GMT
Added: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml Fri Sep 28 12:34:24 2007
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<!-- $Rev$ $Date$ -->
+
+<application xmlns="http://geronimo.apache.org/xml/ns/j2ee/application-1.2">
+
+    <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
+        <moduleId>
+            <groupId>a</groupId>
+            <artifactId>a</artifactId>
+            <version>2.0-SNAPSHOT</version>
+            <type>ear</type>
+        </moduleId>
+    </environment>
+
+</application>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.classpath
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.classpath?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.classpath (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.classpath Fri Sep 28 12:34:24 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<classpath>
+	<classpathentry kind="src" path="src/main/java/org/apache/geronimo/monitor/controller"/>
+	<classpathentry kind="src" path="src/main/java/org/apache/geronimo/monitor/snapshot"/>
+	<classpathentry kind="src" path="src/main/java/org/apache/geronimo/monitor/helper"/>
+	<classpathentry excluding="helper/|controller/|snapshot/" kind="src" path="src/main/java/org/apache/geronimo/monitor"/>
+	<classpathentry excluding="org/apache/geronimo/monitor/|org/apache/geronimo/monitor/helper/|org/apache/geronimo/monitor/controller/|org/apache/geronimo/monitor/snapshot/" kind="src" path="src/main/java"/>
+	<classpathentry kind="lib" path="target/MRC-ejb-2.0-SNAPSHOT.jar"/>
+	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
+	<classpathentry kind="lib" path="C:/.m2/org/apache/geronimo/specs/geronimo-j2ee-management_1.1_spec/1.0/geronimo-j2ee-management_1.1_spec-1.0.jar"/>
+	<classpathentry kind="lib" path="C:/i/2.0/target/geronimo-tomcat6-jee5-2.0.2-SNAPSHOT/repository/org/apache/geronimo/modules/geronimo-management/2.0.2-SNAPSHOT/geronimo-management-2.0.2-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="C:/i/2.0/target/geronimo-tomcat6-jee5-2.0.2-SNAPSHOT/repository/org/apache/geronimo/modules/geronimo-j2ee/2.0.2-SNAPSHOT/geronimo-j2ee-2.0.2-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="C:/i/2.0/target/geronimo-tomcat6-jee5-2.0.2-SNAPSHOT/repository/org/apache/geronimo/modules/geronimo-system/2.0.2-SNAPSHOT/geronimo-system-2.0.2-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="C:/i/2.0/modules/geronimo-kernel/target/geronimo-kernel-2.0.2-SNAPSHOT.jar"/>
+	<classpathentry kind="lib" path="/2.0/modules/geronimo-j2ee/target/geronimo-j2ee-2.0.1-SNAPSHOT.jar"/>
+	<classpathentry kind="output" path="target/classes"/>
+</classpath>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.classpath
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.project
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.project?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.project (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.project Fri Sep 28 12:34:24 2007
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+	<name>MRC</name>
+	<comment></comment>
+	<projects>
+	</projects>
+	<buildSpec>
+		<buildCommand>
+			<name>org.eclipse.jdt.core.javabuilder</name>
+			<arguments>
+			</arguments>
+		</buildCommand>
+	</buildSpec>
+	<natures>
+		<nature>org.eclipse.jdt.core.javanature</nature>
+	</natures>
+</projectDescription>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/.project
------------------------------------------------------------------------------
    svn:executable = *

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt Fri Sep 28 12:34:24 2007
@@ -0,0 +1,203 @@
+
+                                 Apache License
+                           Version 2.0, January 2004
+                        http://www.apache.org/licenses/
+
+   TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
+
+   1. Definitions.
+
+      "License" shall mean the terms and conditions for use, reproduction,
+      and distribution as defined by Sections 1 through 9 of this document.
+
+      "Licensor" shall mean the copyright owner or entity authorized by
+      the copyright owner that is granting the License.
+
+      "Legal Entity" shall mean the union of the acting entity and all
+      other entities that control, are controlled by, or are under common
+      control with that entity. For the purposes of this definition,
+      "control" means (i) the power, direct or indirect, to cause the
+      direction or management of such entity, whether by contract or
+      otherwise, or (ii) ownership of fifty percent (50%) or more of the
+      outstanding shares, or (iii) beneficial ownership of such entity.
+
+      "You" (or "Your") shall mean an individual or Legal Entity
+      exercising permissions granted by this License.
+
+      "Source" form shall mean the preferred form for making modifications,
+      including but not limited to software source code, documentation
+      source, and configuration files.
+
+      "Object" form shall mean any form resulting from mechanical
+      transformation or translation of a Source form, including but
+      not limited to compiled object code, generated documentation,
+      and conversions to other media types.
+
+      "Work" shall mean the work of authorship, whether in Source or
+      Object form, made available under the License, as indicated by a
+      copyright notice that is included in or attached to the work
+      (an example is provided in the Appendix below).
+
+      "Derivative Works" shall mean any work, whether in Source or Object
+      form, that is based on (or derived from) the Work and for which the
+      editorial revisions, annotations, elaborations, or other modifications
+      represent, as a whole, an original work of authorship. For the purposes
+      of this License, Derivative Works shall not include works that remain
+      separable from, or merely link (or bind by name) to the interfaces of,
+      the Work and Derivative Works thereof.
+
+      "Contribution" shall mean any work of authorship, including
+      the original version of the Work and any modifications or additions
+      to that Work or Derivative Works thereof, that is intentionally
+      submitted to Licensor for inclusion in the Work by the copyright owner
+      or by an individual or Legal Entity authorized to submit on behalf of
+      the copyright owner. For the purposes of this definition, "submitted"
+      means any form of electronic, verbal, or written communication sent
+      to the Licensor or its representatives, including but not limited to
+      communication on electronic mailing lists, source code control systems,
+      and issue tracking systems that are managed by, or on behalf of, the
+      Licensor for the purpose of discussing and improving the Work, but
+      excluding communication that is conspicuously marked or otherwise
+      designated in writing by the copyright owner as "Not a Contribution."
+
+      "Contributor" shall mean Licensor and any individual or Legal Entity
+      on behalf of whom a Contribution has been received by Licensor and
+      subsequently incorporated within the Work.
+
+   2. Grant of Copyright License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      copyright license to reproduce, prepare Derivative Works of,
+      publicly display, publicly perform, sublicense, and distribute the
+      Work and such Derivative Works in Source or Object form.
+
+   3. Grant of Patent License. Subject to the terms and conditions of
+      this License, each Contributor hereby grants to You a perpetual,
+      worldwide, non-exclusive, no-charge, royalty-free, irrevocable
+      (except as stated in this section) patent license to make, have made,
+      use, offer to sell, sell, import, and otherwise transfer the Work,
+      where such license applies only to those patent claims licensable
+      by such Contributor that are necessarily infringed by their
+      Contribution(s) alone or by combination of their Contribution(s)
+      with the Work to which such Contribution(s) was submitted. If You
+      institute patent litigation against any entity (including a
+      cross-claim or counterclaim in a lawsuit) alleging that the Work
+      or a Contribution incorporated within the Work constitutes direct
+      or contributory patent infringement, then any patent licenses
+      granted to You under this License for that Work shall terminate
+      as of the date such litigation is filed.
+
+   4. Redistribution. You may reproduce and distribute copies of the
+      Work or Derivative Works thereof in any medium, with or without
+      modifications, and in Source or Object form, provided that You
+      meet the following conditions:
+
+      (a) You must give any other recipients of the Work or
+          Derivative Works a copy of this License; and
+
+      (b) You must cause any modified files to carry prominent notices
+          stating that You changed the files; and
+
+      (c) You must retain, in the Source form of any Derivative Works
+          that You distribute, all copyright, patent, trademark, and
+          attribution notices from the Source form of the Work,
+          excluding those notices that do not pertain to any part of
+          the Derivative Works; and
+
+      (d) If the Work includes a "NOTICE" text file as part of its
+          distribution, then any Derivative Works that You distribute must
+          include a readable copy of the attribution notices contained
+          within such NOTICE file, excluding those notices that do not
+          pertain to any part of the Derivative Works, in at least one
+          of the following places: within a NOTICE text file distributed
+          as part of the Derivative Works; within the Source form or
+          documentation, if provided along with the Derivative Works; or,
+          within a display generated by the Derivative Works, if and
+          wherever such third-party notices normally appear. The contents
+          of the NOTICE file are for informational purposes only and
+          do not modify the License. You may add Your own attribution
+          notices within Derivative Works that You distribute, alongside
+          or as an addendum to the NOTICE text from the Work, provided
+          that such additional attribution notices cannot be construed
+          as modifying the License.
+
+      You may add Your own copyright statement to Your modifications and
+      may provide additional or different license terms and conditions
+      for use, reproduction, or distribution of Your modifications, or
+      for any such Derivative Works as a whole, provided Your use,
+      reproduction, and distribution of the Work otherwise complies with
+      the conditions stated in this License.
+
+   5. Submission of Contributions. Unless You explicitly state otherwise,
+      any Contribution intentionally submitted for inclusion in the Work
+      by You to the Licensor shall be under the terms and conditions of
+      this License, without any additional terms or conditions.
+      Notwithstanding the above, nothing herein shall supersede or modify
+      the terms of any separate license agreement you may have executed
+      with Licensor regarding such Contributions.
+
+   6. Trademarks. This License does not grant permission to use the trade
+      names, trademarks, service marks, or product names of the Licensor,
+      except as required for reasonable and customary use in describing the
+      origin of the Work and reproducing the content of the NOTICE file.
+
+   7. Disclaimer of Warranty. Unless required by applicable law or
+      agreed to in writing, Licensor provides the Work (and each
+      Contributor provides its Contributions) on an "AS IS" BASIS,
+      WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
+      implied, including, without limitation, any warranties or conditions
+      of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
+      PARTICULAR PURPOSE. You are solely responsible for determining the
+      appropriateness of using or redistributing the Work and assume any
+      risks associated with Your exercise of permissions under this License.
+
+   8. Limitation of Liability. In no event and under no legal theory,
+      whether in tort (including negligence), contract, or otherwise,
+      unless required by applicable law (such as deliberate and grossly
+      negligent acts) or agreed to in writing, shall any Contributor be
+      liable to You for damages, including any direct, indirect, special,
+      incidental, or consequential damages of any character arising as a
+      result of this License or out of the use or inability to use the
+      Work (including but not limited to damages for loss of goodwill,
+      work stoppage, computer failure or malfunction, or any and all
+      other commercial damages or losses), even if such Contributor
+      has been advised of the possibility of such damages.
+
+   9. Accepting Warranty or Additional Liability. While redistributing
+      the Work or Derivative Works thereof, You may choose to offer,
+      and charge a fee for, acceptance of support, warranty, indemnity,
+      or other liability obligations and/or rights consistent with this
+      License. However, in accepting such obligations, You may act only
+      on Your own behalf and on Your sole responsibility, not on behalf
+      of any other Contributor, and only if You agree to indemnify,
+      defend, and hold each Contributor harmless for any liability
+      incurred by, or claims asserted against, such Contributor by reason
+      of your accepting any such warranty or additional liability.
+
+   END OF TERMS AND CONDITIONS
+
+   APPENDIX: How to apply the Apache License to your work.
+
+      To apply the Apache License to your work, attach the following
+      boilerplate notice, with the fields enclosed by brackets "[]"
+      replaced with your own identifying information. (Don't include
+      the brackets!)  The text should be enclosed in the appropriate
+      comment syntax for the file format. We also recommend that a
+      file or class name and description of purpose be included on the
+      same "printed page" as the copyright notice for easier
+      identification within third-party archives.
+
+   Copyright [yyyy] [name of copyright owner]
+
+   Licensed 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.
+

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/LICENSE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt Fri Sep 28 12:34:24 2007
@@ -0,0 +1,5 @@
+Apache Geronimo 
+Copyright 2003-2006 The Apache Software Foundation
+
+This product includes software developed by
+The Apache Software Foundation (http://www.apache.org/).

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/NOTICE.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml Fri Sep 28 12:34:24 2007
@@ -0,0 +1,59 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+    
+     http://www.apache.org/licenses/LICENSE-2.0
+    
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+-->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+    <modelVersion>4.0.0</modelVersion>
+
+    <parent>
+        <groupId>org.apache.geronimo.plugins.mrc</groupId>
+        <artifactId>mrc-server</artifactId>
+        <version>1.0-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    
+
+
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-j2ee</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>jar</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.modules</groupId>
+            <artifactId>geronimo-management</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>jar</type>
+        </dependency>
+    </dependencies>
+
+    <artifactId>mrc-server-ejb</artifactId>
+    <name>Geronimo Stats :: Server :: EJB</name>
+    <packaging>jar</packaging>
+
+    <description>Geronimo Stats. EJB Module</description>
+
+
+</project>
+

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt Fri Sep 28 12:34:24 2007
@@ -0,0 +1,12 @@
+HOW TO COMPILE AND DEPLOY
+    1. run `mvn clean install`
+    2. Deploy the JAR file present in the MRC-ejb/target folder along with 
+       MRC.xml present at the home directory into Geronimo.
+       2a. Navigate to <GERONIMO_HOME>/bin/ directory
+       2b. Give it this command
+
+          java -jar ./deployer.jar -u system -p manager deploy <path-to-jar> <path-to-xml>
+
+
+**The snapshot information for the server will reside under the folder
+    <GERONIMO_HOME>/var/

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/readme.txt
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java Fri Sep 28 12:34:24 2007
@@ -0,0 +1,64 @@
+/**
+ *  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.geronimo.monitor;
+
+import java.net.URI;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.Set;
+
+import javax.management.ObjectName;
+
+import org.apache.geronimo.kernel.Kernel;
+import org.apache.geronimo.kernel.KernelRegistry;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.AbstractNameQuery;
+
+public class MBeanHelper {
+    
+    private Kernel kernel;
+    
+    public MBeanHelper() {
+        kernel = KernelRegistry.getSingleKernel();
+    }
+    
+    /**
+     * Return all MBeans that provide stats
+     */
+    public Set<ObjectName> getStatsProvidersMBeans(Set<ObjectName> allMBeans) {
+        Set<ObjectName> result = new HashSet();
+
+        try {
+            for (Iterator it = allMBeans.iterator(); it.hasNext(); ) {
+                try {
+                    ObjectName objName = (ObjectName) it.next();
+                    Boolean statisticsProvider = (Boolean) kernel.getAttribute(objName, "statisticsProvider");
+                    if (Boolean.TRUE.equals(statisticsProvider)) {
+                        result.add(objName);
+                    }
+                } catch (Exception e) {
+                    // this will happen if there is not a matching attribute "statisticsProvider"
+                }
+            }
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+
+        return result;
+    }
+}

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java Fri Sep 28 12:34:24 2007
@@ -0,0 +1,383 @@
+/**
+ *  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.geronimo.monitor;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Set;
+
+import javax.management.Attribute;
+import javax.management.MBeanServer;
+import javax.management.MBeanServerFactory;
+import javax.management.ObjectName;
+import javax.management.j2ee.Management;
+import javax.management.j2ee.ManagementHome;
+import javax.management.j2ee.statistics.BoundedRangeStatistic;
+import javax.management.j2ee.statistics.RangeStatistic;
+import javax.management.j2ee.statistics.Stats;
+import javax.management.j2ee.statistics.CountStatistic;
+import javax.management.j2ee.statistics.Statistic;
+import javax.management.j2ee.statistics.TimeStatistic;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
+//import org.apache.commons.logging.Log;
+//import org.apache.commons.logging.LogFactory;
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.gbean.GBeanInfo;
+import org.apache.geronimo.gbean.GBeanInfoBuilder;
+import org.apache.geronimo.gbean.GBeanLifecycle;
+
+import org.apache.geronimo.monitor.MBeanHelper;
+
+import org.apache.geronimo.j2ee.mejb.MEJB;
+
+import org.apache.geronimo.management.geronimo.stats.WebModuleStats;
+import org.apache.geronimo.management.stats.WebModuleStatsImpl;
+import org.apache.geronimo.monitor.snapshot.SnapshotThread;
+import org.apache.geronimo.monitor.snapshot.SnapshotXMLBuilder;
+import org.apache.geronimo.monitor.snapshot.SnapshotConfigXMLBuilder;
+
+/**
+ * This is the GBean that will be the bottleneck for the communication
+ * between the management node and the data in the server node.
+ */
+public class MasterRemoteControl implements GBeanLifecycle {
+    // constants
+    private static final String GERONIMO_DEFAULT_DOMAIN = "geronimo";
+    private static final Long DEFAULT_DURATION = new Long(5000);
+
+    //private static final Log log = LogFactory.getLog(MasterRemoteControl.class);
+
+    // mbean server to talk to other components
+    private static MBeanServer mbServer = null;
+    
+    // mangement ejb - use this to do the monitoring
+    private static MEJB mejb = null;
+    
+    // threads
+    private static SnapshotThread snapshotThread = null;
+    
+    // use this to call utility functions pertaining to mbeans
+    private static MBeanHelper mbeanHelper;
+
+    public MasterRemoteControl() {
+        // retrieve the mbean server
+        ArrayList mbServerList = MBeanServerFactory.findMBeanServer(null);
+        if(mbServerList.size() >= 1) {
+            mbServer = (MBeanServer) mbServerList.get(0);
+            for(int i = 0; i < mbServerList.size(); i++) {
+                String domain = ((MBeanServer)mbServerList.get(i)).getDefaultDomain();
+                if(domain.equals(GERONIMO_DEFAULT_DOMAIN)) {
+                    mbServer = (MBeanServer)mbServerList.get(i);
+                    break;
+                }
+            }
+        }
+        // ensure that the mbServer has something in it
+        if(mbServer == null) {
+            mbServer = MBeanServerFactory.createMBeanServer(GERONIMO_DEFAULT_DOMAIN);
+        }
+        // instantiate the MEJB, which will be out gateway to communicate to MBeans
+        mejb = new MEJB(null, mbServer);
+        // instantiate teh mbean helper to query mbean names
+        mbeanHelper = new MBeanHelper();
+    }
+    
+    /**
+     * Looks up the JSR-77 statistics associated with this object name.
+     * 
+     * @param objectName
+     * @return HashMap
+     * @throws Exception
+     */
+    public static HashMap getStats(String objectName) throws Exception {
+        HashMap statsMap = new HashMap();
+        Stats stats = (Stats)mejb.getAttribute(new ObjectName(objectName), "stats");
+        String[] sttsName = stats.getStatisticNames();
+        Statistic[] stts = stats.getStatistics();
+        for(int i = 0; i < sttsName.length; i++) {
+            Statistic aStat = stats.getStatistic(sttsName[i]);
+            if(aStat instanceof RangeStatistic) {
+                Long current = new Long(((RangeStatistic)aStat).getCurrent());
+                Long high = new Long(((RangeStatistic)aStat).getHighWaterMark());
+                Long low = new Long(((RangeStatistic)aStat).getLowWaterMark());
+                statsMap.put(stts[i].getName() + " Current", current);
+                statsMap.put(stts[i].getName() + " Max", high);
+                statsMap.put(stts[i].getName() + " Min", low);
+            } else if(aStat instanceof CountStatistic) {
+                Long current = new Long(((CountStatistic)aStat).getCount());
+                statsMap.put(stts[i].getName(), current);
+            } else if(aStat instanceof TimeStatistic) {
+                Long current = new Long(((TimeStatistic)aStat).getCount());
+                Long max = new Long(((TimeStatistic)aStat).getMaxTime());
+                Long min = new Long(((TimeStatistic)aStat).getMinTime());
+                Long total = new Long(((TimeStatistic)aStat).getTotalTime());
+                statsMap.put(stts[i].getName() + " CurrentTime", current);
+                statsMap.put(stts[i].getName() + " MaxTime", max);
+                statsMap.put(stts[i].getName() + " MinTime", min);
+                statsMap.put(stts[i].getName() + " TotalTime", total);
+            } else {
+                // this should never happen
+                throw new Exception();
+            }
+        }
+        return statsMap;
+    }
+    
+    /**
+     * Changes the objectName's attrName's value to attrValue
+     * 
+     * @param objectName
+     * @param attrName
+     * @param attrValue
+     * @throws Exception
+     */
+    public void setAttribute(String objectName, String attrName, Object attrValue) throws Exception {
+        Attribute attr = new Attribute(attrName, attrValue);
+        mejb.setAttribute(new ObjectName(objectName), attr);
+    }
+    
+    /**
+     * Begins the snapshot process given the time interval between snapshots
+     *
+     * Precondition:
+     *          interval is given in milli seconds
+     * 
+     * @param interval
+     */
+    public void startSnapshot(Long interval) /*throws Exception*/ {
+        if((snapshotThread == null || (snapshotThread != null && !snapshotThread.isAlive())) &&
+                interval.longValue() > 0) {
+            snapshotThread = new SnapshotThread(interval.longValue(), mbServer);
+            snapshotThread.start();
+        } else {
+            //throw new Exception("There is already a snapshot thread running.");
+        }
+    }
+    
+    /**
+     * Stops the snapshot thread
+     */
+    public void stopSnapshot() {
+        if(snapshotThread != null) {
+            if(snapshotThread.getSnapshotDuration() == Long.MAX_VALUE) {
+                saveDuration(DEFAULT_DURATION);
+            } else {
+                saveDuration(snapshotThread.getSnapshotDuration());
+            }
+            snapshotThread.setSnapshotDuration(Long.MAX_VALUE);
+        } else {
+            System.out.println("There is not a snapshot thread running. Stopping aborted.");
+            //log.error("There is not a snapshot thread running. Stopping aborted.");
+        }
+    }
+    
+    /**
+     * Fetches the data stored from the snapshot thread and returns
+     * it in a ArrayList with each element being a HashMap of the attribute
+     * mapping to the statistic. All stats will be the average of 
+     *          1 - n, n+1 - 2n, ..., cn+1 - c(n+1)
+     *
+     * Grabs 'numberOfSnapshots' snapshots. Grabs one snapshot per
+     * 'everyNthsnapshot'
+     * 
+     * @param numberOfSnapshot
+     * @param everyNthSnapshot
+     * @return ArrayList
+     */ 
+    public ArrayList fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot) {
+        SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
+        snapshotXMLBuilder.openDocument();
+        ArrayList retval = snapshotXMLBuilder.fetchData(numberOfSnapshot, everyNthSnapshot);
+        snapshotXMLBuilder.saveDocument( snapshotXMLBuilder.getDocument() );
+        return retval;
+    }
+    
+    /**
+     * Fetches the max amount for each statistic stored from the snapshot thread
+     * and returns it in a HashMap
+     * 
+     * @param numberOfSnapshot
+     * @return HashMap
+     */
+    public HashMap fetchMaxSnapshotData(Integer numberOfSnapshot) {
+        SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
+        snapshotXMLBuilder.openDocument();
+        HashMap retval = snapshotXMLBuilder.fetchMaxSnapshotData(numberOfSnapshot);
+        snapshotXMLBuilder.saveDocument( snapshotXMLBuilder.getDocument() );
+        return retval;
+    }
+
+    /**
+     * Fetches the min amount for each statistic stored from the snapshot thread
+     * and returns it in a HashMap
+     * 
+     * @param numberOfSnapshot
+     * @return HashMap
+     */
+    public HashMap fetchMinSnapshotData(Integer numberOfSnapshot) {
+        SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
+        snapshotXMLBuilder.openDocument();
+        HashMap retval = snapshotXMLBuilder.fetchMinSnapshotData(numberOfSnapshot);
+        snapshotXMLBuilder.saveDocument( snapshotXMLBuilder.getDocument() );
+        return retval;
+    }
+    
+    /**
+     * Gets the elapsed time in milliseconds between each snapshot.
+     * 
+     * @return Long
+     */
+    public Long getSnapshotDuration() {
+        if(snapshotThread != null) {
+            return new Long(snapshotThread.getSnapshotDuration());
+        } else {
+            return null;
+        }
+    }
+    
+    /**
+     * Sets the elapsed time in milliseconds between each snapshot.
+     * 
+     * @param snapshotDuration
+     */
+    public void setSnapshotDuration(Long snapshotDuration) {
+        if(snapshotThread != null) {
+            snapshotThread.setSnapshotDuration(snapshotDuration.longValue());
+            saveDuration(snapshotThread.getSnapshotDuration());
+        } else {
+            System.out.println("There is not a snapshot thread instantiated.");
+        }
+    }
+    
+    public Long getSnapshotCount() {
+        return SnapshotXMLBuilder.getSnapshotCount();
+    }
+    
+    /**
+     * Fetches all mbean names that provide JSR-77 statistics
+     * 
+     * @return A set containing all mbean names of mbeans that provide
+     * statistics
+     */
+    public Set<ObjectName> getStatisticsProviderMBeanNames() {
+        return mbeanHelper.getStatsProvidersMBeans( getAllMBeanNames() );
+    }
+    
+    /**
+     * Fetches all mbean names
+     * 
+     * @return A set containing all mbean names
+     */
+    public Set<ObjectName> getAllMBeanNames() {
+        return (Set<ObjectName>)mejb.queryNames(null, null);
+    }
+    
+    public void doFail() {
+        //log.warn("Failed");
+        stopSnapshot();
+    }
+
+    /**
+     * Executes when the GBean starts up. Also starts the snapshot thread.
+     */
+    public void doStart() {
+        //log.debug("Started");
+        startSnapshot( fetchSnapshotDuration() );
+    }
+    
+    /**
+     * Executes when the GBean stops. Also stops the snapshot thread.
+     */
+    public void doStop() {
+        //log.debug("Stopped");
+        stopSnapshot();
+    }
+    
+    private void saveDuration(long duration) {
+        SnapshotConfigXMLBuilder.save(duration);
+    }
+    
+    private Long fetchSnapshotDuration() {
+        final String DURATION = "duration";
+        try {
+            String returnedDuration = SnapshotConfigXMLBuilder.getAttributeValue( DURATION );
+            return Long.parseLong( returnedDuration );
+        } catch(Exception e) {
+            return DEFAULT_DURATION; // the default
+        }
+    }
+    
+    /**
+     * Adds a record of the mbean via its name to take snapshots of. As a result
+     * the mbeanName will be written to snapshot-config.xml
+     * 
+     * @param mbeanName
+     */
+    public void addMBeanForSnapshot(String mbeanName) {
+        SnapshotConfigXMLBuilder.addMBeanName(mbeanName);
+        snapshotThread.addMBeanForSnapshot(mbeanName);
+    }
+
+    /**
+     * Removes a record of the mbean via its name to take snapshots of. As a result
+     * the mbeanName will be removed from snapshot-config.xml
+     * 
+     * @param mbeanName
+     */
+    public void removeMBeanForSnapshot(String mbeanName) {
+        SnapshotConfigXMLBuilder.removeMBeanName(mbeanName);
+        snapshotThread.removeMBeanForSnapshot(mbeanName);
+    }
+    
+    /**
+     * @return A map: mbeanName --> ArrayList of statistic attributes for that mbean
+     */
+    public HashMap<String, ArrayList<String>> getAllSnapshotStatAttributes() {
+        return SnapshotXMLBuilder.getAllSnapshotStatAttributes();
+    }
+
+    public static final GBeanInfo GBEAN_INFO;
+
+    static {
+        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("MasterRemoteControl", MasterRemoteControl.class);
+        infoFactory.addOperation("getStats", new Class[] {String.class}, "HashMap");
+        infoFactory.addOperation("setAttribute", new Class[] {String.class, String.class, Object.class}, "void");
+        infoFactory.addOperation("startSnapshot", new Class[] {Long.class}, "void");
+        infoFactory.addOperation("stopSnapshot", new Class[] {}, "void");
+        infoFactory.addOperation("fetchSnapshotData", new Class[] {Integer.class, Integer.class}, "ArrayList");
+        infoFactory.addOperation("fetchMaxSnapshotData", new Class[] {Integer.class}, "HashMap");
+        infoFactory.addOperation("fetchMinSnapshotData", new Class[] {Integer.class}, "HashMap");
+        infoFactory.addOperation("getSnapshotDuration", new Class[] {}, "Long");
+        infoFactory.addOperation("getSnapshotCount", new Class[] {}, "Long");
+        infoFactory.addOperation("setSnapshotDuration", new Class[] {Long.class}, "void");
+        infoFactory.addOperation("getStatisticsProviderMBeanNames", new Class[] {}, "Set");
+        infoFactory.addOperation("getAllMBeanNames", new Class[] {}, "Set");
+        infoFactory.addOperation("getAllSnapshotStatAttributes", new Class[] {}, "HashMap");
+        infoFactory.addOperation("addMBeanForSnapshot", new Class[] {String.class}, "void");
+        infoFactory.addOperation("removeMBeanForSnapshot", new Class[] {String.class}, "void");
+        infoFactory.setConstructor(new String[] {});
+        GBEAN_INFO = infoFactory.getBeanInfo();
+    }
+
+    public static GBeanInfo getGBeanInfo() {
+        return GBEAN_INFO;
+    }
+}

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java Fri Sep 28 12:34:24 2007
@@ -0,0 +1,579 @@
+/**
+ *  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.geronimo.monitor;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.HashMap;
+import java.util.Hashtable;
+import java.util.Set;
+
+import javax.management.MBeanServerConnection;
+import javax.management.ObjectName;
+import javax.management.j2ee.statistics.CountStatistic;
+import javax.management.j2ee.statistics.Statistic;
+import javax.management.j2ee.statistics.Stats;
+import javax.management.j2ee.statistics.TimeStatistic;
+import javax.management.remote.JMXServiceURL;
+import javax.management.remote.JMXConnector;
+import javax.management.remote.JMXConnectorFactory;
+
+import org.apache.geronimo.gbean.AbstractName;
+import org.apache.geronimo.management.stats.StatisticImpl;
+
+public class SMP {
+    private static final String PATH = "geronimo:ServiceModule=org.apache.geronimo.monitor/MRC/1.0/car,J2EEServer=geronimo,name=MasterRemoteControl,j2eeType=GBean";
+    
+    public static void main(String[] args) {
+        try {
+            JMXServiceURL serviceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector");
+            Hashtable env = new Hashtable();
+            String[] credentials = new String[2];
+            credentials[0] = "system";
+            credentials[1] = "manager";
+            env.put(JMXConnector.CREDENTIALS, credentials);
+            JMXConnector connector = JMXConnectorFactory.connect( serviceURL, env );
+            MBeanServerConnection mbServerConn = connector.getMBeanServerConnection();
+            //int mbCount = mbServerConn.getMBeanCount().intValue();
+            //System.out.println("MBeanCount: " + mbCount);
+            //printDomains(mbServerConn);
+            //System.out.println();
+            //printMBeans(mbServerConn);
+//            testTomcatControl(mbServerConn);
+//            testCacheController(mbServerConn);
+//            printMaxSpareThread(mbServerConn);
+//            updateMaxSpareThread(mbServerConn);
+//            printMaxSpareThread(mbServerConn);
+//            testThreadPoolControl(mbServerConn);
+            /*
+            try {
+                testSnapshotThread(mbServerConn, 5000);
+            } catch(Exception e) { 
+                System.out.println(e.getMessage());
+            }
+            */
+//            testSnapshotThread(mbServerConn, 5000);
+//            testSnapshotThreadStop(mbServerConn);
+//            testFetchingSnapshot(mbServerConn, new Integer(10), new Integer(3));
+//            testFetchingMaxSnapshot(mbServerConn, new Integer(1000));
+//            testFetchingMinSnapshot(mbServerConn, new Integer(1000));
+//            testFetchingSnapshotCount(mbServerConn);
+//            testTomcatWebConnectorStats(mbServerConn);
+//            testJVMStats(mbServerConn);
+//            testGetStats(mbServerConn);
+//            testAddMBeanToSnapshot(mbServerConn);
+//            testGetMBeans(mbServerConn);
+//            testSetSnapshotDuration(mbServerConn, new Long(60000));
+            testRemoveMBeanToSnapshot(mbServerConn);
+            testGetStatsAttr(mbServerConn);
+            
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testRemoveMBeanToSnapshot(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        Set<ObjectName> mbeans = getStatsMBeans(mbServerConn);
+        try {
+            Iterator<ObjectName> it = mbeans.iterator();
+            String mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            System.out.println(mbeanName);
+            mbServerConn.invoke(
+                    objName,
+                    "removeMBeanForSnapshot",
+                    new Object[] { mbeanName },
+                    new String[] { "java.lang.String" });
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+        
+
+    private static void testAddMBeanToSnapshot(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        Set<ObjectName> mbeans = getStatsMBeans(mbServerConn);
+        try {
+            Iterator<ObjectName> it = mbeans.iterator();
+            String mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            mbeanName = it.next().getCanonicalName();
+            System.out.println(mbeanName);
+            mbServerConn.invoke(
+                    objName,
+                    "addMBeanForSnapshot",
+                    new Object[] { mbeanName },
+                    new String[] { "java.lang.String" });
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testGetStatsAttr(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap<String, ArrayList<String>> map = (HashMap<String, ArrayList<String>>)mbServerConn.invoke(
+                    objName,
+                    "getAllSnapshotStatAttributes",
+                    new Object[] { },
+                    new String[] { });
+            System.out.println("* * * Stats Attribute * * *");
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String mbeanName = (String)it.next();
+                System.out.println(mbeanName);
+                ArrayList<String> list = map.get(mbeanName);
+                for(int i = 0; i < list.size(); i++) {
+                    System.out.println("\t" + list.get(i));
+                }
+                System.out.println();
+            }
+        } catch(Exception e) {
+            e.printStackTrace();
+        }        
+    }
+    
+    private static void testGetStats(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        Set<ObjectName> mbeanNames = getStatsMBeans(mbServerConn);
+        for(Iterator it = mbeanNames.iterator(); it.hasNext(); ) {
+            //String mbeanName = "geronimo:ServiceModule=org.apache.geronimo.configs/jetty6/2.0.1/car,J2EEServer=geronimo,name=JettyWebContainer,j2eeType=GBean";
+            String mbeanName = ((ObjectName)it.next()).getCanonicalName();
+            try {
+                HashMap map = (HashMap)mbServerConn.invoke(
+                        objName,
+                        "getStats",
+                        new Object[] { mbeanName },
+                        new String[] { "java.lang.String" });
+                System.out.println(mbeanName);
+                printStats(map);
+                System.out.println();
+            } catch(Exception e) {
+                e.printStackTrace();
+            }
+        }
+    }
+    
+    private static void testSetSnapshotDuration(MBeanServerConnection mbServerConn, Long duration) throws Exception {
+        System.out.println("* * * testSetSnapshotDuration() * * *");
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            mbServerConn.invoke(
+                    objName,
+                    "setSnapshotDuration", 
+                    new Object[] { duration },
+                    new String[] { "java.lang.Long" });
+        } catch(Exception e ) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testGetMBeans(MBeanServerConnection mbServerConn) throws Exception {
+        System.out.println("* * * testGetMBeans() * * *");
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            Set<ObjectName> set = (Set<ObjectName>)mbServerConn.invoke(
+                    objName,
+                    "getAllMBeanNames", 
+                    new Object[] {},
+                    new String[] {});
+            System.out.println("Size: " + set.size());
+            for(Iterator it = set.iterator(); it.hasNext(); ) {
+                ObjectName oName = (ObjectName)it.next();
+                System.out.println(oName.getCanonicalName());
+            }
+        } catch(Exception  e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static Set<ObjectName> getStatsMBeans(MBeanServerConnection mbServerConn) throws Exception {
+        System.out.println("* * * testGetStatsMBeans() * * *");
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            Set<ObjectName> set = (Set<ObjectName>)mbServerConn.invoke(
+                    objName,
+                    "getStatisticsProviderMBeanNames", 
+                    new Object[] {},
+                    new String[] {});
+            return set;
+        } catch(Exception  e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+    
+    private static void testJVMStats(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap stats = (HashMap)mbServerConn.invoke( 
+                    objName, 
+                    "getStats",
+                    new Object[] {"geronimo:J2EEServer=geronimo,name=JVM,j2eeType=JVM"},
+                    new String[] {"java.lang.String"});
+            printStats(stats);
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void printStats(HashMap stats) {
+        // print stats in lexicographic order
+        if (stats != null){
+            ArrayList<String> keys = new ArrayList<String>();
+            for(Iterator it = stats.keySet().iterator(); it.hasNext(); ) {
+                keys.add((String)it.next());
+            }
+            // sort the keys
+            Collections.sort(keys);
+            // print the stats
+            for(int i = 0; i < (int)keys.size(); i++) {
+                String key = (String)keys.get(i);
+                Long value = (Long)stats.get(key);
+                System.out.println(key + " : " + value);
+            }
+        }
+    }
+    
+    private static void testTomcatWebConnectorStats(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap stats = (HashMap)mbServerConn.invoke( objName, 
+                    "getStats", 
+                    new Object[] {"geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.2-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String"});
+            printStats(stats);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testFetchingSnapshotCount(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            Long count = (Long)mbServerConn.invoke(
+                        objName, 
+                        "getSnapshotCount", 
+                        new Object[] {  },
+                        new String[] {  });
+            System.out.println("Snapshot Count: " + count);
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void testFetchingMinSnapshot(MBeanServerConnection mbServerConn,
+            Integer numberOfSnapshot) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = (HashMap)mbServerConn.invoke(
+                        objName, 
+                        "fetchMinSnapshotData", 
+                        new Object[] { numberOfSnapshot }, 
+                        new String[] { "java.lang.Integer" });
+            System.out.println("===MIN SNAPSHOT===");
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String mbeanName = (String)it.next();
+                System.out.println(mbeanName);
+                HashMap stats = (HashMap)map.get(mbeanName);
+                for(Iterator itt = stats.keySet().iterator(); itt.hasNext(); ) {
+                    String key = (String)itt.next();
+                    Object value = stats.get(key);
+                    System.out.println("'" + key + "':'" + value + "'");
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testFetchingMaxSnapshot(MBeanServerConnection mbServerConn,
+                                                Integer numberOfSnapshot) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = (HashMap)mbServerConn.invoke(
+                        objName, 
+                        "fetchMaxSnapshotData", 
+                        new Object[] { numberOfSnapshot }, 
+                        new String[] { "java.lang.Integer" });
+            System.out.println("===MAX SNAPSHOT===");
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String mbeanName = (String)it.next();
+                System.out.println(mbeanName);
+                HashMap stats = (HashMap)map.get(mbeanName);
+                for(Iterator itt = stats.keySet().iterator(); itt.hasNext(); ) {
+                    String key = (String)itt.next();
+                    Object value = stats.get(key);
+                    System.out.println("'" + key + "':'" + value + "'");
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testFetchingSnapshot(MBeanServerConnection mbServerConn,
+                                             Integer numberOfSnapshot, 
+                                             Integer everyNthSnapshot) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            ArrayList<HashMap<String, HashMap>> list = (ArrayList<HashMap<String, HashMap>>)mbServerConn.invoke(
+                        objName, 
+                        "fetchSnapshotData", 
+                        new Object[] { numberOfSnapshot, everyNthSnapshot }, 
+                        new String[] { "java.lang.Integer", "java.lang.Integer" });
+            System.out.println("===SNAPSHOT===");
+            for(int i = 0; i < list.size(); i++) {
+                HashMap map = list.get(i);
+                for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                    String mbeanName = (String)it.next();
+                    System.out.println(mbeanName);
+                    HashMap stats = (HashMap)map.get(mbeanName);
+                    for(Iterator itt = stats.keySet().iterator(); itt.hasNext(); ) {
+                        String key = (String)itt.next();
+                        Object value = stats.get(key);
+                        System.out.println("'" + key + "':'" + value + "'");
+                    }
+                    
+                }
+                System.out.println();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testTomcatControl(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = new HashMap();
+            HashMap maxSpareThreadsMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxSpareThreads", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap minSpareThreadsMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMinSpareThreads", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap maxHttpHeaderSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxHttpHeaderSize", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap maxKeepAliveRequestsMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxKeepAliveRequests", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap maxPostSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxPostSize", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap maxSavePostSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxSavePostSize", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap maxThreadsMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchMaxThreads", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap portMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchPort", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap redirectPortMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchRedirectPort", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap acceptCountMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchAcceptCount", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap addressMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchAddress", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap bufferSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchBufferSize", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap connectionTimeoutMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchConnectionTimeout", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap geronimoProtocolMap = (HashMap)mbServerConn.invoke( objName, 
+                    "invoke", 
+                    new Object[] {"TomcatWebConnectorController", "fetchGeronimoProtocol", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                    new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            map.putAll(maxSpareThreadsMap);
+            map.putAll(minSpareThreadsMap);
+            map.putAll(maxHttpHeaderSizeMap);
+            map.putAll(maxKeepAliveRequestsMap);
+            map.putAll(maxPostSizeMap);
+            map.putAll(maxSavePostSizeMap);
+            map.putAll(maxThreadsMap);
+            map.putAll(portMap);
+            map.putAll(redirectPortMap);
+            map.putAll(acceptCountMap);
+            map.putAll(addressMap);
+            map.putAll(bufferSizeMap);
+            map.putAll(connectionTimeoutMap);
+            map.putAll(geronimoProtocolMap);
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String key = (String)it.next();
+                System.out.println(key + ": " + map.get(key));
+            }           
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testSnapshotThreadStop(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = new HashMap();
+            mbServerConn.invoke( objName, "stopSnapshot",  new Object[] {},
+                                                            new String[] {} );
+        } catch(Exception e ) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testSnapshotThread(MBeanServerConnection mbServerConn, long time) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = new HashMap();
+            mbServerConn.invoke( objName, "startSnapshot",  new Object[] { new Long(time) },
+                                                            new String[] {"java.lang.Long"} );
+        } catch(Exception e ) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testCacheController(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = new HashMap();
+            HashMap accessCountMap = (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"CacheController", "fetchAccessCount", "Geronimo:type=Cache,host=0.0.0.0,path=/console"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap hitCountMap = (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"CacheController", "fetchHitCount", "Geronimo:type=Cache,host=0.0.0.0,path=/console"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap cacheMaxSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"CacheController", "fetchCacheMaxSize", "Geronimo:type=Cache,host=0.0.0.0,path=/console"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap cacheSizeMap = (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"CacheController", "fetchCacheSize", "Geronimo:type=Cache,host=0.0.0.0,path=/console"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            map.putAll(accessCountMap);
+            map.putAll(hitCountMap);
+            map.putAll(cacheMaxSizeMap);
+            map.putAll(cacheSizeMap);
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String key = (String)it.next();
+                System.out.println(key + ": " + map.get(key));
+            }
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void testThreadPoolControl(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = new HashMap();
+            HashMap maxThreadMap= (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"ThreadPoolController", "fetchMaxThreads", "Geronimo:type=ThreadPool,name=http-8080"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap currentThreadsBusyMap= (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"ThreadPoolController", "fetchCurrentThreadsBusy", "Geronimo:type=ThreadPool,name=http-8080"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            HashMap currentThreadCountMap= (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"ThreadPoolController", "fetchCurrentThreadCount", "Geronimo:type=ThreadPool,name=http-8080"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            map.putAll(maxThreadMap);
+            map.putAll(currentThreadsBusyMap);
+            map.putAll(currentThreadCountMap);
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String key = (String)it.next();
+                System.out.println(key + ": " + map.get(key));
+            }
+        } catch( Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void printMaxSpareThread(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName(PATH);
+        try {
+            HashMap map = (HashMap)mbServerConn.invoke( objName, 
+                                                        "invoke", 
+                                                        new Object[] {"TomcatWebConnectorController", "fetchMaxSpareThreads", "geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.1-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean"},
+                                                        new String[] {"java.lang.String", "java.lang.String", "java.lang.String"});
+            for(Iterator it = map.keySet().iterator(); it.hasNext(); ) {
+                String key = (String)it.next();
+                System.out.println(key + ": " + map.get(key));
+            }
+        } catch( Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private static void updateMaxSpareThread(MBeanServerConnection mbServerConn) throws Exception {
+         ObjectName objName = new ObjectName(PATH);
+        try {
+            mbServerConn.invoke( objName, 
+                                 "setAttribute", 
+                                 new Object[] {"geronimo:ServiceModule=org.apache.geronimo.configs/tomcat6/2.0.2-SNAPSHOT/car,J2EEServer=geronimo,name=TomcatWebConnector,j2eeType=GBean", "maxSpareThreads", new Integer(99)},
+                                 new String[] {"java.lang.String", "java.lang.String", "java.lang.Object"});
+        } catch( Exception e) {
+            e.printStackTrace();
+        }
+    }
+    
+    private static void printMBeans(MBeanServerConnection mbServerConn) throws Exception {
+        ObjectName objName = new ObjectName("geronimo:role=Kernel");
+        System.out.println("Getting ready to shutdown server.");
+        mbServerConn.invoke(objName, "shutdown", null, null);
+        System.out.println("Server is shutdown.");
+    }
+
+    private static void printDomains(MBeanServerConnection mbServerConn) throws Exception {
+        String domains[] = mbServerConn.getDomains();
+        for(int i = 0 ; i < domains.length; i++) {
+            System.out.println("Domain: " + domains[i]);
+        }
+    }
+
+    private static void printNames(MBeanServerConnection mbServerConn) throws Exception {
+        Set mbNames = mbServerConn.queryMBeans(null, null);
+        System.out.println("ObjectNameCount = " + mbNames.size());
+        for(Iterator it = mbNames.iterator(); it.hasNext(); ) {
+            System.out.println("ObjectName = " + it.next());
+        }
+    }
+}

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
------------------------------------------------------------------------------
    svn:executable = *

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java?rev=580468&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotConfigXMLBuilder.java Fri Sep 28 12:34:24 2007
@@ -0,0 +1,259 @@
+/**
+ *  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.geronimo.monitor.snapshot;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.util.ArrayList;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import org.w3c.dom.Document;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+import com.sun.org.apache.xml.internal.serialize.OutputFormat;
+import com.sun.org.apache.xml.internal.serialize.XMLSerializer;
+
+/**
+ * In charge of dealing with the XML processing of the snapshot's data.
+ */
+public class SnapshotConfigXMLBuilder {
+    private static final String pathToXML = 
+        System.getProperty("org.apache.geronimo.home.dir") + "/var/snapshot-config.xml";
+    
+    private static final String SNAPSHOT_CONFIG = "snapshot-config";
+    private static final String DURATION = "duration";
+    private static final String MBEAN = "mbean"; 
+    
+    /**
+     * @return A list of all mbean names that have been previously saved.
+     * These mbean names are those to keep track of for per snapshot.
+     */
+    public static ArrayList<String> getMBeanNames() {
+        ArrayList<String> mbeanList = new ArrayList<String>();
+        // get an instance of the document
+        Document doc = openDocument();
+        // get the root element node
+        Element rootElement = doc.getDocumentElement();
+        // get all children in the root node (i.e. all config properties)
+        NodeList configNodes = rootElement.getChildNodes();
+        // find the duration node and save it
+        for(int i = 0; i < configNodes.getLength(); i++) {
+            if(MBEAN.equals(configNodes.item(i).getNodeName())) {
+                mbeanList.add( configNodes.item(i).getTextContent() );
+            }
+        }
+        return mbeanList;
+    }
+    
+    /**
+     * Adds to the snapshot-config.xml another configuration element <mbean>
+     * in order to persistently keep track of all user requested statistics.
+     * If there is a duplicate, nothing will be done.
+     */
+    public static void removeMBeanName(String mbeanName) {
+        ArrayList<String> mbeanList = getMBeanNames();
+        // operate on the snapshot-config.xml if there exists the mbean name
+        if(mbeanList.contains(mbeanName)) {
+            // get an instance of the document
+            Document doc = openDocument();
+            // get the root element node
+            Element rootElement = doc.getDocumentElement();
+            // find the Node that represents the mbeanName
+            NodeList list = rootElement.getChildNodes();
+            for(int i = 0; i < list.getLength(); i++) {
+                // check the Node's text context for a match with mbeanName
+                if(list.item(i).getTextContent().equals(mbeanName)) {
+                    // remove the node from rootElement
+                    Node toRemoveNode = list.item(i);
+                    rootElement.removeChild(toRemoveNode);
+                    break;
+                }
+            }
+            // save the document
+            saveDocument(doc, pathToXML);
+        }
+    }
+
+    /**
+     * Removes from the snapshot-config.xml a configuration element <mbean>
+     * in order to persistently keep track of all user requested statistics.
+     * If there does not exist an instance of the mbeanNAme, nothing will be done.
+     */
+    public static void addMBeanName(String mbeanName) {
+        ArrayList<String> mbeanList = getMBeanNames();
+        if(mbeanList.contains(mbeanName)) {
+            return;
+        } else {
+            // get an instance of the document
+            Document doc = openDocument();
+            // get the root element node
+            Element rootElement = doc.getDocumentElement();
+            // create <mbean> element
+            Element mbeanElement = doc.createElement(MBEAN);
+            mbeanElement.setTextContent(mbeanName);
+            // add <mbean> element to the rootElement
+            rootElement.appendChild(mbeanElement);
+            // save the document
+            saveDocument(doc, pathToXML);
+        }
+    }
+    
+    /**
+     * Saves the duration of the snapshot as a configuration attribute
+     * @param duration
+     */
+    public static void save(long duration) {
+        Document doc = openDocument();
+        // get the root node        
+        Element rootElement = doc.getDocumentElement();
+        // get all children in the root node (i.e. all config properties)
+        NodeList configNodes = rootElement.getChildNodes();
+        // find the duration node and save it
+        boolean foundDurationNode = false;
+        for(int i = 0; i < configNodes.getLength() && !foundDurationNode; i++) {
+            Node configNode = configNodes.item(i);
+            if(DURATION.equals(configNode.getNodeName())) {
+                // found a match
+                configNode.setTextContent(duration + "");
+                foundDurationNode = true;
+            }
+        }
+        // if there was not a duration node, make one
+        if(!foundDurationNode) {
+            Element durationElement = doc.createElement(DURATION);
+            durationElement.setTextContent(duration + "");
+            rootElement.appendChild(durationElement);
+        }
+        try {
+            Thread.sleep(10000);
+        } catch(Exception e) {
+            
+        }
+        // save the document to file
+        saveDocument(doc, pathToXML);
+    }
+    
+    /**
+     * Returns the value of the configuration attribute, defined by the key
+     * @param key
+     * @return
+     * @throws Exception
+     */
+    public static String getAttributeValue(String key) throws Exception {
+        Document doc = openDocument();
+        // get the root element node
+        Element rootElement = doc.getDocumentElement();
+        // get all children in the root node (i.e. all config properties)
+        NodeList configNodes = rootElement.getChildNodes();
+        // find the duration node and save it
+        for(int i = 0; i < configNodes.getLength(); i++) {
+            if(key.equals(configNodes.item(i).getNodeName())) {
+                return configNodes.item(i).getTextContent();
+            }
+        }
+        throw new Exception("[WARNING] " + key + " is no found in " + SNAPSHOT_CONFIG);
+    }
+    
+    /**
+     * Ensures that there is an existing XML file. Creates one if there
+     * does not exist one already. 
+     */
+    public static void checkXMLExists() {
+        File docFile = new File(pathToXML);
+        // create an XML document if it does not exist
+        if(!docFile.exists()) {
+            Document doc = setUpDocument( createDocument() );
+            saveDocument(doc, pathToXML);
+        }
+    }
+    
+    /**
+     * Prepares the root element for a document.
+     */
+    public static Document setUpDocument(Document document) {
+        // add <snapshot-config> tag as the root
+        Element rootElement = document.createElement("snapshot-config");
+        document.appendChild(rootElement);
+        return document;
+    }
+    
+    /**
+     * Creates an instance of a Document and returns it
+     */
+    public static Document createDocument() {
+        // get an instance of factory
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        try {
+            // get an instance of builder
+            DocumentBuilder db = dbf.newDocumentBuilder();
+            // create an instance of DOM
+            return db.newDocument();
+        } catch(ParserConfigurationException pce) {
+            System.out.println("Error while trying to instantiate DocumentBuilder " + pce);
+        }
+        return null;
+    }
+    
+    /**
+     * Write the document object to the file location specified by
+     * the path.
+     */
+    public static void saveDocument(Document document, String path) {
+        try {
+            // formatting the doc
+            OutputFormat format = new OutputFormat(document);
+            format.setIndenting(true);
+            // generate a file output
+            XMLSerializer serializer = new XMLSerializer(new FileOutputStream(new File(path)), format);
+            serializer.serialize(document);
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    /**
+     * Parses the XML document specified by the private member 'pathToXML'
+     * and stores the information in the a Document object
+     */
+    public static Document openDocument() {
+        // ensure that the XML file is there
+        checkXMLExists();
+        // get the factory
+        DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance();
+        // continue to attempt to parse
+        while(true) {
+            try {
+                // Using factory get an instance of document builder
+                DocumentBuilder db = dbf.newDocumentBuilder();
+                // parse using builder to get DOM representation of the XML file
+                Document doc = db.parse(pathToXML);
+                return doc;
+            } catch(Exception e) {
+                // Either this file is being read/written to by snapshot thread
+                // or there is an UNKNOWN error
+                System.out.println(e.getMessage());
+            }
+        }
+    }
+}



Mime
View raw message