geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r590502 [1/2] - in /geronimo/sandbox/monitoring/mrc-server: ./ mrc-car/ mrc-car/src/ mrc-car/src/main/ mrc-car/src/main/plan/ mrc-ds-car/ mrc-ds-car/src/ mrc-ds-car/src/main/ mrc-ds-car/src/main/plan/ mrc-ear/ mrc-ear/src/main/resources/MET...
Date Tue, 30 Oct 2007 22:59:26 GMT
Author: akulshreshtha
Date: Tue Oct 30 15:59:24 2007
New Revision: 590502

URL: http://svn.apache.org/viewvc?rev=590502&view=rev
Log:
GERONIMO-3561 Monitoring Plugin : Patch by Viet H. Nguyen

Added:
    geronimo/sandbox/monitoring/mrc-server/mrc-car/
    geronimo/sandbox/monitoring/mrc-server/mrc-car/LICENSE.txt   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-car/NOTICE.txt   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-car/src/
    geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/
    geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/
    geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/LICENSE.txt   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/NOTICE.txt   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml   (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/
    geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml   (with props)
Modified:
    geronimo/sandbox/monitoring/mrc-server/mrc-ear/pom.xml
    geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotDBHelper.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
    geronimo/sandbox/monitoring/mrc-server/pom.xml

Added: geronimo/sandbox/monitoring/mrc-server/mrc-car/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-car/LICENSE.txt?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-car/LICENSE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-car/LICENSE.txt Tue Oct 30 15:59: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-car/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-car/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-car/NOTICE.txt?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-car/NOTICE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-car/NOTICE.txt Tue Oct 30 15:59: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-car/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml Tue Oct 30 15:59:24 2007
@@ -0,0 +1,136 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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$ -->
+
+<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>2.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+-->
+    <parent>
+        <groupId>org.apache.geronimo.configs</groupId>
+        <artifactId>configs</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>mrc-server-car</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>Geronimo Plugins :: Monitoring CAR</name>
+    <packaging>car</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>mrc-server-ds-car</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.plugins.mrc</groupId>
+            <artifactId>mrc-server-ear</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>ear</type>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>openejb</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>transaction</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>j2ee-server</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>j2ee-security</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>mejb</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${pom.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+
+                <groupId>org.apache.geronimo.plugins</groupId>
+                <artifactId>car-maven-plugin</artifactId>
+                <configuration>
+                    <deploymentConfigs>
+                        <deploymentConfig>${gbeanDeployer}</deploymentConfig>
+                        <deploymentConfig>${j2eeDeployer}</deploymentConfig>
+                        <deploymentConfig>${openejbDeployer}</deploymentConfig>
+                    </deploymentConfigs>
+                    <module>
+                        <groupId>org.apache.geronimo.plugins.mrc</groupId>
+                        <artifactId>mrc-server-ear</artifactId>
+                        <version>1.0-SNAPSHOT</version>
+                        <type>ear</type>
+                    </module>
+                    <category>Administration</category>
+                    <osiApproved>true</osiApproved>
+                    <useMavenDependencies>
+                        <value>true</value>
+                        <includeVersion>true</includeVersion>
+                    </useMavenDependencies>
+                    <commonInstance>
+                        <plugin-artifact>
+                            <source-repository>~/.m2/repository/</source-repository>
+                            <source-repository>http://repo1.maven.org/maven2/</source-repository>
+                            <source-repository>http://people.apache.org/repo/m2-snapshot-repository/</source-repository>
+                            <source-repository>http://people.apache.org/repo/m2-incubating-repository/</source-repository>
+                            <source-repository>file:///C:/.m2/</source-repository>
+                            </plugin-artifact>
+                        </commonInstance>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-car/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml Tue Oct 30 15:59:24 2007
@@ -0,0 +1,22 @@
+<?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">
+</application>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/LICENSE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/LICENSE.txt?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/LICENSE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/LICENSE.txt Tue Oct 30 15:59: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-ds-car/LICENSE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/NOTICE.txt
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/NOTICE.txt?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/NOTICE.txt (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/NOTICE.txt Tue Oct 30 15:59: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-ds-car/NOTICE.txt
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml Tue Oct 30 15:59:24 2007
@@ -0,0 +1,94 @@
+<?xml version="1.0" encoding="ISO-8859-1"?>
+<!--
+ 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$ -->
+
+<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>
+-->
+    <parent>
+        <groupId>org.apache.geronimo.configs</groupId>
+        <artifactId>configs</artifactId>
+        <version>2.1-SNAPSHOT</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+
+    <artifactId>mrc-server-ds-car</artifactId>
+    <version>1.0-SNAPSHOT</version>
+    <name>Geronimo Plugins :: Monitoring CAR</name>
+    <packaging>car</packaging>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>system-database</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.tranql</groupId>
+            <artifactId>tranql-connector-derby-embed-local</artifactId>
+            <version>1.3</version>
+            <type>rar</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>connector-deployer</artifactId>
+            <version>2.1-SNAPSHOT</version>
+            <type>car</type>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <resources>
+            <resource>
+                <directory>${pom.basedir}/src/main/resources</directory>
+                <filtering>true</filtering>
+            </resource>
+        </resources>
+
+        <plugins>
+            <plugin>
+
+                <groupId>org.apache.geronimo.plugins</groupId>
+                <artifactId>car-maven-plugin</artifactId>
+                <configuration>
+                    <deploymentConfigs>
+                        <deploymentConfig>${gbeanDeployer}</deploymentConfig>
+                        <deploymentConfig>${j2eeDeployer}</deploymentConfig>
+                        <deploymentConfig>${connectorDeployer}</deploymentConfig>
+                    </deploymentConfigs>
+                    <module>
+                        <groupId>org.tranql</groupId>
+                        <artifactId>tranql-connector-derby-embed-local</artifactId>
+                        <version>1.3</version>
+                        <type>rar</type>
+                    </module>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml?rev=590502&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml Tue Oct 30 15:59:24 2007
@@ -0,0 +1,64 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
+    <environment>
+
+        <moduleId>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>mrc-server-ds-car</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>car</type>
+        </moduleId>
+
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.geronimo.configs</groupId>
+                <artifactId>system-database</artifactId>
+                <version>2.1-SNAPSHOT</version>
+                <type>car</type>
+            </dependency>
+        </dependencies>
+    </environment>
+    <resourceadapter>
+        <outbound-resourceadapter>
+            <!-- Pool for Active Statisitcs -->
+            <connection-definition>
+                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+                <connectiondefinition-instance>
+                    <name>jdbc/ActiveDS</name>
+                    <config-property-setting name="CreateDatabase">true</config-property-setting>
+                    <config-property-setting name="Password">monitor</config-property-setting>
+                    <config-property-setting name="UserName">monitor</config-property-setting>
+                    <config-property-setting name="DatabaseName">ActiveMRCDB</config-property-setting>
+                    <connectionmanager>
+                        <local-transaction/>
+                        <single-pool>
+                            <max-size>10</max-size>
+                            <min-size>0</min-size>
+                            <match-one/>
+                        </single-pool>
+                    </connectionmanager>
+                </connectiondefinition-instance>
+            </connection-definition>
+
+            <!-- Pool for Archived Statisitcs -->
+            <connection-definition>
+                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+                <connectiondefinition-instance>
+                    <name>jdbc/ArchiveDS</name>
+                    <config-property-setting name="CreateDatabase">true</config-property-setting>
+                    <config-property-setting name="Password">monitor</config-property-setting>
+                    <config-property-setting name="UserName">monitor</config-property-setting>
+                    <config-property-setting name="DatabaseName">ArchiveMRCDB</config-property-setting>
+                    <connectionmanager>
+                        <local-transaction/>
+                        <single-pool>
+                            <max-size>10</max-size>
+                            <min-size>0</min-size>
+                            <match-one/>
+                        </single-pool>
+                    </connectionmanager>
+                </connectiondefinition-instance>
+            </connection-definition>
+        </outbound-resourceadapter>
+    </resourceadapter>
+</connector>

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/sandbox/monitoring/mrc-server/mrc-ds-car/src/main/plan/plan.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ear/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ear/pom.xml?rev=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ear/pom.xml (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ear/pom.xml Tue Oct 30 15:59:24 2007
@@ -36,12 +36,14 @@
     <description>Geronimo Stats. EAR Module</description>
 
     <dependencies>
+    <!--
         <dependency>
-            <groupId>org.tranql</groupId>
-            <artifactId>tranql-connector-ra</artifactId>
-            <version>1.3</version>
-            <type>rar</type>
+            <groupId>org.apache.geronimo.configs</groupId>
+            <artifactId>mrc-server-ds-car</artifactId>
+            <version>1.0-SNAPSHOT</version>
+            <type>car</type>
         </dependency>
+        -->
         <dependency>
             <groupId>org.apache.geronimo.plugins.mrc</groupId>
             <artifactId>mrc-server-ejb</artifactId>
@@ -82,5 +84,6 @@
     </build>
 
 </project>
+
 
 

Modified: 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=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/META-INF/geronimo-application.xml Tue Oct 30 15:59:24 2007
@@ -29,11 +29,15 @@
             <version>1.0-SNAPSHOT</version>
             <type>ear</type>
         </moduleId>
-    </environment>
 
-    <module>
-        <connector>tranql-connector-ra-1.3.rar</connector>
-        <alt-dd>MonitorDBPool.xml</alt-dd>
-    </module>
-    
+        <dependencies>
+            <!-- dependency on the DataSource plugin  -->
+            <dependency>
+                <groupId>org.apache.geronimo.configs</groupId>
+                <artifactId>mrc-server-ds-car</artifactId>
+                <version>1.0-SNAPSHOT</version>
+                <type>car</type>
+            </dependency>
+        </dependencies>
+    </environment>
 </application>

Modified: 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=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MBeanHelper.java Tue Oct 30 15:59:24 2007
@@ -40,16 +40,16 @@
     /**
      * Return all MBeans that provide stats
      */
-    public Set<ObjectName> getStatsProvidersMBeans(Set<ObjectName> allMBeans) {
-        Set<ObjectName> result = new HashSet();
+    public Set<String> getStatsProvidersMBeans(Set<String> allMBeans) {
+        Set<String> result = new HashSet();
 
         try {
             for (Iterator it = allMBeans.iterator(); it.hasNext(); ) {
                 try {
-                    ObjectName objName = (ObjectName) it.next();
-                    Boolean statisticsProvider = (Boolean) kernel.getAttribute(objName, "statisticsProvider");
+                    String mbeanName = (String) it.next();
+                    Boolean statisticsProvider = (Boolean) kernel.getAttribute(new ObjectName(mbeanName), "statisticsProvider");
                     if (Boolean.TRUE.equals(statisticsProvider)) {
-                        result.add(objName);
+                        result.add(mbeanName);
                     }
                 } catch (Exception e) {
                     // this will happen if there is not a matching attribute "statisticsProvider"

Modified: 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=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControl.java Tue Oct 30 15:59:24 2007
@@ -34,6 +34,7 @@
 
 import javax.annotation.Resource;
 import javax.annotation.PostConstruct;
+import javax.annotation.PreDestroy;
 import javax.annotation.security.RolesAllowed;
 import javax.annotation.security.RunAs;
 import javax.ejb.Remote;
@@ -55,8 +56,6 @@
 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;
@@ -84,8 +83,6 @@
     private static final Long DEFAULT_DURATION = new Long(300000);
     private static final int DEFAULT_RETENTION = 30; // 30 days
 
-    //private static final Log log = LogFactory.getLog(MasterRemoteControl.class);
-
     // mbean server to talk to other components
     private static MBeanServer mbServer = null;
     
@@ -102,8 +99,8 @@
     private static MBeanHelper mbeanHelper;
 
     // inject Data Sources
-    @Resource(name="ActiveDS") private DataSource activeDS;
-    @Resource(name="ArchiveDS") private DataSource archiveDS;
+    @Resource(name="jdbc/ActiveDS") private DataSource activeDS;
+    @Resource(name="jdbc/ArchiveDS") private DataSource archiveDS;
 
     public MasterRemoteControl() {
         
@@ -189,22 +186,31 @@
      */
     private void createTables(Statement stmt) {
         try {
-            String tableMBeansCreate = "CREATE TABLE MBeans( id INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), mbeanName VARCHAR(256) NOT NULL, PRIMARY KEY(id) )";
-            String tableSnapshotsCreate = "CREATE TABLE Snapshots(id INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1), snapshot_time BIGINT NOT NULL, snapshot_date VARCHAR(30) NOT NULL, PRIMARY KEY(id))";
+            // MBeans
+            // -id
+            // -mbeanName
+            // -statsNameList
+            String tableMBeansCreate      = "CREATE TABLE MBeans(";
+            tableMBeansCreate            +=     "id INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),";
+            tableMBeansCreate            +=     "mbeanName VARCHAR(256) NOT NULL,";
+            tableMBeansCreate            +=     "statsNameList VARCHAR(512) NOT NULL,";
+            tableMBeansCreate            +=     "PRIMARY KEY(id)";
+            tableMBeansCreate            +=  ")";            
+            // Statistics
+            // -id
+            // -mbeanId (f.k. references MBeans.id)
+            // snapshot_time
+            // statsValueList
             String tableStatisticsCreate  = "CREATE TABLE Statistics (";
-                   tableStatisticsCreate +=     "id BIGINT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),";
+                   tableStatisticsCreate +=     "id INT NOT NULL GENERATED ALWAYS AS IDENTITY (START WITH 1, INCREMENT BY 1),";
                    tableStatisticsCreate +=     "mbeanId INT NOT NULL,";
-                   tableStatisticsCreate +=     "snapshotId INT NOT NULL,";
-                   tableStatisticsCreate +=     "statsValue BIGINT NOT NULL,"; 
-                   tableStatisticsCreate +=     "statsName VARCHAR(100) NOT NULL,";
+                   tableStatisticsCreate +=     "snapshot_time BIGINT NOT NULL,";
+                   tableStatisticsCreate +=     "statsValueList VARCHAR(512) NOT NULL,"; 
                    tableStatisticsCreate +=     "PRIMARY KEY(id),";
-                   tableStatisticsCreate +=     "FOREIGN KEY (mbeanId) REFERENCES MBeans(id),";
-                   tableStatisticsCreate +=     "FOREIGN KEY (snapshotId) REFERENCES Snapshots(id)";
+                   tableStatisticsCreate +=     "FOREIGN KEY (mbeanId) REFERENCES MBeans(id)";
                    tableStatisticsCreate += ")";
             stmt.executeUpdate(tableMBeansCreate);
             System.out.println("MBeans Table Created");
-            stmt.executeUpdate(tableSnapshotsCreate);
-            System.out.println("Snapshots Table Created");
             stmt.executeUpdate(tableStatisticsCreate);
             System.out.println("Statistics Table Created");
         } catch(Exception e) {
@@ -389,8 +395,9 @@
      * @return ArrayList
      */ 
     @RolesAllowed("mejbuser")
-    public ArrayList fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot) {
-        ArrayList retval = (ArrayList)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
+    public ArrayList<HashMap<String, HashMap<String, Object>>> fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot) {
+        ArrayList<HashMap<String, HashMap<String, Object>>> retval = 
+            (ArrayList<HashMap<String, HashMap<String, Object>>>)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
         return retval;
     }
     
@@ -402,8 +409,9 @@
      * @return HashMap
      */
     @RolesAllowed("mejbuser")
-    public HashMap fetchMaxSnapshotData(Integer numberOfSnapshot) {
-        HashMap retval = (HashMap)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
+    public HashMap<String, HashMap<String, Long>> fetchMaxSnapshotData(Integer numberOfSnapshot) {
+        HashMap<String, HashMap<String, Long>> retval = 
+            (HashMap<String, HashMap<String, Long>>)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
         return retval;
     }
 
@@ -415,8 +423,9 @@
      * @return HashMap
      */
     @RolesAllowed("mejbuser")
-    public HashMap fetchMinSnapshotData(Integer numberOfSnapshot) {
-        HashMap retval = (HashMap)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
+    public HashMap<String, HashMap<String, Long>> fetchMinSnapshotData(Integer numberOfSnapshot) {
+        HashMap<String, HashMap<String, Long>> retval = 
+            (HashMap<String, HashMap<String, Long>>)org.apache.geronimo.monitor.snapshot.SnapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
         return retval;
     }
     
@@ -471,7 +480,7 @@
      * statistics
      */
     @RolesAllowed("mejbuser")
-    public Set<ObjectName> getStatisticsProviderMBeanNames() {
+    public Set<String> getStatisticsProviderMBeanNames() {
         return mbeanHelper.getStatsProvidersMBeans( getAllMBeanNames() );
     }
     
@@ -481,26 +490,28 @@
      * @return A set containing all mbean names
      */
     @RolesAllowed("mejbuser")
-    public Set<ObjectName> getAllMBeanNames() {
+    public Set<String> getAllMBeanNames() {
         try {
-            return (Set<ObjectName>)mejb.queryNames(null, null);
+            Set<ObjectName> names = (Set<ObjectName>)mejb.queryNames(null, null);
+            Set<String> strNames = new HashSet<String>();
+            for(Iterator<ObjectName> it = names.iterator(); it.hasNext(); ) {
+                strNames.add(it.next().getCanonicalName());
+            }
+            return strNames;
         } catch(Exception e) {
             e.printStackTrace();
-            return new HashSet<ObjectName>();
+            return new HashSet<String>();
         }
     }
     
-    @RolesAllowed("mejbuser")
     private void saveDuration(long duration) {
         SnapshotConfigXMLBuilder.saveDuration(duration);
     }
     
-    @RolesAllowed("mejbuser")
     private void saveRetention(int retention) {
         SnapshotConfigXMLBuilder.saveRetention(retention);
     }
     
-    @RolesAllowed("mejbuser")
     private Long fetchSnapshotDuration() {
         final String DURATION = "duration";
         try {

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java?rev=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java Tue Oct 30 15:59:24 2007
@@ -33,7 +33,7 @@
 @Remote
 public interface MasterRemoteControlRemote {
     @RolesAllowed("mejbuser")
-    public HashMap getStats(String s) throws Exception;
+    public HashMap<String, Long> getStats(String s) throws Exception;
     @RolesAllowed("mejbadmin")
     public void setAttribute(String s, String ss, Object o) throws Exception;
     @RolesAllowed("mejbuser")
@@ -41,11 +41,11 @@
     @RolesAllowed("mejbuser")
     public boolean stopSnapshot();
     @RolesAllowed("mejbuser")
-    public ArrayList fetchSnapshotData(Integer i, Integer ii);
+    public ArrayList<HashMap<String, HashMap<String, Object>>> fetchSnapshotData(Integer i, Integer ii);
     @RolesAllowed("mejbuser")
-    public HashMap fetchMaxSnapshotData(Integer i);
+    public HashMap<String, HashMap<String, Long>> fetchMaxSnapshotData(Integer i);
     @RolesAllowed("mejbuser")
-    public HashMap fetchMinSnapshotData(Integer i);
+    public HashMap<String, HashMap<String, Long>> fetchMinSnapshotData(Integer i);
     @RolesAllowed("mejbuser")
     public Long getSnapshotDuration();
     @RolesAllowed("mejbuser")
@@ -53,11 +53,11 @@
     @RolesAllowed("mejbuser")
     public void setSnapshotDuration(Long l);
     @RolesAllowed("mejbuser")
-    public Set getStatisticsProviderMBeanNames();
+    public Set<String> getStatisticsProviderMBeanNames();
     @RolesAllowed("mejbuser")
-    public Set getAllMBeanNames();
+    public Set<String> getAllMBeanNames();
     @RolesAllowed("mejbuser")
-    public HashMap getAllSnapshotStatAttributes();
+    public HashMap<String, ArrayList<String>> getAllSnapshotStatAttributes();
     @RolesAllowed("mejbuser")
     public void addMBeanForSnapshot(String s);
     @RolesAllowed("mejbuser")

Modified: 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=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java Tue Oct 30 15:59:24 2007
@@ -222,22 +222,22 @@
     }
 
     private static void testPrintStatisticsProviderMBeans(MasterRemoteControlRemote mrc) {
-        Set<ObjectName> list = mrc.getStatisticsProviderMBeanNames();
-        for(Iterator<ObjectName> it = list.iterator(); it.hasNext(); ) {
-            String mbeanName = it.next().getCanonicalName();
+        Set<String> list = mrc.getStatisticsProviderMBeanNames();
+        for(Iterator<String> it = list.iterator(); it.hasNext(); ) {
+            String mbeanName = it.next();
             System.out.println(mbeanName);
         }
     }
     
     private static void testRemoveMBeanToSnapshot(MBeanServerConnection mbServerConn) throws Exception {
         ObjectName objName = new ObjectName(PATH);
-        Set<ObjectName> mbeans = getStatsMBeans(mbServerConn);
+        Set<String> 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();
+            Iterator<String> it = mbeans.iterator();
+            String mbeanName = it.next();
+            mbeanName = it.next();
+            mbeanName = it.next();
+            mbeanName = it.next();
             System.out.println(mbeanName);
             mbServerConn.invoke(
                     objName,
@@ -252,13 +252,13 @@
 
     private static void testAddMBeanToSnapshot(MBeanServerConnection mbServerConn) throws Exception {
         ObjectName objName = new ObjectName(PATH);
-        Set<ObjectName> mbeans = getStatsMBeans(mbServerConn);
+        Set<String> 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();
+            Iterator<String> it = mbeans.iterator();
+            String mbeanName = it.next();
+            mbeanName = it.next();
+            mbeanName = it.next();
+            mbeanName = it.next();
             System.out.println(mbeanName);
             mbServerConn.invoke(
                     objName,
@@ -295,7 +295,7 @@
     
     private static void testGetStats(MBeanServerConnection mbServerConn) throws Exception {
         ObjectName objName = new ObjectName(PATH);
-        Set<ObjectName> mbeanNames = getStatsMBeans(mbServerConn);
+        Set<String> 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();
@@ -347,11 +347,11 @@
         }
     }
     
-    private static Set<ObjectName> getStatsMBeans(MBeanServerConnection mbServerConn) throws Exception {
+    private static Set<String> getStatsMBeans(MBeanServerConnection mbServerConn) throws Exception {
         System.out.println("* * * testGetStatsMBeans() * * *");
         ObjectName objName = new ObjectName(PATH);
         try {
-            Set<ObjectName> set = (Set<ObjectName>)mbServerConn.invoke(
+            Set<String> set = (Set<String>)mbServerConn.invoke(
                     objName,
                     "getStatisticsProviderMBeanNames", 
                     new Object[] {},

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotDBHelper.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotDBHelper.java?rev=590502&r1=590501&r2=590502&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotDBHelper.java (original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotDBHelper.java Tue Oct 30 15:59:24 2007
@@ -33,10 +33,9 @@
 public class SnapshotDBHelper {
     // field attributes for the Statistics table in the DB
     private static final String SNAPSHOT_TIME = "snapshot_time";
-    private static final String SNAPSHOT_DATE = "snapshot_date";
     private static final String MBEANNAME = "mbeanName";
-    private static final String STATSVALUE = "statsValue";
-    private static final String STATSNAME = "statsName";
+    private static final String STATSVALUELIST = "statsValueList";
+    private static final String STATSNAMELIST = "statsNameList";
     // Connection object used for DB interaction
     private static Connection conn = null;
     // Data Sources
@@ -51,17 +50,18 @@
         HashMap<String, ArrayList<String>> retval = new HashMap<String, ArrayList<String>>();
         try {
             Statement stmt = conn.createStatement();
-            String query = "SELECT DISTINCT M.mbeanName, S.statsName FROM Statistics S, MBeans M WHERE M.id=S.mbeanId";
+            String query = "SELECT DISTINCT mbeanName, statsNameList FROM MBeans";
             ResultSet rs = stmt.executeQuery(query);
             // add each mbean/statsValue combination to retval
             while(rs.next()) {
                 String mbeanName = rs.getString(MBEANNAME);
-                String statsValue = rs.getString(STATSNAME);
-                ArrayList<String> mbeanAttributeList = retval.get(mbeanName);
-                if(mbeanAttributeList == null) {
-                    mbeanAttributeList = new ArrayList<String>();
+                String statsNameStr = rs.getString(STATSNAMELIST);
+                String[] statsNameList = statsNameStr.split(",");
+                ArrayList<String> mbeanAttributeList = new ArrayList<String>();
+                // copy from String[] to ArrayList<String>
+                for(int i = 0; i < statsNameList.length; i++) {
+                    mbeanAttributeList.add(statsNameList[i]);
                 }
-                mbeanAttributeList.add(statsValue);
                 retval.put(mbeanName, mbeanAttributeList);
             }
         } catch(Exception e) {
@@ -81,7 +81,7 @@
         try {
             openActiveConnection();
             Statement stmt = conn.createStatement();
-            String query = "SELECT COUNT(DISTINCT snapshot_time) FROM Snapshots";
+            String query = "SELECT COUNT(DISTINCT snapshot_time) FROM Statistics";
             ResultSet rs = stmt.executeQuery(query);
             rs.next();
             retval = rs.getLong(1);
@@ -132,23 +132,30 @@
                     if(mbeanMap == null) {
                         mbeanMap = new HashMap<String, Long>();
                     }
-                    // compute the statsName and maximum statValue
-                    String statsName = snapshotData.getString(STATSNAME);
-                    Long statsValue = mbeanMap.get(statsName);
-                    if(statsValue == null) {
+                    String[] statsNameList = snapshotData.getString(STATSNAMELIST).split(",");
+                    String[] statsValueList = snapshotData.getString(STATSVALUELIST).split(",");
+                    assert(statsNameList.length == statsValueList.length);
+                    // for each statname/statsvalue combo in an mbean
+                    for(int i = 0 ; i < statsNameList.length; i++) {
+                        String statsName = statsNameList[i];
+                        Long maxStatsValue = mbeanMap.get(statsName);
+                        // give maxStatsValue some value if there isn't one
+                        if(maxStatsValue == null) {
+                            if(isMax) {
+                                maxStatsValue = new Long(0);
+                            } else {
+                                maxStatsValue = Long.MAX_VALUE;
+                            }
+                        }
+                        // relax
                         if(isMax) {
-                            statsValue = new Long(0);
+                            maxStatsValue = new Long(Math.max(Long.parseLong(statsValueList[i]), maxStatsValue.longValue()));
                         } else {
-                            statsValue = Long.MAX_VALUE;
+                            maxStatsValue = new Long(Math.min(Long.parseLong(statsValueList[i]), maxStatsValue.longValue()));
                         }
+                        // save name/value back into mbeanMap
+                        mbeanMap.put(statsName, maxStatsValue);
                     }
-                    if(isMax) {
-                        statsValue = new Long(Math.max(Long.parseLong(snapshotData.getString(STATSVALUE)), statsValue.longValue()));
-                    } else {
-                        statsValue = new Long(Math.min(Long.parseLong(snapshotData.getString(STATSVALUE)), statsValue.longValue()));
-                    }
-                    // relax
-                    mbeanMap.put(statsName, statsValue);
                     // save mbeanMap back into stats
                     stats.put(mbean, mbeanMap);
                 }
@@ -176,22 +183,33 @@
      */
     public static boolean addSnapshotToDB(HashMap<String, HashMap<String, Long>> aggregateStats) {
         boolean success = true;
-        // get the current date
-        Calendar cal = Calendar.getInstance();
-        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String currDate = sdf.format(cal.getTime());
-        
         // get the current time from 1970
         String currTime = "";
         currTime += (new Date()).getTime();
         try {
             // for each mbean
             for(Iterator itt = aggregateStats.keySet().iterator(); itt.hasNext(); ) {
+                String mbean = (String)itt.next();
+                // prepare the statsNameList and statsValueList beforehand
+                String statsNameList = "", statsValueList = "";
+                for(Iterator<String> it = aggregateStats.get(mbean).keySet().iterator(); it.hasNext(); ) {
+                    String statsName = it.next();
+                    Long statsValue = aggregateStats.get(mbean).get(statsName);
+                    if(statsNameList.length() == 0 || statsValueList.length() == 0) {
+                        // do not add a comma because this is the first occurrence
+                        statsValueList += statsValue.toString();
+                        statsNameList += statsName;
+                    } else {
+                        // add a comma
+                        statsValueList += "," + statsValue.toString();
+                        statsNameList += "," + statsName;
+                    }
+                }
+                
+                // start talking to DB
                 openActiveConnection();
                 Statement stmt = conn.createStatement();
-                String mbean = (String)itt.next();
                 HashMap stats = aggregateStats.get(mbean);
-                System.out.println(mbean);
                 //--------Ensure MBeans are in place
                 int mbeanId = getMBeanId(mbean); 
                 if(mbeanId != -1) {
@@ -199,26 +217,12 @@
                 } else {
                     // doesn't exist in the db so add it
                     // add mbean record to the db
-                    stmt.executeUpdate("INSERT INTO MBeans (mbeanName) VALUES ("+ surroundWithQuotes(mbean) + ")");
+                    stmt.executeUpdate("INSERT INTO MBeans (mbeanName, statsNameList) VALUES ("+ surroundWithQuotes(mbean) + "," + surroundWithQuotes(statsNameList) + ")");
                     mbeanId = getMBeanId(mbean);
                 }
-                //--------Ensure Snapshots are in place
-                int snapshotId = getSnapshotId(currTime);
-                if(snapshotId != -1) {
-                    // snapshot already exists in the db
-                } else {
-                    // doesn't exist in the db
-                    // add snapshot time record to the db
-                    stmt.executeUpdate("INSERT INTO Snapshots (snapshot_time, snapshot_date) VALUES (" + currTime + ", " + surroundWithQuotes(currDate) +")");
-                    snapshotId = getSnapshotId(currTime);
-                }
-                // for each stat within an mbean
-                for(Iterator it = stats.keySet().iterator(); it.hasNext(); ) {
-                    String key = (String)it.next();
-                    Long value = (Long)stats.get(key);
-                    //--------Ensure Statistics are in place
-                    stmt.executeUpdate( prepareInsertStatement(key, value, snapshotId, mbeanId) );
-                }
+                
+                // insert the statistics into Statistics table
+                stmt.executeUpdate( prepareInsertSnapshotStatement(currTime, statsValueList, mbeanId) );
                 closeConnection();
             }
         } catch(Exception  e){
@@ -236,7 +240,6 @@
         } catch(Exception e) {
             System.out.println("[WARN] Cannot archive snapshots because attribute 'retention' is not present in snapshot-config.xml.");
         }
-        
         return success;
     }
     
@@ -271,10 +274,9 @@
                 while(rsSnapshotData.next()) {
                     // extract values from sql table
                     String mbeanName = rsSnapshotData.getString(MBEANNAME);
-                    String statsName = rsSnapshotData.getString(STATSNAME);
-                    Long statsValue = rsSnapshotData.getLong(STATSVALUE);
+                    String statsNameList = rsSnapshotData.getString(STATSNAMELIST);
+                    String statsValueList = rsSnapshotData.getString(STATSVALUELIST);
                     Long snapshot_time = rsSnapshotData.getLong(SNAPSHOT_TIME);
-                    String snapshot_date = rsSnapshotData.getString(SNAPSHOT_DATE);
                     // get a connection to the archive db too
                     Connection archiveConn = archiveDS.getConnection();
                     Statement archiveStmt = archiveConn.createStatement();
@@ -285,21 +287,11 @@
                     } else {
                         // doesn't exist in the db so add it
                         // add mbean record to the db
-                        archiveStmt.executeUpdate("INSERT INTO MBeans (mbeanName) VALUES ("+ surroundWithQuotes(mbeanName) + ")");
+                        archiveStmt.executeUpdate("INSERT INTO MBeans (mbeanName, statsNameList) VALUES ("+ surroundWithQuotes(mbeanName) + ", " + surroundWithQuotes(statsNameList) + ")");
                         mbeanId = getMBeanIdFromArchive(mbeanName);
                     }
-                    //--------Ensure Snapshots are in place
-                    int snapshotId = getSnapshotIdFromArchive(snapshot_time + "");
-                    if(snapshotId != -1) {
-                        // snapshot already exists in the db
-                    } else {
-                        // doesn't exist in the db
-                        // add snapshot time record to the db
-                        snapshotsOver += archiveStmt.executeUpdate("INSERT INTO Snapshots (snapshot_time, snapshot_date) VALUES (" + snapshot_time + ", " + surroundWithQuotes(snapshot_date) +")");
-                        snapshotId = getSnapshotIdFromArchive(snapshot_time + "");
-                    }
                     // ensure Statistics table has record of mbeanId, snapshotId, statsValue, statsName
-                    String updateStr = prepareInsertStatement(statsName, statsValue, snapshotId, mbeanId);
+                    String updateStr = prepareInsertSnapshotStatement(snapshot_time + "", statsValueList, mbeanId);
                     statisticsOver += archiveStmt.executeUpdate( updateStr );
                     // close connection to archiveDB
                     archiveConn.close();
@@ -313,11 +305,8 @@
                 openActiveConnection();
                 Statement stmt = conn.createStatement();
                 // remove from Statistics table
-                String statisticsUpdate = "DELETE FROM Statistics WHERE snapshotId=" + getSnapshotId(snapshotTime + "");
+                String statisticsUpdate = "DELETE FROM Statistics WHERE snapshot_time=" + snapshotTime;
                 statisticsOver -= stmt.executeUpdate(statisticsUpdate);
-                // remove from Snapshots Table
-                String snapshotUpdate = "DELETE FROM Snapshots WHERE snapshot_time=" + snapshotTime;
-                snapshotsOver -= stmt.executeUpdate(snapshotUpdate);
                 closeConnection();
             }
         } catch(Exception e) {
@@ -342,7 +331,7 @@
     private static ResultSet getOverDueSnapshotTimes(long cutOffTime) {
         try {
             Statement stmt = conn.createStatement();
-            String query = "SELECT snapshot_time FROM Snapshots WHERE snapshot_time < " + cutOffTime;
+            String query = "SELECT DISTINCT snapshot_time FROM Statistics WHERE snapshot_time < " + cutOffTime;
             return stmt.executeQuery(query);
         } catch(Exception e) {
             e.printStackTrace();
@@ -351,40 +340,6 @@
     }
     
     /**
-     * @param snapshot_time
-     * @return The snapshot id of the snapshot time from table ActiveDB.Snapshots. Returns -1 if record does not exist.
-     */    
-    private static int getSnapshotId(String snapshot_time) throws Exception {
-        int retval = -1;
-        Connection conn = activeDS.getConnection();
-        Statement stmt = conn.createStatement();
-        ResultSet rs = stmt.executeQuery("SELECT id FROM Snapshots WHERE snapshot_time=" + snapshot_time);
-        if(rs.next()) {
-            retval = rs.getInt("id");
-        }
-        stmt.close();
-        conn.close();
-        return retval;
-    }
-    
-    /**
-     * @param snapshot_time
-     * @return The snapshot id of the snapshot time from table ArchiveDB.Snapshots. Returns -1 if record does not exist.
-     */    
-    private static int getSnapshotIdFromArchive(String snapshot_time) throws Exception {
-        int retval = -1;
-        Connection archiveConn = archiveDS.getConnection();
-        Statement stmt = archiveConn.createStatement();
-        ResultSet rs = stmt.executeQuery("SELECT id FROM Snapshots WHERE snapshot_time=" + snapshot_time);
-        if(rs.next()) {
-            retval = rs.getInt("id");
-        }
-        stmt.close();
-        archiveConn.close();
-        return retval;
-    }
-
-    /**
      * @param mbean
      * @return The mbean id of the mbean from table ArchiveDB.MBean. Returns -1 if record does not exist.
      */
@@ -419,20 +374,16 @@
     }
     
     /**
-     * @param statsName
-     * @param statsValue
-     * @param currDate
-     * @param currTime
-     * @param mbean
+     * @param snapshot_time
+     * @param statsValueList
+     * @param mbeanId
      * @return Returns an SQL insert statement for one statistic given the correct information.
      */
-    public static String prepareInsertStatement(String statsName, Long statsValue, int snapshotId, int mbeanId) {
-        String retval = "INSERT INTO Statistics (statsName, statsValue, snapshotId, mbeanId) VALUES (";
-        retval += surroundWithQuotes(statsName);
+    public static String prepareInsertSnapshotStatement(String snapshot_time, String statsValueList, int mbeanId) {
+        String retval = "INSERT INTO Statistics (snapshot_time, statsValueList, mbeanId) VALUES (";
+        retval += snapshot_time;
         retval += ",";
-        retval += statsValue;
-        retval += ",";
-        retval += snapshotId;
+        retval += surroundWithQuotes(statsValueList);
         retval += ",";
         retval += mbeanId;
         retval += ")";
@@ -502,7 +453,6 @@
         HashMap<String, HashMap<String, Object>> snapshotPkg = new HashMap<String, HashMap<String, Object>>();
         openActiveConnection();
         ResultSet snapshotData = fetchSnapshotDataFromDB(snapshotTime);
-        String snapshotDate = null;
         try {
             // for each record save it somewhere in the snapshotPkg
             while(snapshotData.next()) {
@@ -512,14 +462,19 @@
                 if(mbeanInfo == null) {
                     mbeanInfo = new HashMap<String, Object>();
                 }
-                // save the statistic name and value into a hashmap
-                mbeanInfo.put(snapshotData.getString(STATSNAME), snapshotData.getLong(STATSVALUE));
+                // get statistics from resultset
+                String statsValueStr = snapshotData.getString(STATSVALUELIST);
+                String statsNameStr = snapshotData.getString(STATSNAMELIST);
+                String[] statsValueList = statsValueStr.split(",");
+                String[] statsNameList = statsNameStr.split(",");
+                assert(statsValueList.length == statsNameList.length);
+                // for each statsValue/statsName, save it
+                for(int i = 0 ; i < statsValueList.length; i++) {
+                    long statValue = Long.parseLong(statsValueList[i]);
+                    mbeanInfo.put(statsNameList[i], new Long(statValue));
+                }
                 // save the hashmap into the snapshotpkg
                 snapshotPkg.put(currMBean, mbeanInfo);
-                // save the snapshotDate
-                if(snapshotDate == null) {
-                    snapshotDate = snapshotData.getString(SNAPSHOT_DATE);
-                }
             }
         } catch(Exception e) {
             e.printStackTrace();
@@ -529,7 +484,6 @@
         // add the time and date
         HashMap<String, Object> timeMap = new HashMap<String, Object>();
         timeMap.put(SNAPSHOT_TIME, snapshotTime);
-        timeMap.put(SNAPSHOT_DATE, snapshotDate);
         snapshotPkg.put("times", timeMap);
         
         return snapshotPkg;
@@ -540,8 +494,8 @@
      * @return Returns a ResultSet with all statistic information that matches the snapshot_time.
      */
     private static ResultSet fetchSnapshotDataFromDB(Long snapshotTime) {
-        String query = "SELECT S.statsValue AS statsValue, S.statsName AS statsName, SN.snapshot_time AS snapshot_time, SN.snapshot_date AS snapshot_date, M.mbeanName AS mbeanName FROM Statistics S, Snapshots SN, MBeans M WHERE SN.snapshot_time=" + snapshotTime;
-        query += " AND S.snapshotId=SN.id AND S.mbeanId=M.id";
+        String query = "SELECT S.statsValueList AS statsValueList, M.statsNameList AS statsNameList, S.snapshot_time AS snapshot_time, M.mbeanName AS mbeanName FROM Statistics S, MBeans M WHERE S.snapshot_time=" + snapshotTime;
+        query += " AND S.mbeanId=M.id";
         ResultSet retval = null;
         try {
             if(conn.isClosed()) {
@@ -559,7 +513,7 @@
      * @return Returns a ResultSet with one column (snapshot_time) sorted in descending order
      */
     private static ResultSet fetchSnapshotTimesFromDB() {
-        String query = "SELECT DISTINCT snapshot_time FROM Snapshots ORDER BY snapshot_time DESC";
+        String query = "SELECT DISTINCT snapshot_time FROM Statistics ORDER BY snapshot_time DESC";
         ResultSet retval = null;
         try {
             if(conn.isClosed()) {
@@ -624,15 +578,31 @@
             if(mbeanId == -1) {
                 System.out.println("[ERROR] " + mbeanName + " does not exist in the database.");
             } else {
-                String query = "SELECT DISTINCT SN.snapshot_time AS snapshot_time, S.statsValue AS statsValue FROM Snapshots SN, Statistics S WHERE S.mbeanId=" + mbeanId + " AND S.snapshotId=SN.id AND S.statsName=" + surroundWithQuotes(statsName) + " ORDER BY SN.snapshot_time DESC";
+                String query = "SELECT DISTINCT snapshot_time, statsValueList, statsNameList FROM Statistics, MBeans M WHERE mbeanId=" + mbeanId + " AND mbeanId=M.id ORDER BY snapshot_time DESC";
                 ResultSet rs = stmt.executeQuery(query);
                 int nthSnapshot = 0;
-                // iterator through the table paying attention to those at everyNthSnapshot-th position
+                // iterate through the table paying attention to those at everyNthSnapshot-th position
                 while(rs.next()) {
                     // every nth snapshot I save the information into my returning hashmap
                     if(nthSnapshot % everyNthSnapshot == 0) {
-                        stats.put(rs.getLong(SNAPSHOT_TIME), rs.getLong(STATSVALUE));
-                        numberOfSnapshots--;
+                        String[] statsValueList = rs.getString(STATSVALUELIST).split(",");
+                        String[] statsNameList = rs.getString(STATSNAMELIST).split(",");
+                        assert(statsValueList.length == statsNameList.length);
+                        Long statsValue = null;
+                        for(int i = 0 ; i < statsNameList.length; i++) {
+                            if(statsNameList[i].equals(statsName)) {
+                                long value = Long.parseLong(statsValueList[i]);
+                                statsValue = new Long(value);
+                            }
+                        }
+                        // exit function after error
+                        if(statsValue == null) {
+                            System.out.println("[WARN] Statistics name '" + statsName + "' does not exist");
+                            return stats;
+                        } else {
+                            stats.put(rs.getLong(SNAPSHOT_TIME), statsValue);
+                            numberOfSnapshots--;
+                        }
                     }
                     // update counter
                     nthSnapshot++;



Mime
View raw message