org.apache.ivy.core.cache.RepositoryCacheManager Java Examples
The following examples show how to use
org.apache.ivy.core.cache.RepositoryCacheManager.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CacheResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
private void ensureConfigured() { if (getIvyPatterns().isEmpty()) { setIvyPatterns(new ArrayList<String>()); setArtifactPatterns(new ArrayList<String>()); for (RepositoryCacheManager cache : getSettings().getRepositoryCacheManagers()) { if (cache instanceof DefaultRepositoryCacheManager) { DefaultRepositoryCacheManager c = (DefaultRepositoryCacheManager) cache; addIvyPattern(c.getBasedir().getAbsolutePath() + "/" + c.getIvyPattern()); addArtifactPattern(c.getBasedir().getAbsolutePath() + "/" + c.getArtifactPattern()); } else { Message.verbose(cache + ": cache implementation is not a DefaultRepositoryCacheManager:" + " unable to configure cache resolver with it"); } } } }
Example #2
Source File: IvyArtifactReport.java From ant-ivy with Apache License 2.0 | 6 votes |
private void writeOriginLocationIfPresent(RepositoryCacheManager cache, TransformerHandler saxHandler, ArtifactDownloadReport artifact) throws SAXException { ArtifactOrigin origin = artifact.getArtifactOrigin(); if (!ArtifactOrigin.isUnknown(origin)) { String originName = origin.getLocation(); boolean isOriginLocal = origin.isLocal(); String originLocation; AttributesImpl originLocationAttrs = new AttributesImpl(); if (isOriginLocal) { originLocationAttrs.addAttribute(null, "is-local", "is-local", "CDATA", "true"); originLocation = originName.replace('\\', '/'); } else { originLocationAttrs.addAttribute(null, "is-local", "is-local", "CDATA", "false"); originLocation = originName; } saxHandler .startElement(null, "origin-location", "origin-location", originLocationAttrs); char[] originLocationAsChars = originLocation.toCharArray(); saxHandler.characters(originLocationAsChars, 0, originLocationAsChars.length); saxHandler.endElement(null, "origin-location", "origin-location"); } }
Example #3
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 6 votes |
public DownloadReport download(Artifact[] artifacts, DownloadOptions options) { RepositoryCacheManager cacheManager = getRepositoryCacheManager(); clearArtifactAttempts(); DownloadReport dr = new DownloadReport(); for (Artifact artifact : artifacts) { ArtifactDownloadReport adr = cacheManager.download(artifact, artifactResourceResolver, downloader, getCacheDownloadOptions(options)); if (DownloadStatus.FAILED == adr.getDownloadStatus()) { if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) { Message.warn("\t" + adr); } } else if (DownloadStatus.NO == adr.getDownloadStatus()) { Message.verbose("\t" + adr); } else if (LogOptions.LOG_QUIET.equals(options.getLog())) { Message.verbose("\t" + adr); } else { Message.info("\t" + adr); } dr.addArtifactReport(adr); checkInterrupted(); } return dr; }
Example #4
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 5 votes |
public synchronized RepositoryCacheManager getDefaultRepositoryCacheManager() { if (defaultRepositoryCacheManager == null) { defaultRepositoryCacheManager = new DefaultRepositoryCacheManager("default-cache", this, getDefaultRepositoryCacheBasedir()); addRepositoryCacheManager(defaultRepositoryCacheManager); } return defaultRepositoryCacheManager; }
Example #5
Source File: IvyPatternHelper.java From ant-ivy with Apache License 2.0 | 5 votes |
public String toString() { if (origin == null) { ModuleRevisionId revId = ModuleRevisionId.newInstance(org, moduleName, branch, revision, extraModuleAttributes); Artifact artifact = new DefaultArtifact(revId, null, artifactName, artifactType, artifactExt, extraArtifactAttributes); // TODO cache: see how we could know which actual cache manager to use, since this // will fail when using a resolver in a chain with a specific cache manager RepositoryCacheManager cacheManager = IvyContext.getContext().getSettings() .getResolver(revId).getRepositoryCacheManager(); origin = cacheManager.getSavedArtifactOrigin(artifact); if (ArtifactOrigin.isUnknown(origin)) { Message.debug("no artifact origin found for " + artifact + " in " + cacheManager); return null; } } if (ArtifactOrigin.isUnknown(origin)) { return null; } // we assume that the original filename is the last part of the original file location String location = origin.getLocation(); int lastPathIndex = location.lastIndexOf('/'); if (lastPathIndex == -1) { lastPathIndex = location.lastIndexOf('\\'); } int lastColonIndex = location.lastIndexOf('.'); return location.substring(lastPathIndex + 1, lastColonIndex); }
Example #6
Source File: UpdateSiteLoader.java From ant-ivy with Apache License 2.0 | 5 votes |
public UpdateSiteLoader(final RepositoryCacheManager repositoryCacheManager, final EventManager eventManager, final CacheResourceOptions options, final TimeoutConstraint timeoutConstraint) { this.repositoryCacheManager = repositoryCacheManager; this.options = options; this.timeoutConstraint = timeoutConstraint; if (eventManager != null) { urlRepository.addTransferListener(eventManager); } }
Example #7
Source File: IvyArtifactReport.java From ant-ivy with Apache License 2.0 | 5 votes |
private void writeCacheLocationIfPresent(RepositoryCacheManager cache, TransformerHandler saxHandler, ArtifactDownloadReport artifact) throws SAXException { File archiveInCache = artifact.getLocalFile(); if (archiveInCache != null) { saxHandler.startElement(null, "cache-location", "cache-location", new AttributesImpl()); char[] archiveInCacheAsChars = archiveInCache.getPath().replace('\\', '/') .toCharArray(); saxHandler.characters(archiveInCacheAsChars, 0, archiveInCacheAsChars.length); saxHandler.endElement(null, "cache-location", "cache-location"); } }
Example #8
Source File: BasicResolver.java From ant-ivy with Apache License 2.0 | 5 votes |
private void cacheModuleDescriptor(ModuleDescriptor systemMd, ModuleRevisionId systemMrid, ResolvedResource ivyRef, ResolvedModuleRevision rmr) { RepositoryCacheManager cacheManager = getRepositoryCacheManager(); final ModuleDescriptorParser parser = systemMd.getParser(); // the metadata artifact which was used to cache the original metadata file Artifact requestedMetadataArtifact = (ivyRef == null) ? systemMd.getMetadataArtifact() : parser.getMetadataArtifact( ModuleRevisionId.newInstance(systemMrid, systemMd.getRevision()), ivyRef.getResource()); cacheManager.originalToCachedModuleDescriptor(this, ivyRef, requestedMetadataArtifact, rmr, new ModuleDescriptorWriter() { public void write(ResolvedResource originalMdResource, ModuleDescriptor md, File src, File dest) throws IOException, ParseException { if (originalMdResource == null) { // a basic ivy file is written containing default data XmlModuleDescriptorWriter.write(md, dest); } else { // copy and update ivy file from source to cache parser.toIvyFile(new FileInputStream(src), originalMdResource.getResource(), dest, md); long repLastModified = originalMdResource.getLastModified(); if (repLastModified > 0) { dest.setLastModified(repLastModified); } } } }); }
Example #9
Source File: CustomIvyResolverRepositoryFactory.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public CustomIvyResolverRepositoryFactory(ProgressLoggerFactory progressLoggerFactory, RepositoryCacheManager localCacheManager, RepositoryCacheManager downloadingCacheManager) { this.progressLoggerFactory = progressLoggerFactory; this.localCacheManager = localCacheManager; this.downloadingCacheManager = downloadingCacheManager; }
Example #10
Source File: CustomResolverArtifactRepository.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
public CustomResolverArtifactRepository(DependencyResolver resolver, ProgressLoggerFactory progressLoggerFactory, RepositoryCacheManager localCacheManager, RepositoryCacheManager downloadingCacheManager) { super(resolver); this.localCacheManager = localCacheManager; this.downloadingCacheManager = downloadingCacheManager; this.transferListener = new ProgressLoggingTransferListener(progressLoggerFactory, CustomResolverArtifactRepository.class); configureResolver(resolver, true); }
Example #11
Source File: CustomIvyResolverRepositoryFactory.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public CustomIvyResolverRepositoryFactory(ProgressLoggerFactory progressLoggerFactory, RepositoryCacheManager localCacheManager, RepositoryCacheManager downloadingCacheManager) { this.progressLoggerFactory = progressLoggerFactory; this.localCacheManager = localCacheManager; this.downloadingCacheManager = downloadingCacheManager; }
Example #12
Source File: CustomResolverArtifactRepository.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
public CustomResolverArtifactRepository(DependencyResolver resolver, ProgressLoggerFactory progressLoggerFactory, RepositoryCacheManager localCacheManager, RepositoryCacheManager downloadingCacheManager) { super(resolver); this.localCacheManager = localCacheManager; this.downloadingCacheManager = downloadingCacheManager; this.transferListener = new ProgressLoggingTransferListener(progressLoggerFactory, CustomResolverArtifactRepository.class); configureResolver(resolver, true); }
Example #13
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { if (repositoryCacheManager == null) { initRepositoryCacheManagerFromSettings(); } return repositoryCacheManager; }
Example #14
Source File: AbstractResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
public void setRepositoryCacheManager(RepositoryCacheManager repositoryCacheManager) { this.cacheManagerName = repositoryCacheManager.getName(); this.repositoryCacheManager = repositoryCacheManager; }
Example #15
Source File: ArtifactLockStrategyTest.java From ant-ivy with Apache License 2.0 | 4 votes |
private RepositoryCacheManager newCacheManager(IvySettings settings) { DefaultRepositoryCacheManager cacheManager = new DefaultRepositoryCacheManager("cache", settings, new File("build/test/cache")); cacheManager.setLockStrategy(new CreateFileLockStrategy(false)); return cacheManager; }
Example #16
Source File: MockResolver.java From ant-ivy with Apache License 2.0 | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { return null; }
Example #17
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 4 votes |
public synchronized void setDefaultRepositoryCacheManager(RepositoryCacheManager cache) { this.defaultRepositoryCacheManager = cache; }
Example #18
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 4 votes |
public synchronized void addRepositoryCacheManager(RepositoryCacheManager c) { init(c); repositoryCacheManagers.put(c.getName(), c); }
Example #19
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 4 votes |
public synchronized RepositoryCacheManager[] getRepositoryCacheManagers() { return repositoryCacheManagers.values().toArray( new RepositoryCacheManager[repositoryCacheManagers.size()]); }
Example #20
Source File: AbstractMavenResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { return new NoOpRepositoryCacheManager(getName()); }
Example #21
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 4 votes |
public synchronized RepositoryCacheManager getRepositoryCacheManager(String name) { return repositoryCacheManagers.get(name); }
Example #22
Source File: IvySettings.java From ant-ivy with Apache License 2.0 | 4 votes |
public synchronized void addConfigured(RepositoryCacheManager c) { addRepositoryCacheManager(c); }
Example #23
Source File: IvyArtifactReport.java From ant-ivy with Apache License 2.0 | 4 votes |
private void generateXml(IvyNode[] dependencies, Map<ModuleRevisionId, Set<ArtifactDownloadReport>> moduleRevToArtifactsMap, Map<ArtifactDownloadReport, Set<String>> artifactsToCopy) { try { try (FileOutputStream fileOutputStream = new FileOutputStream(tofile)) { TransformerHandler saxHandler = createTransformerHandler(fileOutputStream); saxHandler.startDocument(); saxHandler.startElement(null, "modules", "modules", new AttributesImpl()); for (IvyNode dependency : dependencies) { if (dependency.getModuleRevision() == null || dependency.isCompletelyEvicted()) { continue; } startModule(saxHandler, dependency); Set<ArtifactDownloadReport> artifactsOfModuleRev = moduleRevToArtifactsMap.get(dependency .getModuleRevision().getId()); if (artifactsOfModuleRev != null) { for (ArtifactDownloadReport artifact : artifactsOfModuleRev) { RepositoryCacheManager cache = dependency.getModuleRevision() .getArtifactResolver().getRepositoryCacheManager(); startArtifact(saxHandler, artifact.getArtifact()); writeOriginLocationIfPresent(cache, saxHandler, artifact); writeCacheLocationIfPresent(cache, saxHandler, artifact); for (String artifactDestPath : artifactsToCopy.get(artifact)) { writeRetrieveLocation(saxHandler, artifactDestPath); } saxHandler.endElement(null, "artifact", "artifact"); } } saxHandler.endElement(null, "module", "module"); } saxHandler.endElement(null, "modules", "modules"); saxHandler.endDocument(); } } catch (SAXException | IOException | TransformerConfigurationException e) { throw new BuildException("impossible to generate report", e); } }
Example #24
Source File: LegacyDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { // This is never used throw new UnsupportedOperationException(); }
Example #25
Source File: LoopbackDependencyResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { throw new UnsupportedOperationException(); }
Example #26
Source File: AbstractMavenResolver.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { return new NoOpRepositoryCacheManager(getName()); }
Example #27
Source File: LegacyDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { // This is never used throw new UnsupportedOperationException(); }
Example #28
Source File: LoopbackDependencyResolver.java From pushfish-android with BSD 2-Clause "Simplified" License | 4 votes |
public RepositoryCacheManager getRepositoryCacheManager() { throw new UnsupportedOperationException(); }
Example #29
Source File: DependencyResolver.java From ant-ivy with Apache License 2.0 | 2 votes |
/** * Returns the {@link RepositoryCacheManager} used to manage the repository cache associated * with this dependency resolver. * * @return the {@link RepositoryCacheManager} used to manage the repository cache associated * with this dependency resolver. */ RepositoryCacheManager getRepositoryCacheManager();
Example #30
Source File: ResolverSettings.java From ant-ivy with Apache License 2.0 | votes |
RepositoryCacheManager getRepositoryCacheManager(String name);