Package org.apache.ivy.core.module.descriptor

Examples of org.apache.ivy.core.module.descriptor.DependencyDescriptor


                    "impossible to get dependencies when data has not been loaded");
        }
        DependencyDescriptor[] dds = md.getDependencies();
        Collection dependencies = new LinkedHashSet(); // it's important to respect order
        for (int i = 0; i < dds.length; i++) {
            DependencyDescriptor dd = data.mediate(dds[i]);
            String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
            if (dependencyConfigurations.length == 0) {
                // no configuration of the dependency is required for current confs :
                // it is exactly the same as if there was no dependency at all on it
                continue;
            }
            ModuleRevisionId requestedDependencyRevisionId = dd.getDependencyRevisionId();
            if (isDependencyModuleExcluded(rootModuleConf, requestedDependencyRevisionId, conf)) {
                // the whole module is excluded, it is considered as not being part of dependencies
                // at all
                Message.verbose("excluding " + dd + " in " + conf);
                continue;
View Full Code Here


           
            if (isForce()) {
                dd = dd.clone(ModuleRevisionId.newInstance(
                    dd.getDependencyRevisionId(), "latest.integration"));
            }
            DependencyDescriptor systemDd = dd;
            DependencyDescriptor nsDd = fromSystem(dd);
            context.setDependencyDescriptor(systemDd);
            context.setResolveData(data);
           
            clearIvyAttempts();
            clearArtifactAttempts();
            ModuleRevisionId systemMrid = systemDd.getDependencyRevisionId();
            ModuleRevisionId nsMrid = nsDd.getDependencyRevisionId();
           
            checkRevision(systemMrid);

            boolean isDynamic = getAndCheckIsDynamic(systemMrid);

            // we first search for the dependency in cache
            ResolvedModuleRevision rmr = null;
            rmr = findModuleInCache(systemDd, data);
            if (rmr != null) {
                if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this) {
                    Message.verbose("\t" + getName() + ": found revision in cache: "
                        + systemMrid
                        + " (resolved by " + rmr.getResolver().getName()
                        + "): but it's a default one, maybe we can find a better one");
                } else if (isForce() && rmr.getResolver() != this) {
                    Message.verbose("\t" + getName() + ": found revision in cache: "
                        + systemMrid
                        + " (resolved by " + rmr.getResolver().getName()
                        + "): but we are in force mode, let's try to find one ourself");
                } else {
                    Message.verbose("\t" + getName() + ": revision in cache: " + systemMrid);
                    return checkLatest(checkForcedResolvedModuleRevision(rmr), data);
                }
            }
           
            checkInterrupted();
           
            ResolvedResource ivyRef = findIvyFileRef(nsDd, data);
            checkInterrupted();

            // get module descriptor
            ModuleDescriptor nsMd;
            ModuleDescriptor systemMd = null;
            if (ivyRef == null) {
                if (!isAllownomd()) {
                    throw new UnresolvedDependencyException(
                        "\t" + getName() + ": no ivy file found for " + systemMrid, false);
                }
                nsMd = DefaultModuleDescriptor.newDefaultInstance(nsMrid, nsDd
                    .getAllDependencyArtifacts());
                ResolvedResource artifactRef = findFirstArtifactRef(nsMd, nsDd, data);
                checkInterrupted();
                if (artifactRef == null) {
                    throw new UnresolvedDependencyException("\t" + getName()
View Full Code Here

    }

    public ResolvedModuleRevision parse(final ResolvedResource mdRef, DependencyDescriptor dd,
            ResolveData data) throws ParseException {

        DependencyDescriptor nsDd = dd;
        dd = toSystem(nsDd);
       
        ModuleRevisionId mrid = dd.getDependencyRevisionId();
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                .getInstance().getParser(mdRef.getResource());
View Full Code Here

    }

    public ResolvedModuleRevision getDependency(DependencyDescriptor dde, ResolveData data)
            throws ParseException {
        IvyContext context = IvyContext.pushNewCopyContext();
        DependencyDescriptor systemDd = dde;
        DependencyDescriptor nsDd = fromSystem(dde);
        context.setDependencyDescriptor(systemDd);
        context.setResolveData(data);
        try {
            clearIvyAttempts();
            clearArtifactAttempts();
            ModuleRevisionId systemMrid = systemDd.getDependencyRevisionId();
            ModuleRevisionId  nsMrid = nsDd.getDependencyRevisionId();
           
            // check revision
            int index = systemMrid.getRevision().indexOf("@");
            if (index != -1
                    && !systemMrid.getRevision().substring(index + 1).equals(workspaceName)) {
                Message.verbose("\t" + getName()
                    + ": unhandled revision => " + systemMrid.getRevision());
                return null;
            }

            boolean isDynamic = getSettings().getVersionMatcher().isDynamic(systemMrid);
            if (isDynamic && !acceptLatest()) {
                Message.error("dynamic revisions not handled by " + getClass().getName()
                    + ". impossible to resolve " + systemMrid);
                return null;
            }

            // we first search for the dependency in cache
            ResolvedModuleRevision rmr = null;
            rmr = findModuleInCache(systemDd, getCacheOptions(data));
            if (rmr != null) {
                if (rmr.getDescriptor().isDefault() && rmr.getResolver() != this) {
                    Message.verbose("\t" + getName() + ": found revision in cache: "
                        + systemMrid
                        + " (resolved by " + rmr.getResolver().getName()
                        + "): but it's a default one, maybe we can find a better one");
                } else {
                    Message.verbose("\t" + getName() + ": revision in cache: " + systemMrid);
                    return rmr;
                }
            }
           
            checkInterrupted();
           
            ResolvedResource ivyRef = findIvyFileRef(nsDd, data);
            checkInterrupted();

            // get module descriptor
            final ModuleDescriptorParser parser;
            ModuleDescriptor nsMd;
            ModuleDescriptor systemMd = null;
            if (ivyRef == null) {
                if (!isAllownomd()) {
                    Message.verbose("\t" + getName() + ": no ivy file found for " + systemMrid);
                    return null;
                }
                parser = XmlModuleDescriptorParser.getInstance();
                nsMd = DefaultModuleDescriptor.newDefaultInstance(nsMrid, nsDd
                    .getAllDependencyArtifacts());
                ResolvedResource artifactRef = findFirstArtifactRef(nsMd, nsDd, data);
                checkInterrupted();
                if (artifactRef == null) {
                    Message.verbose("\t" + getName() + ": no ivy file nor artifact found for "
View Full Code Here

    }

    public ResolvedModuleRevision parse(final ResolvedResource mdRef, DependencyDescriptor dd,
            ResolveData data) throws ParseException {

        DependencyDescriptor nsDd = dd;
        dd = toSystem(nsDd);
       
        ModuleRevisionId mrid = dd.getDependencyRevisionId();
        ModuleDescriptorParser parser = ModuleDescriptorParserRegistry
                .getInstance().getParser(mdRef.getResource());
View Full Code Here

        return mdBuilder.getModuleDescriptor();
    }

    private ResolvedModuleRevision parseOtherPom(ParserSettings ivySettings,
            ModuleRevisionId parentModRevID) throws ParseException {
        DependencyDescriptor dd = new DefaultDependencyDescriptor(parentModRevID, true);
        ResolveData data = IvyContext.getContext().getResolveData();
        if (data == null) {
            ResolveEngine engine = IvyContext.getContext().getIvy().getResolveEngine();
            ResolveOptions options = new ResolveOptions();
            options.setDownload(false);
View Full Code Here

            logAttempt(rejected.toString());
        }
        if (found == null && !foundBlacklisted.isEmpty()) {
            // all acceptable versions have been blacklisted, this means that an unsolvable conflict
            // has been found
            DependencyDescriptor dd = context.getDependencyDescriptor();
            IvyNode parentNode = context.getResolveData().getNode(dd.getParentRevisionId());
            ConflictManager cm = parentNode.getConflictManager(mrid.getModuleId());
            cm.handleAllBlacklistedRevisions(dd, foundBlacklisted);
        }

        return found;
View Full Code Here

                            + ": check your configuration");
                    return false;
                }
                try {
                    Message.debug("\tusing " + resolver + " to resolve " + getId());
                    DependencyDescriptor dependencyDescriptor = getDependencyDescriptor(parent);
                    long start = System.currentTimeMillis();
                    data.getEventManager().fireIvyEvent(
                        new StartResolveDependencyEvent(resolver, dependencyDescriptor));
                    module = resolver.getDependency(dependencyDescriptor, data);
                    data.getEventManager().fireIvyEvent(
                        new EndResolveDependencyEvent(resolver, dependencyDescriptor, module,
                            System.currentTimeMillis() - start));
                    if (module != null) {
                        module.getResolver().getRepositoryCacheManager().saveResolvers(
                            module.getDescriptor(),
                            module.getResolver().getName(),
                            module.getArtifactResolver().getName());
                        if (settings.logModuleWhenFound()
                                && LogOptions.LOG_DEFAULT.equals(getData().getOptions().getLog())) {
                            Message.info("\tfound " + module.getId() + " in "
                                    + module.getResolver().getName());
                        } else {
                            Message.verbose("\tfound " + module.getId() + " in "
                                    + module.getResolver().getName());
                        }

                        if (settings.getVersionMatcher().isDynamic(getId())) {
                            // IVY-56: check if revision has actually been resolved
                            if (settings.getVersionMatcher().isDynamic(module.getId())) {
                                Message
                                        .error("impossible to resolve dynamic revision for "
                                                + getId()
                                                + ": check your configuration and make sure revision is part of your pattern");
                                problem = new RuntimeException(
                                        "impossible to resolve dynamic revision");
                                return false;
                            }
                            IvyNode resolved = data.getNode(module.getId());
                            if (resolved != null) {
                                // exact revision has already been resolved
                                // => update it and discard this node
                                md = module.getDescriptor(); // needed for handleConfiguration
                                if (!handleConfiguration(loaded, rootModuleConf, parent,
                                    parentConf, conf, shouldBePublic)) {
                                    return false;
                                }

                                if (resolved.md == null) {
                                    resolved.md = md;
                                }
                                if (resolved.module == null) {
                                    resolved.module = module;
                                }
                                resolved.downloaded |= module.getReport().isDownloaded();
                                resolved.searched |= module.getReport().isSearched();
                                resolved.dds.putAll(dds);
                                resolved.updateDataFrom(this, rootModuleConf, true);
                                resolved.loadData(rootModuleConf, parent, parentConf, conf,
                                    shouldBePublic);
                                DependencyDescriptor dd = dependencyDescriptor;
                                if (dd != null) {
                                    resolved.addDependencyArtifacts(rootModuleConf, dd
                                            .getDependencyArtifacts(parentConf));
                                    resolved.addDependencyIncludes(rootModuleConf, dd
                                            .getIncludeRules(parentConf));
                                }
                               
                                data.replaceNode(getId(), resolved, rootModuleConf);
                                // this actually discards the node

                                if (settings.logResolvedRevision()) {
                                    Message.info("\t[" + module.getId().getRevision() + "] "
                                            + getId());
                                } else {
                                    Message.verbose("\t[" + module.getId().getRevision() + "] "
                                            + getId());
                                }

                                return true;
                            }
                        }
                        downloaded = module.getReport().isDownloaded();
                        searched = module.getReport().isSearched();
                    } else {
                        Message.warn("\tmodule not found: " + getId());
                        resolver.reportFailure();
                        problem = new RuntimeException("not found");
                    }
                } catch (ResolveProcessException e) {
                    throw e;
                } catch (Exception e) {
                    e.printStackTrace();
                    problem = e;
                }

                // still not resolved, report error
                if (module == null) {
                    return false;
                } else {
                    loaded = true;
                    if (settings.getVersionMatcher().isDynamic(getId())) {
                        if (settings.logResolvedRevision()) {
                            Message.info("\t[" + module.getId().getRevision() + "] " + getId());
                        } else {
                            Message.verbose("\t[" + module.getId().getRevision() + "] " + getId());
                        }
                    }
                    md = module.getDescriptor();
                    confsToFetch.remove("*");
                    updateConfsToFetch(Arrays.asList(resolveSpecialConfigurations(
                        getRequiredConfigurations(parent, parentConf), this)));
                }
            } else {
                loaded = true;
            }
        }
        handleConfiguration(loaded, rootModuleConf, parent, parentConf, conf, shouldBePublic);
        if (hasProblem()) {
            Message.debug("problem : " + problem.getMessage());
            return false;
        } else {
            DependencyDescriptor dd = getDependencyDescriptor(parent);
            if (dd != null) {
                addDependencyArtifacts(rootModuleConf, dd.getDependencyArtifacts(parentConf));
                addDependencyIncludes(rootModuleConf, dd.getIncludeRules(parentConf));
            }
            return loaded;
        }
    }
View Full Code Here

                    "impossible to get dependencies when data has not been loaded");
        }
        DependencyDescriptor[] dds = md.getDependencies();
        Collection dependencies = new LinkedHashSet(); // it's important to respect order
        for (int i = 0; i < dds.length; i++) {
            DependencyDescriptor dd = dds[i];
            String[] dependencyConfigurations = dd.getDependencyConfigurations(conf, requestedConf);
            if (dependencyConfigurations.length == 0) {
                // no configuration of the dependency is required for current confs :
                // it is exactly the same as if there was no dependency at all on it
                continue;
            }
            if (isDependencyModuleExcluded(rootModuleConf, dd.getDependencyRevisionId(), conf)) {
                // the whole module is excluded, it is considered as not being part of dependencies
                // at all
                Message.verbose("excluding " + dd.getDependencyRevisionId() + " in " + conf);
                continue;
            }
            IvyNode depNode = data.getNode(dd.getDependencyRevisionId());
            if (depNode == null) {
                depNode = new IvyNode(data, this, dd);
            } else {
                depNode.addDependencyDescriptor(this, dd);
                if (depNode.hasProblem()) {
View Full Code Here

            Properties props = new Properties();
            if (dependencies.length > 0) {
                IvyNode root = dependencies[0].getRoot();
                for (int i = 0; i < dependencies.length; i++) {
                    if (!dependencies[i].hasProblem()) {
                        DependencyDescriptor dd = dependencies[i].getDependencyDescriptor(root);
                        if (dd != null) {
                            ModuleRevisionId depResolvedId = dependencies[i].getResolvedId();
                            ModuleDescriptor depDescriptor = dependencies[i].getDescriptor();
                            ModuleRevisionId depRevisionId = dd.getDependencyRevisionId();
                            if (depResolvedId == null) {
                                throw new NullPointerException("getResolvedId() is null for "
                                    + dependencies[i].toString());
                            }
                            if (depRevisionId == null) {
                                throw new NullPointerException("getDependencyRevisionId() "
                                    + "is null for " + dd.toString());
                            }
                            String rev = depResolvedId.getRevision();
                            // The evicted modules have no description, so we can't put their
                            // status.
                            String status = depDescriptor == null ? "?" : depDescriptor.getStatus();
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.module.descriptor.DependencyDescriptor

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.