Tabnine Logo
AbstractSoftwareProcessSshDriver
Code IndexAdd Tabnine to your IDE (free)

How to use
AbstractSoftwareProcessSshDriver
in
brooklyn.entity.basic

Best Java code snippets using brooklyn.entity.basic.AbstractSoftwareProcessSshDriver (Showing top 20 results out of 315)

origin: io.brooklyn/brooklyn-software-messaging

@Override
public RabbitBrokerImpl getEntity() {
  return (RabbitBrokerImpl) super.getEntity();
}

origin: io.brooklyn/brooklyn-software-base

public int copyResource(File file, String target) {
  return copyResource(file.toURI().toASCIIString(), target);
}
public int copyResource(String resource, String target) {
origin: io.brooklyn/brooklyn-software-base

public int copyTemplate(String template, String target) {
  return copyTemplate(template, target, ImmutableMap.<String, String>of());
}

origin: io.brooklyn/brooklyn-software-base

/**
 * Name to be used in the local repo, when looking for the download file.
 * If null, will 
 */
public String getDownloadFilename() {
  return getEntity().getEntityType().getSimpleName().toLowerCase() + "-"+getVersion() + ".tar.gz";
}
origin: io.brooklyn/brooklyn-software-base

public String getVersion() {
  return elvis(getEntity().getConfig(SoftwareProcess.SUGGESTED_VERSION), getDefaultVersion());
}
origin: io.brooklyn/brooklyn-software-base

@SuppressWarnings({ "rawtypes", "unchecked" })
@Override
public int execute(Map flags2, List<String> script, String summaryForLogging) {
  Map flags = new LinkedHashMap();
  if (!flags2.containsKey(IGNORE_ENTITY_SSH_FLAGS))
    flags.putAll(getSshFlags());
  flags.putAll(flags2);
  Map<String, String> environment = (Map<String, String>) ((flags.get("env") != null) ? flags.get("env") : getShellEnvironment());
  if (!flags.containsKey("logPrefix")) flags.put("logPrefix", ""+entity.getId()+"@"+getLocation().getDisplayName());
  return getMachine().execScript(flags, summaryForLogging, script, environment);
}
origin: io.brooklyn/brooklyn-software-base

/**
 * Sets all JVM options (-X.. -D..) in an environment var JAVA_OPTS.
 * <p>
 * That variable is constructed from getJavaOpts(), then wrapped _unescaped_ in double quotes. An
 * error is thrown if there is an unescaped double quote in the string. All other unescaped
 * characters are permitted, but unless $var expansion or `command` execution is desired (although
 * this is not confirmed as supported) the generally caller should escape any such characters, for
 * example using {@link BashStringEscapes#escapeLiteralForDoubleQuotedBash(String)}.
 */
@Override
public Map<String, String> getShellEnvironment() {
  for (String it : getJavaOpts()) {
    BashStringEscapes.assertValidForDoubleQuotingInBash(it);
  }
  // do not double quote here; the env var is double quoted subsequently;
  // spaces should be preceded by double-quote
  // (if dbl quotes are needed we could pass on the command-line instead of in an env var)
  String sJavaOpts = Joiner.on(" ").join(getJavaOpts());
  // println "using java opts: $sJavaOpts"
  return MutableMap.<String, String> builder().putAll(super.getShellEnvironment()).put("JAVA_OPTS", sJavaOpts).build();
}
origin: io.brooklyn/brooklyn-software-base

public int execute(List<String> script, String summaryForLogging) {
  return execute(Maps.newLinkedHashMap(), script, summaryForLogging);
}

origin: io.brooklyn/brooklyn-software-base

/** @deprecated since 0.5.0, should use {@link copyResource(File, String)}. */
@Deprecated
public void copyFile(File src, String destination) {
  copyFile(MutableMap.of(), src, destination);
}
/** @deprecated since 0.5.0, destination should be a string not a File */
origin: io.brooklyn/brooklyn-software-messaging

  @Override
  public Map<String, String> getShellEnvironment() {
    return MutableMap.<String, String>builder()
        .putAll(super.getShellEnvironment())
        .put("RABBITMQ_HOME", getRunDir())
        .put("RABBITMQ_LOG_BASE", getRunDir())
        .put("RABBITMQ_NODENAME", getEntity().getId())
        .put("RABBITMQ_NODE_PORT", getAmqpPort().toString())
        .put("RABBITMQ_PID_FILE", getRunDir()+"/"+getPidFile())
        .build();
  }
}
origin: io.brooklyn/brooklyn-software-database

public MariaDbNodeImpl getEntity() { return (MariaDbNodeImpl) super.getEntity(); }
public int getPort() { return getEntity().getPort(); }
origin: io.brooklyn/brooklyn-software-base

