geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From akulshresh...@apache.org
Subject svn commit: r585796 - in /geronimo/sandbox/monitoring/mrc-server: ./ mrc-ear/src/main/resources/ mrc-ear/src/main/resources/META-INF/ mrc-ejb/src/main/java/org/apache/geronimo/monitor/ mrc-ejb/src/main/resources/ mrc-ejb/src/main/resources/META-INF/
Date Thu, 18 Oct 2007 02:36:27 GMT
Author: akulshreshtha
Date: Wed Oct 17 19:36:26 2007
New Revision: 585796

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

Added:
    geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/MonitorDBPool.xml  
(with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java
  (with props)
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/openejb-jar.xml
  (with props)
Removed:
    geronimo/sandbox/monitoring/mrc-server/mrc-server-ear-1.0-SNAPSHOT.ear
Modified:
    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/MasterRemoteControl.java
    geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/SMP.java

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=585796&r1=585795&r2=585796&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
Wed Oct 17 19:36:26 2007
@@ -24,11 +24,16 @@
 
     <environment xmlns="http://geronimo.apache.org/xml/ns/deployment-1.2">
         <moduleId>
-            <groupId>a</groupId>
-            <artifactId>a</artifactId>
-            <version>2.0-SNAPSHOT</version>
+            <groupId>${pom.groupId}</groupId>
+            <artifactId>${pom.artifactId}</artifactId>
+            <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>
+    
 </application>

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/MonitorDBPool.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/MonitorDBPool.xml?rev=585796&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/MonitorDBPool.xml (added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ear/src/main/resources/MonitorDBPool.xml Wed
Oct 17 19:36:26 2007
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<connector xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.1">
+	<dep:environment xmlns:dep="http://geronimo.apache.org/xml/ns/deployment-1.1">
+        <dep:moduleId>
+            <dep:groupId>console.dbpool</dep:groupId>
+            <dep:artifactId>MonitoringDBPools</dep:artifactId>
+            <dep:version>1.0</dep:version>
+            <dep:type>rar</dep:type>
+        </dep:moduleId>
+        <dep:dependencies>
+            <dep:dependency>
+                <dep:groupId>org.apache.geronimo.configs</dep:groupId>
+                <dep:artifactId>system-database</dep:artifactId>
+                <dep:version>2.1-SNAPSHOT</dep:version>
+                <dep:type>car</dep:type>
+            </dep:dependency>
+        </dep:dependencies>
+    </dep:environment>
+    <resourceadapter>
+        <outbound-resourceadapter>
+            <!-- Pool for Active Statisitcs -->
+            <connection-definition>
+                <connectionfactory-interface>javax.sql.DataSource</connectionfactory-interface>
+                <connectiondefinition-instance>
+                    <name>ActiveDBPool</name>
+                    <config-property-setting name="Password">monitor</config-property-setting>
+                    <config-property-setting name="UserName">monitor</config-property-setting>
+                    <config-property-setting name="ConnectionURL">jdbc:derby:ActiveDB;create=true</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>ArchiveDBPool</name>
+                    <config-property-setting name="Password">monitor</config-property-setting>
+                    <config-property-setting name="ConnectionURL">jdbc:derby:ArchiveDB;create=true</config-property-setting>
+                    <config-property-setting name="UserName">monitor</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-ear/src/main/resources/MonitorDBPool.xml
------------------------------------------------------------------------------
    svn:eol-style = native

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

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

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=585796&r1=585795&r2=585796&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
Wed Oct 17 19:36:26 2007
@@ -19,8 +19,14 @@
 import java.util.ArrayList;
 import java.util.HashMap;
 import java.util.HashSet;
+import java.util.Properties;
 import java.util.Set;
 
+import javax.annotation.security.RolesAllowed;
+import javax.annotation.security.RunAs;
+import javax.ejb.Remote;
+import javax.ejb.Stateful;
+
 import javax.management.Attribute;
 import javax.management.MBeanServer;
 import javax.management.MBeanServerFactory;
@@ -51,11 +57,16 @@
 import org.apache.geronimo.monitor.snapshot.SnapshotThread;
 import org.apache.geronimo.monitor.snapshot.SnapshotXMLBuilder;
 import org.apache.geronimo.monitor.snapshot.SnapshotConfigXMLBuilder; 
+
 /**
- * This is the GBean that will be the bottleneck for the communication
+ * This is a Stateful Session Bean that will be the bottleneck for the communication
  * between the management node and the data in the server node.
  */
-public class MasterRemoteControl implements GBeanLifecycle {
+@RolesAllowed("mejbadmin")
+@Stateful(name="ejb/mgmt/MRC")
+@Remote(MasterRemoteControlRemote.class)
+@RunAs("mejbadmin")
+public class MasterRemoteControl {
     // constants
     private static final String GERONIMO_DEFAULT_DOMAIN = "geronimo";
     private static final Long DEFAULT_DURATION = new Long(300000);
@@ -91,12 +102,28 @@
         if(mbServer == null) {
             mbServer = MBeanServerFactory.createMBeanServer(GERONIMO_DEFAULT_DOMAIN);
         }
-        // instantiate the MEJB, which will be out gateway to communicate to MBeans
-        
-        
         // instantiate teh mbean helper to query mbean names
         mbeanHelper = new MBeanHelper();
     }
+
+    @RolesAllowed("mejbadmin")
+    public void setUpMEJB() {
+        // instantiate the MEJB, which will be our gateway to communicate to MBeans
+        try {
+            Properties p = new Properties();
+            p.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.openejb.client.LocalInitialContextFactory");
+            InitialContext ctx = new InitialContext(p);
+
+            ManagementHome mejbHome = (ManagementHome)ctx.lookup("ejb/mgmt/MEJBRemoteHome");
+            mejb = mejbHome.create();
+            // Uncomment to see if mejb is working well
+            //System.out.println("SUCCESS!");
+            //System.out.println("MEJB Default Domain: " + mejb.getDefaultDomain());
+            //System.out.println("MEJB Count: " + mejb.getMBeanCount());
+        } catch(Exception e) {
+            e.printStackTrace();
+        }
+    }
     
     /**
      * Looks up the JSR-77 statistics associated with this object name.
@@ -105,6 +132,7 @@
      * @return HashMap
      * @throws Exception
      */
+    @RolesAllowed("mejbadmin")
     public static HashMap getStats(String objectName) throws Exception {
         HashMap statsMap = new HashMap();
         Stats stats = (Stats)mejb.getAttribute(new ObjectName(objectName), "stats");
@@ -155,6 +183,7 @@
      * @param attrValue
      * @throws Exception
      */
+    @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);
@@ -168,6 +197,7 @@
      * 
      * @param interval
      */
+    @RolesAllowed("mejbadmin")
     public boolean startSnapshot(Long interval) {
         if((snapshotThread == null || (snapshotThread != null && !snapshotThread.isAlive()))
&&
                 interval.longValue() > 0) {
@@ -184,6 +214,7 @@
     /**
      * Stops the snapshot thread
      */
+    @RolesAllowed("mejbadmin")
     public boolean stopSnapshot() {
         if(snapshotThread != null) {
             if(snapshotThread.getSnapshotDuration() == Long.MAX_VALUE) {
@@ -214,6 +245,7 @@
      * @param everyNthSnapshot
      * @return ArrayList
      */ 
+    @RolesAllowed("mejbadmin")
     public ArrayList fetchSnapshotData(Integer numberOfSnapshot, Integer everyNthSnapshot)
{
         SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
         snapshotXMLBuilder.openDocument();
@@ -229,6 +261,7 @@
      * @param numberOfSnapshot
      * @return HashMap
      */
+    @RolesAllowed("mejbadmin")
     public HashMap fetchMaxSnapshotData(Integer numberOfSnapshot) {
         SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
         snapshotXMLBuilder.openDocument();
@@ -244,6 +277,7 @@
      * @param numberOfSnapshot
      * @return HashMap
      */
+    @RolesAllowed("mejbadmin")
     public HashMap fetchMinSnapshotData(Integer numberOfSnapshot) {
         SnapshotXMLBuilder snapshotXMLBuilder = new SnapshotXMLBuilder();
         snapshotXMLBuilder.openDocument();
@@ -257,6 +291,7 @@
      * 
      * @return Long
      */
+    @RolesAllowed("mejbadmin")
     public Long getSnapshotDuration() {
         if(snapshotThread != null) {
             return new Long(snapshotThread.getSnapshotDuration());
@@ -270,6 +305,7 @@
      * 
      * @param snapshotDuration
      */
+    @RolesAllowed("mejbadmin")
     public void setSnapshotDuration(Long snapshotDuration) {
         if(snapshotThread != null) {
             snapshotThread.setSnapshotDuration(snapshotDuration.longValue());
@@ -279,6 +315,7 @@
         }
     }
     
+    @RolesAllowed("mejbadmin")
     public Long getSnapshotCount() {
         return SnapshotXMLBuilder.getSnapshotCount();
     }
@@ -289,6 +326,7 @@
      * @return A set containing all mbean names of mbeans that provide
      * statistics
      */
+    @RolesAllowed("mejbadmin")
     public Set<ObjectName> getStatisticsProviderMBeanNames() {
         return mbeanHelper.getStatsProvidersMBeans( getAllMBeanNames() );
     }
@@ -298,6 +336,7 @@
      * 
      * @return A set containing all mbean names
      */
+    @RolesAllowed("mejbadmin")
     public Set<ObjectName> getAllMBeanNames() {
         try {
             return (Set<ObjectName>)mejb.queryNames(null, null);
@@ -328,10 +367,12 @@
         stopSnapshot();
     }
     
+    @RolesAllowed("mejbadmin")
     private void saveDuration(long duration) {
         SnapshotConfigXMLBuilder.save(duration);
     }
     
+    @RolesAllowed("mejbadmin")
     private Long fetchSnapshotDuration() {
         final String DURATION = "duration";
         try {
@@ -348,6 +389,7 @@
      * 
      * @param mbeanName
      */
+    @RolesAllowed("mejbadmin")
     public void addMBeanForSnapshot(String mbeanName) {
         SnapshotConfigXMLBuilder.addMBeanName(mbeanName);
         snapshotThread.addMBeanForSnapshot(mbeanName);
@@ -359,6 +401,7 @@
      * 
      * @param mbeanName
      */
+    @RolesAllowed("mejbadmin")
     public void removeMBeanForSnapshot(String mbeanName) {
         SnapshotConfigXMLBuilder.removeMBeanName(mbeanName);
         snapshotThread.removeMBeanForSnapshot(mbeanName);
@@ -367,6 +410,7 @@
     /**
      * @return A map: mbeanName --> ArrayList of statistic attributes for that mbean
      */
+    @RolesAllowed("mejbadmin")
     public HashMap<String, ArrayList<String>> getAllSnapshotStatAttributes()
{
         return SnapshotXMLBuilder.getAllSnapshotStatAttributes();
     }
@@ -374,36 +418,9 @@
     /**
      * @return Returns true if snapshot is running.
      */
+    @RolesAllowed("mejbadmin")
     public boolean isSnapshotRunning() {
         // snapshot is running when the duration is not infinity
         return !snapshotThread.getEnd();
-    }
-
-    public static final GBeanInfo GBEAN_INFO;
-
-    static {
-        GBeanInfoBuilder infoFactory = GBeanInfoBuilder.createStatic("MasterRemoteControl",
MasterRemoteControl.class);
-        infoFactory.addOperation("getStats", new Class[] {String.class}, "HashMap");
-        infoFactory.addOperation("setAttribute", new Class[] {String.class, String.class,
Object.class}, "void");
-        infoFactory.addOperation("startSnapshot", new Class[] {Long.class}, "boolean");
-        infoFactory.addOperation("stopSnapshot", new Class[] {}, "boolean");
-        infoFactory.addOperation("fetchSnapshotData", new Class[] {Integer.class, Integer.class},
"ArrayList");
-        infoFactory.addOperation("fetchMaxSnapshotData", new Class[] {Integer.class}, "HashMap");
-        infoFactory.addOperation("fetchMinSnapshotData", new Class[] {Integer.class}, "HashMap");
-        infoFactory.addOperation("getSnapshotDuration", new Class[] {}, "Long");
-        infoFactory.addOperation("getSnapshotCount", new Class[] {}, "Long");
-        infoFactory.addOperation("setSnapshotDuration", new Class[] {Long.class}, "void");
-        infoFactory.addOperation("getStatisticsProviderMBeanNames", new Class[] {}, "Set");
-        infoFactory.addOperation("getAllMBeanNames", new Class[] {}, "Set");
-        infoFactory.addOperation("getAllSnapshotStatAttributes", new Class[] {}, "HashMap");
-        infoFactory.addOperation("addMBeanForSnapshot", new Class[] {String.class}, "void");
-        infoFactory.addOperation("removeMBeanForSnapshot", new Class[] {String.class}, "void");
-        infoFactory.addOperation("isSnapshotRunning", new Class[] {}, "boolean");
-        infoFactory.setConstructor(new String[] {});
-        GBEAN_INFO = infoFactory.getBeanInfo();
-    }
-
-    public static GBeanInfo getGBeanInfo() {
-        return GBEAN_INFO;
     }
 }

Added: 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=585796&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java
(added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/java/org/apache/geronimo/monitor/MasterRemoteControlRemote.java
Wed Oct 17 19:36:26 2007
@@ -0,0 +1,69 @@
+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 javax.annotation.security.RolesAllowed;
+import javax.ejb.Remote;
+
+/**
+ * Remote Interface for MasterRemoteControl. Defines the operations
+ * that are made available to the remote client.
+ */
+@Remote
+public interface MasterRemoteControlRemote {
+
+    @RolesAllowed("mejbadmin")
+    public HashMap getStats(String s) throws Exception;
+    @RolesAllowed("mejbadmin")
+    public void setAttribute(String s, String ss, Object o) throws Exception;
+    @RolesAllowed("mejbadmin")
+    public boolean startSnapshot(Long l);
+    @RolesAllowed("mejbadmin")
+    public boolean stopSnapshot();
+    @RolesAllowed("mejbadmin")
+    public ArrayList fetchSnapshotData(Integer i, Integer ii);
+    @RolesAllowed("mejbadmin")
+    public HashMap fetchMaxSnapshotData(Integer i);
+    @RolesAllowed("mejbadmin")
+    public HashMap fetchMinSnapshotData(Integer i);
+    @RolesAllowed("mejbadmin")
+    public Long getSnapshotDuration();
+    @RolesAllowed("mejbadmin")
+    public Long getSnapshotCount();
+    @RolesAllowed("mejbadmin")
+    public void setSnapshotDuration(Long l);
+    @RolesAllowed("mejbadmin")
+    public Set getStatisticsProviderMBeanNames();
+    @RolesAllowed("mejbadmin")
+    public Set getAllMBeanNames();
+    @RolesAllowed("mejbadmin")
+    public HashMap getAllSnapshotStatAttributes();
+    @RolesAllowed("mejbadmin")
+    public void addMBeanForSnapshot(String s);
+    @RolesAllowed("mejbadmin")
+    public void removeMBeanForSnapshot(String s);
+    @RolesAllowed("mejbadmin")
+    public boolean isSnapshotRunning();
+    @RolesAllowed("mejbadmin")
+    public void setUpMEJB();
+
+}

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

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

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

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=585796&r1=585795&r2=585796&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
Wed Oct 17 19:36:26 2007
@@ -21,6 +21,7 @@
 import java.util.Iterator;
 import java.util.HashMap;
 import java.util.Hashtable;
+import java.util.Properties;
 import java.util.Set;
 
 import javax.management.MBeanServerConnection;
@@ -32,15 +33,22 @@
 import javax.management.remote.JMXServiceURL;
 import javax.management.remote.JMXConnector;
 import javax.management.remote.JMXConnectorFactory;
+import javax.naming.Context;
+import javax.naming.InitialContext;
 
 import org.apache.geronimo.gbean.AbstractName;
 import org.apache.geronimo.management.stats.StatisticImpl;
+import org.apache.geronimo.monitor.MasterRemoteControlRemote;
+
+import javax.management.j2ee.ManagementHome;
+import javax.management.j2ee.Management;
 
 public class SMP {
     private static final String PATH = "geronimo:ServiceModule=org.apache.geronimo.monitor/MRC/1.0/car,J2EEServer=geronimo,name=MasterRemoteControl,j2eeType=GBean";
     
     public static void main(String[] args) {
         try {
+        /*
             JMXServiceURL serviceURL = new JMXServiceURL("service:jmx:rmi:///jndi/rmi://localhost:1099/JMXConnector");
             Hashtable env = new Hashtable();
             String[] credentials = new String[2];
@@ -60,13 +68,13 @@
 //            updateMaxSpareThread(mbServerConn);
 //            printMaxSpareThread(mbServerConn);
 //            testThreadPoolControl(mbServerConn);
-            /*
+            
             try {
                 testSnapshotThread(mbServerConn, 5000);
             } catch(Exception e) { 
                 System.out.println(e.getMessage());
             }
-            */
+            
             testSnapshotThreadStop(mbServerConn);
             System.out.println("Stopped");
             Thread.sleep(1000);
@@ -84,7 +92,24 @@
 //            testSetSnapshotDuration(mbServerConn, new Long(60000));
 //            testRemoveMBeanToSnapshot(mbServerConn);
 //            testGetStatsAttr(mbServerConn);
-            
+            */
+//            MasterRemoteControl mrc;
+            Properties props = new Properties();
+            props.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.openejb.client.RemoteInitialContextFactory");
+            props.setProperty(Context.PROVIDER_URL, "127.0.0.1:4201");
+            props.setProperty(Context.SECURITY_PRINCIPAL, "system");
+            props.setProperty(Context.SECURITY_CREDENTIALS, "manager");
+            props.setProperty("openejb.authentication.realmName", "geronimo-admin");
+            Context ic = new InitialContext(props);
+            System.out.println("Success: Initialized InitialContext");
+            MasterRemoteControlRemote o = (MasterRemoteControlRemote)ic.lookup("ejb/mgmt/MRCRemote");
+            System.out.println("Success: look up MRCRemote");
+            o.setUpMEJB();
+            System.out.println("Success: setUpMEJB");
+            //nagementHome o = (ManagementHome)ic.lookup("ejb/mgmt/MEJBRemoteHome");
+            //Management m = o.create();
+            System.out.println(o);
+            //System.out.println(m.getDefaultDomain());
         } catch (Exception e) {
             e.printStackTrace();
         }

Added: geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/openejb-jar.xml
URL: http://svn.apache.org/viewvc/geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/openejb-jar.xml?rev=585796&view=auto
==============================================================================
--- geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/openejb-jar.xml
(added)
+++ geronimo/sandbox/monitoring/mrc-server/mrc-ejb/src/main/resources/META-INF/openejb-jar.xml
Wed Oct 17 19:36:26 2007
@@ -0,0 +1,56 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<openejb-jar
+        xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1"
+        xmlns:nam="http://geronimo.apache.org/xml/ns/naming-1.1" 
+        xmlns:pkgen="http://www.openejb.org/xml/ns/pkgen-2.0" 
+        xmlns:sec="http://geronimo.apache.org/xml/ns/security-1.1" 
+        xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.2">
+
+    <sys:environment>
+        <sys:moduleId>
+            <sys:groupId>org.apache.geronimo.plugins</sys:groupId>
+            <sys:artifactId>MRCRemote</sys:artifactId>
+            <sys:version>1.0</sys:version>
+            <sys:type>car</sys:type>
+        </sys:moduleId>
+
+        <dependencies>
+            <dependency>
+                <groupId>org.apache.geronimo.configs</groupId>
+                <artifactId>mejb</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>
+        </dependencies>
+    </sys:environment>
+
+    <enterprise-beans>
+        <session>
+            <ejb-name>ejb/mgmt/MRC</ejb-name>
+            <jndi-name>ejb/mgmt/MRC</jndi-name>
+        </session>
+    </enterprise-beans>
+
+    <security xmlns="http://geronimo.apache.org/xml/ns/security-2.0">
+        <role-mappings>
+            <role role-name="mejbuser">
+                <principal name="admin"
+                    class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+                <principal name="mejb-admin"
+                    class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+            </role>
+
+            <role role-name="mejbadmin">
+                <principal name="mejb-admin"
+                    class="org.apache.geronimo.security.realm.providers.GeronimoGroupPrincipal"/>
+            </role>
+        </role-mappings>
+    </security>
+</openejb-jar>

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

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

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



Mime
View raw message