## org.mortbay.jetty.plugin
Class AbstractJettyMojo

    java.lang.Object
      org.apache.maven.plugin.AbstractMojo
          org.mortbay.jetty.plugin.AbstractJettyMojo

All Implemented Interfaces:
  org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo

Direct Known Subclasses:
  AbstractJetty6Mojo, AbstractJettyRunMojo

    public abstract class AbstractJettyMojo

extends org.apache.maven.plugin.AbstractMojo

AbstractJettyMojo

Field Summary
`protected Thread` `consoleScanner` A scanner to check ENTER hits on the console
`protected String` `contextPath` The context path for the webapp.
`protected boolean` `daemon` Determines whether or not the server blocks when started.
`protected File` `jettyConfig` Location of a jetty xml configuration file whose contents will be applied before any plugin configuration.
`protected File` `overrideWebXml` A web.xml file to be applied AFTER the webapp's web.xml file.
`String` `PORT_SYSPROPERTY`
`protected org.apache.maven.project.MavenProject` `project` The maven project.
`protected String` `reload` reload can be set to either 'automatic' or 'manual' if 'manual' then the context can be reloaded by a linefeed in the console if 'automatic' then traditional reloading on changed files is enabled.
`protected int` `scanIntervalSeconds` The interval in seconds to scan the webapp for changes and restart the context if necessary.
`protected ArrayList` `scanList` List of files and directories to scan
`protected Scanner` `scanner` A scanner to check for changes to the webapp
`protected ArrayList` `scannerListeners` List of Listeners for the scanner
`protected JettyPluginServer` `server` The proxy for the Server object
`protected String` `stopKey` Key to provide when stopping jetty on executing java -DSTOP.KEY=<stopKey> -DSTOP.PORT=<stopPort> -jar start.jar --stop
`protected int` `stopPort` Port to listen to stop jetty on executing -DSTOP.PORT=<stopPort> -DSTOP.KEY=<stopKey> -jar start.jar --stop
`protected SystemProperties` `systemProperties` System properties to set before execution.
`protected File` `tmpDirectory` The temporary directory to use for the webapp.
`protected Jetty6PluginWebAppContext` `webAppConfig` The "virtual" webapp created by the plugin
`protected File` `webDefaultXml` A webdefault.xml file to use instead of the default for the webapp.

Fields inherited from interface org.apache.maven.plugin.Mojo
`ROLE`

Constructor Summary
`AbstractJettyMojo()`

Method Summary
`abstract void` `applyJettyXml()`
`abstract void` `checkPomConfiguration()`
`abstract void` `configureScanner()`
`void` `configureWebApplication()` Subclasses should invoke this to setup basic info on the webapp
`abstract JettyPluginServer` `createServer()` create a proxy that wraps a particular jetty version Server object
`void` `execute()`
`File` `findJettyWebXmlFile(File webInfDir)` Try and find a jetty-web.xml file, using some historical naming conventions if necessary.
`abstract void` `finishConfigurationBeforeStart()`
`abstract Object[]` `getConfiguredConnectors()`
`abstract Object` `getConfiguredRequestLog()`
`abstract Object[]` `getConfiguredUserRealms()`
`String` `getContextPath()`
`File` `getJettyXmlFile()`
`File` `getOverrideWebXml()`
`org.apache.maven.project.MavenProject` `getProject()`
`int` `getScanIntervalSeconds()`
`ArrayList` `getScanList()`
`Scanner` `getScanner()`
`ArrayList` `getScannerListeners()`
`JettyPluginServer` `getServer()`
`File` `getTmpDirectory()`
`File` `getWebDefaultXml()`
`abstract void` `restartWebApp(boolean reconfigureScanner)`
`void` `setScanList(ArrayList list)`
`void` `setScannerListeners(ArrayList listeners)`
`void` `setServer(JettyPluginServer server)`
`protected void` `startConsoleScanner()` Run a thread that monitors the console input to detect ENTER hits.
`void` `startJetty()`

Methods inherited from class org.apache.maven.plugin.AbstractMojo
`getLog, getPluginContext, setLog, setPluginContext`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### server

    protected JettyPluginServer server

  The proxy for the Server object

### webAppConfig

    protected Jetty6PluginWebAppContext webAppConfig

  The "virtual" webapp created by the plugin

### project

    protected org.apache.maven.project.MavenProject project

  The maven project.

### contextPath

    protected String contextPath

  The context path for the webapp. Defaults to the name of the webapp's artifact.

### tmpDirectory

    protected File tmpDirectory

  The temporary directory to use for the webapp. Defaults to target/jetty-tmp

### webDefaultXml

    protected File webDefaultXml

  A webdefault.xml file to use instead of the default for the webapp. Optional.

### overrideWebXml

    protected File overrideWebXml

  A web.xml file to be applied AFTER the webapp's web.xml file. Useful for applying different build profiles, eg test, production etc. Optional.

