You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by dj...@apache.org on 2008/11/17 22:37:31 UTC

svn commit: r718393 [1/2] - in /geronimo/server/trunk/plugins/monitoring: ./ agent-car-jmx/ agent-car-jmx/src/main/history/ agent-car-jmx/src/main/plan/ agent-ds/ agent-ds/src/main/plan/ agent-ejb/src/main/java/org/apache/geronimo/monitoring/ agent-ejb...

Author: djencks
Date: Mon Nov 17 13:37:30 2008
New Revision: 718393

URL: http://svn.apache.org/viewvc?rev=718393&view=rev
Log:
GERONIMO-4415 start of code cleanup and use of jpa in console.  Also add a server assembly for testing

Added:
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java   (contents, props changed)
      - copied, changed from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java   (contents, props changed)
      - copied, changed from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java   (contents, props changed)
      - copied, changed from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotThread.java
    geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/
    geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml   (with props)
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java   (with props)
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/data/Graph.java   (with props)
Removed:
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java
    geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/
Modified:
    geronimo/server/trunk/plugins/monitoring/agent-car-jmx/pom.xml
    geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/monitoring/agent-ds/pom.xml
    geronimo/server/trunk/plugins/monitoring/agent-ds/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControl.java
    geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlLocal.java
    geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlRemote.java
    geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java
    geronimo/server/trunk/plugins/monitoring/agent-jmx/pom.xml
    geronimo/server/trunk/plugins/monitoring/agent/pom.xml
    geronimo/server/trunk/plugins/monitoring/agent/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/monitoring/agent/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-ds/pom.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/plan/plan.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-jetty/pom.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-jetty/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/pom.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/src/main/history/dependencies.xml
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/StatsGraph.java
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddGraph.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddServer.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringAddView.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditGraph.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditServer.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringEditView.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringGraphs.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringNormal.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringPage.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringServers.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViewServer.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/WEB-INF/view/monitoringViews.jsp
    geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/webapp/monitoringPopUpGraph.jsp
    geronimo/server/trunk/plugins/monitoring/pom.xml

Modified: geronimo/server/trunk/plugins/monitoring/agent-car-jmx/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-car-jmx/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-car-jmx/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-car-jmx/pom.xml Mon Nov 17 13:37:30 2008
@@ -48,7 +48,7 @@
         </dependency>
     
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
             <artifactId>agent-ds</artifactId>
             <version>${monitoringConsoleVersion}</version>
             <type>car</type>

Modified: geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/history/dependencies.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/history/dependencies.xml Mon Nov 17 13:37:30 2008
@@ -12,7 +12,7 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.plugins</groupId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
         <artifactId>agent-ds</artifactId>
         <type>car</type>
     </dependency>

Modified: geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/plan/plan.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-car-jmx/src/main/plan/plan.xml Mon Nov 17 13:37:30 2008
@@ -19,28 +19,7 @@
 <!-- $Rev$ $Date$ -->
 
 <module xmlns="http://geronimo.apache.org/xml/ns/deployment-${geronimoSchemaVersion}">
-    <environment>
-        <moduleId>
-            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
-            <artifactId>agent-car-jmx</artifactId>
-            <version>${monitoringConsoleVersion}</version>
-        </moduleId>
 
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.geronimo.plugins.monitoring</groupId>
-                <artifactId>agent-jar</artifactId>
-                <version>${monitoringConsoleVersion}</version>
-                <type>jar</type>
-            </dependency>
-            <dependency>
-                <groupId>org.apache.geronimo.plugins</groupId>
-                <artifactId>agent-ds</artifactId>
-                <version>${monitoringConsoleVersion}</version>
-                <type>car</type>
-            </dependency>
-        </dependencies>
-    </environment>
+    <gbean name="MasterRemoteControlJMX" class="org.apache.geronimo.monitoring.jmx.MasterRemoteControlJMX" />
 
-    <gbean name="MasterRemoteControlJMX" class="org.apache.geronimo.monitoring.MasterRemoteControlJMX" />
 </module>

Modified: geronimo/server/trunk/plugins/monitoring/agent-ds/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ds/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ds/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ds/pom.xml Mon Nov 17 13:37:30 2008
@@ -30,7 +30,6 @@
         <version>2.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.geronimo.plugins</groupId>
     <artifactId>agent-ds</artifactId>
     <name>Geronimo Plugins, Monitoring :: Agent DataSource</name>
     <packaging>car</packaging>

Modified: geronimo/server/trunk/plugins/monitoring/agent-ds/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ds/src/main/plan/plan.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ds/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ds/src/main/plan/plan.xml Mon Nov 17 13:37:30 2008
@@ -19,28 +19,6 @@
 <!-- $Rev$ $Date$ -->
 
 <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-${geronimoSchemaVersion}">
-    <environment>
-        <moduleId>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>${pom.artifactId}</artifactId>
-            <version>${version}</version>
-            <type>car</type>
-        </moduleId>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.geronimo.configs</groupId>
-                <artifactId>system-database</artifactId>
-                <type>car</type>
-            </dependency>
-            <!-- SQL files -->
-	        <dependency>
-	            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
-	            <artifactId>agent-sql</artifactId>
-	            <version>${monitoringConsoleVersion}</version>
-	            <type>jar</type>
-	        </dependency>
-        </dependencies>
-    </environment>
     
     <resourceadapter>
         <outbound-resourceadapter>

Modified: geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControl.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControl.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControl.java Mon Nov 17 13:37:30 2008
@@ -21,9 +21,9 @@
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Properties;
 import java.util.Set;
 import java.util.TreeMap;
+import java.rmi.RemoteException;
 
 import javax.annotation.PostConstruct;
 import javax.annotation.Resource;
@@ -35,9 +35,9 @@
 import javax.ejb.Timeout;
 import javax.ejb.Timer;
 import javax.ejb.TimerService;
+import javax.ejb.CreateException;
+import javax.ejb.EJB;
 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;
@@ -46,18 +46,17 @@
 import javax.management.j2ee.statistics.Statistic;
 import javax.management.j2ee.statistics.Stats;
 import javax.management.j2ee.statistics.TimeStatistic;
-import javax.naming.Context;
-import javax.naming.InitialContext;
+import javax.naming.NamingException;
 import javax.sql.DataSource;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.monitoring.snapshot.SnapshotConfigXMLBuilder;
 import org.apache.geronimo.monitoring.snapshot.SnapshotDBHelper;
 import org.apache.geronimo.monitoring.snapshot.SnapshotProcessor;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
