Search in sources :

Example 1 with DependencyDescriptorMediator

use of org.apache.ivy.core.module.descriptor.DependencyDescriptorMediator in project ant-ivy by apache.

the class XmlModuleDescriptorWriter method printAllMediators.

private static void printAllMediators(ModuleDescriptor md, PrintWriter out) {
    Map<MapMatcher, DependencyDescriptorMediator> mediators = md.getAllDependencyDescriptorMediators().getAllRules();
    for (Map.Entry<MapMatcher, DependencyDescriptorMediator> mediatorRule : mediators.entrySet()) {
        MapMatcher matcher = mediatorRule.getKey();
        DependencyDescriptorMediator mediator = mediatorRule.getValue();
        if (mediator instanceof OverrideDependencyDescriptorMediator) {
            OverrideDependencyDescriptorMediator oddm = (OverrideDependencyDescriptorMediator) mediator;
            out.print(String.format("\t\t<override org=\"%s\" module=\"%s\" matcher=\"%s\"", XMLHelper.escape(matcher.getAttributes().get(IvyPatternHelper.ORGANISATION_KEY)), XMLHelper.escape(matcher.getAttributes().get(IvyPatternHelper.MODULE_KEY)), XMLHelper.escape(matcher.getPatternMatcher().getName())));
            if (oddm.getBranch() != null) {
                out.print(" branch=\"" + XMLHelper.escape(oddm.getBranch()) + "\"");
            }
            if (oddm.getVersion() != null) {
                out.print(" rev=\"" + XMLHelper.escape(oddm.getVersion()) + "\"");
            }
            out.println("/>");
        } else {
            Message.verbose("ignoring unhandled DependencyDescriptorMediator: " + mediator.getClass());
        }
    }
}
Also used : OverrideDependencyDescriptorMediator(org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator) OverrideDependencyDescriptorMediator(org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator) DependencyDescriptorMediator(org.apache.ivy.core.module.descriptor.DependencyDescriptorMediator) MapMatcher(org.apache.ivy.plugins.matcher.MapMatcher) Map(java.util.Map)

Aggregations

Map (java.util.Map)1 DependencyDescriptorMediator (org.apache.ivy.core.module.descriptor.DependencyDescriptorMediator)1 OverrideDependencyDescriptorMediator (org.apache.ivy.core.module.descriptor.OverrideDependencyDescriptorMediator)1 MapMatcher (org.apache.ivy.plugins.matcher.MapMatcher)1