org.kuali.common.deploy
Class DeployUtils

java.lang.Object
  extended by org.kuali.common.deploy.DeployUtils

public class DeployUtils
extends Object


Constructor Summary
DeployUtils()
           
 
Method Summary
static org.kuali.common.util.secure.channel.Result chown(org.kuali.common.util.secure.channel.SecureChannel channel, String owner, String group, List<String> paths)
           
static void copyFiles(org.kuali.common.util.secure.channel.SecureChannel channel, List<Deployable> deployables, Properties filterProperties)
           
static org.kuali.common.util.secure.channel.Result delete(org.kuali.common.util.secure.channel.SecureChannel channel, List<String> paths)
           
static org.kuali.common.util.secure.channel.Result executeCommand(org.kuali.common.util.secure.channel.SecureChannel channel, String command, boolean validateResult)
           
static org.kuali.common.util.secure.channel.Result executePathCommand(org.kuali.common.util.secure.channel.SecureChannel channel, String command, List<String> paths)
           
static void executePathCommand(org.kuali.common.util.secure.channel.SecureChannel channel, String command, String path)
           
static List<org.kuali.common.util.UnixProcess> getMatchingProcesses(List<org.kuali.common.util.UnixProcess> processes, String command)
          Return a list of any processes where the command exactly matches the command passed in.
static String getNohupBackgroundProcess(String user, String cmd)
          Execute cmd as user using nohup and running it in the background.
static List<String> getOutputLines(org.kuali.common.util.secure.channel.Result result)
           
static org.kuali.common.util.UnixProcess getUnixProcess(String header, String line)
          Output looks like this:
static List<org.kuali.common.util.UnixProcess> getUnixProcesses(org.kuali.common.util.secure.channel.Result result)
          Output looks like this:
static List<org.kuali.common.util.UnixProcess> getUnixProcesses(org.kuali.common.util.secure.channel.SecureChannel channel, String user)
           
static void kill(org.kuali.common.util.secure.channel.SecureChannel channel, org.kuali.common.util.UnixProcess process)
           
static void killMatchingProcesses(org.kuali.common.util.secure.channel.SecureChannel channel, String user, String cmd, String processLabel)
           
protected static void logCopy(String src, String dst, long elapsed)
           
static void logResult(org.kuali.common.util.secure.channel.Result result, org.slf4j.Logger logger)
           
static void logResult(org.kuali.common.util.secure.channel.Result result, org.slf4j.Logger logger, org.kuali.common.util.log.LoggerLevel level)
           
static org.kuali.common.util.secure.channel.Result mkdirs(org.kuali.common.util.secure.channel.SecureChannel channel, List<String> paths)
           
static org.kuali.common.util.MonitorTextFileResult monitorTextFile(org.kuali.common.util.secure.channel.SecureChannel channel, String path, String token, int intervalMillis, int timeoutMillis, String encoding)
          Examine the contents of a text file, stopping as soon as it contains token, or timeout is exceeded, whichever comes first.
static org.kuali.common.util.secure.channel.Result runscript(org.kuali.common.util.secure.channel.SecureChannel channel, String username, String script)
           
static org.kuali.common.util.secure.channel.Result runscript(org.kuali.common.util.secure.channel.SecureChannel channel, String username, String script, boolean validateExitValue)
           
static void validateResult(org.kuali.common.util.secure.channel.Result result)
           
static void validateResult(org.kuali.common.util.secure.channel.Result result, List<Integer> exitValues)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DeployUtils

public DeployUtils()
Method Detail

monitorTextFile

public static org.kuali.common.util.MonitorTextFileResult monitorTextFile(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                          String path,
                                                                          String token,
                                                                          int intervalMillis,
                                                                          int timeoutMillis,
                                                                          String encoding)
Examine the contents of a text file, stopping as soon as it contains token, or timeout is exceeded, whichever comes first.


killMatchingProcesses

public static void killMatchingProcesses(org.kuali.common.util.secure.channel.SecureChannel channel,
                                         String user,
                                         String cmd,
                                         String processLabel)

getNohupBackgroundProcess

public static String getNohupBackgroundProcess(String user,
                                               String cmd)
Execute cmd as user using nohup and running it in the background.


copyFiles

public static void copyFiles(org.kuali.common.util.secure.channel.SecureChannel channel,
                             List<Deployable> deployables,
                             Properties filterProperties)

logCopy

protected static void logCopy(String src,
                              String dst,
                              long elapsed)

getMatchingProcesses

public static List<org.kuali.common.util.UnixProcess> getMatchingProcesses(List<org.kuali.common.util.UnixProcess> processes,
                                                                           String command)
Return a list of any processes where the command exactly matches the command passed in.


getUnixProcesses

public static List<org.kuali.common.util.UnixProcess> getUnixProcesses(org.kuali.common.util.secure.channel.Result result)
Output looks like this:
   UID        PID  PPID  C STIME TTY          TIME CMD
         tomcat   15461 15460  0 22:51 pts/0    00:00:00 -bash
         tomcat   15480 15461  0 22:52 pts/0    00:00:02 java -jar /usr/local/machine-agent/machineagent.jar
 


getUnixProcess

public static org.kuali.common.util.UnixProcess getUnixProcess(String header,
                                                               String line)
Output looks like this:
   UID        PID  PPID  C STIME TTY          TIME CMD
         tomcat   15461 15460  0 22:51 pts/0    00:00:00 -bash
         tomcat   15480 15461  0 22:52 pts/0    00:00:02 java -jar /usr/local/machine-agent/machineagent.jar
 


executeCommand

public static org.kuali.common.util.secure.channel.Result executeCommand(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                         String command,
                                                                         boolean validateResult)

kill

public static void kill(org.kuali.common.util.secure.channel.SecureChannel channel,
                        org.kuali.common.util.UnixProcess process)

getUnixProcesses

public static List<org.kuali.common.util.UnixProcess> getUnixProcesses(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                       String user)

runscript

public static org.kuali.common.util.secure.channel.Result runscript(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                    String username,
                                                                    String script)

runscript

public static org.kuali.common.util.secure.channel.Result runscript(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                    String username,
                                                                    String script,
                                                                    boolean validateExitValue)

delete

public static org.kuali.common.util.secure.channel.Result delete(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                 List<String> paths)

mkdirs

public static org.kuali.common.util.secure.channel.Result mkdirs(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                 List<String> paths)

chown

public static org.kuali.common.util.secure.channel.Result chown(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                String owner,
                                                                String group,
                                                                List<String> paths)

executePathCommand

public static void executePathCommand(org.kuali.common.util.secure.channel.SecureChannel channel,
                                      String command,
                                      String path)

executePathCommand

public static org.kuali.common.util.secure.channel.Result executePathCommand(org.kuali.common.util.secure.channel.SecureChannel channel,
                                                                             String command,
                                                                             List<String> paths)

getOutputLines

public static List<String> getOutputLines(org.kuali.common.util.secure.channel.Result result)

logResult

public static void logResult(org.kuali.common.util.secure.channel.Result result,
                             org.slf4j.Logger logger,
                             org.kuali.common.util.log.LoggerLevel level)

logResult

public static void logResult(org.kuali.common.util.secure.channel.Result result,
                             org.slf4j.Logger logger)

validateResult

public static void validateResult(org.kuali.common.util.secure.channel.Result result)

validateResult

public static void validateResult(org.kuali.common.util.secure.channel.Result result,
                                  List<Integer> exitValues)


Copyright © 2004–2014 The Kuali Foundation. All rights reserved.