public void copyResources(Map<String, String> resources) {
  if (resources != null && resources.size() > 0) {
    log.info("Customising {} with resources: {}", entity, resources);
    for (Map.Entry<String, String> entry : resources.entrySet()) {
      String source = entry.getValue();
      String dest = entry.getKey();
      copyResource(source, dest);
    }
  }
}
origin: io.brooklyn/brooklyn-software-base

public int copyTemplate(File template, String target) {
  return copyTemplate(template.toURI().toASCIIString(), target);
}
public int copyTemplate(String template, String target) {
origin: io.brooklyn/brooklyn-software-webapp

@Override
public NginxControllerImpl getEntity() {
  return (NginxControllerImpl) super.getEntity();
}
origin: io.brooklyn/brooklyn-software-base

public int copyResource(String resource, String target) {
  return copyResource(MutableMap.of(), resource, target);
}
@SuppressWarnings({ "unchecked", "rawtypes" })
origin: io.brooklyn/brooklyn-software-base

public void copyTemplates(Map<String, String> templates) {
  if (templates != null && templates.size() > 0) {
    log.info("Customising {} with templates: {}", entity, templates);
    for (Map.Entry<String, String> entry : templates.entrySet()) {
      String source = entry.getValue();
      String dest = entry.getKey();
      copyTemplate(source, dest);
    }
  }
}
origin: io.brooklyn/brooklyn-software-database

@Override
public PostgreSqlNodeImpl getEntity() {
  return (PostgreSqlNodeImpl) super.getEntity();
}
origin: io.brooklyn/brooklyn-software-network

@Override
public BindDnsServerImpl getEntity() {
  return (BindDnsServerImpl) super.getEntity();
}
origin: io.brooklyn/brooklyn-software-database

public MySqlNodeImpl getEntity() { return (MySqlNodeImpl) super.getEntity(); }
public int getPort() { return getEntity().getPort(); }
origin: io.brooklyn/brooklyn-software-base

/** extracts the values for the main brooklyn.ssh.config.* config keys (i.e. those declared in ConfigKeys) 
 * as declared on the entity, and inserts them in a map using the unprefixed state, for ssh. */
/* currently this is computed for each call, which may be wasteful, but it is reliable in the face of config changes. 
 * we could cache the Map.  note that we do _not_ cache (or even own) the SshTool; 
 * the SshTool is created or re-used by the SshMachineLocation making use of these properties */
protected Map<String, Object> getSshFlags() {
  Map<String, Object> result = Maps.newLinkedHashMap();
  StringConfigMap globalConfig = ((EntityInternal)getEntity()).getManagementContext().getConfig();
  Map<ConfigKey<?>, Object> mgmtConfig = globalConfig.getAllConfig();
  Map<ConfigKey<?>, Object> entityConfig = ((EntityInternal)getEntity()).getAllConfig();
  Map<ConfigKey<?>, Object> allConfig = MutableMap.<ConfigKey<?>, Object>builder().putAll(mgmtConfig).putAll(entityConfig).build();
  
  for (ConfigKey<?> key : allConfig.keySet()) {
    if (key.getName().startsWith(SshTool.BROOKLYN_CONFIG_KEY_PREFIX)) {
      // have to use raw config to test whether the config is set
      Object val = ((EntityInternal)getEntity()).getConfigMap().getRawConfig(key);
      if (val!=null) {
        val = getEntity().getConfig(key);
      } else {
        val = globalConfig.getRawConfig(key);
        if (val!=null) val = globalConfig.getConfig(key);
      }
      if (val!=null) {
        result.put(ConfigUtils.unprefixedKey(SshTool.BROOKLYN_CONFIG_KEY_PREFIX, key).getName(), val);
      }
    }
  }
  return result;
}
brooklyn.entity.basicAbstractSoftwareProcessSshDriver

Javadoc

An abstract SSH implementation of the AbstractSoftwareProcessDriver. This provides conveniences for clients implementing the install/customize/launch/isRunning/stop lifecycle over SSH. These conveniences include checking whether software is already installed, creating/using a PID file for some operations, and reading ssh-specific config from the entity to override/augment ssh flags on the session.

Most used methods

  • getEntity
  • getShellEnvironment
    The environment variables to be set when executing the commands (for install, run, check running, et
  • copyFile
  • copyResource
  • copyTemplate
  • execute
  • getDefaultVersion
  • getEntityVersionLabel
  • getInstallDir
  • getLocation
    returns location (tighten type, since we know it is an ssh machine location here)
  • getMachine
  • getResource
  • getMachine,
  • getResource,
  • getRunDir,
  • getSshFlags,
  • getVersion,
  • newScript,
  • postLaunch,
  • processTemplate,
  • start

Popular in Java

  • Making http requests using okhttp
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • onRequestPermissionsResult (Fragment)
  • notifyDataSetChanged (ArrayAdapter)
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • Permission (java.security)
    Legacy security code; do not use.
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • LoggerFactory (org.slf4j)
    The LoggerFactory is a utility class producing Loggers for various logging APIs, most notably for lo
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now