use of com.fathomdb.hash.Md5Hash in project platformlayer by platformlayer.
the class SolrInstall method addChildren.
@Override
protected void addChildren() throws OpsException {
addChild(JavaVirtualMachine.buildJava6());
// addChild(injected(JettyInstall.class));
addChild(injected(SupervisordInstall.class));
{
// TODO: Would be nice not to hard code this mirror
String apacheMirror = "http://apache.osuosl.org/";
// This probably does need to be hard-coded though
// (though maybe selectable from a list of supported releases)
String file = "lucene/solr/3.6.0/apache-solr-3.6.0.tgz";
Md5Hash hash = new Md5Hash("ac11ef4408bb015aa3a5eefcb1047aec");
File basePath = new File("/opt/");
File zipFile = new File(basePath, "apache-solr-3.6.0.tgz");
File extractPath = new File(basePath, "apache-solr-3.6.0");
DownloadFileByHash download = injected(DownloadFileByHash.class);
download.setUrl(apacheMirror + file);
download.hash = hash;
download.filePath = zipFile;
addChild(download);
// Needed for ExpandArchive
addChild(PackageDependency.build("unzip"));
// TODO: Only unzip if newly downloaded
ExpandArchive unzip = injected(ExpandArchive.class);
unzip.archiveFile = zipFile;
unzip.extractPath = extractPath;
addChild(unzip);
}
addChild(PosixGroup.build("solr"));
addChild(PosixUser.build("solr", false, "solr"));
}
use of com.fathomdb.hash.Md5Hash in project platformlayer by platformlayer.
the class ZookeeperInstall method buildDownload.
@Override
protected DownloadFileByHash buildDownload() {
DownloadFileByHash download = super.buildDownload();
// TODO: Would be nice not to hard code this mirror
// String apacheMirror = "http://ftp.osuosl.org/pub/apache/";
String apacheMirror = "http://apache.osuosl.org/";
// This probably does need to be hard-coded though
// (though maybe selectable from a list of supported releases)
// String url = apacheMirror + "zookeeper/zookeeper-3.3.5/zookeeper-3.3.5.tar.gz";
// download.setUrl(url);
// download.hash = new Md5Hash("4c2c969bce8717d6443e184ff91dfdc7");
String url = apacheMirror + "zookeeper/zookeeper-3.4.5/zookeeper-3.4.5.tar.gz";
download.setUrl(url);
download.hash = new Md5Hash("f64fef86c0bf2e5e0484d19425b22dcb");
return download;
}
use of com.fathomdb.hash.Md5Hash in project platformlayer by platformlayer.
the class MavenHashes method getMd5.
public static Md5Hash getMd5(Path artifactPath) throws IOException {
String fileName = artifactPath.getFileName().toString();
Path md5Path = artifactPath.resolveSibling(fileName + ".md5");
InputStream is = null;
try {
is = Files.newInputStream(md5Path);
String md5 = IoUtils.readAll(is);
return new Md5Hash(md5);
} finally {
IoUtils.safeClose(is);
}
}
use of com.fathomdb.hash.Md5Hash in project platformlayer by platformlayer.
the class OpsTargetBase method getFileHash.
@Override
public Md5Hash getFileHash(File filePath) throws OpsException {
Command command = Command.build("md5sum {0}", filePath);
ProcessExecution execution = executeCommandUnchecked(command);
if (execution.getExitCode() == 1) {
if (execution.getStdErr().contains("No such file or directory")) {
return null;
}
}
execution.checkExitCode();
String stdout = execution.getStdOut();
// Format is "hash filename"
String[] items = stdout.split(" ");
return new Md5Hash(items[0]);
}
use of com.fathomdb.hash.Md5Hash in project platformlayer by platformlayer.
the class CertificateChains method toModel.
public static CertificateChainInfo toModel(X509Certificate[] chain) {
CertificateChainInfo chainInfo = new CertificateChainInfo();
List<CertificateInfo> certificates = chainInfo.getCertificates();
for (X509Certificate cert : chain) {
CertificateInfo certificateInfo = new CertificateInfo();
certificateInfo.setSubjectDN(Certificates.getSubject(cert));
Md5Hash hash = OpenSshUtils.getSignature(cert.getPublicKey());
certificateInfo.setPublicKeyHash(hash.toHex());
byte[] data = cert.getPublicKey().getEncoded();
certificateInfo.setPublicKey(Hex.toHex(data));
certificates.add(certificateInfo);
}
return chainInfo;
}
Aggregations