Codota Logo
ProcessExecution
Code IndexAdd Codota to your IDE (free)

How to use
ProcessExecution
in
org.rhq.core.system

Best Java code snippets using org.rhq.core.system.ProcessExecution (Showing top 12 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
Charset c =
  • Codota IconString charsetName;Charset.forName(charsetName)
  • Codota IconCharset.defaultCharset()
  • Codota IconContentType contentType;contentType.getCharset()
  • Smart code suggestions by Codota
}
origin: org.rhq/rhq-jboss-as-7-plugin

processExecution.setEnvironmentVariables(startScriptEnv);
List<String> arguments = processExecution.getArguments();
if (arguments == null) {
  arguments = new ArrayList<String>();
  processExecution.setArguments(arguments);
processExecution.setWorkingDirectory(startScriptFile.getParent());
processExecution.setCaptureOutput(true);
processExecution.setWaitForCompletion(MAX_PROCESS_WAIT_TIME);
processExecution.setKillOnTimeout(false);
  processExecution.setWaitForCompletion(waitTime);
} else if (waitTime < 0) {
  processExecution.setWaitForCompletion(0);
processExecution.setKillOnTimeout(killOnTimeout);
origin: org.jboss.on/jopr-tomcat-plugin

private ProcessExecution getRpmStart(Configuration pluginConfiguration) {
  ProcessExecution processExecution;
  String rpm = getTomcatServiceNum();
  if (isWindows()) {
    processExecution = new ProcessExecution("net");
    // disable the executable existence check because it is a command on the supplied PATH
    processExecution.setCheckExecutableExists(false);
    processExecution.setArguments(new ArrayList<String>());
    processExecution.getArguments().add("start");
    processExecution.getArguments().add(rpm);
  } else {
    processExecution = new ProcessExecution("service");
    // disable the executable existence check because it is a command on the supplied PATH
    processExecution.setCheckExecutableExists(false);
    processExecution.setArguments(new ArrayList<String>());
    processExecution.getArguments().add(rpm);
    processExecution.getArguments().add("start");
  }
  Map<String, String> envVars = new LinkedHashMap<String, String>(System.getenv());
  processExecution.setEnvironmentVariables(envVars);
  initProcessExecution(processExecution);
  return processExecution;
}
origin: org.jboss.on/jopr-tomcat-plugin

private void initProcessExecution(ProcessExecution processExecution) {
  processExecution.setCaptureOutput(true);
  processExecution.setWaitForCompletion(120000L); // 120 seconds - that should be safe? // TODO: make this configurable
  processExecution.setKillOnTimeout(false);
}
origin: org.rhq/rhq-core-plugin-api

processExecution = new ProcessExecution(executable);
processExecution.setArguments(args);
processExecution.setEnvironmentVariables(envVars);
processExecution.setWorkingDirectory(file.getParent());
origin: org.jboss.on/jopr-tomcat-plugin

private static void applyEnvironmentVars(PropertyList environment, ProcessExecution processExecution) {
  if (environment != null) {
    Map<String, String> environmentVariables = processExecution.getEnvironmentVariables();
    for (Property prop : environment.getList()) {
      PropertyMap var = (PropertyMap) prop;
      environmentVariables.put(var.getSimpleValue("name", null), var.getSimpleValue("value", null));
    }
    processExecution.setEnvironmentVariables(environmentVariables);
  }
}
origin: org.jboss.on/jopr-tomcat-plugin

private void initScriptProcessExecution(ProcessExecution processExecution, File scriptFile) {
  // For the script to work the current working dir must be set to the script's parent dir
  processExecution.setWorkingDirectory(scriptFile.getParent());
  // Set necessary environment variables
  setProcessExecutionEnvironment(processExecution, this.serverComponent.getCatalinaHome().getPath(),
    this.serverComponent.getCatalinaBase().getPath());
  initProcessExecution(processExecution);
}
origin: org.rhq/rhq-cassandra-ccm-core

private ProcessExecutionResults startNode(File basedir) {
  if (log.isDebugEnabled()) {
    log.debug("Starting node at " + basedir);
  }
  File binDir = new File(basedir, "bin");
  File startScript;
  SystemInfo systemInfo = SystemInfoFactory.createSystemInfo();
  ProcessExecution startScriptExe;
  if (systemInfo.getOperatingSystemType() == OperatingSystemType.WINDOWS) {
    startScript = new File(binDir, "cassandra.bat");
    startScriptExe = createProcessExecution(null, startScript);
  } else {
    startScript = new File(binDir, "cassandra");
    startScriptExe = createProcessExecution(null, startScript);
    startScriptExe.addArguments(Arrays.asList("-p", "cassandra.pid"));
  }
  startScriptExe.setWaitForCompletion(0);
  ProcessExecutionResults results = systemInfo.executeProcess(startScriptExe);
  if (log.isDebugEnabled()) {
    log.debug(startScript + " returned with exit code [" + results.getExitCode() + "]");
  }
  return results;
}
origin: org.jboss.on/jopr-tomcat-plugin

private ProcessExecution getScriptStart(Configuration pluginConfiguration) {
  File startScriptFile = this.serverComponent.getStartScriptPath();
  validateScriptFile(startScriptFile, TomcatServerComponent.PLUGIN_CONFIG_START_SCRIPT);
  String prefix = pluginConfiguration.getSimple(TomcatServerComponent.PLUGIN_CONFIG_SCRIPT_PREFIX)
    .getStringValue();
  ProcessExecution processExecution;
  // prefix is either null or contains ONLY whitespace characters
  if (prefix == null || prefix.replaceAll("\\s", "").equals("")) {
    processExecution = ProcessExecutionUtility.createProcessExecution(startScriptFile);
  } else {
    // The process execution should be tied to the process represented as the prefix. If there are any other
    // tokens in the prefix, consider them arguments to the prefix process.
    StringTokenizer prefixTokenizer = new StringTokenizer(prefix);
    String processName = prefixTokenizer.nextToken();
    File prefixProcess = new File(processName);
    processExecution = ProcessExecutionUtility.createProcessExecution(prefixProcess);
    while (prefixTokenizer.hasMoreTokens()) {
      String prefixArgument = prefixTokenizer.nextToken();
      processExecution.getArguments().add(prefixArgument);
    }
    // Assemble the AS start script and its prefixes as one argument to the prefix
    String startScriptArgument = startScriptFile.getAbsolutePath();
    processExecution.getArguments().add(startScriptArgument);
  }
  initScriptProcessExecution(processExecution, startScriptFile);
  return processExecution;
}
origin: org.rhq/rhq-cassandra-ccm-core

processExecution = new ProcessExecution(executable);
processExecution.setArguments(args);
processExecution.setEnvironmentVariables(envVars);
processExecution.setWorkingDirectory(file.getParent());
origin: org.jboss.on/jopr-tomcat-plugin

processExecution.setCaptureOutput(true);
processExecution.setWaitForCompletion(timeout);
processExecution.setKillOnTimeout(true);
origin: org.jboss.on/jopr-tomcat-plugin

Map<String, String> processExecutionEnvironmentVariables = processExecution.getEnvironmentVariables();
if (null == processExecutionEnvironmentVariables) {
  processExecutionEnvironmentVariables = new LinkedHashMap<String, String>();
  processExecution.setEnvironmentVariables(processExecutionEnvironmentVariables);
origin: org.jboss.on/jopr-tomcat-plugin

private ProcessExecution getRpmShutdown() {
  ProcessExecution processExecution;
  String rpm = getTomcatServiceNum();
  if (isWindows()) {
    processExecution = new ProcessExecution("net");
    // disable the executable existence check because it is a command on the supplied PATH
    processExecution.setCheckExecutableExists(false);
    processExecution.setArguments(new ArrayList<String>());
    processExecution.getArguments().add("stop");
    processExecution.getArguments().add(rpm);
  } else {
    processExecution = new ProcessExecution("service");
    // disable the executable existence check because it is a command on the supplied PATH
    processExecution.setCheckExecutableExists(false);
    processExecution.setArguments(new ArrayList<String>());
    processExecution.getArguments().add(rpm);
    processExecution.getArguments().add("stop");
  }
  Map<String, String> envVars = new LinkedHashMap<String, String>(System.getenv());
  log.info("Operation Envs: " + envVars);
  processExecution.setEnvironmentVariables(envVars);
  initProcessExecution(processExecution);
  return processExecution;
}
org.rhq.core.systemProcessExecution

Javadoc

Provides information on what process to execute and how to execute it.

Agent plugin developers should also see the ProcessExecutionUtility class in the plugin-api module, which provides handy methods for creating ProcessExecutions.

Most used methods

  • setArguments
    Sets an optional set of arguments to pass to the executable.
  • setEnvironmentVariables
    Sets an optional set of environment variables to pass to the process. If null, the new process will
  • setWorkingDirectory
    If not null, will be the working directory of the new process (if null, the new process's working di
  • <init>
    Constructor for ProcessExecution that defines the full path to the executable that will be run. See
  • setWaitForCompletion
    The time, in milliseconds, to wait for the process to exit (will not wait if 0 or less).
  • getArguments
    Obtain the optional set of arguments to the executable as List.
  • setCaptureOutput
    If true, the process's output will be captured and returned in the results. This may be ignored ifwa
  • setKillOnTimeout
    If true, then the process will be forcibly killed if it doesn't exit within the #getWaitForCompletio
  • addArguments
    Adds an optional set of arguments to the current arguments passed to the executable.
  • getArgumentsAsArray
    Obtain the optional set of arguments to the executable as String array
  • getCaptureMode
    get process output capture mode
  • getEnvironmentVariables
  • getCaptureMode,
  • getEnvironmentVariables,
  • getEnvironmentVariablesAsArray,
  • getExecutable,
  • getWaitForCompletion,
  • getWorkingDirectory,
  • isCaptureOutput,
  • isCheckExecutableExists,
  • isKillOnTimeout,
  • setCheckExecutableExists

Popular in Java

  • Updating database using SQL prepared statement
  • requestLocationUpdates (LocationManager)
  • notifyDataSetChanged (ArrayAdapter)
  • setScale (BigDecimal)
    Returns a BigDecimal whose scale is the specified value, and whose value is numerically equal to thi
  • URLConnection (java.net)
    The abstract class URLConnection is the superclass of all classes that represent a communications li
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • TreeSet (java.util)
    A NavigableSet implementation based on a TreeMap. The elements are ordered using their Comparable, o
  • Collectors (java.util.stream)
  • BoxLayout (javax.swing)
  • LogFactory (org.apache.commons.logging)
    A minimal incarnation of Apache Commons Logging's LogFactory API, providing just the common Log look
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now