@Test public void jarInJar() { URI remoteArchiveURI = URI.create("jar:file: URI localResourceURI = URI.create("jar:file:/bla/1234!/globi.json"); URI remoteResourceURI = CacheLocalReadonly.getRemoteJarURIIfNeeded(remoteArchiveURI, localResourceURI); assertThat(remoteResourceURI.toString(), is("jar:file:/bla/1234!/globi.json")); }
static URI getRemoteJarURIIfNeeded(URI remoteArchiveURI, URI localResourceURI) { URI remoteResourceURI = localResourceURI; if (isJarResource(localResourceURI) && !isJarResource(remoteArchiveURI)) { URI datasetArchiveURI = getDatasetArchiveURI(localResourceURI); remoteResourceURI = URI.create(StringUtils.replace(localResourceURI.toString(), datasetArchiveURI.toString(), remoteArchiveURI.toString())); } return remoteResourceURI; }
CacheLocalReadonly implements Cache { static URI getRemoteJarURIIfNeeded(URI remoteArchiveURI, URI localResourceURI) { URI remoteResourceURI = localResourceURI; if (isJarResource(localResourceURI) && !isJarResource(remoteArchiveURI)) { URI datasetArchiveURI = getDatasetArchiveURI(localResourceURI); remoteResourceURI = URI.create(StringUtils.replace(localResourceURI.toString(), datasetArchiveURI.toString(), remoteArchiveURI.toString())); } return remoteResourceURI; } }
CacheLocalReadonly implements Cache { static URI getRemoteJarURIIfNeeded(URI remoteArchiveURI, URI localResourceURI) { URI remoteResourceURI = localResourceURI; if (isJarResource(localResourceURI) && !isJarResource(remoteArchiveURI)) { URI datasetArchiveURI = getDatasetArchiveURI(localResourceURI); remoteResourceURI = URI.create(StringUtils.replace(localResourceURI.toString(), datasetArchiveURI.toString(), remoteArchiveURI.toString())); } return remoteResourceURI; } CacheLocalReadonly(String namespace, String cachePath);  CacheLocalReadonly(String namespace, String cachePath, InputStreamFactory factory); }
CacheLocalReadonly implements Cache { static URI getRemoteJarURIIfNeeded(URI remoteArchiveURI, URI localResourceURI) { URI remoteResourceURI = localResourceURI; if (isJarResource(localResourceURI) && !isJarResource(remoteArchiveURI)) { URI datasetArchiveURI = getDatasetArchiveURI(localResourceURI); remoteResourceURI = URI.create(StringUtils.replace(localResourceURI.toString(), datasetArchiveURI.toString(), remoteArchiveURI.toString())); } return remoteResourceURI; } 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 URI getRemoteJarURIIfNeeded(URI remoteArchiveURI, URI localResourceURI) { URI remoteResourceURI = localResourceURI; if (isJarResource(localResourceURI) && !isJarResource(remoteArchiveURI)) { URI datasetArchiveURI = getDatasetArchiveURI(localResourceURI); remoteResourceURI = URI.create(StringUtils.replace(localResourceURI.toString(), datasetArchiveURI.toString(), remoteArchiveURI.toString())); } return remoteResourceURI; } 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);  }