migrate jetty-webapp to jmx annotations

This commit is contained in:
Jesse McConnell 2012-08-15 13:49:07 -05:00
parent c92ce4bd1e
commit 2d9c4e823c
3 changed files with 17 additions and 15 deletions

View File

@ -20,7 +20,7 @@ import java.lang.annotation.Target;
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
@Documented @Documented
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD } ) @Target( { ElementType.TYPE } )
public @interface ManagedObject public @interface ManagedObject
{ {
/** /**

View File

@ -45,6 +45,8 @@ import org.eclipse.jetty.util.ArrayUtil;
import org.eclipse.jetty.util.Loader; import org.eclipse.jetty.util.Loader;
import org.eclipse.jetty.util.MultiException; import org.eclipse.jetty.util.MultiException;
import org.eclipse.jetty.util.URIUtil; 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.log.Log; import org.eclipse.jetty.util.log.Log;
import org.eclipse.jetty.util.log.Logger; import org.eclipse.jetty.util.log.Logger;
import org.eclipse.jetty.util.resource.Resource; import org.eclipse.jetty.util.resource.Resource;
@ -63,6 +65,7 @@ import org.eclipse.jetty.util.resource.ResourceCollection;
* @org.apache.xbean.XBean description="Creates a servlet web application at a given context from a resource base" * @org.apache.xbean.XBean description="Creates a servlet web application at a given context from a resource base"
* *
*/ */
@ManagedObject("Web Application ContextHandler")
public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context
{ {
private static final Logger LOG = Log.getLogger(WebAppContext.class); private static final Logger LOG = Log.getLogger(WebAppContext.class);
@ -564,6 +567,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return Returns the configurations. * @return Returns the configurations.
*/ */
@ManagedAttribute(value="configuration classes used to configure webapp", readonly=true)
public String[] getConfigurationClasses() public String[] getConfigurationClasses()
{ {
return _configurationClasses; return _configurationClasses;
@ -583,6 +587,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml * The default descriptor is a web.xml format file that is applied to the context before the standard WEB-INF/web.xml
* @return Returns the defaultsDescriptor. * @return Returns the defaultsDescriptor.
*/ */
@ManagedAttribute(value="default web.xml deascriptor applied before standard web.xml", readonly=true)
public String getDefaultsDescriptor() public String getDefaultsDescriptor()
{ {
return _defaultsDescriptor; return _defaultsDescriptor;
@ -607,6 +612,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* An override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml * An override descriptor is a web.xml format file that is applied to the context after the standard WEB-INF/web.xml
* @return Returns the Override Descriptor list * @return Returns the Override Descriptor list
*/ */
@ManagedAttribute(value="web.xml deascriptors applied after standard web.xml", readonly=true)
public List<String> getOverrideDescriptors() public List<String> getOverrideDescriptors()
{ {
return Collections.unmodifiableList(_overrideDescriptors); return Collections.unmodifiableList(_overrideDescriptors);
@ -626,6 +632,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* @see #setServerClasses(String[]) * @see #setServerClasses(String[])
* @return Returns the serverClasses. * @return Returns the serverClasses.
*/ */
@ManagedAttribute(value="classes and packages hidden by the context classloader", readonly=true)
public String[] getServerClasses() public String[] getServerClasses()
{ {
if (_serverClasses == null) if (_serverClasses == null)
@ -647,6 +654,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* @see #setSystemClasses(String[]) * @see #setSystemClasses(String[])
* @return Returns the systemClasses. * @return Returns the systemClasses.
*/ */
@ManagedAttribute("classes and packages given priority by context classloader")
public String[] getSystemClasses() public String[] getSystemClasses()
{ {
if (_systemClasses == null) if (_systemClasses == null)
@ -732,6 +740,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return Returns the war as a file or URL string (Resource) * @return Returns the war as a file or URL string (Resource)
*/ */
@ManagedAttribute(value="war file location", readonly=true)
public String getWar() public String getWar()
{ {
if (_war==null) if (_war==null)
@ -757,6 +766,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return Returns the distributable. * @return Returns the distributable.
*/ */
@ManagedAttribute("web application distributable")
public boolean isDistributable() public boolean isDistributable()
{ {
return _distributable; return _distributable;
@ -766,6 +776,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return Returns the extractWAR. * @return Returns the extractWAR.
*/ */
@ManagedAttribute(value="extract war", readonly=true)
public boolean isExtractWAR() public boolean isExtractWAR()
{ {
return _extractWAR; return _extractWAR;
@ -775,6 +786,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return True if the webdir is copied (to allow hot replacement of jars on windows) * @return True if the webdir is copied (to allow hot replacement of jars on windows)
*/ */
@ManagedAttribute(value="webdir copied on deploy (allows hot replacement on windows)", readonly=true)
public boolean isCopyWebDir() public boolean isCopyWebDir()
{ {
return _copyDir; return _copyDir;
@ -796,6 +808,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* should first try to load from WEB-INF/lib or WEB-INF/classes (servlet * should first try to load from WEB-INF/lib or WEB-INF/classes (servlet
* spec recommendation). * spec recommendation).
*/ */
@ManagedAttribute(value="parent classloader given priority", readonly=true)
public boolean isParentLoaderPriority() public boolean isParentLoaderPriority()
{ {
return _parentLoaderPriority; return _parentLoaderPriority;
@ -922,6 +935,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/** /**
* @return the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists. * @return the web.xml descriptor to use. If set to null, WEB-INF/web.xml is used if it exists.
*/ */
@ManagedAttribute(value="standard web.xml descriptor", readonly=true)
public String getDescriptor() public String getDescriptor()
{ {
return _descriptor; return _descriptor;
@ -1121,6 +1135,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
} }
/* ------------------------------------------------------------ */ /* ------------------------------------------------------------ */
@ManagedAttribute(value="temporary directory location", readonly=true)
public File getTempDirectory () public File getTempDirectory ()
{ {
return _tmpDir; return _tmpDir;
@ -1141,6 +1156,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* pointing to directories or jar files. Directories should end * pointing to directories or jar files. Directories should end
* with '/'. * with '/'.
*/ */
@ManagedAttribute(value="extra classpath for context classloader", readonly=true)
public String getExtraClasspath() public String getExtraClasspath()
{ {
return _extraClasspath; return _extraClasspath;

View File

@ -1,14 +0,0 @@
WebAppContext: Web Application ContextHandler
configurationClasses: Array of names of configuration classes
defaultsDescriptor: Default web.xml descriptor applied before standard web.xml
overrideDescriptor: Override web.xml descriptor applied after standard web.xml
serverClasses: Classes and packages hidden by the context classloader
systemClasses: Classes and packages given priority by context classloader
war: WAR file location
distributable: Is the web application distributable
extractWAR: Is the war file extraced on deploy
copyWebDir: Is the web application directory copied on deploy
parentLoaderPriority: Is the parent classloader given priority
descriptor: The standard web.xml descriptor
extraClasspath: Extra classpath for the context classloader
tempDirectory: Temporary directory location