org.terracotta.maven.plugins.tc
Class AbstractDsoMojo

java.lang.Object
  extended by org.apache.maven.plugin.AbstractMojo
      extended by org.terracotta.maven.plugins.tc.AbstractDsoMojo
All Implemented Interfaces:
org.apache.maven.plugin.ContextEnabled, org.apache.maven.plugin.Mojo
Direct Known Subclasses:
AbstractDsoServerMojo, BootjarMojo, DsoDevConsoleMojo, DsoLifecycleMojo

public abstract class AbstractDsoMojo
extends org.apache.maven.plugin.AbstractMojo

Author:
Eugene Kuleshov

Nested Class Summary
 class AbstractDsoMojo.CargoStartable
           
 class AbstractDsoMojo.CmdStartable
           
static interface AbstractDsoMojo.Startable
           
 
Field Summary
protected  java.io.File bootJar
          Location of the generated DSO boot jar
protected  java.util.List<java.lang.String> classpathElements
          Project classpath.
protected  java.io.File config
          Location of the DSO config (tc-config.xml)
static java.lang.String CONTEXT_KEY_STARTABLES
           
protected  int debugPort
           
protected  java.lang.String jvm
          Path to the java executable to use to spawned processes
protected  java.lang.String jvmargs
          Arguments for the spawned java processes
protected  boolean jvmdebug
          Enable remote JVM debugging for the started process
protected  org.apache.maven.artifact.repository.ArtifactRepository localRepository
          ArtifactRepository of the localRepository.
protected  java.lang.String mode
          TC mode, either 'custom' or 'express'.
protected  java.lang.String modules
          Optional modules that should be enabled in DSO, for example for tc:run and tc:bootjar goals For example: org.mortbay.jetty.tim-jetty-6.1.4;bundle-version:=1.1.0.SNAPSHOT
protected  int numberOfNodes
          Number of nodes to start (not recommended, use processes element instead)
protected  java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
          Plugin artifacts
protected  ProcessConfiguration[] processes
          Configuration for the DSO-enabled processes to start.
protected  java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
          Remote repositories declared in the project pom
protected  DsoArtifactResolver resolver
          DSO artifact resolver
protected  java.io.File workingDirectory
          Working directory for the spawned java processes
 
Fields inherited from interface org.apache.maven.plugin.Mojo
ROLE
 
Constructor Summary
AbstractDsoMojo()
           
AbstractDsoMojo(AbstractDsoMojo mojo)
           
 
Method Summary
protected  Commandline createCommandLine()
           
protected  java.lang.String createJvmArguments()
           
protected  java.lang.String createJvmArguments(ProcessConfiguration process, java.lang.String nodeName, int totalNumberOfNodes)
           
protected  java.lang.String createPluginClasspath()
           
protected  java.lang.String createPluginClasspathAsFile()
           
protected  java.lang.String createProjectClasspath()
           
protected  java.util.List<com.terracottatech.config.Module> getAdditionalModules()
          Collect additional modules from all processes
protected  com.tc.config.schema.NewCommonL1Config getClientConfig()
           
protected  java.lang.String getJMXUrl(com.tc.config.schema.NewCommonL2Config config)
           
protected  java.lang.String getModulesRepository()
           
protected  com.tc.config.schema.NewCommonL2Config getServerConfig(java.lang.String serverName)
           
 java.lang.String getServerStatus(java.lang.String jmxUrl)
           
protected  java.util.List<AbstractDsoMojo.Startable> getStartables()
           
protected  org.apache.maven.artifact.Artifact getTerracottaArtifact()
           
protected  boolean isCustomMode()
           
protected  java.lang.String quoteIfNeeded(java.lang.String path)
           
protected  void resolveModuleArtifacts()
           
protected  void resolveModuleArtifacts(java.util.List<com.terracottatech.config.Module> additionalModules)
           
 void setJvm(java.lang.String jvm)
           
 void setJvmargs(java.lang.String jvmargs)
           
 
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
 
Methods inherited from interface org.apache.maven.plugin.Mojo
execute
 

Field Detail

CONTEXT_KEY_STARTABLES

public static final java.lang.String CONTEXT_KEY_STARTABLES

localRepository

protected org.apache.maven.artifact.repository.ArtifactRepository localRepository
ArtifactRepository of the localRepository. To obtain the directory of localRepository in unit tests use System.setProperty("localRepository").


remoteRepositories

protected java.util.List<org.apache.maven.artifact.repository.ArtifactRepository> remoteRepositories
Remote repositories declared in the project pom


classpathElements

protected java.util.List<java.lang.String> classpathElements
Project classpath.


pluginArtifacts

protected java.util.List<org.apache.maven.artifact.Artifact> pluginArtifacts
Plugin artifacts


jvm

protected java.lang.String jvm
Path to the java executable to use to spawned processes


jvmargs

protected java.lang.String jvmargs
Arguments for the spawned java processes


