Class 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
    • 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
      • getArgs

        public List<String> getArgs()
        Get command line arguments.
        Returns:
        Returns the arguments
      • 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 name
        otherlogFilename - other log file name
        Throws:
        EoulsanException - if an error occurs while creating log file
      • flushLog

        public void flushLog()
        Flush log.
      • 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