### scanIntervalSeconds

    protected int scanIntervalSeconds

  The interval in seconds to scan the webapp for changes and restart the context if necessary. Ignored if reload is enabled. Disabled by default.

### reload

    protected String reload

  reload can be set to either 'automatic' or 'manual' if 'manual' then the context can be reloaded by a linefeed in the console if 'automatic' then traditional reloading on changed files is enabled.

### systemProperties

    protected SystemProperties systemProperties

  System properties to set before execution. Note that these properties will NOT override System properties that have been set on the command line or by the JVM. Optional.

### jettyConfig

    protected File jettyConfig

  Location of a jetty xml configuration file whose contents will be applied before any plugin configuration. Optional.

### stopPort

    protected int stopPort

  Port to listen to stop jetty on executing -DSTOP.PORT=<stopPort> -DSTOP.KEY=<stopKey> -jar start.jar --stop

### stopKey

    protected String stopKey

  Key to provide when stopping jetty on executing java -DSTOP.KEY=<stopKey> -DSTOP.PORT=<stopPort> -jar start.jar --stop

### daemon

    protected boolean daemon

  Determines whether or not the server blocks when started. The default behavior (daemon = false) will cause the server to pause other processes while it continues to handle web requests. This is useful when starting the server with the intent to work with it interactively.

  Often, it is desirable to let the server start and continue running subsequent processes in an automated build environment. This can be facilitated by setting daemon to true.

### scanner

    protected Scanner scanner

  A scanner to check for changes to the webapp

### scanList

    protected ArrayList scanList

  List of files and directories to scan

### scannerListeners

    protected ArrayList scannerListeners

  List of Listeners for the scanner

### consoleScanner

    protected Thread consoleScanner

  A scanner to check ENTER hits on the console

### PORT_SYSPROPERTY

    public String PORT_SYSPROPERTY

Constructor Detail

### AbstractJettyMojo

    public AbstractJettyMojo()

Method Detail

### getConfiguredUserRealms

    public abstract Object[] getConfiguredUserRealms()

  Returns:
    Returns the realms configured in the pom

### getConfiguredConnectors

    public abstract Object[] getConfiguredConnectors()

  Returns:
    Returns the connectors configured in the pom

### getConfiguredRequestLog

    public abstract Object getConfiguredRequestLog()

### checkPomConfiguration

    public abstract void checkPomConfiguration()
                                        throws org.apache.maven.plugin.MojoExecutionException

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`

### configureScanner

    public abstract void configureScanner()
                                   throws org.apache.maven.plugin.MojoExecutionException

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`

### applyJettyXml

    public abstract void applyJettyXml()
                                throws Exception

  Throws:
    `Exception`

### createServer

    public abstract JettyPluginServer createServer()
                                            throws Exception

  create a proxy that wraps a particular jetty version Server object

  Returns:
  Throws:
    `Exception`

### finishConfigurationBeforeStart

    public abstract void finishConfigurationBeforeStart()
                                                 throws Exception

  Throws:
    `Exception`

### getProject

    public org.apache.maven.project.MavenProject getProject()

### getTmpDirectory

    public File getTmpDirectory()

### getWebDefaultXml

    public File getWebDefaultXml()

### getOverrideWebXml

    public File getOverrideWebXml()

### getContextPath

    public String getContextPath()

  Returns:
    Returns the contextPath.

### getScanIntervalSeconds

    public int getScanIntervalSeconds()

  Returns:
    Returns the scanIntervalSeconds.

### getJettyXmlFile

    public File getJettyXmlFile()

### getServer

    public JettyPluginServer getServer()

### setServer

    public void setServer(JettyPluginServer server)

### setScanList

    public void setScanList(ArrayList list)

### getScanList

    public ArrayList getScanList()

### setScannerListeners

    public void setScannerListeners(ArrayList listeners)

### getScannerListeners

    public ArrayList getScannerListeners()

### getScanner

    public Scanner getScanner()

### execute

    public void execute()
                 throws org.apache.maven.plugin.MojoExecutionException,
                        org.apache.maven.plugin.MojoFailureException

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`
    `org.apache.maven.plugin.MojoFailureException`

### startJetty

    public void startJetty()
                    throws org.apache.maven.plugin.MojoExecutionException

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`

### restartWebApp

    public abstract void restartWebApp(boolean reconfigureScanner)
                                throws Exception

  Throws:
    `Exception`

### configureWebApplication

    public void configureWebApplication()
                                 throws Exception

  Subclasses should invoke this to setup basic info on the webapp

  Throws:
    `org.apache.maven.plugin.MojoExecutionException`
    `Exception`

### startConsoleScanner

    protected void startConsoleScanner()

  Run a thread that monitors the console input to detect ENTER hits.

### findJettyWebXmlFile

    public File findJettyWebXmlFile(File webInfDir)

  Try and find a jetty-web.xml file, using some historical naming conventions if necessary.

  Parameters:
    `webInfDir` -
  Returns:

Copyright © 1995-2008 Mort Bay Consulting. All Rights Reserved.