Class Statements


  • public class Statements
    extends Object
    Statements used in shell scripts.
    • Constructor Detail

      • Statements

        public Statements()
    • Method Detail

      • newStatementList

        public static Statement newStatementList​(Statement... statements)
      • findPid

        public static Statement findPid​(String args)
        Stores the pid into the variable FOUND_PID if successful.
        Parameters:
        args - - what to search for in the process tree.
      • forget

        public static Statement forget​(String instanceName,
                                       String script,
                                       String logDir)
        Runs the script in a way that it can be matched later with findPid(java.lang.String)
        Parameters:
        instanceName - - what to match the process on
        script - - what to run in the background
        logDir - - where to write the following logs:
        1. stdout.log
        2. stderr.log
      • interpret

        public static Statement interpret​(String... portableStatements)
        statement can have multiple newlines, note you should use lf to be portable
        See Also:
        ShellToken
      • literal

        public static Statement literal​(String literalStatement)
        sends statement only appending a newline
      • exec

        public static Statement exec​(String portableStatement)
        interprets and adds a newline to the statement
      • extractTargzIntoDirectory

        public static Statement extractTargzIntoDirectory​(String method,
                                                          URI endpoint,
                                                          com.google.common.collect.Multimap<String,​String> headers,
                                                          String directory)
        untar, ungzip the data received from the request parameters.
        Parameters:
        method - http method: ex GET
        endpoint - uri corresponding to the request
        headers - request headers to send
        directory -
      • extractTargzAndFlattenIntoDirectory

        public static Statement extractTargzAndFlattenIntoDirectory​(URI tgz,
                                                                    String dest)
        like extractTargzIntoDirectory(URI, String) except that it flattens the first directory in the archive For example, apache-maven-3.0.4-bin.tar.gz normally extracts directories like ./apache-maven-3.0.4/bin. This command eliminates the intermediate directory, in the example ./apache-maven-3.0.4/
        Parameters:
        tgz - remote ref to download
        dest - path where the files in the intermediate directory will end
      • extractTargzIntoDirectory

        public static Statement extractTargzIntoDirectory​(URI targz,
                                                          String directory)
      • extractZipIntoDirectory

        public static Statement extractZipIntoDirectory​(String method,
                                                        URI endpoint,
                                                        com.google.common.collect.Multimap<String,​String> headers,
                                                        String directory)
        unzip the data received from the request parameters.
        Parameters:
        method - http method: ex GET
        endpoint - uri corresponding to the request
        headers - request headers to send
        directory -
      • pipeHttpResponseToBash

        public static Statement pipeHttpResponseToBash​(String method,
                                                       URI endpoint,
                                                       com.google.common.collect.Multimap<String,​String> headers)
        exec the data received from the request parameters.
        Parameters:
        method - http method: ex GET
        endpoint - uri corresponding to the request
        headers - request headers to send