geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/log4j Log4jService.java Log4jSocketServer.java
Date Tue, 30 Dec 2003 21:17:14 GMT
djencks     2003/12/30 13:17:14

  Modified:    modules/core/src/java/org/apache/geronimo/core/logging
                        AbstractLoggingService.java LoggingService.java
               modules/core/src/java/org/apache/geronimo/core/logging/log4j
                        Log4jService.java Log4jSocketServer.java
  Log:
  convert logging classes to geronimo mbeans
  
  Revision  Changes    Path
  1.4       +53 -28    incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/AbstractLoggingService.java
  
  Index: AbstractLoggingService.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/AbstractLoggingService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- AbstractLoggingService.java	8 Sep 2003 04:24:49 -0000	1.3
  +++ AbstractLoggingService.java	30 Dec 2003 21:17:14 -0000	1.4
  @@ -57,13 +57,16 @@
   package org.apache.geronimo.core.logging;
   
   import java.net.URL;
  -
   import java.util.Timer;
   
   import org.apache.geronimo.common.NullArgumentException;
   import org.apache.geronimo.common.task.URLMonitorTask;
  -
  -import org.apache.geronimo.kernel.service.AbstractManagedObject;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
   
   /**
    * An abstract logging service.
  @@ -73,24 +76,23 @@
    * @version $Revision$ $Date$
    */
   public abstract class AbstractLoggingService
  -    extends AbstractManagedObject
  -    implements LoggingService
  +    implements LoggingService, GeronimoMBeanTarget
   {
       /** The default refresh period (60 seconds) */
       public static final int DEFAULT_REFRESH_PERIOD = 60;
  -    
  +
       /** The URL to the configuration file. */
       protected URL configURL;
  -    
  +
       /** The time (in seconds) between checking for new config. */
       protected int refreshPeriod;
  -    
  +
       /** The URL watch timer (in daemon mode). */
       protected Timer timer = new Timer(true);
  -    
  +
       /** A monitor to check when the config URL changes. */
       protected URLMonitorTask monitor;
  -    
  +
       /**
        * Initialize <code>AbstractLoggingService</code>.
        *
  @@ -102,7 +104,7 @@
           setRefreshPeriod(period);
           setConfigurationURL(url);
       }
  -    
  +
       /**
        * Initialize <code>AbstractLoggingService</code> using the default
        * refresh period.
  @@ -113,46 +115,50 @@
       {
           this(url, DEFAULT_REFRESH_PERIOD);
       }
  -    
  +
       public int getRefreshPeriod()
       {
           return refreshPeriod;
       }
  -    
  +
       public void setRefreshPeriod(final int period)
       {
           if (period < 1) {
               throw new IllegalArgumentException("Refresh period must be > 0");
           }
  -        
  +
           this.refreshPeriod = period;
       }
  -    
  +
       public URL getConfigurationURL()
       {
           return configURL;
       }
  -    
  +
       public void setConfigurationURL(final URL url)
       {
           if (url == null) {
               throw new NullArgumentException("url");
           }
  -        
  +
           this.configURL = url;
       }
  -    
  +
       public void reconfigure()
       {
           configure(configURL);
       }
  -    
  -    
  -    ///////////////////////////////////////////////////////////////////////////
  -    //                         AbstractManagedObject                         //
  -    ///////////////////////////////////////////////////////////////////////////
  -    
  -    protected void doStart() throws Exception
  +
  +
  +    //GeronimoMBeanTarget
  +    public void setMBeanContext(GeronimoMBeanContext context) {
  +    }
  +
  +    public boolean canStart() {
  +        return true;
  +    }
  +
  +    public void doStart()
       {
           monitor = new URLMonitorTask(configURL);
           monitor.addListener(new URLMonitorTask.Listener() {
  @@ -163,10 +169,29 @@
           monitor.run();
           timer.schedule(monitor, 1000 * refreshPeriod, 1000 * refreshPeriod);
       }
  -    
  -    protected void doStop() throws Exception
  +
  +    public void doStop()
       {
           monitor.cancel();
           monitor = null;
       }
  +
  +    public boolean canStop() {
  +        return true;
  +    }
  +
  +    public void doFail() {
  +    }
  +
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
  +        //set class in caller
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("RefreshPeriod", true, true,
"Period in seconds at which configuration refreshes"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("ConfigurationURL", true,
true, "Location of the logging configuration"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("reconfigure", new GeronimoParameterInfo[]
{}, GeronimoOperationInfo.ACTION, "reconfigure now from previously set url"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("configure",
  +                new GeronimoParameterInfo[] {new GeronimoParameterInfo("url", URL.class,
"URL to read configuration from")}, GeronimoOperationInfo.ACTION, "configure now from supplied
url"));
  +        return mbeanInfo;
  +    }
  +
   }
  
  
  
  1.3       +6 -15     incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/LoggingService.java
  
  Index: LoggingService.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/LoggingService.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoggingService.java	8 Sep 2003 04:24:49 -0000	1.2
  +++ LoggingService.java	30 Dec 2003 21:17:14 -0000	1.3
  @@ -63,23 +63,19 @@
    *
    * <p>Currently assumes URL based configuration.
    *
  - * @jmx:mbean
  - *      extends="org.apache.geronimo.kernel.management.StateManageable, org.apache.geronimo.kernel.management.ManagedObject"
    *
    * @version $Revision$ $Date$
    */
   public interface LoggingService
  -    extends LoggingServiceMBean
   {
       /**
        * Get the refresh period.
        *
        * @return The refresh period (in seconds).
        *
  -     * @jmx:managed-attribute
        */
       int getRefreshPeriod();
  -    
  +
       /**
        * Set the refresh period.
        *
  @@ -87,41 +83,36 @@
        *
        * @throws IllegalArgumentException     Refresh period must be > 0
        *
  -     * @jmx:managed-attribute
        */
       void setRefreshPeriod(int period);
  -    
  +
       /**
        * Get the logging configuration URL.
        *
        * @return The logging configuration URL.
        *
  -     * @jmx:managed-attribute
        */
       URL getConfigurationURL();
  -    
  +
       /**
        * Set the logging configuration URL.
        *
        * @param url   The logging configuration URL.
        *
  -     * @jmx:managed-attribute
        */
       void setConfigurationURL(URL url);
  -    
  +
       /**
        * Force the logging system to reconfigure.
        *
  -     * @jmx:managed-operation
        */
       void reconfigure();
  -    
  +
       /**
        * Force the logging system to configure from the given URL.
        *
        * @param url   The URL to configure the logging system from.
        *
  -     * @jmx:managed-operation
        */
       void configure(URL url);
   }
  
  
  
  1.4       +43 -42    incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/log4j/Log4jService.java
  
  Index: Log4jService.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/log4j/Log4jService.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Log4jService.java	8 Sep 2003 04:24:49 -0000	1.3
  +++ Log4jService.java	30 Dec 2003 21:17:14 -0000	1.4
  @@ -58,61 +58,54 @@
   
   import java.net.URL;
   
  -import org.apache.log4j.Level;
  -import org.apache.log4j.Logger;
  -
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -
   import org.apache.geronimo.common.NullArgumentException;
  -
  +import org.apache.geronimo.common.log.log4j.URLConfigurator;
   import org.apache.geronimo.common.propertyeditor.PropertyEditors;
   import org.apache.geronimo.common.propertyeditor.TextPropertyEditorSupport;
  -
  -import org.apache.geronimo.kernel.log.XLevel;
  -import org.apache.geronimo.common.log.log4j.URLConfigurator;
  -
   import org.apache.geronimo.core.logging.AbstractLoggingService;
  +import org.apache.geronimo.kernel.log.XLevel;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
  +import org.apache.log4j.Level;
  +import org.apache.log4j.Logger;
   
   /**
    * A Log4j logging service.
    *
  - * @jmx:mbean
  - *      extends="org.apache.geronimo.core.logging.LoggingServiceMBean"
    *
    * @version $Revision$ $Date$
    */
   public class Log4jService
       extends AbstractLoggingService
  -    implements Log4jServiceMBean
   {
       private static final Log log = LogFactory.getLog(Log4jService.class);
  -    
  +
       /**
        * Construct a <code>Log4jService</code>.
  -     * 
  +     *
        * @param url       The configuration URL.
        * @param period    The refresh period (in seconds).
        *
  -     * @jmx:managed-constructor
        */
       public Log4jService(final URL url, final int period)
       {
           super(url, period);
       }
  -    
  +
       /**
        * Construct a <code>Log4jService</code>.
  -     * 
  +     *
        * @param url   The configuration URL.
        *
  -     * @jmx:managed-constructor
        */
       public Log4jService(final URL url)
       {
           super(url);
       }
  -    
  +
       /**
        * Force the logging system to configure from the given URL.
        *
  @@ -123,15 +116,15 @@
           if (url == null) {
               throw new NullArgumentException("url");
           }
  -        
  +
           URLConfigurator.configure(url);
       }
  -    
  -    
  +
  +
       ///////////////////////////////////////////////////////////////////////////
       //                    Log4j Level Accessors & Mutators                   //
       ///////////////////////////////////////////////////////////////////////////
  -    
  +
       /**
        * A property editor for Log4j Levels.
        */
  @@ -143,7 +136,7 @@
               return XLevel.toLevel(getAsText().trim());
           }
       }
  -    
  +
       /**
        * A property editor for Log4j Loggers.
        */
  @@ -155,21 +148,20 @@
               return Logger.getLogger(getAsText().trim());
           }
       }
  -    
  +
       /** Install property editors for Logger and Level. */
       static
       {
           PropertyEditors.registerEditor(Logger.class, LoggerEditor.class);
           PropertyEditors.registerEditor(Level.class, LevelEditor.class);
       }
  -    
  +
       /**
        * Sets the level for a logger of the give name.
        *
        * @param logger    The logger to change level
        * @param level     The level to change the logger to.
        *
  -     * @jmx:managed-operation
        */
       public void setLoggerLevel(final Logger logger, final Level level)
       {
  @@ -179,43 +171,52 @@
           if (level == null) {
               throw new NullArgumentException("level");
           }
  -        
  +
           logger.setLevel(level);
           log.info("Changed logger '" + logger.getName() + "' level: " + level);
       }
  -    
  +
       /**
        * Gets the level of the logger of the give name.
        *
        * @param logger    The logger to inspect.
        *
  -     * @jmx:managed-operation
        */
       public String getLoggerLevel(final Logger logger)
       {
           if (logger == null) {
               throw new NullArgumentException("logger");
           }
  -        
  +
           Level level = logger.getLevel();
  -        
  +
           if (level != null) {
               return level.toString();
           }
  -        
  +
           return null;
       }
  -    
  -    
  -    ///////////////////////////////////////////////////////////////////////////
  -    //                         AbstractManagedObject                         //
  -    ///////////////////////////////////////////////////////////////////////////
  -    
  -    protected void doStart() throws Exception
  +
  +
  +    //GeronimoMBeanTarget
  +    public void doStart()
       {
           super.doStart();
  -        
  +
           // Make sure the root Logger has loaded
           Logger.getRootLogger();
  +    }
  +
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        GeronimoMBeanInfo mbeanInfo = AbstractLoggingService.getGeronimoMBeanInfo();
  +        mbeanInfo.setTargetClass(Log4jService.class.getName());
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("setLoggerLevel", new GeronimoParameterInfo[]
{
  +            new GeronimoParameterInfo("logger", Logger.class, "Logger to configure"),
  +            new GeronimoParameterInfo("level", Level.class, "Level to set the Logger to")},
  +                GeronimoOperationInfo.ACTION, "Configure the logger to the level"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getLoggerLevel", new GeronimoParameterInfo[]
{
  +            new GeronimoParameterInfo("logger", Logger.class, "Logger to configure")},
  +                GeronimoOperationInfo.INFO, "Get the level the logger is configured to"));
  +        return mbeanInfo;
       }
   }
  
  
  
  1.3       +106 -115  incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/log4j/Log4jSocketServer.java
  
  Index: Log4jSocketServer.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/core/logging/log4j/Log4jSocketServer.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Log4jSocketServer.java	8 Sep 2003 04:24:49 -0000	1.2
  +++ Log4jSocketServer.java	30 Dec 2003 21:17:14 -0000	1.3
  @@ -56,18 +56,22 @@
   
   package org.apache.geronimo.core.logging.log4j;
   
  -import java.net.Socket;
  -import java.net.ServerSocket;
  +import java.io.IOException;
   import java.net.InetAddress;
  +import java.net.ServerSocket;
  +import java.net.Socket;
   
   import org.apache.commons.logging.Log;
   import org.apache.commons.logging.LogFactory;
  -
  +import org.apache.geronimo.kernel.service.GeronimoAttributeInfo;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanContext;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanInfo;
  +import org.apache.geronimo.kernel.service.GeronimoMBeanTarget;
  +import org.apache.geronimo.kernel.service.GeronimoOperationInfo;
  +import org.apache.geronimo.kernel.service.GeronimoParameterInfo;
   import org.apache.log4j.LogManager;
  -import org.apache.log4j.spi.LoggerRepository;
   import org.apache.log4j.net.SocketNode;
  -
  -import org.apache.geronimo.kernel.service.AbstractManagedObject;
  +import org.apache.log4j.spi.LoggerRepository;
   
   /**
    * A Log4j SocketServer service.  Listens for client connections on the
  @@ -79,142 +83,97 @@
    * by using a custom LoggerRepositoryFactory.  The default factory
    * will simply return the current repository.
    *
  - * @jmx:mbean
  - *      extends="org.apache.geronimo.kernel.management.StateManageable,org.apache.geronimo.kernel.management.ManagedObject"
    *
    * @version $Revision$ $Date$
    */
  -public class Log4jSocketServer
  -    extends AbstractManagedObject
  -    implements Log4jSocketServerMBean
  -{
  +public class Log4jSocketServer implements GeronimoMBeanTarget {
       /** The port number where the server listens. */
       protected int port = -1;
  -    
  +
       /** The listen backlog count. */
       protected int backlog = 50;
  -    
  +
       /** The address to bind to. */
       protected InetAddress bindAddress;
  -    
  +
       /** True if the socket listener is enabled. */
       protected boolean listenerEnabled = true;
  -    
  +
       /** The socket listener thread. */
       protected SocketListenerThread listenerThread;
  -    
  +
       /** The server socket which the listener listens on. */
       protected ServerSocket serverSocket;
  -    
  +
       /** The factory to create LoggerRepository's for client connections. */
       protected LoggerRepositoryFactory loggerRepositoryFactory;
  -    
  -    /**
  -     * @jmx:managed-constructor
  -     */
  -    public Log4jSocketServer()
  -    {
  -        super();
  -    }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
  +
       public void setPort(final int port)
       {
           this.port = port;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public int getPort()
       {
           return port;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public void setBacklog(final int backlog)
       {
           this.backlog = backlog;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public int getBacklog()
       {
           return backlog;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public void setBindAddress(final InetAddress addr)
       {
           this.bindAddress = addr;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public InetAddress getBindAddress()
       {
           return bindAddress;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public void setListenerEnabled(final boolean enabled)
       {
           listenerEnabled = enabled;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  -    public boolean setListenerEnabled()
  +
  +    public boolean getListenerEnabled()
       {
           return listenerEnabled;
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public void setLoggerRepositoryFactoryType(final Class type)
           throws InstantiationException, IllegalAccessException, ClassCastException
       {
           this.loggerRepositoryFactory = (LoggerRepositoryFactory)type.newInstance();
       }
  -    
  -    /**
  -     * @jmx:managed-attribute
  -     */
  +
       public Class getLoggerRepositoryFactoryType()
       {
           if (loggerRepositoryFactory == null) {
               return null;
           }
  -        
  +
           return loggerRepositoryFactory.getClass();
       }
  -    
  -    /**
  -     * @jmx:managed-operation
  -     */
  +
       public LoggerRepository getLoggerRepository(final InetAddress addr)
       {
           return loggerRepositoryFactory.create(addr);
       }
  -    
  -    
  +
  +
       ///////////////////////////////////////////////////////////////////////////
       //                             Socket Listener                           //
       ///////////////////////////////////////////////////////////////////////////
  -    
  +
       protected class SocketListenerThread
           extends Thread
       {
  @@ -222,45 +181,45 @@
           protected boolean enabled;
           protected boolean shuttingDown;
           protected Object lock = new Object();
  -        
  +
           public SocketListenerThread(final boolean enabled)
           {
               super("SocketListenerThread");
  -            
  +
               this.enabled = enabled;
           }
  -        
  +
           public void setEnabled(boolean enabled)
           {
               this.enabled = enabled;
  -            
  +
               synchronized (lock) {
                   lock.notifyAll();
               }
  -            
  +
               if (log.isDebugEnabled()) {
                   log.debug("Notified that enabled: " + enabled);
               }
           }
  -        
  +
           public void shutdown()
           {
               enabled = false;
               shuttingDown = true;
  -            
  +
               synchronized (lock) {
                   lock.notifyAll();
               }
  -            
  +
               if (log.isDebugEnabled()) {
                   log.debug("Notified to shutdown");
               }
           }
  -        
  +
           public void run()
           {
               while (!shuttingDown) {
  -                
  +
                   if (!enabled) {
                       try {
                           log.debug("Disabled, waiting for notification");
  @@ -270,7 +229,7 @@
                       }
                       catch (InterruptedException ignore) {}
                   }
  -                
  +
                   try {
                       doRun();
                   }
  @@ -279,27 +238,27 @@
                   }
               }
           }
  -        
  +
           protected void doRun() throws Exception
           {
               while (enabled) {
                   boolean debug = log.isDebugEnabled();
  -                
  +
                   Socket socket = serverSocket.accept();
                   InetAddress addr =  socket.getInetAddress();
                   if (debug) {
  -                    log.debug("Connected to client: " + addr); 
  +                    log.debug("Connected to client: " + addr);
                   }
  -                
  +
                   LoggerRepository repo = getLoggerRepository(addr);
                   if (debug) {
                       log.debug("Using repository: " + repo);
                   }
  -                
  +
                   //
                   // jason: may want to expose socket node as an MBean for management
                   //
  -                
  +
                   log.debug("Starting new socket node");
                   SocketNode node = new SocketNode(socket, repo);
                   Thread thread = new Thread(node);
  @@ -308,17 +267,17 @@
               }
           }
       }
  -    
  -    
  +
  +
       ///////////////////////////////////////////////////////////////////////////
       //                         LoggerRepositoryFactory                       //
       ///////////////////////////////////////////////////////////////////////////
  -    
  +
       public static interface LoggerRepositoryFactory
       {
           public LoggerRepository create(InetAddress addr);
       }
  -    
  +
       /**
        * A simple LoggerRepository factory which simply returns
        * the current repository from the LogManager.
  @@ -327,7 +286,7 @@
           implements LoggerRepositoryFactory
       {
           private LoggerRepository repo;
  -        
  +
           public LoggerRepository create(final InetAddress addr)
           {
               if (repo == null) {
  @@ -336,40 +295,72 @@
               return repo;
           }
       }
  -    
  -    
  +
  +
       ///////////////////////////////////////////////////////////////////////////
       //                    AbstractManagedObject Overrides                    //
       ///////////////////////////////////////////////////////////////////////////
  -    
  -    protected void doStart() throws Exception
  +
  +    public void setMBeanContext(GeronimoMBeanContext context) {
  +    }
  +
  +    public boolean canStart() {
  +        return true;
  +    }
  +
  +    public void doStart()
       {
           listenerThread = new SocketListenerThread(false);
           listenerThread.setDaemon(true);
           listenerThread.start();
  -        log.debug("Socket listener thread started");
  -        
  +        //log.debug("Socket listener thread started");
  +
           if (loggerRepositoryFactory == null) {
  -            log.debug("Using default logger repository factory");
  +            //log.debug("Using default logger repository factory");
               loggerRepositoryFactory = new DefaultLoggerRepositoryFactory();
           }
  -        
  +
           // create a new server socket to handle port number changes
  -        if (bindAddress == null) {
  -            serverSocket = new ServerSocket(port, backlog);
  -        }
  -        else {
  -            serverSocket = new ServerSocket(port, backlog, bindAddress);
  +        try {
  +            if (bindAddress == null) {
  +                serverSocket = new ServerSocket(port, backlog);
  +            }
  +            else {
  +                serverSocket = new ServerSocket(port, backlog, bindAddress);
  +            }
  +        } catch (IOException e) {
  +            throw new RuntimeException("Problem starting socket server", e);
           }
  -        
  -        log.info("Listening on " + serverSocket);
  +
  +        //log.info("Listening on " + serverSocket);
           listenerThread.setEnabled(listenerEnabled);
       }
  -    
  -    protected void doStop() throws Exception
  +
  +    public boolean canStop() {
  +        return true;
  +    }
  +
  +    public void doStop()
       {
           listenerThread.shutdown();
           listenerThread = null;
           serverSocket = null;
  +    }
  +
  +    public void doFail() {
  +    }
  +
  +    public static GeronimoMBeanInfo getGeronimoMBeanInfo() {
  +        GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
  +        mbeanInfo.setTargetClass(Log4jSocketServer.class.getName());
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Port", true, true, "Port
to listen on"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("Backlog", true, true, "Backlog"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("BindAddress", true, true,
"BindAddress to listen on"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("ListenerEnabled", true, true,
"whether Listener is enabled"));
  +        mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("LoggerRepositoryFactoryType",
true, true, "Class for constructing LoggerRepository instances"));
  +        mbeanInfo.addOperationInfo(new GeronimoOperationInfo("getLoggerRepository", new
GeronimoParameterInfo[] {
  +            new GeronimoParameterInfo("address", InetAddress.class, "address to get the
repository for")},
  +                GeronimoOperationInfo.INFO, "Get the logger repository for the supplied
address"));
  +        return mbeanInfo;
       }
   }
  
  
  

Mime
View raw message