avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From giac...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager DefaultManager.java
Date Sun, 23 Jun 2002 18:45:02 GMT
giacomo     2002/06/23 11:45:02

  Modified:    src/java/org/apache/avalon/phoenix/components/manager
                        DefaultManager.java
  Log:
  made it compatible with the 1.1 JMX spec (and still usable with 1.0 ri impl) added the ability
to configure a 'manager-html-parser'
  
  Revision  Changes    Path
  1.26      +16 -7     jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/DefaultManager.java
  
  Index: DefaultManager.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/DefaultManager.java,v
  retrieving revision 1.25
  retrieving revision 1.26
  diff -u -r1.25 -r1.26
  --- DefaultManager.java	20 Jun 2002 14:13:29 -0000	1.25
  +++ DefaultManager.java	23 Jun 2002 18:45:02 -0000	1.26
  @@ -15,6 +15,7 @@
   import java.rmi.server.RemoteObject;
   import java.rmi.server.UnicastRemoteObject;
   import javax.management.MBeanServer;
  +import javax.management.MBeanServerFactory;
   import javax.management.MalformedObjectNameException;
   import javax.management.ObjectName;
   import org.apache.avalon.excalibur.i18n.ResourceManager;
  @@ -87,6 +88,15 @@
   
           try
           {
  +            final String htmlParserClass = m_configuration.getChild( "manager-html-parser"
).getValue( null );
  +            ObjectName parserName = null;
  +            if( null != htmlParserClass )
  +            {
  +                parserName = new ObjectName( "Adaptor:name=htmlParser" );
  +                System.out.println( "Created HTML Parser " + parserName );
  +                m_mBeanServer.createMBean( htmlParserClass, parserName );
  +            }
  +
               final int port = m_configuration.getChild( "manager-adaptor-port" ).getValueAsInteger(
DEFAULT_HTTPADAPTER_PORT );
               final HtmlAdaptorServer html =
                   new HtmlAdaptorServer( port );
  @@ -104,6 +114,10 @@
               final ObjectName name = new ObjectName( stringName );
               System.out.println( "Created HTML Adaptor " + name );
               m_mBeanServer.registerMBean( html, name );
  +            if( null != htmlParserClass )
  +            {
  +                html.setParser( parserName );
  +            }
               html.start();
           }
           catch( final Exception e )
  @@ -260,20 +274,15 @@
       private MBeanServer createMBeanServer()
           throws Exception
       {
  -        final String className =
  -            m_parameters.getParameter( "manager-mBeanServer-class",
  -                                       "com.sun.management.jmx.MBeanServerImpl" );
  -
           try
           {
  -            Thread.currentThread().setContextClassLoader( getClass().getClassLoader() );
  -            return (MBeanServer)Class.forName( className ).newInstance();
  +            return MBeanServerFactory.createMBeanServer();
           }
           catch( final Exception e )
           {
               final String message =
                   REZ.getString( "jmxmanager.error.mbeanserver.create",
  -                               className );
  +                               "MBeanServerFactory" );
               throw new ParameterException( message, e );
           }
       }
  
  
  

--
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