Package org.apache.ivy.core.cache

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


        destFilePattern = IvyPatternHelper.substituteVariables(destFilePattern, settings
                .getVariables());
        String destIvyPattern = IvyPatternHelper.substituteVariables(options.getDestIvyPattern(),
            settings.getVariables());

        RepositoryCacheManager cacheManager = getCacheManager(options);
        String[] confs = getConfs(mrid, options);
        Message.info("\tconfs: " + Arrays.asList(confs));
        if (this.eventManager != null) {
            this.eventManager.fireIvyEvent(new StartRetrieveEvent(mrid, confs, options));
        }

        try {
            Map artifactsToCopy = determineArtifactsToCopy(mrid, destFilePattern, options);
            File fileRetrieveRoot = new File(IvyPatternHelper.getTokenRoot(destFilePattern));
            File ivyRetrieveRoot = destIvyPattern == null ? null : new File(IvyPatternHelper
                    .getTokenRoot(destIvyPattern));
            Collection targetArtifactsStructure = new HashSet(); // Set(File) set of all paths
            // which should be present at
            // then end of retrieve (useful
            // for sync)
            Collection targetIvysStructure = new HashSet(); // same for ivy files

            // do retrieve
            int targetsCopied = 0;
            int targetsUpToDate = 0;
            long totalCopiedSize = 0;
            for (Iterator iter = artifactsToCopy.keySet().iterator(); iter.hasNext();) {
                Artifact artifact = (Artifact) iter.next();
                File archive;
                if ("ivy".equals(artifact.getType())) {
                    archive = cacheManager.getIvyFileInCache(artifact.getModuleRevisionId());
                } else {
                    archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
                            .getSavedArtifactOrigin(artifact), options.isUseOrigin());
                    if (!options.isUseOrigin() && !archive.exists()) {
                        // file is not available in cache, maybe the last resolve was performed with
                        // useOrigin=true.
                        // we try to use the best we can
                        archive = cacheManager.getArchiveFileInCache(artifact, cacheManager
                                .getSavedArtifactOrigin(artifact));
                    }
                }
                Set dest = (Set) artifactsToCopy.get(artifact);
                Message.verbose("\tretrieving " + archive);
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) {
                        // 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 = 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

                        + "It will require the availability of the namespace '"
                        + getNamespace().getName() + "' to be fully usable.");
                }
            }

            RepositoryCacheManager cacheManager = data.getCacheManager();
           
            // 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,
                    systemMd, 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 = options.getCacheManager();

        clearArtifactAttempts();
        DownloadReport dr = new DownloadReport();
        for (int i = 0; i < artifacts.length; i++) {
            ArtifactDownloadReport adr = cacheManager.download(
                artifacts[i], artifactResourceResolver, downloader,
                new CacheDownloadOptions().setListener(downloadListener)
                    .setUseOrigin(options.isUseOrigin()));
            if (DownloadStatus.FAILED == adr.getDownloadStatus()) {
                if (!ArtifactDownloadReport.MISSING_ARTIFACT.equals(adr.getDownloadDetails())) {
View Full Code Here

            List paths = getArtifacts();
            if (paths.isEmpty()) {
                NameEntry ne = fileset.createExclude();
                ne.setName("**/*");
            } else {
                RepositoryCacheManager cache = getCacheManager();
                for (Iterator iter = paths.iterator(); iter.hasNext();) {
                    Artifact a = (Artifact) iter.next();
                    NameEntry ne = fileset.createInclude();
                    ne.setName(cache.getArchivePathInCache(a, cache.getSavedArtifactOrigin(a)));
                }
            }
        } catch (Exception ex) {
            throw new BuildException("impossible to build ivy cache fileset: " + ex, ex);
        }
View Full Code Here

            }
        }
        try {
            Path path = new Path(getProject());
            getProject().addReference(pathid, path);
            RepositoryCacheManager cache = getCacheManager();
            for (Iterator iter = getArtifacts().iterator(); iter.hasNext();) {
                Artifact a = (Artifact) iter.next();
                path.createPathElement().setLocation(
                    cache.getArchiveFileInCache(a, cache.getSavedArtifactOrigin(a), isUseOrigin()));
            }
        } catch (Exception ex) {
            throw new BuildException("impossible to build ivy path: " + ex, ex);
        }
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.