@Test public void candidateHash() { String hashCandidate = CacheLocalReadonly.getHashCandidate(URI.create("file:/bla/1234"), URI.create("file:/bla/")); assertThat(hashCandidate, is("1234")); }
static String getHashCandidate(URI resourceURI, URI cacheDir) { String hashCandidate = null; URI candidateURI = resourceURI; candidateURI = getDatasetArchiveURI(candidateURI); if (candidateURI != null && StringUtils.startsWith(candidateURI.toString(), cacheDir.toString())) { hashCandidate = StringUtils.replace(candidateURI.toString(), cacheDir.toString(), ""); } return hashCandidate; }
CacheLocalReadonly implements Cache { static String getHashCandidate(URI resourceURI, URI cacheDir) { String hashCandidate = null; URI candidateURI = resourceURI; candidateURI = getDatasetArchiveURI(candidateURI); if (candidateURI != null && StringUtils.startsWith(candidateURI.toString(), cacheDir.toString())) { hashCandidate = StringUtils.replace(candidateURI.toString(), cacheDir.toString(), ""); } return hashCandidate; } }
CacheLocalReadonly implements Cache { static String getHashCandidate(URI resourceURI, URI cacheDir) { String hashCandidate = null; URI candidateURI = resourceURI; candidateURI = getDatasetArchiveURI(candidateURI); if (candidateURI != null && StringUtils.startsWith(candidateURI.toString(), cacheDir.toString())) { hashCandidate = StringUtils.replace(candidateURI.toString(), cacheDir.toString(), ""); } return hashCandidate; } CacheLocalReadonly(String namespace, String cachePath);  CacheLocalReadonly(String namespace, String cachePath, InputStreamFactory factory); }
CacheLocalReadonly implements Cache { static String getHashCandidate(URI resourceURI, URI cacheDir) { String hashCandidate = null; URI candidateURI = resourceURI; candidateURI = getDatasetArchiveURI(candidateURI); if (candidateURI != null && StringUtils.startsWith(candidateURI.toString(), cacheDir.toString())) { hashCandidate = StringUtils.replace(candidateURI.toString(), cacheDir.toString(), ""); } return hashCandidate; } CacheLocalReadonly(String namespace, String cachePath);  CacheLocalReadonly(String namespace, String cachePath, InputStreamFactory factory); @Override ContentProvenance provenanceOf(URI resourceURI); static ContentProvenance getContentProvenance(URI resourceURI, String cachePath, String namespace); static ContentProvenance getProvenance(URI resourceURI, String localArchiveSha256, URI sourceURI, String sha256, String accessedAt, File cacheDir, String namespace); static boolean inCachedArchive(String localArchiveSha256, String sha256); @Override InputStream retrieve(URI resourceURI); }
CacheLocalReadonly implements Cache { static String getHashCandidate(URI resourceURI, URI cacheDir) { String hashCandidate = null; URI candidateURI = resourceURI; candidateURI = getDatasetArchiveURI(candidateURI); if (candidateURI != null && StringUtils.startsWith(candidateURI.toString(), cacheDir.toString())) { hashCandidate = StringUtils.replace(candidateURI.toString(), cacheDir.toString(), ""); } return hashCandidate; } CacheLocalReadonly(String namespace, String cachePath);  CacheLocalReadonly(String namespace, String cachePath, InputStreamFactory factory); @Override ContentProvenance provenanceOf(URI resourceURI); static ContentProvenance getContentProvenance(URI resourceURI, String cachePath, String namespace); static ContentProvenance getProvenance(URI resourceURI, String localArchiveSha256, URI sourceURI, String sha256, String accessedAt, File cacheDir, String namespace); static boolean inCachedArchive(String localArchiveSha256, String sha256); @Override InputStream retrieve(URI resourceURI);  }