Class Main
- java.lang.Object
-
- fr.ens.biologie.genomique.eoulsan.Main
-
- Direct Known Subclasses:
MainCLI,MainHadoop
public abstract class Main extends Object
This class is the main class. Check the environment, if Hadoop library is in the classpath launch Hadoop main class else run local main class.- Since:
- 1.0
- Author:
- Laurent Jourdren
-
-
Field Summary
Fields Modifier and Type Field Description static StringEOULSAN_CLASSPATH_JVM_ARGstatic StringEOULSAN_MEMORYstatic StringEOULSAN_PATHstatic StringEOULSAN_SCRIPT
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidcreateLogFileAndFlushLog(URI logFilename)Create a new log file and flush log.voidcreateLogFiles(URI EoulsanlogFilename, URI otherlogFilename)Create the log file for Eoulsan and additional log file for dependencies that use their own logging system.voidcreateOtherLog(URI logFilename)Create the additional log file for dependencies that use their own logging system.voidflushLog()Flush log.ActiongetAction()Get the action.List<String>getActionArgs()Get the action arguments.List<String>getArgs()Get command line arguments.StringgetClassPath()Get Eoulsan classpath.List<String>getCommandLineSettings()Get the command line settings arguments.StringgetConfigurationFileArgument()Get the configuration file argument.FilegetEoulsanDirectory()Get Eoulsan directory.intgetEoulsanMemory()Get Eoulsan memory requirement.StringgetEoulsanScriptPath()Get Eoulsan script path.protected abstract StringgetHelpEoulsanCommand()Get the command used to launch Eoulsan.static MaingetInstance()Get the instance of the Main class.StringgetJavaExecutablePath()Get java executable path.List<String>getJVMArgs()Get JVM arguments.StringgetLaunchMode()Get the launch mode of the application.StringgetLaunchScriptPath()Get the path to the launch script.StringgetLogFileArgument()Get the log file argument.protected abstract HandlergetLogHandler(URI logFile)Get the Handler to create the log file.StringgetLogLevelArgument()Get the log level arguments.protected voidhelp(org.apache.commons.cli.Options options)Show command line help.protected abstract voidinitializeRuntime(Settings settings)Initialize the Eoulsan runtime.static voidmain(String[] args)Main method of the program.protected org.apache.commons.cli.OptionsmakeOptions()Create options for command lineprotected voidsysInfoLog()Log system information.
-
-
-
Field Detail
-
EOULSAN_CLASSPATH_JVM_ARG
public static final String EOULSAN_CLASSPATH_JVM_ARG
- See Also:
- Constant Field Values
-
EOULSAN_SCRIPT
public static final String EOULSAN_SCRIPT
- See Also:
- Constant Field Values
-
EOULSAN_PATH
public static final String EOULSAN_PATH
- See Also:
- Constant Field Values
-
EOULSAN_MEMORY
public static final String EOULSAN_MEMORY
- See Also:
- Constant Field Values
-
-
Method Detail
-
getInstance
public static Main getInstance()
Get the instance of the Main class.- Returns:
- a Main object
-
getJavaExecutablePath
public String getJavaExecutablePath()
Get java executable path.- Returns:
- the path to the java executable
-
getJVMArgs
public List<String> getJVMArgs()
Get JVM arguments.- Returns:
- the JVM arguments as an array
-
getClassPath
public String getClassPath()
Get Eoulsan classpath. The result of the method is based on the content of the -Deoulsan.hadoop.libs JVM argument.- Returns:
- the JVM class as a String
-
getEoulsanScriptPath
public String getEoulsanScriptPath()
Get Eoulsan script path.- Returns:
- the Eoulsan script path
-
getEoulsanMemory
public int getEoulsanMemory()
Get Eoulsan memory requirement.- Returns:
- the Eoulsan memory requirement
-
getEoulsanDirectory
public File getEoulsanDirectory()
Get Eoulsan directory.- Returns:
- the Eoulsan directory
-
getAction
public Action getAction()
Get the action.- Returns:
- Returns the action
-
getActionArgs
public List<String> getActionArgs()
Get the action arguments.- Returns:
- Returns the actionArgs
-
getLogLevelArgument
public String getLogLevelArgument()
Get the log level arguments.- Returns:
- Returns the logLevel
-
getLogFileArgument
public String getLogFileArgument()
Get the log file argument.- Returns:
- Returns the log
-
getConfigurationFileArgument
public String getConfigurationFileArgument()
Get the configuration file argument.- Returns:
- Returns the configuration file
-
getCommandLineSettings
public List<String> getCommandLineSettings()
Get the command line settings arguments.- Returns:
- a list with the settings defined in the command line
-
getLaunchScriptPath
public String getLaunchScriptPath()
Get the path to the launch script.- Returns:
- the path to the launch script or null if no launch script has been used
-
getLaunchMode
public String getLaunchMode()
Get the launch mode of the application.- Returns:
- the launch mode of the application
-
help
protected void help(org.apache.commons.cli.Options options)
Show command line help.- Parameters:
options- Options of the software
-
makeOptions
protected org.apache.commons.cli.Options makeOptions()
Create options for command line- Returns:
- an Options object
-
sysInfoLog
protected void sysInfoLog()
Log system information.
-
createLogFileAndFlushLog
public void createLogFileAndFlushLog(URI logFilename) throws EoulsanException
Create a new log file and flush log.- Parameters:
logFilename- log file name- Throws:
EoulsanException- if an error occurs while creating log file
-
createOtherLog
public void createOtherLog(URI logFilename)
Create the additional log file for dependencies that use their own logging system.- Parameters:
logFilename- the log file name
-
createLogFiles
public void createLogFiles(URI EoulsanlogFilename, URI otherlogFilename) throws EoulsanException
Create the log file for Eoulsan and additional log file for dependencies that use their own logging system.- Parameters:
EoulsanlogFilename- Eoulsan log file nameotherlogFilename- other log file name- Throws:
EoulsanException- if an error occurs while creating log file
-
flushLog
public void flushLog()
Flush log.
-
initializeRuntime
protected abstract void initializeRuntime(Settings settings) throws EoulsanException
Initialize the Eoulsan runtime.- Throws:
EoulsanException
-
getHelpEoulsanCommand
protected abstract String getHelpEoulsanCommand()
Get the command used to launch Eoulsan.- Returns:
- a String with the command used to launch Eoulsan
-
getLogHandler
protected abstract Handler getLogHandler(URI logFile) throws IOException
Get the Handler to create the log file.- Parameters:
logFile- the path to the log file- Returns:
- a new Handler object
- Throws:
IOException- if an exception occurs while creating the handler
-
main
public static void main(String[] args)
Main method of the program.- Parameters:
args- command line arguments
-
-