@Override public File getArtifact() throws Exception { return maven.getArtifact(); }
CachedPom(MavenEntry mavenEntry, URI repo) throws Exception { super(mavenEntry.maven, mavenEntry.getPomFile(), repo); this.maven = mavenEntry; }
if (isValid()) { String valid = getProperty(url.toASCIIString()); if (valid != null) return createPom(url); if (verify(url, pomPath)) { return createPom(url); if (download(url, pomPath)) { if (verify(url, pomPath)) { artifact = new FutureTask<File>(new Callable<File>() { return createPom(url); saveProperties();
/** * We maintain a set of bnd properties in the cache directory. * * @param key The key for the property * @param value The value for the property */ private void setProperty(String key, String value) { Properties properties = getProperties(); properties.setProperty(key, value); propertiesChanged = true; }
public CachedPom getPom(String groupId, String artifactId, String version, URI... extra) throws Exception { MavenEntry entry = getEntry(groupId, artifactId, version); return entry.getPom(extra); }
/** * @param groupId * @param artifactId * @param version * @throws Exception */ public MavenEntry getEntry(String groupId, String artifactId, String version) throws Exception { String path = dirpath(groupId, artifactId, version); MavenEntry entry; synchronized (entries) { entry = entries.get(path); if (entry != null) return entry; entry = new MavenEntry(this, path); entries.put(path, entry); } return entry; }
/** * Verify the path against its digest for the given algorithm. * * @param repo * @param path * @param algorithm * @throws Exception */ private boolean verify(URI repo, String path, String algorithm) throws Exception { String digestPath = path + "." + algorithm; File actualFile = new File(root, path); if (download(repo, digestPath)) { File digestFile = new File(root, digestPath); final MessageDigest md = MessageDigest.getInstance(algorithm); IO.copy(actualFile, md); byte[] digest = md.digest(); String source = IO.collect(digestFile) .toUpperCase(); String hex = Hex.toHexString(digest) .toUpperCase(); if (source.startsWith(hex)) { System.err.println("Verified ok " + actualFile + " digest " + algorithm); return true; } } System.err.println("Failed to verify " + actualFile + " for digest " + algorithm); return false; }
if (isValid()) { String valid = getProperty(url.toASCIIString()); if (valid != null) return createPom(url); if (verify(url, pomPath)) { return createPom(url); if (download(url, pomPath)) { if (verify(url, pomPath)) { artifact = new FutureTask<>(new Callable<File>() { return createPom(url); saveProperties();
/** * Answer a property. * * @param key The key * @return The value */ private String getProperty(String key) { Properties properties = getProperties(); return properties.getProperty(key); }
public CachedPom getPom(String groupId, String artifactId, String version, URI... extra) throws Exception { MavenEntry entry = getEntry(groupId, artifactId, version); return entry.getPom(extra); }
/** * @param groupId * @param artifactId * @param version * @throws Exception */ public MavenEntry getEntry(String groupId, String artifactId, String version) throws Exception { String path = dirpath(groupId, artifactId, version); MavenEntry entry; synchronized (entries) { entry = entries.get(path); if (entry != null) return entry; entry = new MavenEntry(this, path); entries.put(path, entry); } return entry; }
/** * Verify the path against its digest for the given algorithm. * * @param repo * @param path * @param algorithm * @throws Exception */ private boolean verify(URI repo, String path, String algorithm) throws Exception { String digestPath = path + "." + algorithm; File actualFile = new File(root, path); if (download(repo, digestPath)) { File digestFile = new File(root, digestPath); final MessageDigest md = MessageDigest.getInstance(algorithm); IO.copy(actualFile, md); byte[] digest = md.digest(); String source = IO.collect(digestFile) .toUpperCase(); String hex = Hex.toHexString(digest) .toUpperCase(); if (source.startsWith(hex)) { System.err.println("Verified ok " + actualFile + " digest " + algorithm); return true; } } System.err.println("Failed to verify " + actualFile + " for digest " + algorithm); return false; }
if (isValid()) { String valid = getProperty(url.toASCIIString()); if (valid != null) return createPom(url); if (verify(url, pomPath)) { return createPom(url); if (download(url, pomPath)) { if (verify(url, pomPath)) { artifact = new FutureTask<File>(new Callable<File>() { return createPom(url); saveProperties();
/** * Answer a property. * * @param key * The key * @return The value */ private String getProperty(String key) { Properties properties = getProperties(); return properties.getProperty(key); }
public CachedPom getPom(String groupId, String artifactId, String version, URI... extra) throws Exception { MavenEntry entry = getEntry(groupId, artifactId, version); return entry.getPom(extra); }
@Override public File getArtifact() throws Exception { return maven.getArtifact(); }
CachedPom(MavenEntry mavenEntry, URI repo) throws Exception { super(mavenEntry.maven, mavenEntry.getPomFile(), repo); this.maven = mavenEntry; }
/** * @param groupId * @param artifactId * @param version * @param extra * @return * @throws Exception */ public MavenEntry getEntry(String groupId, String artifactId, String version) throws Exception { String path = path(groupId, artifactId, version); MavenEntry entry; synchronized (entries) { entry = entries.get(path); if (entry != null) return entry; entry = new MavenEntry(this, path); entries.put(path, entry); } return entry; }