- * This is a Stateful Session Bean that will be the bottleneck for the communication
+ * This is a Stateless Session Bean that will be the bottleneck for the communication
  * between the management node and the data in the server node.
  */
 @Stateless(name="ejb/mgmt/MRC")
@@ -67,17 +66,9 @@
 public class MasterRemoteControl {
     private static final Logger log = LoggerFactory.getLogger(MasterRemoteControl.class);
     
-    // mbean server to talk to other components
-    private static MBeanServer mbServer = null;
-    
-    // mangement ejb - use this to do the monitoring
-    private static Management mejb = null;
+    @EJB(name = "ejb/mgmt/MEJB")
+    private ManagementHome mejbHome;
     
-    // credentials for snapshot processor
-    private static String username = null;
-    private static String password = null;
-    private static int port = -1;
-
     // inject Data Sources
     @Resource(name="jdbc/ActiveDS") private DataSource activeDS;
     @Resource(name="jdbc/ArchiveDS") private DataSource archiveDS;
@@ -99,30 +90,6 @@
     }
 
     /**
-     * Retrieves and instance of the MEJB and starts the snapshot process
-     */
-    @RolesAllowed("mejbuser")
-    public void setUpMEJB(String username, String password) {
-        // instantiate the MEJB, which will be our gateway to communicate to MBeans
-        try {
-            Properties p = new Properties();
-            p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
-            InitialContext ctx = new InitialContext(p);
-
-            ManagementHome mejbHome = (ManagementHome)ctx.lookup("ejb/mgmt/MEJB");
-            mejb = mejbHome.create();
-            
-            // save credentials
-            this.username = username;
-            this.password = password;
-            this.port = port;
-
-        } catch(Exception e) {
-            log.error(e.getMessage(), e);
-        }
-    }
-    
-    /**
      * Looks up the JSR-77 statistics associated with this object name.
      * 
      * @param objectName
@@ -130,9 +97,9 @@
      * @throws Exception
      */
     @RolesAllowed("mejbuser")
-    public static HashMap<String, Long> getStats(String objectName) throws Exception {
+    public HashMap<String, Long> getStats(String objectName) throws Exception {
         HashMap<String, Long> statsMap = new HashMap<String, Long>();
-        Stats stats = (Stats)mejb.getAttribute(new ObjectName(objectName), "stats");
+        Stats stats = (Stats)getMEJB().getAttribute(new ObjectName(objectName), "stats");
         String[] sttsName = stats.getStatisticNames();
         Statistic[] stts = stats.getStatistics();
         for(int i = 0; i < sttsName.length; i++) {
@@ -174,14 +141,14 @@
     @RolesAllowed("mejbadmin")
     public void setAttribute(String objectName, String attrName, Object attrValue) throws Exception {
         Attribute attr = new Attribute(attrName, attrValue);
-        mejb.setAttribute(new ObjectName(objectName), attr);
+        getMEJB().setAttribute(new ObjectName(objectName), attr);
     }
     
     // This method is called by the EJB container upon Timer expiration.
     @Timeout
-    @PermitAll
+    @RolesAllowed("mejbuser")
     public void handleTimeout(Timer theTimer) {
-        SnapshotProcessor.takeSnapshot(this.username, this.password);
+        SnapshotProcessor.takeSnapshot(this);
         
         // get the duration of theTimer
         long duration = Long.parseLong((String)theTimer.getInfo());
@@ -274,7 +241,7 @@
      */ 
     @RolesAllowed("mejbuser")
     public ArrayList<HashMap<String, HashMap<String, Object>>> fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot) {
-        return (ArrayList<HashMap<String, HashMap<String, Object>>>)snapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
+        return snapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
     }
     
     /**
@@ -286,7 +253,7 @@
      */
     @RolesAllowed("mejbuser")
     public HashMap<String, HashMap<String, Long>> fetchMaxSnapshotData(Integer numberOfSnapshot) {
-        return (HashMap<String, HashMap<String, Long>>)snapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
+        return snapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
     }
 
     /**
@@ -298,7 +265,7 @@
      */
     @RolesAllowed("mejbuser")
     public HashMap<String, HashMap<String, Long>> fetchMinSnapshotData(Integer numberOfSnapshot) {
-        return (HashMap<String, HashMap<String, Long>>)snapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
+        return snapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
     }
     
     /**
@@ -368,7 +335,7 @@
     @RolesAllowed("mejbuser")
     public Set<String> getAllMBeanNames() {
         try {
-            Set<ObjectName> names = (Set<ObjectName>)mejb.queryNames(null, null);
+            Set<ObjectName> names = (Set<ObjectName>)getMEJB().queryNames(null, null);
             Set<String> strNames = new HashSet<String>();
             for(Iterator<ObjectName> it = names.iterator(); it.hasNext(); ) {
                 strNames.add(it.next().getCanonicalName());
@@ -422,7 +389,7 @@
             ArrayList<String> mbeanStatsList = new ArrayList<String>();
             String mbeanName = it.next();
             try {
-                Stats stats = (Stats)mejb.getAttribute(new ObjectName(mbeanName), "stats");
+                Stats stats = (Stats)getMEJB().getAttribute(new ObjectName(mbeanName), "stats");
                 String[] sttsName = stats.getStatisticNames();
                 Statistic[] stts = stats.getStatistics();
                 for(int i = 0; i < sttsName.length; i++) {
@@ -474,7 +441,7 @@
      */
     @RolesAllowed("mejbadmin")
     public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature) throws Exception {
-        return mejb.invoke(name, operationName, params, signature);
+        return getMEJB().invoke(name, operationName, params, signature);
     }
     
     /**
@@ -498,11 +465,15 @@
      */
     @RolesAllowed("mejbuser")
     public Set<String> getTrackedMBeans() {
-        ArrayList<String> mbeans = (ArrayList<String>)SnapshotConfigXMLBuilder.getMBeanNames();
+        ArrayList<String> mbeans = SnapshotConfigXMLBuilder.getMBeanNames();
         Set<String> set = new HashSet<String>();
         for(int i = 0; i < mbeans.size(); i++) {
             set.add(mbeans.get(i));
         }
         return set;
     }
+
+    private Management getMEJB() throws NamingException, RemoteException, CreateException {
+        return mejbHome.create();
+    }
 }

Modified: geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlLocal.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlLocal.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlLocal.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlLocal.java Mon Nov 17 13:37:30 2008
@@ -48,7 +48,6 @@
     public boolean addMBeanForSnapshot(String s);
     public boolean removeMBeanForSnapshot(String s);
     public boolean isSnapshotRunning();
-    public void setUpMEJB(String username, String password);
     public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature);
     public TreeMap<Long, Long> getSpecificStatistics(String mbeanName, String statsName, int numberOfSnapshots, int everyNthSnapshot, boolean showArchive);
     public Set<String> getTrackedMBeans();

