User: olegnitz
Date: 02/02/10 09:57:44
Modified: jetty/src/main/org/mortbay/jetty/jmx Main.java jetty.mlet
mbean_en.properties
Added: jetty/src/main/org/mortbay/jetty/jmx ServerMBean.java
Removed: jetty/src/main/org/mortbay/jetty/jmx DebugMBean.java
HttpContextMBean.java HttpListenerMBean.java
JettyServerMBean.java LifeCycleMBean.java
LogMBean.java LogSinkMBean.java ModelMBeanImpl.java
OutputStreamLogSinkMBean.java
ServletHttpContextMBean.java
SocketListenerMBean.java TestModelMBean.java
ThreadPoolMBean.java ThreadedServerMBean.java
WebApplicationMBean.java
Log:
Fresh version of Jetty and patches to Jetty plugin by Jan Bartel
Revision Changes Path
1.2 +3 -92 contrib/jetty/src/main/org/mortbay/jetty/jmx/Main.java
Index: Main.java
===================================================================
RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/jmx/Main.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- Main.java 17 Jan 2002 01:23:20 -0000 1.1
+++ Main.java 10 Feb 2002 17:57:44 -0000 1.2
@@ -1,109 +1,20 @@
// ========================================================================
// Copyright (c) 1999 Mort Bay Consulting (Australia) Pty. Ltd.
-// $Id: Main.java,v 1.1 2002/01/17 01:23:20 olegnitz Exp $
+// $Id: Main.java,v 1.2 2002/02/10 17:57:44 olegnitz Exp $
// ========================================================================
package org.mortbay.jetty.jmx;
-import java.util.Set;
-import java.util.ArrayList;
-import java.util.Iterator;
-import javax.management.loading.MLet;
-import javax.management.ObjectInstance;
-import javax.management.ObjectName;
-import javax.management.MBeanServer;
-import javax.management.MBeanServerFactory;
-import javax.management.MBeanException;
-import javax.management.RuntimeErrorException;
-import javax.management.RuntimeMBeanException;
-import javax.management.RuntimeOperationsException;
-import org.mortbay.util.Code;
-import org.mortbay.util.Log;
-
/* ------------------------------------------------------------ */
/**
- *
- * @version $Revision: 1.1 $
- * @author Greg Wilkins (gregw)
+ * @deprecated Use org.mortbay.jmx.Main.
*/
public class Main
{
- static MLet mlet;
-
- /* ------------------------------------------------------------ */
- /**
- * @param arg
- * @return
- */
- static void startMLet(String[] arg)
- {
- try
- {
- // Create a MBeanServer
- final MBeanServer server =
-
MBeanServerFactory.createMBeanServer(ModelMBeanImpl.getJettyDomain());
- Code.debug("MBeanServer=",server);
-
- // Create and register the MLet
- mlet = new MLet();
- server.registerMBean(mlet,
- new ObjectName(server.getDefaultDomain(),
- "service", "MLet"));
- Code.debug("MLet=",mlet);
-
- // Set MLet as classloader for this app
- Thread.currentThread().setContextClassLoader(mlet);
-
-
- // load config files
- for (int i=0;i<arg.length;i++)
- {
- Log.event("Load "+arg[i]);
- Set beans=mlet.getMBeansFromURL(arg[i]);
- Iterator iter=beans.iterator();
- while(iter.hasNext())
- {
- Object bean=iter.next();
- if (bean instanceof Throwable)
- {
- iter.remove();
- Code.warning((Throwable)bean);
- }
- else if (bean instanceof ObjectInstance)
- {
- ObjectInstance oi = (ObjectInstance)bean;
-
- if
("com.sun.jdmk.comm.HtmlAdaptorServer".equals(oi.getClassName()))
- {
- Log.event("Starting
com.sun.jdmk.comm.HtmlAdaptorServer");
-
try{server.invoke(oi.getObjectName(),"start",null,null);}
- catch(Exception e){Code.warning(e);}
- }
- }
- }
-
- Code.debug("Loaded "+beans.size(),"MBeans: ",beans);
- }
- }
- catch(Exception e)
- {
- Code.warning(e);
- }
- }
-
/* ------------------------------------------------------------ */
public static void main(String[] arg)
throws Exception
{
- if (arg.length==0)
- {
- System.err.println("Usage - java org.mortbay.jetty.jmx.Main
<mletURL>...");
- System.exit(1);
- }
- startMLet(arg);
- synchronized(mlet)
- {
- mlet.wait();
- }
+ org.mortbay.util.jmx.Main.main(arg);
}
}
1.2 +10 -6 contrib/jetty/src/main/org/mortbay/jetty/jmx/jetty.mlet
Index: jetty.mlet
===================================================================
RCS file: /cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/jmx/jetty.mlet,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- jetty.mlet 17 Jan 2002 01:23:20 -0000 1.1
+++ jetty.mlet 10 Feb 2002 17:57:44 -0000 1.2
@@ -10,27 +10,31 @@
</MLET>
<MLET
- CODE="org.mortbay.jetty.jmx.DebugMBean"
- ARCHIVE="org.mortbay.jetty.jar"
+ CODE="org.mortbay.util.jmx.CodeMBean"
+ ARCHIVE="org.mortbay.jetty.jmx.jar"
CODEBASE="file:__JETTY_JMX_HOME__/lib">
</MLET>
<MLET
- CODE="org.mortbay.jetty.jmx.LogMBean"
- ARCHIVE="org.mortbay.jetty.jar"
+ CODE="org.mortbay.util.jmx.LogMBean"
+ ARCHIVE="org.mortbay.jetty.jmx.jar"
CODEBASE="file:__JETTY_JMX_HOME__/lib">
</MLET>
<MLET
- CODE="org.mortbay.jetty.jmx.JettyServerMBean"
+ CODE="org.mortbay.jetty.jmx.ServerMBean"
ARCHIVE="org.mortbay.jetty.jar"
CODEBASE="file:__JETTY_JMX_HOME__/lib">
<ARG type="java.lang.String" value="__JETTY_HOME__/etc/admin.xml">
</MLET>
<MLET
- CODE="org.mortbay.jetty.jmx.JettyServerMBean"
+ CODE="org.mortbay.jetty.jmx.ServerMBean"
ARCHIVE="org.mortbay.jetty.jmx.jar"
CODEBASE="file:__JETTY_JMX_HOME__/lib">
<ARG type="java.lang.String" value="__JETTY_HOME__/etc/demo.xml">
</MLET>
+
+
+
+
1.2 +15 -179 contrib/jetty/src/main/org/mortbay/jetty/jmx/mbean_en.properties
Index: mbean_en.properties
===================================================================
RCS file:
/cvsroot/jboss/contrib/jetty/src/main/org/mortbay/jetty/jmx/mbean_en.properties,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- mbean_en.properties 17 Jan 2002 01:23:20 -0000 1.1
+++ mbean_en.properties 10 Feb 2002 17:57:44 -0000 1.2
@@ -1,181 +1,17 @@
-LifeCycle.started = True if the instance has been started and is still running.
-LifeCycle.destroyed = True if the instance has been destroyed and it's resources
freed.
-LifeCycle.start() = Initialize and start the instance.
-LifeCycle.stop() = Stop the instance.
+Server=Jetty HTTP Server and Servlet container.
-
-Log = The org.mortbay.util.Log logging service. \
- This object allows LogSink instances to be added. MBeans for the LogSinks are \
- created by this object.
-Log.logSinks = An array of all registered LogSink instances.
-Log.add(java.lang.String) = Add a LogSink by class name.
-Log.add(java.lang.String)[0] = classname:LogSink class name or null for the
default class.
-Log.add(org.mortbay.util.LogSink) = Add a LogSink instance.
-Log.add(org.mortbay.util.LogSink)[0]= logSink:LogSink instance.
-Log.disableLog() = Disable logging by stopping all LogSinks
-Log.message(java.lang.String,java.lang.String) = Log a message.
-Log.message(java.lang.String,java.lang.String)[0] = tag:Message tag (eg DEBUG,
WARN, etc.).
-Log.message(java.lang.String,java.lang.String)[1] = message:Message string.
-
-LogSink = A logging component that consumes messages from
the Log mechanism.
-LogSink.log(java.lang.String) = Log a message to this sink.
-LogSink.log(java.lang.String)[0]= message:formatted message
-
-WriterLogSink = A LogSink that writes messages to a WriterStream or
File.
-WriterLogSink.logDateFormat = The SimpleDateFormat string to use for formatting log
messages.
-WriterLogSink.logTimezone = The Timezone name to use for formatting log messages.
-WriterLogSink.logTimeStamps = If true, timestamps are added when formatting
messages.
-WriterLogSink.logLabels = If true, the Frame details are added when formatting
messages.
-WriterLogSink.logTags = If true, the tag is added when formatting messages.
-WriterLogSink.logStackSize = If true, an indication of stack depth is added when
formatting messages.
-WriterLogSink.logStackTrace = If true, a stack trace is added to every logged
message.
-WriterLogSink.logOneLine = If true, log messages are formatted onto a single
line.
-WriterLogSink.append = If true, log existing log files are appended to.
-WriterLogSink.writer = The writer to log to.
-WriterLogSink.filename = The filename to log to. If the filename contains the
string yyyy_mm_dd, then the log is rolled over \
- every local midnight to a new file named with the
date.
-WriterLogSink.retainDays = The number of days to retain old log files before
deleting them.
-WriterLogSink.flushOn = If true, the log is flushed on every log entry.
-
-OutputStreamLogSink = A LogSink that writes messages to a
OutputStream or File.
-OutputStreamLogSink.logDateFormat = The SimpleDateFormat string to use for
formatting log messages.
-OutputStreamLogSink.logTimezone = The Timezone name to use for formatting log
messages.
-OutputStreamLogSink.logTimeStamps = If true, timestamps are added when formatting
messages.
-OutputStreamLogSink.logLabels = If true, the Frame details are added when
formatting messages.
-OutputStreamLogSink.logTags = If true, the tag is added when formatting
messages.
-OutputStreamLogSink.logStackSize = If true, an indication of stack depth is added
when formatting messages.
-OutputStreamLogSink.logStackTrace = If true, a stack trace is added to every logged
message.
-OutputStreamLogSink.logOneLine = If true, log messages are formatted onto a
single line.
-OutputStreamLogSink.append = If true, log existing log files are appended to.
-OutputStreamLogSink.utputStream = The stream to log to.
-OutputStreamLogSink.filename = The filename to log to. If the filename
contains the string yyyy_mm_dd, then the log is rolled over \
- every local midnight to a new file named with the
date.
-OutputStreamLogSink.retainDays = The number of days to retain old log files
before deleting them.
-OutputStreamLogSink.flushOn = If true, the log is flushed on every log entry.
-
-
-JettyServer = \
-Jetty HTTP Server. The components of the server are HttpListeners, HttpContexts and
a request Log. Each component \
-is created as it's own MBean as it is added. Changes made to this MBean are not
persisted.
-
-JettyServer.started = True if any of the components of Jetty Server have been
started and are still running.
-JettyServer.start() = Start the Jetty Server and all registered listeners,
contexts and logs.
-JettyServer.stop() = Stop the Jetty Server and all registered listeners, contexts
and logs.
-JettyServer.destroy() = Destroy and deregister a stopped Jetty Server.
-
-JettyServer.addListener(java.lang.String) = Create and add a new HttpListener.
-JettyServer.addListener(java.lang.String)[0] = listenerClass:The Listener classname
or null for the default HttpListener class.
-
-JettyServer.addHostAlias(java.lang.String,java.lang.String) = Define a virtual
host alias
-JettyServer.addHostAlias(java.lang.String,java.lang.String)[0] = host:Known host
name or IP
-JettyServer.addHostAlias(java.lang.String,java.lang.String)[1] = alias:Alias host
name or IP
-
-JettyServer.addContext(java.lang.String,java.lang.String) = Create and add a new
context.
-JettyServer.addContext(java.lang.String,java.lang.String)[0] = host:Virtual host
name. null for all hosts.
-JettyServer.addContext(java.lang.String,java.lang.String)[1] = contextPath:The path
specification for the context.
-
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)
= Create and add a J2EE web application.
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[0]
= host:Virtual host name. null for all hosts.
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[1]
= contextPath:The path specification for the context.
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[2]
= webapp:A filename or URL for the web application director or WAR file.
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[3]
= defaults:A filename or URL to the wap application defaults file, which must be in
web.xml format.
-JettyServer.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[4]
= extractWar:True if WAR files should be extracted to a temporary location.
-JettyServer.logDateFormat = The date format for entries in the request log.
-JettyServer.logSink = The LogSink for the requestLog.
-
-JettyServer.statsOn = True if statistics collection is turned on.
-JettyServer.statsReset() = Reset statistics.
-JettyServer.connections = Number of connections accepted by the server since
statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsOpen = Number of connections currently open that were opened
since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsOpenMax = Maximum number of connections opened
simultaneously since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsDurationAve = Sliding average duration in milliseconds of
open connections since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsDurationMax = Maximum duration in milliseconds of an open
connection since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsRequestsAve = Sliding average number of requests per
connection since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.connectionsRequestsMax = Maximum number of requests per connection
since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.errors = Number of errors since statsReset() called. Undefined if
setStatsOn(false). An error is a request that resulted in an exception being thrown by
the handler.
-JettyServer.requests = Number of requests since statsReset() called. Undefined if
setStatsOn(false).
-JettyServer.requestsActive = Number of requests currently active. Undefined if
setStatsOn(false).
-JettyServer.requestsActiveMax = Maximum number of active requests since
statsReset() called. Undefined if setStatsOn(false).
-JettyServer.requestsDurationAve = Average duration of request handling in
milliseconds since statsReset() called. Undefined if setStatsOn(false).
-JettyServer.requestsDurationMax = Get maximum duration in milliseconds of request
handling since statsReset() called. Undefined if setStatsOn(false).
-
-
-HttpListener.host = The host or IP interface to listen on. Null or 0.0.0.0 is
interpreted as all known interfaces.
-HttpListener.port = The port to listen on. 0 is interpreted as any free port.
-
-SocketListener.lowResourcePersistTimeMs = Time in ms to persist idle connections if
low on resources.
-SocketListener.lowOnResources = True if listener is low on resources.
-SocketListener.outOfResources = True if listener is out of resources.
-
-HttpContext=A HTTP Context, which is a collection of HttpHandlers with their
resources and configurations. Changes made to this MBean are not persisted.
-HttpContext.contextPath = The URL prefix of this context.
-HttpContext.classPath = The path to load classes for this context from.
-HttpContext.classLoader = The classloader for this context. If both the
class path and the class loader are set, \
- then the classloader is used as the parent
loader for a context loader initialized on the classpath. \
- This attribute always returns the actual
classloader used for the context.
-HttpContext.realm = The name of the security realm for the context.
-HttpContext.redirectNullPath = If true, requests to /contextpath are
redirected to /contextpath/
-HttpContext.resourceBase = The file or URL to use as a prefix to all
resource lookups within the context.
-HttpContext.servingResources = If true, a ResourceHandler is serving static
resources from the context resource base.
-HttpContext.hosts = A list of virtual host aliases that this
context is registered against.
-HttpContext.handlers = A list of handlers in this context.
-HttpContext.logSink = The LogSink for the requestLog.
-HttpContext.statsOn = True if statistics collection is turned on.
-HttpContext.statsReset() = Reset statistics.
-HttpContext.requests = Number of requests since statsReset() called. Undefined if
setStatsOn(false).
-HttpContext.responses1xx = Number of responses with 1xx status (Informal) since
statsReset() called. Undefined if setStatsOn(false).
-HttpContext.responses2xx = Number of responses with 2xx status (Success) since
statsReset() called. Undefined if setStatsOn(false).
-HttpContext.responses3xx = Number of responses with 3xx status (Redirection) since
statsReset() called. Undefined if setStatsOn(false).
-HttpContext.responses4xx = Number of responses with 4xx status (Client Error) since
statsReset() called. Undefined if setStatsOn(false).
-HttpContext.responses5xx = Number of responses with 5xx status (Server Error) since
statsReset() called. Undefined if setStatsOn(false).
-
-HttpContext.setInitParameter(java.lang.String,java.lang.String) =Set an context
initialization parameter.
-HttpContext.setInitParameter(java.lang.String,java.lang.String)[0]=name:The name of
the parameter.
-HttpContext.setInitParameter(java.lang.String,java.lang.String)[1]=value:The value
of the parameter.
-HttpContext.getInitParameter(java.lang.String) =Get a context initialization
parameter.
-HttpContext.getInitParameter(java.lang.String)[0]=name:The name of the parameter.
-HttpContext.getInitParameterNames()=Get a list of initialization parameter names.
-HttpContext.setAttribute(java.lang.String,java.lang.String) =Set a context
attribute.
-HttpContext.setAttribute(java.lang.String,java.lang.String)[0]=name:The attribute
name.
-HttpContext.setAttribute(java.lang.String,java.lang.String)[1]=value:The attribute
value.
-HttpContext.getAttribute(java.lang.String) =Get a context attribute
-HttpContext.getAttribute(java.lang.String)[0]=name:The attribute name.
-HttpContext.getAttributeNames()=Get a list of attribute names.
-HttpContext.removeAttribute(java.lang.String) =Remove a context attribute.
-HttpContext.removeAttribute(java.lang.String)[0]=name:The attribute name.
-HttpContext.addHttpHandler(int,org.mortbay.http.HttpHandler) = Add a HttpHandler
instance to the context. When a request is serviced by the context, \
- each handler is
called in order until it is handled.
-HttpContext.addHttpHandler(int,org.mortbay.http.HttpHandler)[0] = index:The index
within the context to insert the handler at.
-HttpContext.addHttpHandler(int,org.mortbay.http.HttpHandler)[1] = handler:The
HttpHandler instance to add.
-HttpContext.getHttpHandler(int) = Get a context HttpHandler.
-HttpContext.getHttpHandler(int)[0] = index:The index of the handler within the
context.
-HttpContext.removeHttpHandler(int) = Remove a context HttpHandler.
-HttpContext.removeHttpHandler(int)[0] = index:The index of the handler within the
context.
-HttpContext.setMimeMapping(java.lang.String,java.lang.String) = Set a mime
mapping by name extension.
-HttpContext.setMimeMapping(java.lang.String,java.lang.String)[0]= extension:The
name extension to map.
-HttpContext.setMimeMapping(java.lang.String,java.lang.String)[1]= mimetype:The MIME
type of resources with the extension.
-
-ServletHttpContext=A HttpContext with additional conveniance methods for servlets .
Changes made to this MBean are not persisted.
-ServletHttpContext.addServlet(java.lang.String,java.lang.String,java.lang.String)
= Add a servlet to the context.
-ServletHttpContext.addServlet(java.lang.String,java.lang.String,java.lang.String)[0]=
name:The name of the servlet.
-ServletHttpContext.addServlet(java.lang.String,java.lang.String,java.lang.String)[1]=
pathSpec:The suffix or prefix URL path for the servlet.
-ServletHttpContext.addServlet(java.lang.String,java.lang.String,java.lang.String)[2]=
className:The class name of the servlet.
-ServletHttpContext.dynamicServletPathSpec = The path spec from which dynamic
servlets are loaded.
-
-WebApplication=A J2EE Web application extension of ServletHttpContext. Changes made
to this MBean are not persisted.
-WebApplication.displayName = The display name of the web application
context.
-WebApplication.defaultsDescriptor = The XML resource defining the default
configuration for the context.
-WebApplication.deploymentDescriptor = The XML resource defining the specific
configuration of the context.
-WebApplication.WAR = The WAR file or directory as a URL or
filename.
-WebApplication.extractWAR = If true, packed WAR files are extracted to
a temp directory.
-
-ThreadPool = Pool of reusable threads. Changes made to this MBean are not persisted.
-ThreadPool.name = Name of the pool.
-ThreadPool.threadClass = Class of the Threads
-ThreadPool.threads = Number of thread instances.
-ThreadPool.idleThreads = number of idle threads.
-ThreadPool.minThreads = minimum number of threads allowed
-ThreadPool.maxThreads = maximum number of threass allowed
-ThreadPool.maxIdleTimeMs = Time in MS that a thread can be idle before it may
expire.
-ThreadPool.maxStopTimeMs = Time in MS that a thread is allowed to run when stopping.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)
= Create and add a J2EE web application.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[0]
= virtualHost:Virtual host name. null for all hosts.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[1]
= contextPath:The path specification for the context.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[2]
= webapp:A filename or URL for the web application director or WAR file.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[3]
= defaults:A filename or URL to the wap application defaults file, which must be in
web.xml format.
+Server.addWebApplication(java.lang.String,java.lang.String,java.lang.String,java.lang.String,boolean)[4]
= extractWar:True if WAR files should be extracted to a temporary location.
+Server.configuration = The configuration XML
+
+Server.addWebApplications(java.lang.String,java.lang.String,java.lang.String,boolean)
= Create and add a J2EE web applications from a directory.
+Server.addWebApplications(java.lang.String,java.lang.String,java.lang.String,boolean)[0]
= virtualHost:Virtual host name. null for all hosts.
+Server.addWebApplications(java.lang.String,java.lang.String,java.lang.String,boolean)[1]
= webapps:A directory containing webapplications
+Server.addWebApplications(java.lang.String,java.lang.String,java.lang.String,boolean)[2]
= defaults:A filename or URL to the wap application defaults file, which must be in
web.xml format.
+Server.addWebApplications(java.lang.String,java.lang.String,java.lang.String,boolean)[3]
= extractWar:True if WAR files should be extracted to a temporary location.
+Server.configuration = The configuration XML
1.1 contrib/jetty/src/main/org/mortbay/jetty/jmx/ServerMBean.java
Index: ServerMBean.java
===================================================================
// ========================================================================
// Copyright (c) 1999 Mort Bay Consulting (Australia) Pty. Ltd.
// $Id: ServerMBean.java,v 1.1 2002/02/10 17:57:44 olegnitz Exp $
// ========================================================================
package org.mortbay.jetty.jmx;
import javax.management.InstanceNotFoundException;
import javax.management.MBeanServer;
import javax.management.MBeanException;
import javax.management.ObjectName;
import javax.management.MBeanOperationInfo;
import javax.management.modelmbean.InvalidTargetObjectTypeException;
import javax.management.modelmbean.ModelMBeanAttributeInfo;
import javax.management.modelmbean.ModelMBeanOperationInfo;
import org.mortbay.jetty.Server;
import org.mortbay.http.HttpServer;
import org.mortbay.http.HttpServer.ComponentEvent;
import org.mortbay.http.HttpServer.ComponentEventListener;
import org.mortbay.http.HttpListener;
import org.mortbay.http.SocketListener;
import org.mortbay.http.HttpContext;
import org.mortbay.http.jmx.HttpServerMBean;
import org.mortbay.jetty.servlet.WebApplicationContext;
import org.mortbay.util.Code;
import org.mortbay.util.Log;
import org.mortbay.util.LogSink;
import org.mortbay.util.LifeCycle;
import org.mortbay.util.OutputStreamLogSink;
import java.beans.beancontext.BeanContextMembershipListener;
import java.beans.beancontext.BeanContextMembershipEvent;
import java.util.Iterator;
import java.util.HashMap;
import java.io.IOException;
/* ------------------------------------------------------------ */
/** JettyServer MBean.
* This Model MBean class provides the mapping for HttpServer
* management methods. It also registers itself as a membership
* listener of the HttpServer, so it can create and destroy MBean
* wrappers for listeners and contexts.
*
* @version $Revision: 1.1 $
* @author Greg Wilkins (gregw)
*/
public class ServerMBean extends HttpServerMBean
{
private Server _jettyServer;
private String _configuration;
/* ------------------------------------------------------------ */
/** Constructor.
* @exception MBeanException
* @exception InstanceNotFoundException
*/
protected ServerMBean(Server jettyServer)
throws MBeanException, InstanceNotFoundException
{
super(jettyServer);
}
/* ------------------------------------------------------------ */
/** Constructor.
* @exception MBeanException
* @exception InstanceNotFoundException
*/
public ServerMBean()
throws MBeanException, InstanceNotFoundException
{
this(new Server());
}
/* ------------------------------------------------------------ */
/** Constructor.
* @param configuration URL or File to jetty.xml style configuration file
* @exception IOException
* @exception MBeanException
* @exception InstanceNotFoundException
*/
public ServerMBean(String configuration)
throws IOException,MBeanException, InstanceNotFoundException
{
this(new Server());
_configuration=configuration;
}
/* ------------------------------------------------------------ */
protected ObjectName newObjectName(MBeanServer server)
{
return uniqueObjectName(server, getDefaultDomain()+":Jetty=");
}
/* ------------------------------------------------------------ */
protected void defineManagedResource()
{
super.defineManagedResource();
defineAttribute("configuration");
defineOperation("addWebApplication",
new String[]{"java.lang.String",
"java.lang.String",
"java.lang.String",
"java.lang.String",
"boolean"},
IMPACT_ACTION);
defineOperation("addWebApplications",
new String[]{"java.lang.String",
"java.lang.String",
"java.lang.String",
"boolean"},
IMPACT_ACTION);
_jettyServer=(Server)getManagedResource();
}
/* ------------------------------------------------------------ */
/**
* @param ok
*/
public void postRegister(Boolean ok)
{
super.postRegister(ok);
if (ok.booleanValue())
{
if (_configuration!=null)
{
try
{
_jettyServer.configure(_configuration);
_jettyServer.start();
}
catch(Exception e)
{
Code.warning(e);
}
}
}
}
/* ------------------------------------------------------------ */
public void postDeregister()
{
_configuration=null;
super.postDeregister();
}
}
_______________________________________________
Jboss-development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development