Giraffe

Gracefully Integrated Remote Access For Files and Execution

“A long neck to reach far-away places”

Giraffe is a Java library that makes it easy to access files and execute commands on local and remote machines. A simple and usable API isolates clients from differences in access mechanisms, allowing the same code to target many different hosts. It aims to feel like an extension of the standard library, integrating with and taking inspiration from the java.nio.file package.

Latest Release: 0.10.1

Maven Coordinates: com.palantir.giraffe:giraffe-(core|ssh):0.10.1

Repository: https://jcenter.bintray.com

String hostname = "production.giraffe-cloud.biz";
SshHostAccessor prodHost = SshHostAccessor.forPassword(hostname, "admin", "l0ngN3ck");

try (HostControlSystem hcs = prodHost.open()) {
  // the path on the local machine
  Path dist = Paths.get("/opt/releases/gazelle-0.42.0.tar.gz");

  // the path on the remote machine
  Path target = hcs.getPath("/opt/gazelle/gazelle-0.42.0.tar.gz");

  MoreFiles.copyLarge(dist, target);
  Commands.execute(hcs.getCommand("tar", "xzf", target));

  MoreFiles.addPermission(target.getParent().resolve("gazelle.sh"), PosixFilePermission.OWNER_EXECUTE);
  Commands.execute(hcs.getCommand("/opt/gazelle/gazelle.sh", "start"));
}

Giraffe is open-sourced under the Apache 2.0 license and is developed by a team at Palantir Technologies, where it is the foundation of many test frameworks and deployment tools.


Releases

  1. 0.10.1 (2020-09-15)
  2. 0.10.0 (2019-02-08)
  3. 0.9.0 (2018-03-30)
  4. 0.8.1 (2017-03-31)
  5. 0.8.0 (2016-01-17)
  6. 0.7.0 (2015-07-13)