Package org.apache.ivy.core.resolve

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


        RepositoryCacheManager[] caches = settings.getRepositoryCacheManagers();
        for (int i = 0; i < caches.length; i++) {
            caches[i].clean();
        }

        data = new ResolveData(ivy.getResolveEngine(), new ResolveOptions());
    }
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(
View Full Code Here

                    settings, searchEngine, resolveEngine);
            }
   
            eventManager.addTransferListener(new TransferListener() {
                public void transferProgress(TransferEvent evt) {
                    ResolveData resolve;
                    switch (evt.getEventType()) {
                        case TransferEvent.TRANSFER_PROGRESS:
                            resolve = IvyContext.getContext().getResolveData();
                            if (resolve == null || !LogOptions.LOG_QUIET.equals(
                                    resolve.getOptions().getLog())) {
                                Message.progress();
                            }
                            break;
                        case TransferEvent.TRANSFER_COMPLETED:
                            resolve = IvyContext.getContext().getResolveData();
                            if (resolve == null || !LogOptions.LOG_QUIET.equals(
                                    resolve.getOptions().getLog())) {
                                Message.endProgress(" (" + (evt.getTotalLength() / KILO) + "kB)");
                            }
                            break;
                        default:
                            break;
View Full Code Here

            throws ParseException {
        if (ivyResolver == null || artifactResolver == null) {
            throw new IllegalStateException(
                    "exactly two resolvers must be added: ivy(1) and artifact(2) one");
        }
        data = new ResolveData(data, doValidate(data));
        final ResolvedModuleRevision mr = ivyResolver.getDependency(dd, data);
        if (mr == null) {
            checkInterrupted();
            if (isAllownomd()) {
                Message.verbose("ivy resolver didn't find " + dd.getDependencyRevisionId()
View Full Code Here

    }

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

                rejected.add(rres.getRevision() + " (" + rres.getLastModified() + ")");
                continue;
            }
            ModuleRevisionId foundMrid = ModuleRevisionId.newInstance(mrid, rres.getRevision());
           
            ResolveData data = context.getResolveData();
            if (data != null
                    && data.getReport() != null
                    && data.isBlacklisted(data.getReport().getConfiguration(), foundMrid)) {
                Message.debug("\t" + name + ": blacklisted: " + rres);
                rejected.add(rres.getRevision() + " (blacklisted)");
                foundBlacklisted.add(foundMrid);
                continue;
            }
View Full Code Here

                }
            }

            // check dependencies
            DependencyDescriptor[] dds = md.getDependencies();
            ResolveData data = new ResolveData(resolveEngine, new ResolveOptions());
            for (int i = 0; i < dds.length; i++) {
                // check master confs
                String[] masterConfs = dds[i].getModuleConfigurations();
                for (int j = 0; j < masterConfs.length; j++) {
                    if (!"*".equals(masterConfs[j].trim())
 
View Full Code Here

        checkmodified = Boolean.valueOf(check);
    }

    public ResolvedModuleRevision getDependency(DependencyDescriptor dd, ResolveData data)
            throws ParseException {
        data = new ResolveData(data, doValidate(data));
        ResolvedModuleRevision ret = null;

        List errors = new ArrayList();

        ResolvedModuleRevision mr = null;
View Full Code Here

         throw new StrictConflictException(node1, node2);
    }
   
    public void handleAllBlacklistedRevisions(
            DependencyDescriptor dd, Collection/*<ModuleRevisionId>*/ foundBlacklisted) {
        ResolveData resolveData = IvyContext.getContext().getResolveData();
        Collection/*<IvyNode>*/ blacklisted = new HashSet();
        for (Iterator iterator = foundBlacklisted.iterator(); iterator.hasNext();) {
            ModuleRevisionId mrid = (ModuleRevisionId) iterator.next();
            blacklisted.add(resolveData.getNode(mrid));
        }
       
        for (Iterator iterator = blacklisted.iterator(); iterator.hasNext();) {
            IvyNode node = (IvyNode) iterator.next();
            IvyNodeBlacklist bdata = node.getBlacklistData(
                resolveData.getReport().getConfiguration());
            handleUnsolvableConflict(
                bdata.getConflictParent(),
                Arrays.asList(new Object[] {
                    bdata.getEvictedNode(), bdata.getSelectedNode()}),
                bdata.getEvictedNode(),
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) {
                    getSettings().logError("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 \n"
                        + "to 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 = ((IvyModuleDescriptorFile) 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) {
                                    getSettings().logError(
                                        "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 = ((IvyModuleDescriptorFile) 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(
View Full Code Here

TOP

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

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.