org.apache.ivy.plugins.conflict.ConflictManager Java Examples

The following examples show how to use org.apache.ivy.plugins.conflict.ConflictManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 6 votes vote down vote up
public synchronized ConflictManager getConflictManager(ModuleId moduleId) {
    ModuleSettings ms = moduleSettings.getRule(moduleId, new Filter<ModuleSettings>() {
        public boolean accept(ModuleSettings o) {
            return o.getConflictManager() != null;
        }
    });
    if (ms == null) {
        return getDefaultConflictManager();
    } else {
        ConflictManager cm = getConflictManager(ms.getConflictManager());
        if (cm == null) {
            throw new IllegalStateException("ivy badly configured: unknown conflict manager "
                    + ms.getConflictManager());
        }
        return cm;
    }
}
 
Example #2
Source File: IvyConflict.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
void addConflict(DefaultModuleDescriptor md, IvySettings settings) {
    String matcherName = (matcher == null) ? PatternMatcher.EXACT : matcher;
    String orgPattern = (org == null) ? PatternMatcher.ANY_EXPRESSION : org;
    String modulePattern = (module == null) ? PatternMatcher.ANY_EXPRESSION : module;
    ConflictManager cm = null;
    if (rev != null) {
        cm = new FixedConflictManager(splitToArray(rev));
    } else if (manager != null) {
        cm = settings.getConflictManager(manager);
    }
    md.addConflictManager(new ModuleId(orgPattern, modulePattern),
        settings.getMatcher(matcherName), cm);
}
 
Example #3
Source File: XmlModuleDescriptorParser.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
protected void managerStarted(Attributes attributes, String managerAtt) {
    String org = settings.substitute(attributes.getValue("org"));
    if (org == null) {
        org = PatternMatcher.ANY_EXPRESSION;
    }
    String mod = settings.substitute(attributes.getValue("module"));
    if (mod == null) {
        mod = PatternMatcher.ANY_EXPRESSION;
    }
    ConflictManager cm;
    String name = settings.substitute(attributes.getValue(managerAtt));
    String rev = settings.substitute(attributes.getValue("rev"));
    if (rev != null) {
        cm = new FixedConflictManager(splitToArray(rev));
    } else if (name != null) {
        cm = settings.getConflictManager(name);
        if (cm == null) {
            addError("unknown conflict manager: " + name);
            return;
        }
    } else {
        addError("bad conflict manager: no manager nor rev");
        return;
    }
    String matcherName = settings.substitute(attributes.getValue("matcher"));
    PatternMatcher matcher = (matcherName == null) ? defaultMatcher
            : settings.getMatcher(matcherName);
    if (matcher == null) {
        addError("unknown matcher: " + matcherName);
        return;
    }
    getMd().addConflictManager(new ModuleId(org, mod), matcher, cm);
}
 
Example #4
Source File: ResolveEngine.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
private Collection<IvyNode> resolveConflicts(VisitNode node, VisitNode ancestor,
        Collection<IvyNode> conflicts, ConflictManager conflictManager) {
    if (node.getParent() != ancestor
    // we are not handling the direct parent

            && conflictManager == settings.getConflictManager(node.getModuleId())
            // the conflict manager is the default one

            && node.getParent().getNode()
                    .getResolvedNodes(node.getModuleId(), node.getRootModuleConf())
                    .equals(conflicts)
    // there is no new conflict in this ancestor

    ) {
        // IVY-465 case
        if (settings.debugConflictResolution()) {
            Message.debug("no new conflicting revisions for " + node + " in " + ancestor + ": "
                    + conflicts);
        }

        return conflicts;
    } else {
        if (settings.debugConflictResolution()) {
            Message.debug("found conflicting revisions for " + node + " in " + ancestor + ": "
                    + conflicts);
        }

        return conflictManager.resolveConflicts(ancestor.getNode(), conflicts);
    }
}
 
Example #5
Source File: IvyNodeEviction.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public Collection<ConflictManager> getAllEvictingConflictManagers() {
    Collection<ConflictManager> ret = new HashSet<>();
    for (EvictionData ed : evicted.values()) {
        ret.add(ed.getConflictManager());
    }
    return ret;
}
 
Example #6
Source File: IvyNode.java    From ant-ivy with Apache License 2.0 5 votes vote down vote up
public ConflictManager getConflictManager(ModuleId mid) {
    if (md == null) {
        throw new IllegalStateException(
                "impossible to get conflict manager when data has not been loaded. IvyNode = "
                        + this);
    }
    ConflictManager cm = md.getConflictManager(mid);
    return cm == null ? settings.getConflictManager(mid) : cm;
}
 
Example #7
Source File: LegacyResolverParserSettings.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConflictManager getConflictManager(String name) {
    return settings.getConflictManager(name);
}
 
Example #8
Source File: AbstractResolver.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ConflictManager getConflictManager(String name) {
    return AbstractResolver.this.getSettings().getConflictManager(name);
}
 
Example #9
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public synchronized void setDefaultConflictManager(ConflictManager defaultConflictManager) {
    this.defaultConflictManager = defaultConflictManager;
}
 
Example #10
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public synchronized void addConflictManager(String name, ConflictManager cm) {
    init(cm);
    conflictsManager.put(name, cm);
}
 