Modified: geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlRemote.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlRemote.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlRemote.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlRemote.java Mon Nov 17 13:37:30 2008
@@ -48,7 +48,6 @@
     public boolean addMBeanForSnapshot(String s);
     public boolean removeMBeanForSnapshot(String s);
     public boolean isSnapshotRunning();
-    public void setUpMEJB(String username, String password);
     public Object invoke(ObjectName name, String operationName, Object[] params, String[] signature);
     public TreeMap<Long, Long> getSpecificStatistics(String mbeanName, String statsName, int numberOfSnapshots, int everyNthSnapshot, boolean showArchive);
     public Set<String> getTrackedMBeans();

Modified: geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-ejb/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java Mon Nov 17 13:37:30 2008
@@ -20,18 +20,15 @@
 import java.lang.reflect.UndeclaredThrowableException;
 import java.util.ArrayList;
 import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Properties;
 import java.util.Set;
 
 import javax.management.ObjectName;
-import javax.naming.Context;
-import javax.naming.InitialContext;
 
+import org.apache.geronimo.kernel.NoSuchOperationException;
+import org.apache.geronimo.monitoring.MBeanHelper;
+import org.apache.geronimo.monitoring.MasterRemoteControl;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.geronimo.monitoring.MBeanHelper;
-import org.apache.geronimo.monitoring.MasterRemoteControlLocal;
 
 /**
  * Thread that is in charge of executing every x milliseconds. Upon each
@@ -45,16 +42,13 @@
      * Collects JSR-77 statistics for all mbeans that have been chosen to 
      * be monitored and stores it in a DB. Will also, archive snapshots
      * if they have passed their retention period.
-     * @param username
-     * @param password
+     * @param mrc
      */
