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

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


                        revision = null;
                        continue;
                    }
                    artifact = artifacts[indexArtifact++];
                }
                ResolvedResource resource = resolver.doFindArtifactRef(artifact, null);
                if (resource == null) {
                    artifact = null;
                    continue;
                }
                JarInputStream in;
                try {
                    in = new JarInputStream(resource.getResource().openStream());
                } catch (IOException e) {
                    Message.warn("Unreadable jar " + resource.getResource().getName() + " ("
                            + e.getMessage() + ")");
                    artifact = null;
                    continue;
                }
                Manifest manifest;
View Full Code Here


    public void clean() {
        TestHelper.cleanTest();
    }

    public File getIvyFile(String mrid) {
        ResolvedResource r = getTestRepository().findIvyFileRef(
            new DefaultDependencyDescriptor(ModuleRevisionId.parse(mrid), false),
            TestHelper.newResolveData(getSettings()));
        if (r == null) {
            throw new IllegalStateException("module not found: " + mrid);
        }
        return ((FileResource) r.getResource()).getFile();
    }
View Full Code Here

        ArtifactOrigin origin = getRepositoryCacheManager().getSavedArtifactOrigin(
            toSystem(artifact));
        if (!ArtifactOrigin.isUnknown(origin)) {
            return origin;
        }
        ResolvedResource artifactRef = getArtifactRef(artifact, null);
        if (artifactRef != null && artifactRef.getResource().exists()) {
            return new ArtifactOrigin(artifact, artifactRef.getResource().isLocal(), artifactRef
                    .getResource().getName());
        }
        return null;
    }
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 Collection findNames(Map tokenValues, String token);

    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

    }

    protected ResolvedResource getArtifactRef(Artifact artifact, Date date) {
        IvyContext.getContext().set(getName() + ".artifact", artifact);
        try {
            ResolvedResource ret = findArtifactRef(artifact, date);
            if (ret == null && artifact.getUrl() != null) {
                URL url = artifact.getUrl();
                Message.verbose("\tusing url for " + artifact + ": " + url);
                logArtifactAttempt(artifact, url.toExternalForm());
                Resource resource;
                if ("file".equals(url.getProtocol())) {
                    File f;
                    try {
                        f = new File(new URI(url.toExternalForm()));
                    } catch (URISyntaxException e) {
                        // unexpected, try to get the best of it
                        f = new File(url.getPath());
                    }
                    resource = new FileResource(new FileRepository(), f);
                } else {
                    resource = new URLResource(url);
                }
                ret = new ResolvedResource(resource, artifact.getModuleRevisionId().getRevision());
            }
            return ret;
        } finally {
            IvyContext.getContext().set(getName() + ".artifact", null);
        }
View Full Code Here

        } else if (!getSettings().getVersionMatcher().isDynamic(mrid)) {
            Message.verbose("\t" + getName() + ": no ivy file in cache found for " + mrid);
            return null;
        } else {
            ensureConfigured();
            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: "
                            + resolvedMrid);
                    return node.getModuleRevision();
                }
                rmr = getRepositoryCacheManager().findModuleInCache(
                    dd.clone(ModuleRevisionId.newInstance(dd.getDependencyRevisionId(),
                        ivyRef.getRevision())), dd.getDependencyRevisionId(),
                    getCacheOptions(data), null);
                if (rmr != null) {
                    Message.verbose("\t" + getName() + ": revision in cache: " + resolvedMrid);
                    return rmr;
                } else {
View Full Code Here

        clearArtifactAttempts();
        DownloadReport dr = new DownloadReport();
        for (int i = 0; i < artifacts.length; i++) {
            final ArtifactDownloadReport adr = new ArtifactDownloadReport(artifacts[i]);
            dr.addArtifactReport(adr);
            ResolvedResource artifactRef = getArtifactRef(artifacts[i], null);
            if (artifactRef != null) {
                Message.verbose("\t[NOT REQUIRED] " + artifacts[i]);
                ArtifactOrigin origin = new ArtifactOrigin(artifacts[i], true, artifactRef
                        .getResource().getName());
                File archiveFile = ((FileResource) artifactRef.getResource()).getFile();
                adr.setDownloadStatus(DownloadStatus.NO);
                adr.setSize(archiveFile.length());
                adr.setArtifactOrigin(origin);
                adr.setLocalFile(archiveFile);
            } else {
View Full Code Here

    public ResolvedResource findIvyFileRef(DependencyDescriptor dd, ResolveData data) {
        if (isM2compatible() && isUsepoms()) {
            ModuleRevisionId mrid = dd.getDependencyRevisionId();
            mrid = convertM2IdForResourceSearch(mrid);

            ResolvedResource rres = null;
            if (dd.getDependencyRevisionId().getRevision().endsWith("SNAPSHOT")) {
                rres = findSnapshotDescriptor(dd, data, mrid);
                if (rres != null) {
                    return rres;
                }
View Full Code Here

        ensureConfigured(getSettings());
        ModuleRevisionId mrid = artifact.getModuleRevisionId();
        if (isM2compatible()) {
            mrid = convertM2IdForResourceSearch(mrid);
        }
        ResolvedResource rres = null;
        if (artifact.getId().getRevision().endsWith("SNAPSHOT") && isM2compatible()) {
            rres = findSnapshotArtifact(artifact, date, mrid);
            if (rres != null) {
                return rres;
            }
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.