jvmdebug

protected boolean jvmdebug
Enable remote JVM debugging for the started process


workingDirectory

protected java.io.File workingDirectory
Working directory for the spawned java processes


config

protected java.io.File config
Location of the DSO config (tc-config.xml)


modules

protected java.lang.String modules
Optional modules that should be enabled in DSO, for example for tc:run and tc:bootjar goals For example: org.mortbay.jetty.tim-jetty-6.1.4;bundle-version:=1.1.0.SNAPSHOT


processes

protected ProcessConfiguration[] processes
Configuration for the DSO-enabled processes to start.

The following example shows plugin configuration that can be used to declare processes to start. Note that elements container and configuration are the same as for Cargo Maven plugin.
 <processes>
   <process nodeName="master" count="1"
      arguments="someArgument"
      jvmargs="-Xmx20m"
      modules="org.mortbay.jetty.tim-jetty-6.1.4;bundle-version:=1.1.0.SNAPSHOT&quot&gt;
     <className>org.terracotta.maven.plugins.tc.test.MasterProcess</className>
   <process/>
   <process nodeName="sample" count="2" jvmargs="-Xmx20m"
     className="org.terracotta.maven.plugins.tc.test.SampleProcess">
    <systemProperty key="foo" value="boo"/>
   </process>
   <process nodeName="tomcat" count="2" jvmargs="-Xmx20m">
    <container>
     <containerId>tomcat5x</containerId>
     <zipUrlInstaller>
      <url>http://www.apache.org/dist/tomcat/tomcat-5/v5.5.25/bin/apache-tomcat-5.5.25.zip</url>
      <installDir>${project.build.directory}/install/tomcat5x</installDir>
     </zipUrlInstaller>
    </container>
   </process>
 </processes>
 
See Launching and Cargo sections for more details.


resolver

protected DsoArtifactResolver resolver
DSO artifact resolver


numberOfNodes

protected int numberOfNodes
Number of nodes to start (not recommended, use processes element instead)


mode

protected java.lang.String mode
TC mode, either 'custom' or 'express'. Default is express


bootJar

protected java.io.File bootJar
Location of the generated DSO boot jar


debugPort

protected int debugPort
Constructor Detail

AbstractDsoMojo

public AbstractDsoMojo()

AbstractDsoMojo

public AbstractDsoMojo(AbstractDsoMojo mojo)
Method Detail

createCommandLine

protected Commandline createCommandLine()

createJvmArguments

protected java.lang.String createJvmArguments()

getModulesRepository

protected java.lang.String getModulesRepository()

createProjectClasspath

protected java.lang.String createProjectClasspath()

createPluginClasspath

protected java.lang.String createPluginClasspath()

createPluginClasspathAsFile

protected java.lang.String createPluginClasspathAsFile()

getTerracottaArtifact

protected org.apache.maven.artifact.Artifact getTerracottaArtifact()

quoteIfNeeded

protected java.lang.String quoteIfNeeded(java.lang.String path)

isCustomMode

protected boolean isCustomMode()

getServerStatus

public java.lang.String getServerStatus(java.lang.String jmxUrl)
                                 throws java.net.MalformedURLException,
                                        java.io.IOException
Throws:
java.net.MalformedURLException
java.io.IOException

getJMXUrl

protected java.lang.String getJMXUrl(com.tc.config.schema.NewCommonL2Config config)

getServerConfig

protected com.tc.config.schema.NewCommonL2Config getServerConfig(java.lang.String serverName)
                                                          throws com.tc.config.schema.setup.ConfigurationSetupException
Throws:
com.tc.config.schema.setup.ConfigurationSetupException

getClientConfig

protected com.tc.config.schema.NewCommonL1Config getClientConfig()
                                                          throws com.tc.config.schema.setup.ConfigurationSetupException
Throws:
com.tc.config.schema.setup.ConfigurationSetupException

resolveModuleArtifacts

protected void resolveModuleArtifacts()
                               throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

resolveModuleArtifacts

protected void resolveModuleArtifacts(java.util.List<com.terracottatech.config.Module> additionalModules)
                               throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

getAdditionalModules

protected java.util.List<com.terracottatech.config.Module> getAdditionalModules()
Collect additional modules from all processes

Returns:
List of Module instances

getStartables

protected java.util.List<AbstractDsoMojo.Startable> getStartables()
                                                           throws org.apache.maven.plugin.MojoExecutionException
Throws:
org.apache.maven.plugin.MojoExecutionException

createJvmArguments

protected java.lang.String createJvmArguments(ProcessConfiguration process,
                                              java.lang.String nodeName,
                                              int totalNumberOfNodes)

setJvmargs

public void setJvmargs(java.lang.String jvmargs)

setJvm

public void setJvm(java.lang.String jvm)


Copyright © 2010 Terracotta, Inc.. All Rights Reserved.