Example #11
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public synchronized ConflictManager getConflictManager(String name) {
    if ("default".equals(name)) {
        return getDefaultConflictManager();
    }
    return conflictsManager.get(name);
}
 
Example #12
Source File: IvySettings.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public synchronized void addConfigured(ConflictManager cm) {
    addConflictManager(cm.getName(), cm);
}
 
Example #13
Source File: ParserSettingsMonitor.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ConflictManager getConflictManager(String name) {
    return delegatedSettings.getConflictManager(name);
}
 
Example #14
Source File: DefaultResolutionCacheManager.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ConflictManager getConflictManager(String name) {
    return delegate.getConflictManager(name);
}
 
Example #15
Source File: DefaultModuleDescriptor.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ConflictManager getConflictManager(ModuleId moduleId) {
    return conflictManagers.getRule(moduleId);
}
 
Example #16
Source File: IvyNode.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public void markEvicted(String rootModuleConf, IvyNode node, ConflictManager conflictManager,
        Collection<IvyNode> resolved) {
    EvictionData evictionData = new EvictionData(rootModuleConf, node, conflictManager,
            resolved);
    markEvicted(evictionData);
}
 
Example #17
Source File: IvyNode.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public Collection<ConflictManager> getAllEvictingConflictManagers() {
    return eviction.getAllEvictingConflictManagers();
}
 
Example #18
Source File: IvyNodeEviction.java    From ant-ivy with Apache License 2.0 4 votes vote down vote up
public ConflictManager getConflictManager() {
    return conflictManager;
}
 
Example #19
Source File: LegacyResolverParserSettings.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ConflictManager getConflictManager(String name) {
    return settings.getConflictManager(name);
}
 
Example #20
Source File: IvyNodeEviction.java    From ant-ivy with Apache License 2.0 3 votes vote down vote up
/**
 * Creates a new object containing the eviction data of an {@link IvyNode}.
 *
 * @param rootModuleConf
 *            the root module configuration
 * @param parent
 *            the parent node (or <tt>null</tt> in case of transitive eviction)
 * @param conflictManager
 *            the conflict manager which evicted the node (or <tt>null</tt> in case of
 *            transitive eviction)
 * @param selected
 *            a collection of {@link IvyNode}s which evict the evicted node (or
 *            <tt>null</tt> in case of transitive eviction)
 * @param detail
 *            a String detailing the reason why the node was evicted
 */
public EvictionData(String rootModuleConf, IvyNode parent, ConflictManager conflictManager,
        Collection<IvyNode> selected, String detail) {
    this.rootModuleConf = rootModuleConf;
    this.parent = parent;
    this.conflictManager = conflictManager;
    this.selected = selected;
    this.detail = detail;
}
 
Example #21
Source File: ModuleDescriptor.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * @param id ModuleId
 * @return the conflict manager to use for the given ModuleId, or null if no specific conflict
 *         manager is associated with the given module id in this module descriptor.
 */
ConflictManager getConflictManager(ModuleId id);
 
Example #22
Source File: DefaultModuleDescriptor.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * regular expressions as explained in Pattern class may be used in ModuleId organisation and
 * name
 *
 * @param moduleId ditto
 * @param matcher PatternMatcher
 * @param manager ConflictManager
 */
public void addConflictManager(ModuleId moduleId, PatternMatcher matcher,
        ConflictManager manager) {
    conflictManagers.defineRule(new MapMatcher(moduleId.getAttributes(), matcher), manager);
}
 
Example #23
Source File: IvyNodeEviction.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * Creates a new object containing the eviction data of an {@link IvyNode}.
 *
 * @param rootModuleConf
 *            the root module configuration
 * @param parent
 *            the parent node (or <tt>null</tt> in case of transitive eviction)
 * @param conflictManager
 *            the conflict manager which evicted the node (or <tt>null</tt> in case of
 *            transitive eviction)
 * @param selected
 *            a collection of {@link IvyNode}s which evict the evicted node (or
 *            <tt>null</tt> in case of transitive eviction)
 */
public EvictionData(String rootModuleConf, IvyNode parent, ConflictManager conflictManager,
        Collection<IvyNode> selected) {
    this(rootModuleConf, parent, conflictManager, selected, null);
}
 
Example #24
Source File: VisitNode.java    From ant-ivy with Apache License 2.0 2 votes vote down vote up
/**
 * Marks the current node as evicted by the the given selected IvyNodes, in the given parent and
 * root module configuration, with the given {@link ConflictManager}
 *
 * @param parent
 *            the VisitNode in which eviction has been made
 * @param conflictMgr
 *            the conflict manager responsible for the eviction
 * @param selected
 *            a Collection of {@link IvyNode} which have been selected
 */
public void markEvicted(VisitNode parent, ConflictManager conflictMgr,
        Collection<IvyNode> selected) {
    node.markEvicted(rootModuleConf, parent.getNode(), conflictMgr, selected);
}
 
Example #25
Source File: ResolveEngineSettings.java    From ant-ivy with Apache License 2.0 votes vote down vote up
ConflictManager getConflictManager(ModuleId mid); 
Example #26
Source File: ParserSettings.java    From ant-ivy with Apache License 2.0 votes vote down vote up
ConflictManager getConflictManager(String name);