avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dona...@apache.org
Subject cvs commit: jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager HostedSystemManager.java
Date Sat, 21 Sep 2002 01:09:30 GMT
donaldp     2002/09/20 18:09:30

  Modified:    src/conf kernel.xml
  Added:       src/java/org/apache/avalon/phoenix/components/manager
                        HostedSystemManager.java
  Log:
  Incorporate the notion of HostedServiceManager that allows you to wire a SystemManager to
an existing MBeanServer.
  
  Revision  Changes    Path
  1.24      +13 -3     jakarta-avalon-phoenix/src/conf/kernel.xml
  
  Index: kernel.xml
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-phoenix/src/conf/kernel.xml,v
  retrieving revision 1.23
  retrieving revision 1.24
  diff -u -r1.23 -r1.24
  --- kernel.xml	21 Sep 2002 00:52:11 -0000	1.23
  +++ kernel.xml	21 Sep 2002 01:09:30 -0000	1.24
  @@ -22,11 +22,11 @@
               See http://mx4j.sourceforge.net/ -
   
                 org.apache.avalon.phoenix.components.manager.MX4JSystemManager
  -              
  +
               There is an impl of system manager that does nothing and it is....
  -            
  +
                 org.apache.avalon.phoenix.components.manager.NoopSystemManager
  -            
  +
               Alternatively, you could comment the whole SystemManager section out.
           -->
   
  @@ -49,6 +49,16 @@
             </user>
             -->
           </component>
  +
  +        <!--
  +        This SystemManager is useful when you are Running Phoenix in a system
  +        where a MBeanServer is already running. It will grab this MBeanServer and
  +        use it to manage Phoenix.
  +        <component role="org.apache.avalon.phoenix.interfaces.SystemManager"
  +            class="org.apache.avalon.phoenix.components.manager.HostedSystemManager"
  +            logger="manager" >
  +        </component>
  +        -->
   
           <!-- There are two kernels
             org.apache.avalon.phoenix.components.kernel.DefaultKernel
  
  
  
  1.1                  jakarta-avalon-phoenix/src/java/org/apache/avalon/phoenix/components/manager/HostedSystemManager.java
  
  Index: HostedSystemManager.java
  ===================================================================
  /*
   * Copyright (C) The Apache Software Foundation. All rights reserved.
   *
   * This software is published under the terms of the Apache Software License
   * version 1.1, a copy of which has been included with this distribution in
   * the LICENSE.txt file.
   */
  package org.apache.avalon.phoenix.components.manager;
  
  import java.io.File;
  import java.util.ArrayList;
  import javax.management.Attribute;
  import javax.management.MBeanServer;
  import javax.management.MBeanServerFactory;
  import javax.management.ObjectName;
  import org.apache.avalon.framework.configuration.Configurable;
  import org.apache.avalon.framework.configuration.Configuration;
  import org.apache.avalon.framework.configuration.ConfigurationException;
  import org.apache.avalon.framework.context.Context;
  import org.apache.avalon.framework.context.ContextException;
  import org.apache.avalon.framework.context.Contextualizable;
  
  /**
   * This is a hosted version of System Manager. It assumes
   * a MBeanServer is already running.
   *
   * @author <a href="mailto:sshort at postx.com">Steve Short</a>
   */
  public class HostedSystemManager
      extends AbstractJMXManager
      implements Contextualizable, Configurable
  {
      public void contextualize( Context context )
          throws ContextException
      {
      }
  
      public void configure( final Configuration configuration )
          throws ConfigurationException
      {
      }
  
      protected MBeanServer createMBeanServer()
          throws Exception
      {
          ArrayList serverList = MBeanServerFactory.findMBeanServer( null );
  
          if( serverList.size() == 0 )
          {
              getLogger().debug( "HostedSystemManager createMBeanServer no MBeanServer could
be found" );
              return null;
          }
  
          MBeanServer ms = (MBeanServer) serverList.get( 0 );
          getLogger().debug( "HostedSystemManager createMBeanServer \"" + ms + "\"" );
          return ms;
      }
  }
  
  
  

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