Package org.apache.ivy.core.resolve

Examples of org.apache.ivy.core.resolve.ResolveOptions


    private ResolveOptions getResolveOptions(Ivy ivy, String[] confs) {
        return getResolveOptions(ivy.getSettings(), confs);
    }

    private ResolveOptions getResolveOptions(IvySettings settings, String[] confs) {
        return new ResolveOptions().setConfs(confs);
    }
View Full Code Here


                qualifier = qualifier.substring(comma);
                while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
                    base.append(' ');
                    qualifier = qualifier.substring(1);
                }
                ResolveData data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
                ModuleRevisionId mrid = ModuleRevisionId.newInstance(org, name, branch, rev,
                    otherAtts);
                DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(mrid, false);
                try {
                    DependencyResolver resolver = ivy.getSettings().getResolver(mrid);
                    if (resolver == null) {
                        return null;
                    }
                    ResolvedModuleRevision dep = resolver.getDependency(ddd, data);
                    if (dep == null) {
                        return null;
                    }
                    String[] confs = dep.getDescriptor().getConfigurationsNames();
                    for (int i = 0; i < confs.length; i++) {
                        confs[i] = base + confs[i];
                    }
                    List ret = new ArrayList(Arrays.asList(confs));
                    ret.add("*");
                    return (String[]) ret.toArray(new String[ret.size()]);
                } catch (ParseException e) {
                    IvyPlugin.log(IStatus.ERROR, "The dependencies of " + mrid
                            + " could not be parsed", e);
                    return null;
                }
            }

        });
        IvyTag conf3 = new IvyTag("conf", "defines configuration mapping has sub element");
        conf3
                .addAttribute(new IvyTagAttribute(
                        "name",
                        "the name of the master configuration to map. \n'*' wildcard can be used to designate all configurations of this module",
                        true, masterConfValueProvider));
        conf3
                .addAttribute(new IvyTagAttribute(
                        "mapped",
                        "a comma separated list of dependency configurations \nto which this master configuration should be mapped",
                        false, new IValueProvider() {
                            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
                                Ivy ivy = getIvy();
                                int[] indexes = ivyFile.getParentTagIndex();
                                if (indexes != null && ivy != null) {
                                    Map otherAttValues = ivyFile.getAllAttsValues(indexes[0] + 1);
                                    String org = ivyFile.getDependencyOrganisation(otherAttValues);
                                    if (org != null && otherAttValues != null
                                            && otherAttValues.get("name") != null
                                            && otherAttValues.get("rev") != null) {
                                        StringBuffer base = new StringBuffer();
                                        String qualifier = ivyFile.getAttributeValueQualifier();
                                        // search for word after last comma
                                        int comma = qualifier.lastIndexOf(",") + 1;
                                        base.append(qualifier.substring(0, comma));
                                        qualifier = qualifier.substring(comma);
                                        while (qualifier.length() > 0 && qualifier.charAt(0) == ' ') {
                                            base.append(' ');
                                            qualifier = qualifier.substring(1);
                                        }
                                        ResolveData data = new ResolveData(ivy.getResolveEngine(),
                                                new ResolveOptions());
                                        ModuleRevisionId mrid = ModuleRevisionId.newInstance(org,
                                            (String) otherAttValues.get("name"),
                                            (String) otherAttValues.get("rev"));
                                        DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(
                                                mrid, false);
                                        try {
                                            String[] confs = ivy.getSettings().getResolver(mrid)
                                                    .getDependency(ddd, data).getDescriptor()
                                                    .getConfigurationsNames();
                                            for (int i = 0; i < confs.length; i++) {
                                                confs[i] = base + confs[i];
                                            }
                                            List ret = new ArrayList(Arrays.asList(confs));
                                            ret.add("*");
                                            return (String[]) ret.toArray(new String[ret.size()]);
                                        } catch (ParseException e) {
                                            IvyPlugin.log(IStatus.ERROR, "The dependencies of "
                                                    + mrid + " could not be parsed", e);
                                            return new String[] {"*"};
                                        }
                                    }
                                }
                                return new String[] {"*"};
                            }

                        }));
        allConf.add(conf3);
        IvyTag mapped = new IvyTag("mapped",
                "map dependency configurations for this master configuration");
        mapped
                .addAttribute(new IvyTagAttribute(
                        "name",
                        "the name of the dependency configuration mapped. \n'*' wildcard can be used to designate all configurations of this module",
                        true, new IValueProvider() {
                            public String[] getValuesfor(IvyTagAttribute att, IvyFile ivyFile) {
                                Ivy ivy = getIvy();
                                int[] indexes = ivyFile.getParentTagIndex();
                                if (indexes != null && ivy != null) {
                                    indexes = ivyFile.getParentTagIndex(indexes[0]);
                                    if (indexes != null) {
                                        Map otherAttValues = ivyFile
                                                .getAllAttsValues(indexes[0] + 1);
                                        String org = ivyFile
                                                .getDependencyOrganisation(otherAttValues);
                                        if (org != null && otherAttValues != null
                                                && otherAttValues.get("name") != null
                                                && otherAttValues.get("rev") != null) {
                                            ResolveData data = new ResolveData(ivy
                                                    .getResolveEngine(), new ResolveOptions());
                                            ModuleRevisionId mrid = ModuleRevisionId.newInstance(
                                                org, (String) otherAttValues.get("name"),
                                                (String) otherAttValues.get("rev"));
                                            DefaultDependencyDescriptor ddd = new DefaultDependencyDescriptor(
                                                    mrid, false);
View Full Code Here

                                // no resolve previously done for at least
                                // one conf... we do it now
                                Message.info("\n\nIVYDE: previous resolve of "
                                        + md.getModuleRevisionId().getModuleId()
                                        + " doesn't contain enough data: resolving again\n");
                                ResolveReport r = ivy.resolve(md, new ResolveOptions()
                                        .setConfs((String[]) conf.confs
                                                .toArray(new String[conf.confs.size()])));
                                all.addAll(Arrays.asList(r.getArtifactsReports(null, false)));
                                confs = r.getConfigurations();
                                problemMessages.addAll(r.getAllProblemMessages());
                                maybeRetrieve(md, confs);

                                break;
                            }
                        }
                    } else {
                        Message.info("\n\nIVYDE: calling resolve on " + conf.ivyXmlPath + "\n");
                        ResolveReport report = ivy.resolve(md, new ResolveOptions()
                                .setConfs((String[]) conf.confs.toArray(new String[conf.confs
                                        .size()])));
                        problemMessages = report.getAllProblemMessages();
                        all = new LinkedHashSet(Arrays.asList(report.getArtifactsReports(null,
                            false)));
View Full Code Here

    private RetrieveOptions getRetrieveOptions() {
        return new RetrieveOptions();
    }

    private ResolveOptions getResolveOptions(String[] confs) {
        return new ResolveOptions().setConfs(confs);
    }
View Full Code Here

            }

            if (line.hasOption("useOrigin")) {
                ivy.getSettings().useDeprecatedUseOrigin();
            }
            ResolveOptions resolveOptions = new ResolveOptions().setConfs(confs)
                .setValidate(validate);
            if (line.hasOption("refresh")) {
                resolveOptions.setRefresh(true);
            }
            ResolveReport report = ivy.resolve(ivyfile.toURI().toURL(), resolveOptions);
            if (report.hasError()) {
                System.exit(1);
            }
View Full Code Here

    // ///////////////////////////////////////////////////////////////////////

    public ResolvedModuleRevision findModule(ModuleRevisionId mrid) {
        pushContext();
        try {
            ResolveOptions options = new ResolveOptions();
            options.setValidate(false);
            return resolveEngine.findModule(mrid, options);
        } finally {
            popContext();
        }
    }
View Full Code Here

            "using cache and useOrigin when calling download is not supported anymore");
        return ivy.getResolveEngine().download(artifact, new DownloadOptions());
    }

    public ResolvedModuleRevision findModule(ModuleRevisionId id) {
        ResolveOptions options = new ResolveOptions();
        options.setValidate(false);
        return ivy.getResolveEngine().findModule(id, options);
    }
View Full Code Here

            Date date, boolean validate, boolean useCacheOnly, boolean transitive,
            boolean useOrigin, boolean download, boolean outputReport, Filter artifactFilter) {
        if (useOrigin) {
            ivy.getSettings().useDeprecatedUseOrigin();
        }
        return new ResolveOptions().setConfs(confs).setRevision(revision)
                .setValidate(validate).setUseCacheOnly(useCacheOnly).setTransitive(transitive)
                .setDownload(download).setOutputReport(outputReport)
                .setArtifactFilter(artifactFilter);
    }
View Full Code Here

            // resolve using appropriate resolver
            ResolveReport report = new ResolveReport(md, resolveId);

            Message.info(":: resolving dependencies ::");
            ResolveOptions options = new ResolveOptions()
                                .setResolveId(resolveId)
                                .setConfs(new String[] {"default"})
                                .setValidate(validate);
            IvyNode[] dependencies = resolveEngine.getDependencies(md, options, report);
            report.setDependencies(Arrays.asList(dependencies), artifactFilter);
View Full Code Here

            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);
            data = new ResolveData(engine, options);
        }
       
        DependencyResolver resolver = ivySettings.getResolver(parentModRevID);
        if (resolver == null) {
View Full Code Here

TOP

Related Classes of org.apache.ivy.core.resolve.ResolveOptions

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.