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)
@Documented
@Target( { ElementType.TYPE, ElementType.METHOD, ElementType.FIELD } )
@Target( { ElementType.TYPE } )
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.MultiException;
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.Logger;
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"
*
*/
@ManagedObject("Web Application ContextHandler")
public class WebAppContext extends ServletContextHandler implements WebAppClassLoader.Context
{
private static final Logger LOG = Log.getLogger(WebAppContext.class);
@ -564,6 +567,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/**
* @return Returns the configurations.
*/
@ManagedAttribute(value="configuration classes used to configure webapp", readonly=true)
public String[] getConfigurationClasses()
{
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
* @return Returns the defaultsDescriptor.
*/
@ManagedAttribute(value="default web.xml deascriptor applied before standard web.xml", readonly=true)
public String getDefaultsDescriptor()
{
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
* @return Returns the Override Descriptor list
*/
@ManagedAttribute(value="web.xml deascriptors applied after standard web.xml", readonly=true)
public List<String> getOverrideDescriptors()
{
return Collections.unmodifiableList(_overrideDescriptors);
@ -626,6 +632,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* @see #setServerClasses(String[])
* @return Returns the serverClasses.
*/
@ManagedAttribute(value="classes and packages hidden by the context classloader", readonly=true)
public String[] getServerClasses()
{
if (_serverClasses == null)
@ -647,6 +654,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* @see #setSystemClasses(String[])
* @return Returns the systemClasses.
*/
@ManagedAttribute("classes and packages given priority by context classloader")
public String[] getSystemClasses()
{
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)
*/
@ManagedAttribute(value="war file location", readonly=true)
public String getWar()
{
if (_war==null)
@ -757,6 +766,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/**
* @return Returns the distributable.
*/
@ManagedAttribute("web application distributable")
public boolean isDistributable()
{
return _distributable;
@ -766,6 +776,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
/**
* @return Returns the extractWAR.
*/
@ManagedAttribute(value="extract war", readonly=true)
public boolean isExtractWAR()
{
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)
*/
@ManagedAttribute(value="webdir copied on deploy (allows hot replacement on windows)", readonly=true)
public boolean isCopyWebDir()
{
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
* spec recommendation).
*/
@ManagedAttribute(value="parent classloader given priority", readonly=true)
public boolean isParentLoaderPriority()
{
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.
*/
@ManagedAttribute(value="standard web.xml descriptor", readonly=true)
public String getDescriptor()
{
return _descriptor;
@ -1121,6 +1135,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
}
/* ------------------------------------------------------------ */
@ManagedAttribute(value="temporary directory location", readonly=true)
public File getTempDirectory ()
{
return _tmpDir;
@ -1141,6 +1156,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
* pointing to directories or jar files. Directories should end
* with '/'.
*/
@ManagedAttribute(value="extra classpath for context classloader", readonly=true)
public String getExtraClasspath()
{
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