org.apache.tomcat.maven.plugin.tomcat6
Class AbstractDeployMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractI18NTomcat6Mojo
          extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractCatalinaMojo
              extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractWarCatalinaMojo
                  extended by org.apache.tomcat.maven.plugin.tomcat6.AbstractDeployMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractDeployWarMojo, ExplodedMojo, InplaceMojo

public abstract class AbstractDeployMojo
extends AbstractWarCatalinaMojo

Deploy a WAR to Tomcat.

Author:
Mark Hobson

Field Summary
 
Fields inherited from class org.apache.tomcat.maven.plugin.tomcat6.AbstractI18NTomcat6Mojo
messagesProvider, path
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractDeployMojo()
           
 
Method Summary
protected  void deployContext()
          Deploys the context XML file to Tomcat.
protected  void deployWar()
          Deploys the WAR to Tomcat.
protected  void deployWarAndContext()
          Deploys the WAR and context XML file to Tomcat.
protected  File getContextFile()
          Gets the Tomcat context XML file.
protected  String getTag()
          Gets the Tomcat webapp tag name to use.
protected abstract  File getWarFile()
          Gets the Tomcat WAR file.
 void invokeManager()
          Invokes Tomcat manager when this Mojo is executed.
protected  boolean isUpdate()
          Gets whether Tomcat should automatically undeploy webapps that already exist when deploying.
protected  void validateContextFile()
          Ensures that the Tomcat context XML file exists and is indeed a file.
protected abstract  void validateWarFile()
          Ensures that the Tomcat WAR file exists and is the correct type for the deployment mode.
 
Methods inherited from class org.apache.tomcat.maven.plugin.tomcat6.AbstractWarCatalinaMojo
execute, isWar
 
Methods inherited from class org.apache.tomcat.maven.plugin.tomcat6.AbstractCatalinaMojo
getDeployedURL, getManager, getPath, getURL, log
 
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
 

Constructor Detail

AbstractDeployMojo

public AbstractDeployMojo()
Method Detail

invokeManager

public void invokeManager()
                   throws org.apache.maven.plugin.MojoExecutionException,
                          TomcatManagerException,
                          IOException
Invokes Tomcat manager when this Mojo is executed.

Specified by:
invokeManager in class AbstractCatalinaMojo
Throws:
org.apache.maven.plugin.MojoExecutionException - if there was a problem executing this goal
TomcatManagerException - if the Tomcat manager request fails
IOException - if an i/o error occurs

getWarFile

protected abstract File getWarFile()
Gets the Tomcat WAR file. This may be a file or a directory depending on the deployment mode.

Returns:
the Tomcat WAR file.

validateWarFile

protected abstract void validateWarFile()
                                 throws org.apache.maven.plugin.MojoExecutionException
Ensures that the Tomcat WAR file exists and is the correct type for the deployment mode.

Throws:
org.apache.maven.plugin.MojoExecutionException - if the WAR file does not exist or is not the correct type for the deployment mode

getContextFile

protected File getContextFile()
Gets the Tomcat context XML file.

Returns:
the Tomcat context XML file.

validateContextFile

protected void validateContextFile()
                            throws org.apache.maven.plugin.MojoExecutionException
Ensures that the Tomcat context XML file exists and is indeed a file.

Throws:
org.apache.maven.plugin.MojoExecutionException - if the context file does not exist or is not a file

isUpdate

protected boolean isUpdate()
Gets whether Tomcat should automatically undeploy webapps that already exist when deploying.

Returns:
whether Tomcat should automatically undeploy webapps that already exist when deploying

getTag

protected String getTag()
Gets the Tomcat webapp tag name to use.

Returns:
the Tomcat webapp tag name to use

deployWar

protected void deployWar()
                  throws org.apache.maven.plugin.MojoExecutionException,
                         TomcatManagerException,
                         IOException
Deploys the WAR to Tomcat.

Throws:
org.apache.maven.plugin.MojoExecutionException - if there was a problem locating the WAR
TomcatManagerException - if the Tomcat manager request fails
IOException - if an i/o error occurs

deployContext

protected void deployContext()
                      throws org.apache.maven.plugin.MojoExecutionException,
                             TomcatManagerException,
                             IOException
Deploys the context XML file to Tomcat.

Throws:
org.apache.maven.plugin.MojoExecutionException - if there was a problem locating the context XML file
TomcatManagerException - if the Tomcat manager request fails
IOException - if an i/o error occurs

deployWarAndContext

protected void deployWarAndContext()
                            throws org.apache.maven.plugin.MojoExecutionException,
                                   TomcatManagerException,
                                   IOException
Deploys the WAR and context XML file to Tomcat.

Throws:
org.apache.maven.plugin.MojoExecutionException - if there was a problem locating either the WAR or the context XML file
TomcatManagerException - if the Tomcat manager request fails
IOException - if an i/o error occurs


Copyright © 2005-2012 The Apache Software Foundation. All Rights Reserved.