Package org.apache.ivy.core.cache

Examples of org.apache.ivy.core.cache.RepositoryCacheManager


                throw new BuildException(baseDir + " is not a directory");
            }
            it = new FSManifestIterable(baseDir);
        } else if (cacheName != null) {
            Ivy ivy = getIvyInstance();
            RepositoryCacheManager cacheManager = ivy.getSettings().getRepositoryCacheManager(
                cacheName);
            if (!(cacheManager instanceof DefaultRepositoryCacheManager)) {
                throw new BuildException("the type of cache '" + cacheManager.getClass().getName()
                        + "' is not supported.");
            }
            File basedir = ((DefaultRepositoryCacheManager) cacheManager).getBasedir();
            it = new FSManifestIterable(basedir);
        } else {
View Full Code Here


            RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
            for (int i = 0; i < caches.length; i++) {
                caches[i].clean();
            }
        } else if (!NONE.equals(getCache())) {
            RepositoryCacheManager cache = settings.getRepositoryCacheManager(getCache());
            if (cache == null) {
                throw new BuildException("unknown cache '" + getCache() + "'");
            } else {
                cache.clean();
            }
        }
    }
View Full Code Here

                            .getModuleRevision().getId());
                    if (artifactsOfModuleRev != null) {
                        for (Iterator iter = artifactsOfModuleRev.iterator(); iter.hasNext();) {
                            ArtifactDownloadReport artifact = (ArtifactDownloadReport) iter.next();

                            RepositoryCacheManager cache = dependency.getModuleRevision()
                                    .getArtifactResolver().getRepositoryCacheManager();

                            startArtifact(saxHandler, artifact.getArtifact());

                            writeOriginLocationIfPresent(cache, saxHandler, artifact);
View Full Code Here

                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;
View Full Code Here

                        + ivy.substitute(defaultLatest));
            }
            ivy.setDefaultLatestStrategy(latestStrategy);
        }
        if (defaultCacheManager != null) {
            RepositoryCacheManager cache = ivy.getRepositoryCacheManager(ivy
                    .substitute(defaultCacheManager));
            if (cache == null) {
                throw new IllegalArgumentException("unknown cache manager "
                        + ivy.substitute(defaultCacheManager));
            }
View Full Code Here

                rmr.getDescriptor(), rmr.getReport(), true);
    }

    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
View Full Code Here

    protected boolean acceptLatest() {
        return true;
    }

    public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
        RepositoryCacheManager cacheManager = getRepositoryCacheManager();

        clearArtifactAttempts();
        DownloadReport dr = new DownloadReport();
        for (int i = 0; i < artifacts.length; i++) {
            ArtifactDownloadReport adr = cacheManager.download(artifacts[i],
                artifactResourceResolver, downloader, getCacheDownloadOptions(options));
            if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
                if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
                    Message.warn("\t" + adr);
                }
View Full Code Here

        Artifact artifact = adr.getArtifact();
        Map extraAtt = new HashMap(artifact.getExtraAttributes());
        extraAtt.put("classifier", metaClassifier);
        Artifact metaArtifact = new DefaultArtifact(artifact.getModuleRevisionId(), artifact
                .getPublicationDate(), artifact.getName(), metaType, "jar", extraAtt);
        RepositoryCacheManager cache = ivy.getSettings()
                .getResolver(artifact.getModuleRevisionId()).getRepositoryCacheManager();
        if (cache instanceof DefaultRepositoryCacheManager) {
            File metaArtifactFile = ((DefaultRepositoryCacheManager) cache)
                    .getArchiveFileInCache(metaArtifact);
            File attempt = new File(metaArtifactFile.getAbsolutePath() + ".notfound");
View Full Code Here

            rmr.getDescriptor(), rmr.getReport(), true);
    }

    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, ivyRef.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) {
View Full Code Here

    protected boolean acceptLatest() {
        return true;
    }

    public DownloadReport download(Artifact[] artifacts, DownloadOptions options) {
        RepositoryCacheManager cacheManager = getRepositoryCacheManager();

        clearArtifactAttempts();
        DownloadReport dr = new DownloadReport();
        for (int i = 0; i < artifacts.length; i++) {
            ArtifactDownloadReport adr = cacheManager.download(
                artifacts[i], artifactResourceResolver, downloader,
                getCacheDownloadOptions(options));
            if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
                if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
                    Message.warn("\t" + adr);
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.cache.RepositoryCacheManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.