diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java index d3f3bca4920..d8901137079 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/AbstractConnector.java @@ -30,6 +30,8 @@ import javax.print.attribute.standard.MediaSize.ISO; import org.eclipse.jetty.io.ByteBufferPool; import org.eclipse.jetty.io.Connection; import org.eclipse.jetty.io.StandardByteBufferPool; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.AggregateLifeCycle; import org.eclipse.jetty.util.component.Dumpable; import org.eclipse.jetty.util.log.Log; @@ -39,6 +41,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory; /** *
Partial implementation of {@link Connector}
*/ +@ManagedObject("Abstract implementation of the Connector Interface") public abstract class AbstractConnector extends AggregateLifeCycle implements Connector, Dumpable { protected final Logger LOG = Log.getLogger(getClass()); @@ -157,6 +160,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co /** * @return Returns the number of acceptor threads. */ + @ManagedAttribute("number of acceptor threads") public int getAcceptors() { return _acceptors.length; @@ -328,6 +332,7 @@ public abstract class AbstractConnector extends AggregateLifeCycle implements Co } @Override + @ManagedAttribute("name of the connector") public String getName() { return _name; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java index 889394cbcc2..803c7ec400a 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Connector.java @@ -17,6 +17,8 @@ import java.util.concurrent.Executor; import java.util.concurrent.ScheduledExecutorService; import org.eclipse.jetty.io.ByteBufferPool; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.LifeCycle; import org.eclipse.jetty.util.ssl.SslContextFactory; @@ -25,6 +27,7 @@ import org.eclipse.jetty.util.ssl.SslContextFactory; * and allows applications to send data to remote peers, by setting up * the machinery needed to handle such tasks. */ +@ManagedObject("Connector Interface") public interface Connector extends LifeCycle { /** @@ -60,6 +63,7 @@ public interface Connector extends LifeCycle /** * @return the dle timeout for connections in milliseconds */ + @ManagedAttribute("maximum time a connection can be idle before being closed (in ms)") public long getIdleTimeout(); /** diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Handler.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Handler.java index 274518bc7ce..7994f854a39 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Handler.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Handler.java @@ -21,6 +21,9 @@ import javax.servlet.http.HttpServletResponse; import org.eclipse.jetty.server.handler.HandlerCollection; import org.eclipse.jetty.server.handler.HandlerWrapper; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; +import org.eclipse.jetty.util.annotation.ManagedOperation; import org.eclipse.jetty.util.component.Destroyable; import org.eclipse.jetty.util.component.LifeCycle; @@ -40,6 +43,7 @@ import org.eclipse.jetty.util.component.LifeCycle; * before passing it to the next stage of handling. * */ +@ManagedObject("Jetty Handler") public interface Handler extends LifeCycle, Destroyable { /* ------------------------------------------------------------ */ @@ -59,8 +63,11 @@ public interface Handler extends LifeCycle, Destroyable throws IOException, ServletException; public void setServer(Server server); + + @ManagedAttribute(value="the jetty server for this handler", readonly=true) public Server getServer(); + @ManagedOperation(value="destroy associated resources", impact="ACTION") public void destroy(); } diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/HandlerContainer.java b/jetty-server/src/main/java/org/eclipse/jetty/server/HandlerContainer.java index 24880541662..b96a781e3ef 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/HandlerContainer.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/HandlerContainer.java @@ -13,6 +13,8 @@ package org.eclipse.jetty.server; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.LifeCycle; /** @@ -22,18 +24,21 @@ import org.eclipse.jetty.util.component.LifeCycle; * or many (see {@link org.eclipse.jetty.server.handler.HandlerList} or {@link org.eclipse.jetty.server.handler.HandlerCollection}. * */ +@ManagedObject("Handler of Multiple Handlers") public interface HandlerContainer extends LifeCycle { /* ------------------------------------------------------------ */ /** * @return array of handlers directly contained by this handler. */ + @ManagedAttribute(value="handlers in this container", managed=true) public Handler[] getHandlers(); /* ------------------------------------------------------------ */ /** * @return array of all handlers contained by this handler and it's children */ + @ManagedAttribute(value="all contained handlers", managed=true) public Handler[] getChildHandlers(); /* ------------------------------------------------------------ */ diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/NCSARequestLog.java b/jetty-server/src/main/java/org/eclipse/jetty/server/NCSARequestLog.java index 8e725bd6502..56410859142 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/NCSARequestLog.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/NCSARequestLog.java @@ -27,6 +27,8 @@ import org.eclipse.jetty.http.PathMap; import org.eclipse.jetty.util.DateCache; import org.eclipse.jetty.util.RolloverFileOutputStream; import org.eclipse.jetty.util.StringUtil; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.AbstractLifeCycle; import org.eclipse.jetty.util.log.Log; import org.eclipse.jetty.util.log.Logger; @@ -39,12 +41,12 @@ import org.eclipse.jetty.util.log.Logger; * servers, and almost all web log analysis software can understand these * formats. * - * @org.apache.xbean.XBean element="ncsaLog" */ /* ------------------------------------------------------------ */ /** */ +@ManagedObject("NCSA standard format request log") public class NCSARequestLog extends AbstractLifeCycle implements RequestLog { private static final Logger LOG = Log.getLogger(NCSARequestLog.class); @@ -124,6 +126,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog * * @return file name of the request log */ + @ManagedAttribute("file of log") public String getFilename() { return _filename; @@ -206,6 +209,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog * * @return timezone string */ + @ManagedAttribute("the timezone") public String getLogTimeZone() { return _logTimeZone; @@ -228,6 +232,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog * * @return number of days to keep a log file */ + @ManagedAttribute("number of days that log files are kept") public int getRetainDays() { return _retainDays; @@ -251,6 +256,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog * * @return value of the flag */ + @ManagedAttribute("use extended NCSA format") public boolean isExtended() { return _extended; @@ -274,6 +280,7 @@ public class NCSARequestLog extends AbstractLifeCycle implements RequestLog * * @return value of the flag */ + @ManagedAttribute("existing log files are appends to the new one") public boolean isAppend() { return _append; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java b/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java index 1354b177305..73721283ceb 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/SelectChannelConnector.java @@ -31,12 +31,14 @@ import org.eclipse.jetty.io.EndPoint; import org.eclipse.jetty.io.SelectChannelEndPoint; import org.eclipse.jetty.io.SelectorManager; import org.eclipse.jetty.io.SelectorManager.ManagedSelector; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.annotation.Name; import org.eclipse.jetty.util.ssl.SslContextFactory; /** *Implementation of {@link NetworkConnector} based on NIO classes.
*/ +@ManagedObject("HTTP connector using NIO ByteChannels and Selectors") public class SelectChannelConnector extends AbstractNetworkConnector { private final SelectorManager _manager; diff --git a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java index c855ec1d8b1..9be99acfb7e 100644 --- a/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java +++ b/jetty-server/src/main/java/org/eclipse/jetty/server/Server.java @@ -33,6 +33,8 @@ import org.eclipse.jetty.util.AttributesMap; import org.eclipse.jetty.util.MultiException; import org.eclipse.jetty.util.TypeUtil; import org.eclipse.jetty.util.URIUtil; +import org.eclipse.jetty.util.annotation.ManagedAttribute; +import org.eclipse.jetty.util.annotation.ManagedObject; import org.eclipse.jetty.util.component.Container; import org.eclipse.jetty.util.component.Destroyable; import org.eclipse.jetty.util.component.Dumpable; @@ -50,6 +52,7 @@ import org.eclipse.jetty.util.thread.ThreadPool; * The server is itself a handler and a ThreadPool. Connectors use the ThreadPool methods * to run jobs that will eventually call the handle method. */ +@ManagedObject(value="Jetty HTTP Servlet server", wrapper="org.eclipse.jetty.server.ServerMBean") public class Server extends HandlerWrapper implements Attributes { private static final Logger LOG = Log.getLogger(Server.class); @@ -120,6 +123,7 @@ public class Server extends HandlerWrapper implements Attributes /* ------------------------------------------------------------ */ + @ManagedAttribute("version of this server") public static String getVersion() { return __version; @@ -164,6 +168,7 @@ public class Server extends HandlerWrapper implements Attributes /** * @return Returns the connectors. */ + @ManagedAttribute(value="connectors for this server", managed=true) public Connector[] getConnectors() { List*/ @SuppressWarnings("deprecation") +@ManagedObject("Abstract Session Manager") public abstract class AbstractSessionManager extends AbstractLifeCycle implements SessionManager { final static Logger __log = SessionHandler.LOG; @@ -135,11 +139,13 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement return _context.getContextHandler(); } + @ManagedAttribute("path of the session cookie, or null for default") public String getSessionPath() { return _sessionPath; } + @ManagedAttribute("if greater the zero, the time in seconds a session cookie will last for") public int getMaxCookieAge() { return _maxCookieAge; @@ -266,6 +272,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return Returns the httpOnly. */ + @ManagedAttribute("true if cookies use the http only flag") public boolean getHttpOnly() { return _httpOnly; @@ -296,6 +303,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return Returns the SessionIdManager used for cross context session management */ + @ManagedAttribute("Session ID Manager") public SessionIdManager getSessionIdManager() { return _sessionIdManager; @@ -307,6 +315,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement * @return seconds */ @Override + @ManagedAttribute("defailt maximum time a session may be idle for (in s)") public int getMaxInactiveInterval() { return _dftMaxIdleSecs; @@ -326,6 +335,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return maximum number of sessions */ + @ManagedAttribute("maximum number of simultaneous sessions") public int getSessionsMax() { return (int)_sessionsStats.getMax(); @@ -335,6 +345,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return total number of sessions */ + @ManagedAttribute("total number of sessions") public int getSessionsTotal() { return (int)_sessionsStats.getTotal(); @@ -361,6 +372,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement } /* ------------------------------------------------------------ */ + @ManagedAttribute("time before a session cookie is re-set (in s)") public int getRefreshCookieAge() { return _refreshCookieAge; @@ -373,6 +385,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement * cookies are ALWAYS marked as secure. If false, a session cookie is * ONLY marked as secure if _secureRequestOnly == true and it is a HTTPS request. */ + @ManagedAttribute("if true, secure cookie flag is set on session cookies") public boolean getSecureCookies() { return _secureCookies; @@ -402,6 +415,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /* ------------------------------------------------------------ */ + @ManagedAttribute("the set session cookie") public String getSessionCookie() { return _sessionCookie; @@ -471,6 +485,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement return null; } + @ManagedAttribute("domain of the session cookie, or null for the default") public String getSessionDomain() { return _sessionDomain; @@ -498,12 +513,14 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /* ------------------------------------------------------------ */ + @ManagedAttribute("number of currently active sessions") public int getSessions() { return (int)_sessionsStats.getCurrent(); } /* ------------------------------------------------------------ */ + @ManagedAttribute("name of use for URL session tracking") public String getSessionIdPathParameterName() { return _sessionIdPathParameterName; @@ -580,6 +597,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * Reset statistics values */ + @ManagedOperation(value="reset statistics", impact="ACTION") public void statsReset() { _sessionsStats.reset(getSessions()); @@ -784,6 +802,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return maximum amount of time session remained valid */ + @ManagedAttribute("maximum amount of time sessions have remained active (in s)") public long getSessionTimeMax() { return _sessionTimeStats.getMax(); @@ -919,6 +938,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return total amount of time all sessions remained valid */ + @ManagedAttribute("total time sessions have remained valid") public long getSessionTimeTotal() { return _sessionTimeStats.getTotal(); @@ -928,6 +948,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return mean amount of time session remained valid */ + @ManagedAttribute("mean time sessions remain valid (in s)") public double getSessionTimeMean() { return _sessionTimeStats.getMean(); @@ -937,6 +958,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @return standard deviation of amount of time session remained valid */ + @ManagedAttribute("standard deviation a session remained valid (in s)") public double getSessionTimeStdDev() { return _sessionTimeStats.getStdDev(); @@ -946,6 +968,7 @@ public abstract class AbstractSessionManager extends AbstractLifeCycle implement /** * @see org.eclipse.jetty.server.SessionManager#isCheckingRemoteSessionIdEncoding() */ + @ManagedAttribute("check remote session id encoding") public boolean isCheckingRemoteSessionIdEncoding() { return _checkingRemoteSessionIdEncoding; diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Handler-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Handler-mbean.properties deleted file mode 100644 index eea633f9343..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Handler-mbean.properties +++ /dev/null @@ -1,3 +0,0 @@ -Handler: Jetty Handler. -server: MObject:RO:The Jetty server for this handler -destroy(): destroy associated resources (eg MBean) \ No newline at end of file diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/HandlerContainer-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/HandlerContainer-mbean.properties deleted file mode 100644 index 374e020897e..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/HandlerContainer-mbean.properties +++ /dev/null @@ -1,3 +0,0 @@ -HandlerContainer: Handler of multiple Handlers -handlers: MObject:RO:Handlers in this container -childHandlers: MObject:RO:All contained handlers diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/NCSARequestLog-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/NCSARequestLog-mbean.properties deleted file mode 100644 index 0c0e3400ffd..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/NCSARequestLog-mbean.properties +++ /dev/null @@ -1,6 +0,0 @@ -NCSARequestLog : NCSA standard format request log -filename : Filename of log -retainDays : Number of days that the log files are kept -append : Existing log files are appended to the new one -extended : Use the extended NCSA format -LogTimeZone : The timezone diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/SelectChannelConnector-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/SelectChannelConnector-mbean.properties deleted file mode 100644 index 096a4b4aad3..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/SelectChannelConnector-mbean.properties +++ /dev/null @@ -1 +0,0 @@ -SelectChannelConnector: HTTP connector using NIO ByteChannels and Selectors diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Server-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Server-mbean.properties deleted file mode 100644 index 017711cd5bc..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/jmx/Server-mbean.properties +++ /dev/null @@ -1,9 +0,0 @@ -Server: Jetty HTTP Servlet server -connectors: MObject:HTTP Connectors for this server -version: RO: The version of this server -sendServerVersion: If true include the server version in HTTP headers -threadPool: MObject:The server Thread Pool -contexts: MMBean:RO:The contexts of this server -startupTime: MBean:RO:The startup time, in milliseconds, since January 1st 1970 -dumpAfterStart: RW:Dump state to stderr after start -dumpBeforeStop: RW:Dump state to stderr before stop diff --git a/jetty-server/src/main/resources/org/eclipse/jetty/server/session/jmx/AbstractSessionManager-mbean.properties b/jetty-server/src/main/resources/org/eclipse/jetty/server/session/jmx/AbstractSessionManager-mbean.properties deleted file mode 100644 index 92deb5f38e3..00000000000 --- a/jetty-server/src/main/resources/org/eclipse/jetty/server/session/jmx/AbstractSessionManager-mbean.properties +++ /dev/null @@ -1,19 +0,0 @@ -AbstractSessionManager: Abstract Session Manager -httpOnly: True if cookies use the http only flag -idManager: MObject:RO:The ID Manager instance -maxCookieAge: if greater than zero, the time in seconds a session cookie will last for -maxInactiveInterval: default maximum time in seconds a session may be idle -refreshCookieAge: The time in seconds after which a session cookie is re-set -secureCookies: If true, the secure cookie flag is set on session cookies -sessionCookie: The set session cookie -sessionDomain: The domain of the session cookie or null for the default -sessionPath: The path of the session cookie or null for the default -sessionsTotal: The total number of sessions -sessionIdPathParameterName: The name to use for URL session tracking -statsReset(): Reset statistics -sessions: Current instantaneous number of sessions -sessionsMax: Maximum number of simultaneous sessions since statsReset() was called -sessionTimeMax: Maximum amount of time in seconds session remained valid since statsReset() was called -sessionTimeTotal: Total amount of time in seconds sessions remained valid since statsReset() was called -sessionTimeMean: Mean amount of time in seconds a session remained valid since statsReset() was called -sessionTimeStdDev: Standard deviation of amount of time in seconds a session remained valid since statsReset() was called \ No newline at end of file