public abstract class AbstractCargoMojo extends AbstractCommonMojo
<container> and
<configuration> elements and supporting the notion of Auto-deployable.| Modifier and Type | Field and Description |
|---|---|
static String |
CONTEXT_KEY_CONTAINER
The key under which the container instance is stored in the plugin context.
|
| Constructor and Description |
|---|
AbstractCargoMojo() |
| Modifier and Type | Method and Description |
|---|---|
static String |
calculateContainerArtifactId(String containerId)
Calculates the container artifact ID for a given container ID.
|
protected boolean |
containsAutoDeployable(Deployable[] deployableElements)
Checks if the autodeployable is part of deployables.
|
protected org.codehaus.cargo.container.deployable.Deployable |
createAutoDeployDeployable(org.codehaus.cargo.container.Container container)
Create the autodeploy deployable (if the current project is a Java EE deployable)
|
protected org.codehaus.cargo.container.configuration.Configuration |
createConfiguration()
Creates a
Configuration instance. |
protected org.codehaus.cargo.container.Container |
createContainer() |
protected void |
createDefaultContainerElementIfNecessary()
Creates a container element if required.
|
protected void |
createDefaultInstallerElementIfNecessary()
Creates a installer element if required.
|
protected org.codehaus.cargo.util.log.Logger |
createLogger()
Create a logger.
|
protected org.codehaus.cargo.container.Container |
createNewContainer()
Creates a brand new
Container instance. |
protected abstract void |
doExecute()
Executes the plugin.
|
void |
execute() |
protected CargoProject |
getCargoProject() |
protected Configuration |
getConfigurationElement() |
protected Container |
getContainerElement() |
protected Daemon |
getDaemon() |
protected Deployable[] |
getDeployablesElement() |
protected Deployer |
getDeployerElement() |
protected org.codehaus.cargo.util.FileHandler |
getFileHandler() |
protected void |
setCargoProject(CargoProject cargoProject) |
protected void |
setConfigurationElement(Configuration configurationElement) |
protected void |
setContainerElement(Container containerElement) |
protected void |
setDeployablesElement(Deployable[] deployablesElement) |
protected void |
setDeployerElement(Deployer deployerElement) |
protected void |
setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler) |
protected void |
waitDeployableMonitor(org.codehaus.cargo.container.Container container,
boolean starting)
Waits until all deployables with a deployable monitor are deployed / undeployed.
|
getProjectpublic static final String CONTEXT_KEY_CONTAINER
public static String calculateContainerArtifactId(String containerId)
containerArtifactId + the version number + x; for
example jboss42x is from container artifact ID
cargo-core-container-jboss.containerId - Container ID, for example jboss42x.cargo-core-container-jboss.protected org.codehaus.cargo.util.FileHandler getFileHandler()
protected void setFileHandler(org.codehaus.cargo.util.FileHandler fileHandler)
fileHandler - the Cargo file utility class to use. This method is useful for unit
testing with Mock objects as it can be passed a test file handler that doesn't perform any
real file action.protected Deployer getDeployerElement()
Deployer. See the Cargo
Maven 2 / Maven 3 plugin reference guide and
Deployer for more details.protected void setDeployerElement(Deployer deployerElement)
deployerElement - the Deployer
configuration defined by the usergetDeployerElement()protected Daemon getDaemon()
protected Deployable[] getDeployablesElement()
Deployable. See the Cargo
Maven 2 / Maven 3 plugin reference guide for more details.protected void setDeployablesElement(Deployable[] deployablesElement)
deployablesElement - the list of
Deployable. See the Cargo
Maven 2 / Maven 3 plugin reference guide for more details.getDeployablesElement()protected Configuration getConfigurationElement()
Configuration. See the Cargo
Maven 2 / Maven 3 plugin reference guide and
Configuration for more details.protected void setConfigurationElement(Configuration configurationElement)
configurationElement - the
Configuration configuration defined by the
usergetConfigurationElement()protected Container getContainerElement()
Container.
See the
Cargo Maven 2 / Maven 3 plugin reference guide and
Container for more details.protected void setContainerElement(Container containerElement)
containerElement - the Container configuration
defined by the usergetContainerElement()protected void setCargoProject(CargoProject cargoProject)
cargoProject - Cargo projectprotected CargoProject getCargoProject()
public final void execute()
throws org.apache.maven.plugin.MojoExecutionException
Note: This method is final so that extending classes cannot extend it. Instead they should
implement the doExecute() method.
org.apache.maven.plugin.MojoExecutionExceptionprotected abstract void doExecute()
throws org.apache.maven.plugin.MojoExecutionException
This method must be implemented by all Mojos extending this class. The reason for this
pattern is because we want the execute() method to always be called so that
necessary plugin initialization can be performed. Without this pattern Mojos extending this
class could "forget" to call super.execute() thus leading to unpredictible
results.
org.apache.maven.plugin.MojoExecutionException - in case of errorprotected org.codehaus.cargo.container.configuration.Configuration createConfiguration()
throws org.apache.maven.plugin.MojoExecutionException
Configuration instance. If the
user has not specified a configuration element in the POM file then automatically create a
standalone configuration if the container's type is local or otherwise create a runtime
configuration.Configuration instanceorg.apache.maven.plugin.MojoExecutionException - in case of errorprotected org.codehaus.cargo.container.Container createContainer()
throws org.apache.maven.plugin.MojoExecutionException
Container instance if no container object was
stored in the Maven Plugin Context or returns the saved instance otherwise. If a new
container instance is created it's also saved in the Maven Plugin Context for later
retrieval.org.apache.maven.plugin.MojoExecutionException - in case of errorprotected org.codehaus.cargo.container.Container createNewContainer()
throws org.apache.maven.plugin.MojoExecutionException
Container instance. If the user has
not specified a container element in the POM file or if the user has not specified the
container id then automatically create a default container (as defined in
createDefaultContainerElementIfNecessary()) if the project calling this plugin has a
WAR packaging. If the packaging is different then an exception is raised.Container instanceorg.apache.maven.plugin.MojoExecutionException - in case of error or if a default container could not be
createdprotected void createDefaultContainerElementIfNecessary()
throws org.apache.maven.plugin.MojoExecutionException
org.apache.maven.plugin.MojoExecutionException - in case of error or if a default container could not be
createdprotected void createDefaultInstallerElementIfNecessary()
throws IOException
IOException - If the properties file cannot be loaded.protected org.codehaus.cargo.container.deployable.Deployable createAutoDeployDeployable(org.codehaus.cargo.container.Container container)
throws org.apache.maven.plugin.MojoExecutionException
container - Container.org.apache.maven.plugin.MojoExecutionException - If deployable creation fails.protected boolean containsAutoDeployable(Deployable[] deployableElements)
deployableElements - Deployable elements.true if autodeployable is in deployableElements,
false otherwise.protected org.codehaus.cargo.util.log.Logger createLogger()
<log> configuration element has been specified by
the user then use it. If none is specified then log to the Maven 2 logging subsystem.protected void waitDeployableMonitor(org.codehaus.cargo.container.Container container,
boolean starting)
container - Container where is deployable deployed.starting - true if container is starting (i.e., wait for deployment),
false otherwise.Copyright © 2004–2016 Github. All rights reserved.