org.scala_tools.maven
Class JavaCommand

java.lang.Object
  extended by org.scala_tools.maven.JavaCommand
All Implemented Interfaces:
JavaMainCaller

public class JavaCommand
extends Object
implements JavaMainCaller

Helper class use to call a java Main in an external process.


Constructor Summary
JavaCommand(org.apache.maven.plugin.AbstractMojo requester, String mainClassName, String classpath, String[] jvmArgs, String[] args)
           
 
Method Summary
 void addArgs(String... args)
          Adds arguments for the process
 void addEnvVar(String key, String value)
          Adds an environemnt variable
 void addJvmArgs(String... args)
          Adds a JVM arg.
 void addOption(String key, boolean value)
          Adds the key iff the value is true
 void addOption(String key, File value)
          Adds an option (key-file pair).
 void addOption(String key, String value)
          Adds option (basically two arguments)
static String[] findFiles(File dir, String pattern)
           
 void run(boolean displayCmd)
           
 void run(boolean displayCmd, boolean throwFailure)
          Runs the JavaMain with all the built up arguments/options
 void setLogOnly(boolean v)
          Sets the process to *only* log errors
 void spawn(boolean displayCmd)
          run the command without stream redirection nor waiting for exit
static String toClasspathString(ClassLoader cl)
           
static String toMultiPath(List<String> paths)
           
static String toMultiPath(String[] paths)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JavaCommand

public JavaCommand(org.apache.maven.plugin.AbstractMojo requester,
                   String mainClassName,
                   String classpath,
                   String[] jvmArgs,
                   String[] args)
            throws Exception
Throws:
Exception
Method Detail

toMultiPath

public static String toMultiPath(List<String> paths)

toMultiPath

public static String toMultiPath(String[] paths)

findFiles

public static String[] findFiles(File dir,
                                 String pattern)

toClasspathString

public static String toClasspathString(ClassLoader cl)
                                throws Exception
Throws:
Exception

addEnvVar

public void addEnvVar(String key,
                      String value)
Description copied from interface: JavaMainCaller
Adds an environemnt variable

Specified by:
addEnvVar in interface JavaMainCaller

addJvmArgs

public void addJvmArgs(String... args)
Description copied from interface: JavaMainCaller
Adds a JVM arg. Note: This is not available for in-process "forks"

Specified by:
addJvmArgs in interface JavaMainCaller

addArgs

public void addArgs(String... args)
Description copied from interface: JavaMainCaller
Adds arguments for the process

Specified by:
addArgs in interface JavaMainCaller

addOption

public void addOption(String key,
                      String value)
Description copied from interface: JavaMainCaller
Adds option (basically two arguments)

Specified by:
addOption in interface JavaMainCaller

addOption

public void addOption(String key,
                      File value)
Description copied from interface: JavaMainCaller
Adds an option (key-file pair). This will pull the absolute path of the file

Specified by:
addOption in interface JavaMainCaller

addOption

public void addOption(String key,
                      boolean value)
Description copied from interface: JavaMainCaller
Adds the key iff the value is true

Specified by:
addOption in interface JavaMainCaller

setLogOnly

public void setLogOnly(boolean v)
Description copied from interface: JavaMainCaller
Sets the process to *only* log errors

Specified by:
setLogOnly in interface JavaMainCaller

run

public void run(boolean displayCmd)
         throws Exception
Specified by:
run in interface JavaMainCaller
Throws:
Exception

run

public void run(boolean displayCmd,
                boolean throwFailure)
         throws Exception
Description copied from interface: JavaMainCaller
Runs the JavaMain with all the built up arguments/options

Specified by:
run in interface JavaMainCaller
Throws:
Exception

spawn

public void spawn(boolean displayCmd)
           throws Exception
Description copied from interface: JavaMainCaller
run the command without stream redirection nor waiting for exit

Specified by:
spawn in interface JavaMainCaller
Throws:
Exception


Copyright © 2009-2010 Scala Tools. All Rights Reserved.