avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pro...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager MX4JSystemManager.java
Date Mon, 22 Jul 2002 20:06:56 GMT
proyal      2002/07/22 13:06:56

  Modified:    src/java/org/apache/avalon/phoenix/components/manager
                        MX4JSystemManager.java
  Log:
  Initial RMI support for MX4j System Manager.
  ObjectName's likely to change in future.
  
  Revision  Changes    Path
  1.11      +31 -0     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/MX4JSystemManager.java
  
  Index: MX4JSystemManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/MX4JSystemManager.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- MX4JSystemManager.java	15 Jul 2002 20:40:51 -0000	1.10
  +++ MX4JSystemManager.java	22 Jul 2002 20:06:56 -0000	1.11
  @@ -15,6 +15,9 @@
   import org.apache.avalon.framework.configuration.Configuration;
   import org.apache.avalon.framework.configuration.ConfigurationException;
   
  +import mx4j.adaptor.rmi.jrmp.JRMPAdaptorMBean;
  +import mx4j.util.StandardMBeanProxy;
  +
   /**
    * This component is responsible for managing phoenix instance.
    *
  @@ -30,6 +33,7 @@
           Integer.getInteger( "phoenix.adapter.http", 8082 ).intValue();
   
       private int m_port;
  +    private boolean m_rmi;
   
       public void initialize()
           throws Exception
  @@ -76,6 +80,32 @@
   
           // starts the server
           mBeanServer.invoke( adaptorName, "start", null, null );
  +
  +        if( m_rmi )
  +        {
  +            startRMIAdaptor( mBeanServer );
  +        }
  +    }
  +
  +    private void startRMIAdaptor( MBeanServer server ) throws Exception
  +    {
  +        // Create and start the naming service
  +        ObjectName naming = new ObjectName( "Naming:type=rmiregistry" );
  +        server.createMBean( "mx4j.tools.naming.NamingService", naming, null );
  +        server.invoke( naming, "start", null, null );
  +
  +        // Create the JRMP adaptor
  +        ObjectName adaptor = new ObjectName( "Adaptor:protocol=JRMP" );
  +        server.createMBean( "mx4j.adaptor.rmi.jrmp.JRMPAdaptor", adaptor, null );
  +        JRMPAdaptorMBean mbean =
  +            ( JRMPAdaptorMBean ) StandardMBeanProxy.create( JRMPAdaptorMBean.class,
  +                                                            server,
  +                                                            adaptor );
  +        // Set the JNDI name with which will be registered
  +        String jndiName = "jrmp";
  +        mbean.setJNDIName( jndiName );
  +        // Register the JRMP adaptor in JNDI and start it
  +        mbean.start();
       }
   
       public void configure( final Configuration configuration )
  @@ -83,6 +113,7 @@
       {
           m_port = configuration.getChild( "manager-adaptor-port" ).
                   getValueAsInteger( DEFAULT_HTTPADAPTER_PORT );
  +        m_rmi = configuration.getChild( "enable-rmi-adaptor" ).getValueAsBoolean( false
);
       }
   
       protected MBeanServer createMBeanServer()
  
  
  

--
To unsubscribe, e-mail:   <mailto:avalon-cvs-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:avalon-cvs-help@jakarta.apache.org>


Mime
View raw message