Package org.apache.ivy.plugins.resolver.util

Examples of org.apache.ivy.plugins.resolver.util.ResolvedResource


        if (rress == null) {
            Message.debug("\t" + name + ": unable to list resources for " + mrid + ": pattern="
                    + pattern);
            return null;
        } else {
            ResolvedResource found = findResource(rress, name, strategy, versionMatcher, rmdparser,
                mrid, date);
            if (found == null) {
                Message.debug("\t" + name + ": no resource found for " + mrid + ": pattern="
                        + pattern);
            }
View Full Code Here


                Message.verbose("\t" + getName() + ": no ivy file in cache found for " + mrid);
                return null;
            }
        } else {
            ensureConfigured(data.getSettings(), data.getCacheManager().getCache());
            ResolvedResource ivyRef = findIvyFileRef(dd, data);
            if (ivyRef != null) {
                Message.verbose("\t" + getName() + ": found ivy file in cache for " + mrid);
                Message.verbose("\t\t=> " + ivyRef);

                ModuleRevisionId resolvedMrid = ModuleRevisionId.newInstance(mrid, ivyRef
                        .getRevision());
                IvyNode node = data.getNode(resolvedMrid);
                if (node != null && node.getModuleRevision() != null) {
                    // this revision has already be resolved : return it
                    Message.verbose("\t" + getName() + ": revision already resolved: "
View Full Code Here

                boolean reachable = res.exists();
                if (reachable) {
                    String revision = pattern.indexOf(IvyPatternHelper.REVISION_KEY) == -1 ? "working@"
                            + name
                            : mrid.getRevision();
                    return new ResolvedResource(res, revision);
                } else if (versionMatcher.isDynamic(mrid)) {
                    return findDynamicResourceUsingPattern(name, repository, strategy,
                        versionMatcher, rmdparser, mrid, pattern, artifact, date);
                } else {
                    Message.debug("\t" + name + ": resource not reachable for " + mrid + ": res="
View Full Code Here

        if (rress == null) {
            Message.debug("\t" + name + ": unable to list resources for " + mrid + ": pattern="
                    + pattern);
            return null;
        } else {
            ResolvedResource found = findResource(rress, name, strategy, versionMatcher, rmdparser,
                mrid, date);
            if (found == null) {
                Message.debug("\t" + name + ": no resource found for " + mrid + ": pattern="
                        + pattern);
            }
View Full Code Here

                    }
                }
            }
            checkInterrupted();
            URL cachedIvyURL = null;
            ResolvedResource ivyRef = findIvyFileRef(dd, data);
            checkInterrupted();
            searched = true;

            // get module descriptor
            ModuleDescriptorParser parser;
            ModuleDescriptor md;
            ModuleDescriptor systemMd = null;
            if (ivyRef == null) {
                if (!isAllownomd()) {
                    Message.verbose("\t" + getName() + ": no ivy file found for " + mrid);
                    return null;
                }
                parser = XmlModuleDescriptorParser.getInstance();
                md = DefaultModuleDescriptor.newDefaultInstance(mrid, dd
                        .getAllDependencyArtifacts());
                ResolvedResource artifactRef = findFirstArtifactRef(md, dd, data);
                checkInterrupted();
                if (artifactRef == null) {
                    Message.verbose("\t" + getName() + ": no ivy file nor artifact found for "
                            + mrid);
                    if (!checkedCache) {
                        cachedRmr = findModuleInCache(data, mrid);
                    }
                    if (cachedRmr != null) {
                        Message.verbose("\t" + getName() + ": revision in cache: " + mrid);
                        return toSystem(cachedRmr);
                    }
                    return null;
                } else {
                    long lastModified = artifactRef.getLastModified();
                    if (lastModified != 0 && md instanceof DefaultModuleDescriptor) {
                        ((DefaultModuleDescriptor) md).setLastModified(lastModified);
                    }
                    Message.verbose("\t" + getName() + ": no ivy file found for " + mrid
                            + ": using default data");
                    if (isDynamic) {
                        md.setResolvedModuleRevisionId(ModuleRevisionId.newInstance(mrid,
                            artifactRef.getRevision()));
                    }
                }
            } else {
                ResolvedModuleRevision rmr = null;
                if (ivyRef instanceof MDResolvedResource) {
View Full Code Here

    protected ResourceMDParser getRMDParser(final DependencyDescriptor dd, final ResolveData data) {
        return new ResourceMDParser() {
            public MDResolvedResource parse(Resource resource, String rev) {
                try {
                    ResolvedModuleRevision rmr = BasicResolver.this.parse(new ResolvedResource(
                            resource, rev), dd, data);
                    if (rmr == null) {
                        return null;
                    } else {
                        return new MDResolvedResource(resource, rev, rmr);
View Full Code Here

                        Message.verbose("\t" + getName() + "looking for artifact " + artifact
                                + " (is " + artifacts[i] + " in system namespace)");
                    }
                    long start = System.currentTimeMillis();
                    try {
                        ResolvedResource artifactRef = getArtifactRef(artifact, null);
                        if (artifactRef != null) {
                            origin = new ArtifactOrigin(artifactRef.getResource().isLocal(),
                                    artifactRef.getResource().getName());
                            if (useOrigin && artifactRef.getResource().isLocal()) {
                                Message.verbose("\t[NOT REQUIRED] " + artifacts[i]);
                                cacheManager.saveArtifactOrigin(artifacts[i], origin);
                                archiveFile = cacheManager.getArchiveFileInCache(artifacts[i],
                                    origin);
                                adr.setDownloadStatus(DownloadStatus.NO);
                                adr.setSize(archiveFile.length());
                                adr.setArtifactOrigin(origin);
                            } else {
                                // refresh archive file now that we better now its origin
                                archiveFile = cacheManager.getArchiveFileInCache(artifacts[i],
                                    origin, useOrigin);
                                if (ResourceHelper.equals(artifactRef.getResource(), archiveFile)) {
                                    Message.error("invalid configuration for resolver '"
                                            + getName()
                                            + "': pointing artifacts to ivy cache is forbidden !");
                                    return null;
                                }
                                Message.info("downloading " + artifactRef.getResource() + " ...");
                                if (eventManager != null) {
                                    eventManager.fireIvyEvent(new StartArtifactDownloadEvent(this,
                                            artifacts[i], origin));
                                }

                                File tmp = cacheManager.getArchiveFileInCache(new DefaultArtifact(
                                        artifacts[i].getModuleRevisionId(), artifacts[i]
                                                .getPublicationDate(), artifacts[i].getName(),
                                        artifacts[i].getType(), artifacts[i].getExt() + ".part",
                                        artifacts[i].getExtraAttributes()), origin, useOrigin);

                                // deal with artifact with url special case
                                if (artifactRef.getResource().getName().equals(
                                    String.valueOf(artifacts[i].getUrl()))) {
                                    Message.verbose("\t" + getName() + ": downloading "
                                            + artifactRef.getResource().getName());
                                    Message.debug("\t\tto " + tmp);
                                    if (tmp.getParentFile() != null) {
                                        tmp.getParentFile().mkdirs();
                                    }
                                    extartifactrep.get(artifactRef.getResource().getName(), tmp);
                                    adr.setSize(tmp.length());
                                } else {
                                    adr.setSize(getAndCheck(artifactRef.getResource(), tmp));
                                }
                                if (!tmp.renameTo(archiveFile)) {
                                    Message.warn("\t[FAILED     ] " + artifacts[i]
                                            + " impossible to move temp file to definitive one ("
                                            + (System.currentTimeMillis() - start) + "ms)");
View Full Code Here

    protected void clearArtifactAttempts() {
        artattempts.clear();
    }

    public boolean exists(Artifact artifact) {
        ResolvedResource artifactRef = getArtifactRef(artifact, null);
        if (artifactRef != null) {
            return artifactRef.getResource().exists();
        }
        return false;
    }
View Full Code Here

    protected long getPublicationDate(ModuleDescriptor md, DependencyDescriptor dd,
            ResolveData data) {
        if (md.getPublicationDate() != null) {
            return md.getPublicationDate().getTime();
        }
        ResolvedResource artifactRef = findFirstArtifactRef(md, dd, data);
        if (artifactRef != null) {
            return artifactRef.getLastModified();
        }
        return -1;
    }
View Full Code Here

    protected abstract ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data);

    protected ResolvedResource findFirstArtifactRef(ModuleDescriptor md, DependencyDescriptor dd,
            ResolveData data) {
        ResolvedResource ret = null;
        String[] conf = md.getConfigurationsNames();
        for (int i = 0; i < conf.length; i++) {
            Artifact[] artifacts = md.getArtifacts(conf[i]);
            for (int j = 0; j < artifacts.length; j++) {
                ret = getArtifactRef(artifacts[j], data.getDate());
View Full Code Here

TOP

Related Classes of org.apache.ivy.plugins.resolver.util.ResolvedResource

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.