geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ecr...@apache.org
Subject svn commit: r599959 - in /geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor: ./ snapshot/
Date Fri, 30 Nov 2007 21:02:16 GMT
Author: ecraig
Date: Fri Nov 30 13:02:13 2007
New Revision: 599959

URL: http://svn.apache.org/viewvc?rev=599959&view=rev
Log:
GERONIMO-3660
monitoring collecting agent needs to have a local interface for the MRC
Patch by Viet Nguyen
Also deleted two no longer needed/relevant classes (SnapshotXMLBuilder 
and SnapshotThread)

Added:
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlLocal.java
Removed:
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotThread.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotXMLBuilder.java
Modified:
    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/snapshot/SnapshotProcessor.java

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=599959&r1=599958&r2=599959&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
Fri Nov 30 13:02:13 2007
@@ -39,6 +39,7 @@
 import javax.annotation.security.PermitAll;
 import javax.annotation.security.RolesAllowed;
 import javax.annotation.security.RunAs;
+import javax.ejb.Local;
 import javax.ejb.Remote;
 import javax.ejb.Stateless;
 import javax.ejb.Timeout;
@@ -83,6 +84,7 @@
  */
 @Stateless(name="ejb/mgmt/MRC")
 @Remote(MasterRemoteControlRemote.class)
+@Local(MasterRemoteControlLocal.class)
 @PermitAll
 public class MasterRemoteControl {
     private static Log log = LogFactory.getLog(MasterRemoteControl.class);

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlLocal.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlLocal.java?rev=599959&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlLocal.java
(added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlLocal.java
Fri Nov 30 13:02:13 2007
@@ -0,0 +1,79 @@
+package org.apache.geronimo.monitor;
+
+/**
+ *  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.
+ */
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Set;
+import java.util.TreeMap;
+
+import javax.annotation.security.RolesAllowed;
+import javax.ejb.Local;
+import javax.management.ObjectName;
+
+/**
+ * Local Interface for MasterRemoteControl. Defines the operations
+ * that are made available to the remote client.
+ */
+@Local
+public interface MasterRemoteControlLocal {
+    @RolesAllowed("mejbuser")
+    public HashMap<String, Long> getStats(String s) throws Exception;
+    @RolesAllowed("mejbadmin")
+    public void setAttribute(String s, String ss, Object o) throws Exception;
+    @RolesAllowed("mejbuser")
+    public boolean startSnapshot(Long l);
+    @RolesAllowed("mejbuser")
+    public boolean stopSnapshot();
+    @RolesAllowed("mejbuser")
+    public ArrayList<HashMap<String, HashMap<String, Object>>> fetchSnapshotData(Integer
i, Integer ii);
+    @RolesAllowed("mejbuser")
+    public HashMap<String, HashMap<String, Long>> fetchMaxSnapshotData(Integer
i);
+    @RolesAllowed("mejbuser")
+    public HashMap<String, HashMap<String, Long>> fetchMinSnapshotData(Integer
i);
+    @RolesAllowed("mejbuser")
+    public Long getSnapshotDuration();
+    @RolesAllowed("mejbuser")
+    public Long getSnapshotCount();
+    @RolesAllowed("mejbuser")
+    public void setSnapshotDuration(Long l);
+    @RolesAllowed("mejbuser")
+    public Set<String> getStatisticsProviderMBeanNames();
+    @RolesAllowed("mejbuser")
+    public Set<String> getAllMBeanNames();
+    @RolesAllowed("mejbuser")
+    public HashMap<String, ArrayList<String>> getAllSnapshotStatAttributes();
+    @RolesAllowed("mejbuser")
+    public boolean addMBeanForSnapshot(String s);
+    @RolesAllowed("mejbuser")
+    public boolean removeMBeanForSnapshot(String s);
+    @RolesAllowed("mejbuser")
+    public boolean isSnapshotRunning();
+    @RolesAllowed("mejbuser")
+    public void setUpMEJB(String username, String password);
+    @RolesAllowed("mejbadmin")
+    public Object invoke(ObjectName name, String operationName, Object[] params, String[]
signature);
+    @RolesAllowed("mejbuser")
+    public TreeMap<Long, Long> getSpecificStatistics(String mbeanName, String statsName,
int numberOfSnapshots, int everyNthSnapshot);
+    @RolesAllowed("mejbuser")
+    public Set<String> getTrackedMBeans();
+    @RolesAllowed("mejbuser")
+    public void setSnapshotRetention(int retention);
+    @RolesAllowed("mejbuser")
+    public String getSnapshotRetention();
+}

Modified: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotProcessor.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotProcessor.java?rev=599959&r1=599958&r2=599959&view=diff
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotProcessor.java
(original)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/snapshot/SnapshotProcessor.java
Fri Nov 30 13:02:13 2007
@@ -25,17 +25,13 @@
 
 import javax.naming.Context;
 import javax.naming.InitialContext;
-import javax.sql.DataSource;
-import javax.management.j2ee.Management;
-import javax.management.MBeanServer;
 import javax.management.MalformedObjectNameException;
 import javax.management.ObjectName;
 
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
-import org.apache.geronimo.monitor.snapshot.SnapshotXMLBuilder;
-import org.apache.geronimo.monitor.MasterRemoteControlRemote;
+import org.apache.geronimo.monitor.MasterRemoteControlLocal;
 import org.apache.geronimo.monitor.MBeanHelper;
 
 /**
@@ -59,7 +55,7 @@
         // get any saved mbean names from snapshot-config.xml
         ArrayList<String> mbeanNames = SnapshotConfigXMLBuilder.getMBeanNames();
         // get a handle on the mrc
-        MasterRemoteControlRemote mrc = getMRC(username, password);
+        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);
@@ -101,7 +97,7 @@
      * 
      * @param mbeanList
      */
-    private static void setStatsOn(ArrayList<String> mbeanList, MasterRemoteControlRemote
mrc) {
+    private static void setStatsOn(ArrayList<String> mbeanList, MasterRemoteControlLocal
mrc) {
         // for each mbean name in the list
         for(int i = 0; i < mbeanList.size(); i++) {
             // turn the statistics collection on
@@ -127,7 +123,7 @@
      * 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(MasterRemoteControlRemote
mrc) {
+    private static ArrayList<String> getDefaultMBeanList(MasterRemoteControlLocal mrc)
{
         Set<String> mbeans = MBeanHelper.getStatsProvidersMBeans( mrc.getAllMBeanNames()
);
         ArrayList<String> retval = new ArrayList<String>();
         for(Iterator it = mbeans.iterator(); it.hasNext(); ) {
@@ -169,19 +165,21 @@
     /**
      * @return An instance of a MRC. 
      */
-    public static MasterRemoteControlRemote getMRC(String username, String password) {
+    public static MasterRemoteControlLocal getMRC(String username, String password) {
         // TODO:
         //      Need to find a way to grab the MRC using LocalInitialContext
         //      so it can get through security and be more efficient.
         Properties props = new Properties();
-        props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
-        props.setProperty(Context.PROVIDER_URL, "127.0.0.1:4201");
+        props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.LocalInitialContextFactory");
+        
+//        props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.apache.openejb.client.RemoteInitialContextFactory");
+//        props.setProperty(Context.PROVIDER_URL, "127.0.0.1:4201");
         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);
-            MasterRemoteControlRemote mrc = (MasterRemoteControlRemote)ic.lookup("ejb/mgmt/MRCRemote");
+            MasterRemoteControlLocal mrc = (MasterRemoteControlLocal)ic.lookup("ejb/mgmt/MRCLocal");
             return mrc;
         } catch(Exception e) {
             return null;



Mime
View raw message