-    public static void takeSnapshot(String username, String password) {
+    public static void takeSnapshot(MasterRemoteControl mrc) {
         // ensure that there is a 'monitoring' directory
         ensureMonitorDir();
         // get any saved mbean names from snapshot-config.xml
         ArrayList<String> mbeanNames = SnapshotConfigXMLBuilder.getMBeanNames();
-        // get a handle on the mrc
-        MasterRemoteControlLocal mrc = getMRC(username, password);
         // in the case where nothing is present, grab a set of default mbeans
         if(mbeanNames.size() <= 0) {
             mbeanNames = getDefaultMBeanList(mrc);
@@ -67,22 +61,19 @@
             // instantiate map <mbean name, stats for mbean>
             HashMap<String, HashMap<String, Long>> aggregateStats = new HashMap<String, HashMap<String, Long>>();
             // for each mbean name in the list, get its stats
-            for(int i = 0; i < mbeanNames.size(); i++) {
-                String mbeanName = mbeanNames.get(i);
-                HashMap<String, Long> stats = (HashMap<String, Long>)mrc.getStats(mbeanName);
+            for (String mbeanName : mbeanNames) {
+                HashMap<String, Long> stats = mrc.getStats(mbeanName);
                 aggregateStats.put(mbeanName, stats);
             }
             
             // store the data in a DB
             (new SnapshotDBHelper()).addSnapshotToDB(aggregateStats);
-            
-            for(Iterator itt = aggregateStats.keySet().iterator(); itt.hasNext(); ) {
-                String mbean = (String)itt.next();
+
+            for (String mbean : aggregateStats.keySet()) {
                 HashMap<String, Long> stats = aggregateStats.get(mbean);
                 log.info(mbean);
-                for(Iterator it = stats.keySet().iterator(); it.hasNext(); ) {
-                    String key = (String)it.next();
-                    Long value = (Long)stats.get(key);
+                for (String key : stats.keySet()) {
+                    Long value = stats.get(key);
                     log.info(key + ": " + value);
                 }
             }
@@ -96,22 +87,27 @@
      * 
      * @param mbeanList
      */
-    private static void setStatsOn(ArrayList<String> mbeanList, MasterRemoteControlLocal mrc) {
+    private static void setStatsOn(ArrayList<String> mbeanList, MasterRemoteControl mrc) {
         // for each mbean name in the list
-        for(int i = 0; i < mbeanList.size(); i++) {
+        for (String aMbeanList : mbeanList) {
             // turn the statistics collection on
             String methodName = "setStatsOn";
-            Object[] params = new Object[] { Boolean.TRUE };
-            String[] signatures = new String[] { "boolean" };
+            Object[] params = new Object[]{Boolean.TRUE};
+            String[] signatures = new String[]{"boolean"};
             try {
-                ObjectName objName = new ObjectName(mbeanList.get(i));
+                ObjectName objName = new ObjectName(aMbeanList);
                 mrc.invoke(objName, methodName, params, signatures);
-                log.info("Stats for " + mbeanList.get(i) + " was turned on.");
-            }catch (UndeclaredThrowableException e) {
-        	// HACK : this will happen for components that always collect statistics
-        	// and do not have StatsOn method.
-            } catch(Exception e) { 
-        	log.error(e.getMessage(), e);
+                log.info("Stats for " + aMbeanList + " was turned on.");
+            } catch (UndeclaredThrowableException e) {
+                // HACK : this will happen for components that always collect statistics
+                // and do not have StatsOn method.
+            } catch (javax.management.ReflectionException e) {
+                if (!(e.getCause() instanceof java.lang.NoSuchMethodException) || !(e.getCause().getCause() instanceof NoSuchOperationException)) {
+                    log.error("unexpected jmx exception", e);
+                }
+                //othewise ignore -- presumably something changed in exception handling.
+            } catch (Exception e) {
+                log.error(e.getMessage(), e);
             }
         }
     }
@@ -121,13 +117,13 @@
      * Prereq: in order to be a connector or container mbean the name must contain "Connector"/"Container" 
      * and "Tomcat"/"Jetty" or JVM.
      */
-    private static ArrayList<String> getDefaultMBeanList(MasterRemoteControlLocal mrc) {
+    private static ArrayList<String> getDefaultMBeanList(MasterRemoteControl mrc) {
         Set<String> mbeans = MBeanHelper.getStatsProvidersMBeans( mrc.getAllMBeanNames() );
         ArrayList<String> retval = new ArrayList<String>();
-        for(Iterator it = mbeans.iterator(); it.hasNext(); ) {
-            String name = (String)it.next();
-            if(((name.contains("Connector") || name.contains("Container")) && (name.contains("Jetty") || name.contains("Tomcat")))
-                                || name.contains("JVM")) {
+        for (Object mbean : mbeans) {
+            String name = (String) mbean;
+            if (((name.contains("Connector") || name.contains("Container")) && (name.contains("Jetty") || name.contains("Tomcat")))
+                    || name.contains("JVM")) {
                 // this is a connector or JVM, so add to the list
                 retval.add(name);
                 // update the snapshot-config.xml to include these
@@ -160,21 +156,4 @@
         }
     }
     
-    /**
-     * @return An instance of a MRC. 
-     */
-    public static MasterRemoteControlLocal getMRC(String username, String password) {
-        Properties props = new Properties();
-        props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
-        props.setProperty(Context.SECURITY_PRINCIPAL, username);
-        props.setProperty(Context.SECURITY_CREDENTIALS, password);
-        props.setProperty("openejb.authentication.realmName", "geronimo-admin");
-        try {
-            Context ic = new InitialContext(props);
-            MasterRemoteControlLocal mrc = (MasterRemoteControlLocal)ic.lookup("ejb/mgmt/MRCLocal");
-            return mrc;
-        } catch(Exception e) {
-            return null;
-        }
-    }
 }

Modified: geronimo/server/trunk/plugins/monitoring/agent-jmx/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-jmx/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-jmx/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-jmx/pom.xml Mon Nov 17 13:37:30 2008
@@ -57,7 +57,7 @@
         <!--</dependency>-->
 
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
             <artifactId>agent-ds</artifactId>
             <version>${version}</version>
             <type>car</type>

Copied: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java (from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java?p2=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java&p1=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java&r1=713949&r2=718393&rev=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/MasterRemoteControlJMX.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java Mon Nov 17 13:37:30 2008
@@ -14,10 +14,9 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.monitoring;
+package org.apache.geronimo.monitoring.jmx;
 
 import java.util.ArrayList;
-import java.util.Collection;
 import java.util.HashMap;
 import java.util.HashSet;
 import java.util.Iterator;
@@ -28,37 +27,28 @@
 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 javax.sql.DataSource;
 
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
 
-import org.apache.geronimo.connector.outbound.ManagedConnectionFactoryWrapper;
-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.monitoring.MBeanHelper;
+import org.apache.geronimo.monitoring.MonitorConstants;
 
-import org.apache.xbean.naming.context.WritableContext.NestedWritableContext;
-
-import org.apache.geronimo.monitoring.snapshot.SnapshotThread;
+import org.apache.geronimo.monitoring.jmx.snapshot.SnapshotThread;
 import org.apache.geronimo.monitoring.snapshot.SnapshotConfigXMLBuilder;
 import org.apache.geronimo.monitoring.snapshot.SnapshotDBHelper;
-import org.apache.geronimo.monitoring.snapshot.ObjectFactory;
 
 /**
  * This is the GBean that will be the bottleneck for the communication
@@ -101,8 +91,8 @@
         // Note: do not put this in the constructor...datasources are not injected by then
         try {
             InitialContext ic = new InitialContext();
-            activeDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ActiveDS");
-            archiveDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins/agent-ds/JCAManagedConnectionFactory/jdbc/ArchiveDS");
+            activeDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins.monitoring/agent-ds/JCAManagedConnectionFactory/jdbc/ActiveDS");
+            archiveDS = (DataSource)ic.lookup("jca:/org.apache.geronimo.plugins.monitoring/agent-ds/JCAManagedConnectionFactory/jdbc/ArchiveDS");
         } catch(Exception e) {
             log.error(e.getMessage());
         }
@@ -196,7 +186,7 @@
      * @return ArrayList
      */ 
     public ArrayList<HashMap<String, HashMap<String, Object>>> fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot) {
-        return (ArrayList<HashMap<String, HashMap<String, Object>>>)snapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
+        return snapshotDBHelper.fetchData(numberOfSnapshot, everyNthSnapshot);
     }
     
     /**
@@ -207,7 +197,7 @@
      * @return HashMap
      */
     public HashMap<String, HashMap<String, Long>> fetchMaxSnapshotData(Integer numberOfSnapshot) {
-        return (HashMap<String, HashMap<String, Long>>)snapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
+        return snapshotDBHelper.fetchMaxSnapshotData(numberOfSnapshot);
     }
 
     /**
@@ -218,7 +208,7 @@
      * @return HashMap
      */
     public HashMap<String, HashMap<String, Long>> fetchMinSnapshotData(Integer numberOfSnapshot) {
-        return (HashMap<String, HashMap<String, Long>>)snapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
+        return snapshotDBHelper.fetchMinSnapshotData(numberOfSnapshot);
     }
     
     /**

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/MasterRemoteControlJMX.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java (from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java?p2=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java&p1=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java&r1=713949&r2=718393&rev=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotProcessor.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java Mon Nov 17 13:37:30 2008
@@ -14,26 +14,23 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.monitoring.snapshot;
+package org.apache.geronimo.monitoring.jmx.snapshot;
 
-import java.io.File;
 import java.lang.reflect.UndeclaredThrowableException;
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.Iterator;
-import java.util.Properties;
 import java.util.Set;
 
 import javax.management.ObjectName;
 import javax.management.ReflectionException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
 
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 import org.apache.geronimo.monitoring.MBeanHelper;
-import org.apache.geronimo.monitoring.MasterRemoteControlJMX;
 import org.apache.geronimo.monitoring.snapshot.SnapshotConfigXMLBuilder;
+import org.apache.geronimo.monitoring.snapshot.SnapshotDBHelper;
+import org.apache.geronimo.monitoring.jmx.MasterRemoteControlJMX;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
 
 /**
  * Thread that is in charge of executing every x milliseconds. Upon each

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotProcessor.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Copied: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java (from r713949, geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotThread.java)
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java?p2=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java&p1=geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotThread.java&r1=713949&r2=718393&rev=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/snapshot/SnapshotThread.java (original)
+++ geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java Mon Nov 17 13:37:30 2008
@@ -14,17 +14,16 @@
  *  See the License for the specific language governing permissions and
  *  limitations under the License.
  */
-package org.apache.geronimo.monitoring.snapshot;
+package org.apache.geronimo.monitoring.jmx.snapshot;
 
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.Iterator;
 import java.util.Set;
 
 import javax.management.MBeanServer;
-import javax.management.ObjectName;
 
-import org.apache.geronimo.monitoring.MasterRemoteControlJMX;
+import org.apache.geronimo.monitoring.jmx.MasterRemoteControlJMX;
+import org.apache.geronimo.monitoring.snapshot.SnapshotConfigXMLBuilder;
 
 /**
  * Thread that is in charge of executing every x milliseconds. Upon each

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/agent-jmx/src/main/java/org/apache/geronimo/monitoring/jmx/snapshot/SnapshotThread.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/monitoring/agent/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent/pom.xml Mon Nov 17 13:37:30 2008
@@ -30,7 +30,6 @@
         <version>2.2-SNAPSHOT</version>
     </parent>
     
-    <groupId>org.apache.geronimo.plugins</groupId>
     <artifactId>agent</artifactId>
     <name>Geronimo Plugins, Monitoring :: Agent</name>
     <packaging>car</packaging>
@@ -45,7 +44,7 @@
         </dependency>
         
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
             <artifactId>agent-ds</artifactId>
             <version>${monitoringConsoleVersion}</version>
             <type>car</type>
@@ -91,10 +90,6 @@
                     </module>
                     <category>Monitoring</category>
                     <osiApproved>true</osiApproved>
-                    <useMavenDependencies>
-                        <value>true</value>
-                        <includeVersion>true</includeVersion>
-                    </useMavenDependencies>
                 </configuration>
             </plugin>
         </plugins>

Modified: geronimo/server/trunk/plugins/monitoring/agent/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent/src/main/history/dependencies.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent/src/main/history/dependencies.xml Mon Nov 17 13:37:30 2008
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <plugin-artifact xmlns:ns2="http://geronimo.apache.org/xml/ns/attributes-1.2" xmlns="http://geronimo.apache.org/xml/ns/plugins-1.3">
     <module-id>
-        <groupId>org.apache.geronimo.plugins</groupId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
         <artifactId>agent</artifactId>
         <version>2.2-SNAPSHOT</version>
         <type>car</type>
@@ -12,7 +12,7 @@
         <type>jar</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.plugins</groupId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
         <artifactId>agent-ds</artifactId>
         <type>car</type>
     </dependency>

Modified: geronimo/server/trunk/plugins/monitoring/agent/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/agent/src/main/plan/plan.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/agent/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/agent/src/main/plan/plan.xml Mon Nov 17 13:37:30 2008
@@ -21,7 +21,8 @@
 <openejb-jar
         xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
         xmlns:sec="http://geronimo.apache.org/xml/ns/security-2.0"
-        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-2.0">
+        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2"
+        xmlns:cs="http://geronimo.apache.org/xml/ns/credentialstore-1.0">
 
 
     <enterprise-beans>
@@ -32,6 +33,13 @@
     </enterprise-beans>
 
     <sec:security>
+        <sec:credential-store-ref>
+            <sys:name>monitoring-credential-store</sys:name>
+        </sec:credential-store-ref>
+        <sec:default-subject>
+            <sec:realm>geronimo-admin</sec:realm>
+            <sec:id>monitoring-user</sec:id>
+        </sec:default-subject>
         <sec:role-mappings>
             <sec:role role-name="mejbuser">
                 <sec:principal name="admin"
@@ -46,4 +54,24 @@
             </sec:role>
         </sec:role-mappings>
     </sec:security>
+
+    <sys:gbean name="monitoring-credential-store" class="org.apache.geronimo.security.credentialstore.SimpleCredentialStoreImpl">
+        <sys:xml-attribute name="credentialStore">
+            <cs:credential-store>
+                <cs:realm name="geronimo-admin">
+                    <cs:subject>
+                        <cs:id>monitoring-user</cs:id>
+                        <cs:credential>
+                            <cs:type>org.apache.geronimo.security.credentialstore.NameCallbackHandler</cs:type>
+                            <cs:value>system</cs:value>
+                        </cs:credential>
+                        <cs:credential>
+                            <cs:type>org.apache.geronimo.security.credentialstore.PasswordCallbackHandler</cs:type>
+                            <cs:value>manager</cs:value>
+                        </cs:credential>
+                    </cs:subject>
+                </cs:realm>
+            </cs:credential-store>
+        </sys:xml-attribute>
+    </sys:gbean>
 </openejb-jar>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-ds/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-ds/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-ds/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-ds/pom.xml Mon Nov 17 13:37:30 2008
@@ -30,7 +30,6 @@
         <version>2.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.geronimo.plugins</groupId>
     <artifactId>mconsole-ds</artifactId>
     <name>Geronimo Plugins, Console :: Monitoring DataSource</name>
     <packaging>car</packaging>
@@ -50,6 +49,7 @@
             <groupId>org.tranql</groupId>
             <artifactId>tranql-connector-derby-embed-local</artifactId>
             <type>rar</type>
+            <scope>provided</scope>
         </dependency>
         
         <dependency>
@@ -57,6 +57,7 @@
             <artifactId>connector-deployer</artifactId>
             <version>${version}</version>
             <type>car</type>
+            <scope>provided</scope>
         </dependency>
     </dependencies>
 

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/history/dependencies.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/history/dependencies.xml Mon Nov 17 13:37:30 2008
@@ -7,18 +7,8 @@
         <type>car</type>
     </module-id>
     <dependency>
-        <groupId>org.tranql</groupId>
-        <artifactId>tranql-connector-derby-embed-local</artifactId>
-        <type>rar</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.configs</groupId>
         <artifactId>system-database</artifactId>
         <type>car</type>
     </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.configs</groupId>
-        <artifactId>connector-deployer</artifactId>
-        <type>car</type>
-    </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/plan/plan.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/plan/plan.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/plan/plan.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-ds/src/main/plan/plan.xml Mon Nov 17 13:37:30 2008
@@ -19,21 +19,6 @@
 <!-- $Rev: 605412 $ $Date: 2007-12-18 19:58:03 -0800 (Tue, 18 Dec 2007) $ -->
 
 <connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-${geronimoSchemaVersion}">
-    <environment>
-        <moduleId>
-            <groupId>${pom.groupId}</groupId>
-            <artifactId>${pom.artifactId}</artifactId>
-            <version>${version}</version>
-            <type>car</type>
-        </moduleId>
-        <dependencies>
-            <dependency>
-                <groupId>org.apache.geronimo.configs</groupId>
-                <artifactId>system-database</artifactId>
-                <type>car</type>
-            </dependency>
-        </dependencies>
-    </environment>
 
     <resourceadapter>
         <outbound-resourceadapter>

Added: geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml?rev=718393&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml (added)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml Mon Nov 17 13:37:30 2008
@@ -0,0 +1,111 @@
+<?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$ -->
+
+<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>
+        <artifactId>monitoring</artifactId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+        <version>2.2-SNAPSHOT</version>
+    </parent>
+
+    <artifactId>mconsole-jetty-server</artifactId>
+    <packaging>server-assembly</packaging>
+    <name>Simple Monitoring Console Server on Jetty</name>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.geronimo.plugingroups</groupId>
+            <artifactId>framework</artifactId>
+            <version>${geronimoVersion}</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+            <artifactId>mconsole-jetty</artifactId>
+            <version>${pom.version}</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+            <artifactId>agent</artifactId>
+            <version>${pom.version}</version>
+            <type>car</type>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+            <artifactId>agent-car-jmx</artifactId>
+            <version>${pom.version}</version>
+            <type>car</type>
+        </dependency>
+    </dependencies>
+
+    <build>
+        <pluginManagement>
+            <plugins>
+                <plugin>
+                    <groupId>org.apache.geronimo.buildsupport</groupId>
+                    <artifactId>car-maven-plugin</artifactId>
+                    <extensions>true</extensions>
+                </plugin>
+            </plugins>
+        </pluginManagement>
+        <plugins>
+            <plugin>
+                <groupId>org.apache.geronimo.buildsupport</groupId>
+                <artifactId>car-maven-plugin</artifactId>
+                <configuration>
+                    <servers>
+                        <serverInstance>
+                            <name>default</name>
+                            <configFile>var/config/config.xml</configFile>
+                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
+                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
+                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
+                        </serverInstance>
+                        <serverInstance>
+                            <name>client</name>
+                            <attributeManagerFrom>default</attributeManagerFrom>
+                            <artifactAliasesFile>var/config/client_artifact_aliases.properties</artifactAliasesFile>
+                        </serverInstance>
+                        <serverInstance>
+                            <name>offline</name>
+                            <configFile>var/config/offline-deployer-config.xml</configFile>
+                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
+                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
+                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
+                        </serverInstance>
+                        <serverInstance>
+                            <name>jsr88</name>
+                            <configFile>var/config/jsr88-configurer-config.xml</configFile>
+                            <configSubstitutionsFile>var/config/config-substitutions.properties</configSubstitutionsFile>
+                            <configSubstitutionsPrefix>org.apache.geronimo.config.substitution.</configSubstitutionsPrefix>
+                            <artifactAliasesFile>var/config/artifact_aliases.properties</artifactAliasesFile>
+                        </serverInstance>
+                    </servers>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+</project>
\ No newline at end of file

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-jetty-server/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-jetty/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-jetty/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-jetty/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-jetty/pom.xml Mon Nov 17 13:37:30 2008
@@ -30,7 +30,6 @@
         <version>2.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.geronimo.plugins</groupId>
     <artifactId>mconsole-jetty</artifactId>
     <name>Geronimo Plugins, Console :: Monitoring (Jetty)</name>
     <packaging>car</packaging>
@@ -64,7 +63,7 @@
         </dependency>
         
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
             <artifactId>mconsole-ds</artifactId>
             <version>${monitoringConsoleVersion}</version>
             <type>car</type>
@@ -87,7 +86,7 @@
 	
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
-            <artifactId>dojo-legacy-jetty6</artifactId>
+            <artifactId>dojo-jetty6</artifactId>
             <version>${version}</version>
             <type>car</type>
         </dependency>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-jetty/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-jetty/src/main/history/dependencies.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-jetty/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-jetty/src/main/history/dependencies.xml Mon Nov 17 13:37:30 2008
@@ -1,12 +1,17 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <plugin-artifact xmlns:ns2="http://geronimo.apache.org/xml/ns/attributes-1.2" xmlns="http://geronimo.apache.org/xml/ns/plugins-1.3">
     <module-id>
-        <groupId>org.apache.geronimo.plugins</groupId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
         <artifactId>mconsole-jetty</artifactId>
         <version>2.2-SNAPSHOT</version>
         <type>car</type>
     </module-id>
     <dependency>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+        <artifactId>mconsole-ds</artifactId>
+        <type>car</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.geronimo.plugins</groupId>
         <artifactId>console-jetty</artifactId>
         <type>car</type>
@@ -18,12 +23,7 @@
     </dependency>
     <dependency>
         <groupId>org.apache.geronimo.configs</groupId>
-        <artifactId>dojo-legacy-jetty6</artifactId>
-        <type>car</type>
-    </dependency>
-    <dependency>
-        <groupId>org.apache.geronimo.plugins</groupId>
-        <artifactId>mconsole-ds</artifactId>
+        <artifactId>dojo-jetty6</artifactId>
         <type>car</type>
     </dependency>
 </plugin-artifact>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/pom.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/pom.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/pom.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/pom.xml Mon Nov 17 13:37:30 2008
@@ -30,7 +30,6 @@
         <version>2.2-SNAPSHOT</version>
     </parent>
 
-    <groupId>org.apache.geronimo.plugins</groupId>
     <artifactId>mconsole-tomcat</artifactId>
     <name>Geronimo Plugins, Console :: Monitoring (Tomcat)</name>
     <packaging>car</packaging>
@@ -64,7 +63,7 @@
         </dependency>
         
         <dependency>
-            <groupId>org.apache.geronimo.plugins</groupId>
+            <groupId>org.apache.geronimo.plugins.monitoring</groupId>
             <artifactId>mconsole-ds</artifactId>
             <version>${monitoringConsoleVersion}</version>
             <type>car</type>
@@ -94,7 +93,7 @@
 		
         <dependency>
             <groupId>org.apache.geronimo.configs</groupId>
-            <artifactId>dojo-legacy-tomcat</artifactId>
+            <artifactId>dojo-tomcat</artifactId>
             <version>${version}</version>
             <type>car</type>
         </dependency>

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/src/main/history/dependencies.xml
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/src/main/history/dependencies.xml?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/src/main/history/dependencies.xml (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-tomcat/src/main/history/dependencies.xml Mon Nov 17 13:37:30 2008
@@ -1,17 +1,12 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <plugin-artifact xmlns:ns2="http://geronimo.apache.org/xml/ns/attributes-1.2" xmlns="http://geronimo.apache.org/xml/ns/plugins-1.3">
     <module-id>
-        <groupId>org.apache.geronimo.plugins</groupId>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
         <artifactId>mconsole-tomcat</artifactId>
         <version>2.2-SNAPSHOT</version>
         <type>car</type>
     </module-id>
     <dependency>
-        <groupId>org.apache.geronimo.configs</groupId>
-        <artifactId>dojo-legacy-tomcat</artifactId>
-        <type>car</type>
-    </dependency>
-    <dependency>
         <groupId>org.apache.geronimo.plugins</groupId>
         <artifactId>console-tomcat</artifactId>
         <type>car</type>
@@ -22,13 +17,18 @@
         <type>car</type>
     </dependency>
     <dependency>
+        <groupId>org.apache.geronimo.plugins.monitoring</groupId>
+        <artifactId>mconsole-ds</artifactId>
+        <type>car</type>
+    </dependency>
+    <dependency>
         <groupId>org.apache.geronimo.configs</groupId>
         <artifactId>openejb</artifactId>
         <type>car</type>
     </dependency>
     <dependency>
-        <groupId>org.apache.geronimo.plugins</groupId>
-        <artifactId>mconsole-ds</artifactId>
+        <groupId>org.apache.geronimo.configs</groupId>
+        <artifactId>dojo-tomcat</artifactId>
         <type>car</type>
     </dependency>
 </plugin-artifact>

Added: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java?rev=718393&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java (added)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java Mon Nov 17 13:37:30 2008
@@ -0,0 +1,28 @@
+/*
+ * 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.monitoring.console;
+
+/**
+ * @version $Rev:$ $Date:$
+ */
+public interface Constants {
+    static String DOJO_JS = "/dojo/dojo/dojo/dojo.js";
+}

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/Constants.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/GraphsBuilder.java Mon Nov 17 13:37:30 2008
@@ -26,29 +26,22 @@
 import java.util.ArrayList;
 import java.util.Date;
 import java.util.HashMap;
-import java.util.Iterator;
 import java.util.TreeMap;
 
 import org.apache.geronimo.monitoring.console.util.DBManager;
+import org.apache.geronimo.monitoring.console.data.Graph;
 
 public class GraphsBuilder {
-    private String ip = new String();
-    private int timeFrame;
-    private int snapCount;
-    private MRCConnector mrc = new MRCConnector();
-    private Connection con;
 
     // constructor
-    public GraphsBuilder(Connection con) {
-        // TODO: Database pull stuff may go here... based on server ID...\
-        this.con = con;
+    public GraphsBuilder() {
     }
 
     public StatsGraph buildOneDB(int graph_id) throws Exception {
-        con = (new DBManager()).getConnection();
-        StatsGraph graph = null;
-        PreparedStatement pStmt = null;
-        ResultSet rsServer = null;
+        Connection con = (new DBManager()).getConnection();
+        StatsGraph statsGraph = null;
+        PreparedStatement pStmt;
+        ResultSet rsServer;
         pStmt = con
                 .prepareStatement("SELECT * from graphs WHERE enabled=1 AND graph_id="
                         + graph_id);
@@ -59,7 +52,7 @@
             String dataName2 = rs.getString("dataname2");
             String graphName1 = rs.getString("dataname1");
             String graphName2 = rs.getString("dataname2");
-            timeFrame = rs.getInt("timeframe");
+            int timeFrame = rs.getInt("timeframe");
             String server_id = rs.getString("server_id");
             String xlabel = rs.getString("xlabel");
             String ylabel = rs.getString("ylabel");
@@ -69,14 +62,26 @@
             String color = rs.getString("color");
             float warninglevel1 = rs.getFloat("warninglevel1");
             String description = rs.getString("description");
-            boolean showArchive = rs.getInt("archive") == 1 ? true : false;
+            boolean showArchive = rs.getInt("archive") == 1;
+
+            Graph graph = new Graph();
+            graph.setId(graph_id);
+            graph.setDescription(description);
+            graph.setXlabel(xlabel);
+            graph.setYlabel(ylabel);
+            graph.setData1operation(data1operation.charAt(0));
+            graph.setOperation(operation);
+            graph.setData2operation(data2operation.charAt(0));
+            graph.setTimeFrame(timeFrame);
+            graph.setColor(color);
+            graph.setWarninglevel1(warninglevel1);
 
             pStmt = con
                     .prepareStatement("SELECT * from servers WHERE enabled=1 AND server_id="
                             + server_id);
             rsServer = pStmt.executeQuery();
             if (rsServer.next()) {
-                ip = rsServer.getString("ip");
+                String ip = rsServer.getString("ip");
                 String username = rsServer.getString("username");
                 String password = rsServer.getString("password");
                 int port = rsServer.getInt("port");
@@ -85,19 +90,16 @@
                 // it opens another
                 // connection to the db to update the SERVERS.last_seen
                 // attribute
-                try {
                     con.close();
-                } catch (Exception e) {
-                    throw e;
-                }
-                mrc = new MRCConnector(ip, username, password, port, protocol);
-                HashMap<String, ArrayList<Object>> DataList = new HashMap<String, ArrayList<Object>>();
+                MRCConnector mrc = new MRCConnector(ip, username, password, port, protocol);
+                HashMap<String, ArrayList<Long>> dataList = new HashMap<String, ArrayList<Long>>();
 
-                DataList.put(graphName1, new ArrayList<Object>());
+                dataList.put(graphName1, new ArrayList<Long>());
                 if ((dataName2 != null) && !dataName2.equals("time")
                         && !dataName2.equals("null") && !dataName2.equals("")) {
-                    DataList.put(graphName2, new ArrayList<Object>());
+                    dataList.put(graphName2, new ArrayList<Long>());
                 }
+                int snapCount;
                 if ((timeFrame / 1440 >= 30))
                     snapCount = 17;
                 else {
@@ -110,11 +112,11 @@
                         snapCount = 12;
                 }
 
-                ArrayList<Object> snapshot_time = new ArrayList<Object>();
+                ArrayList<Long> snapshot_time = new ArrayList<Long>();
 
-                ArrayList<Object> PrettyTime = new ArrayList<Object>();
+                ArrayList<Long> prettyTime = new ArrayList<Long>();
 
-                String prettyTimeFrame = new String();
+                String prettyTimeFrame;
                 DecimalFormat fmt = new DecimalFormat("0.##");
                 if (timeFrame / 60 > 24) {
                     prettyTimeFrame = fmt.format((float) (timeFrame / 1440))
@@ -143,7 +145,7 @@
                 }
                 // Check if snapshotList is empty
                 if (snapshotList1.size() == 0) {
-                    snapshotList1.put(System.currentTimeMillis(), new Long(0));
+                    snapshotList1.put(System.currentTimeMillis(), (long) 0);
                     /*
                      * If there are not enough snapshots available to fill the
                      * requested number, insert some with values of 0 and the
@@ -159,76 +161,70 @@
                         snapshotList1
                                 .put(
                                         (timeFix - (mrc.getSnapshotDuration() * skipCount)),
-                                        new Long(0));
+                                        (long) 0);
                     }
                 }
                 if (snapshotList2.size() == 0) {
-                    snapshotList2.put(System.currentTimeMillis(), new Long(0));
+                    snapshotList2.put(System.currentTimeMillis(), (long) 0);
                     while (snapshotList2.size() < snapCount) {
                         // Temporary, always is first element (oldest)
                         Long timeFix = snapshotList2.firstKey();
                         snapshotList2
                                 .put(
                                         (timeFix - (mrc.getSnapshotDuration() * skipCount)),
-                                        new Long(0));
+                                        (long) 0);
                     }
                 }
 
-                for (Iterator<Long> it = snapshotList1.keySet().iterator(); it
-                        .hasNext();) {
-                    Long current = it.next();
+                for (Long current : snapshotList1.keySet()) {
                     snapshot_time.add(current);
-                    ArrayList<Object> ArrayListTemp = DataList.get(graphName1);
+                    ArrayList<Long> ArrayListTemp = dataList.get(graphName1);
                     ArrayListTemp.add(snapshotList1.get(current));
-                    DataList.put(graphName1, ArrayListTemp);
                     if ((dataName2 != null) && !dataName2.equals("time")
                             && !dataName2.equals("null")
                             && !dataName2.equals("")) {
-                        ArrayList<Object> ArrayListTemp2 = DataList
-                                .get(graphName2);
+                        ArrayList<Long> ArrayListTemp2 = dataList.get(graphName2);
                         ArrayListTemp2.add(snapshotList2.get(current));
-                        DataList.put(graphName2, ArrayListTemp2);
                     }
-                    PrettyTime.add((Long) current / 1000);
+                    prettyTime.add(current / 1000);
                 }
 
                 if (dataName2.equals("time")) {
-                    graph = (new StatsGraph(graph_id, ip + " - " + xlabel
-                            + " - " + prettyTimeFrame, description, xlabel,
-                            ylabel, data1operation.charAt(0), DataList
-                                    .get(graphName1), operation, data2operation
-                                    .charAt(0), PrettyTime, snapshot_time,
-                            (int) (mrc.getSnapshotDuration() / 1000),
-                            timeFrame, color, warninglevel1, warninglevel1));
+                    statsGraph = new StatsGraph(graph,
+                            ip + " - " + xlabel + " - " + prettyTimeFrame,
+                            dataList.get(graphName1),
+                            prettyTime,
+                            snapshot_time,
+                            (int) (mrc.getSnapshotDuration() / 1000)
+                    );
                 } else if (!dataName2.equals("time") && (dataName2 != null)
                         && !dataName2.equals("null") && !dataName2.equals("")) {
-                    graph = (new StatsGraph(graph_id, ip + " - " + xlabel
-                            + " - " + prettyTimeFrame, description, xlabel,
-                            ylabel, data1operation.charAt(0), DataList
-                                    .get(graphName1), operation, data2operation
-                                    .charAt(0), DataList.get(graphName2),
+                    statsGraph = new StatsGraph(graph,
+                            ip + " - " + xlabel + " - " + prettyTimeFrame,
+                            dataList.get(graphName1),
+                            dataList.get(graphName2),
                             snapshot_time,
-                            (int) (mrc.getSnapshotDuration() / 1000),
-                            timeFrame, color, warninglevel1, warninglevel1));
+                            (int) (mrc.getSnapshotDuration() / 1000)
+                    );
                 } else if (dataName2 == null || dataName2.equals("null")
                         || dataName2.equals("")) {
-                    graph = (new StatsGraph(graph_id, ip + " - " + xlabel
-                            + " - " + prettyTimeFrame, description, xlabel,
-                            ylabel, data1operation.charAt(0), DataList
-                                    .get(graphName1), operation, snapshot_time,
-                            (int) (mrc.getSnapshotDuration() / 1000),
-                            timeFrame, color, warninglevel1, warninglevel1));
+                    statsGraph = new StatsGraph(graph,
+                            ip + " - " + xlabel + " - " + prettyTimeFrame,
+                            dataList.get(graphName1),
+                            snapshot_time,
+                            (int) (mrc.getSnapshotDuration() / 1000)
+                    );
                 } else {
                     System.out.println("Using Null call.");
-                    graph = (new StatsGraph());
+                    statsGraph = new StatsGraph();
                 }
             }
         }
 
         // check to see if graph was successfully populated
-        if (graph != null) {
+        if (statsGraph != null) {
             // get the current date
-            Format formatter = null;
+            Format formatter;
             formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             Date date = new Date(System.currentTimeMillis());
             String currentTime = formatter.format(date);
@@ -241,6 +237,6 @@
                     + "' WHERE GRAPH_ID=" + graph_id);
             conn.close();
         }
-        return graph;
+        return statsGraph;
     }
 }

Modified: geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java?rev=718393&r1=718392&r2=718393&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java (original)
+++ geronimo/server/trunk/plugins/monitoring/mconsole-war/src/main/java/org/apache/geronimo/monitoring/console/MRCConnector.java Mon Nov 17 13:37:30 2008
@@ -87,7 +87,6 @@
                 Context ic = new InitialContext(props);
                 mrc = (MasterRemoteControlRemote) ic
                         .lookup("ejb/mgmt/MRCRemote");
-                mrc.setUpMEJB(userName, password);
             } catch (Exception e) {
                 throw e;
             }