View Javadoc

1   package org_scala_tools_maven_executions;
2   
3   import java.io.File;
4   /**
5    * This interface is used to create a call on a main method of a java class.
6    *
7    * The important implementations are JavaCommand and ReflectionJavaCaller
8    *
9    * @author J. Suereth
10   *
11   */
12  public interface JavaMainCaller {
13      /** Adds an environemnt variable */
14      public abstract void addEnvVar(String key, String value);
15      /** Adds a JVM arg.  Note: This is not available for in-process "forks" */
16      public abstract void addJvmArgs(String... args);
17      /** Adds arguments for the process */
18      public abstract void addArgs(String... args);
19      /** Adds option (basically two arguments) */
20      public abstract void addOption(String key, String value);
21      /** Adds an option (key-file pair). This will pull the absolute path of the file */
22      public abstract void addOption(String key, File value);
23      /** Adds the key if the value is true */
24      public abstract void addOption(String key, boolean value);
25  
26      /** request run to be redirected to maven/requester logger */
27      public abstract void redirectToLog();
28  
29      // TODO: avoid to have several Thread to pipe stream
30      // TODO: add support to inject startup command and shutdown command (on :quit)
31      public abstract void run(boolean displayCmd) throws Exception;
32      /** Runs the JavaMain with all the built up arguments/options */
33      public abstract boolean run(boolean displayCmd, boolean throwFailure) throws Exception;
34  
35      /**
36       * run the command without stream redirection nor waiting for exit
37       *
38       * @param displayCmd
39       * @return the spawn Process (or null if no process was spawned)
40       * @throws Exception
41       */
42      public abstract SpawnMonitor spawn(boolean displayCmd) throws Exception;
43  
44  }