Search in sources :

Example 21 with OpenNode

use of org.eclipse.ceylon.cmr.spi.OpenNode in project ceylon by eclipse.

the class AbstractOpenNode method link.

@Override
public void link(OpenNode child) {
    if (child == null)
        throw new IllegalArgumentException("Null node!");
    OpenNode previous = children.putIfAbsent(child.getLabel(), child);
    if (previous == null) {
        if (child instanceof AbstractOpenNode) {
            AbstractOpenNode dn = (AbstractOpenNode) child;
            dn.parents.put(getLabel(), this);
        }
    } else {
        MergeStrategy ms = findService(MergeStrategy.class);
        ms.conflict(previous, child);
    }
}
Also used : MergeStrategy(org.eclipse.ceylon.cmr.spi.MergeStrategy) OpenNode(org.eclipse.ceylon.cmr.spi.OpenNode)

Example 22 with OpenNode

use of org.eclipse.ceylon.cmr.spi.OpenNode in project ceylon by eclipse.

the class AbstractOpenNode method put.

protected OpenNode put(ConcurrentMap<String, OpenNode> map, String label, OpenNode child) {
    final OpenNode previous = map.putIfAbsent(label, child);
    if (previous == null) {
        if (child instanceof AbstractOpenNode) {
            final AbstractOpenNode dn = (AbstractOpenNode) child;
            dn.parents.put(getLabel(), this);
        }
    } else {
        // replace
        child = previous;
    }
    return child;
}
Also used : OpenNode(org.eclipse.ceylon.cmr.spi.OpenNode)

Aggregations

OpenNode (org.eclipse.ceylon.cmr.spi.OpenNode)22 IOException (java.io.IOException)7 Node (org.eclipse.ceylon.cmr.spi.Node)7 File (java.io.File)6 ArrayList (java.util.ArrayList)3 CmrRepository (org.eclipse.ceylon.cmr.api.CmrRepository)3 ByteArrayInputStream (java.io.ByteArrayInputStream)2 ContentHandle (org.eclipse.ceylon.cmr.spi.ContentHandle)2 ContentStore (org.eclipse.ceylon.cmr.spi.ContentStore)2 StructureBuilder (org.eclipse.ceylon.cmr.spi.StructureBuilder)2 RepositoryException (org.eclipse.ceylon.model.cmr.RepositoryException)2 FileInputStream (java.io.FileInputStream)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 ArtifactCallback (org.eclipse.ceylon.cmr.api.ArtifactCallback)1 ArtifactCallbackStream (org.eclipse.ceylon.cmr.api.ArtifactCallbackStream)1 ArtifactContext (org.eclipse.ceylon.cmr.api.ArtifactContext)1 ModuleVersionDetails (org.eclipse.ceylon.cmr.api.ModuleVersionDetails)1 ModuleVersionQuery (org.eclipse.ceylon.cmr.api.ModuleVersionQuery)1 ModuleVersionResult (org.eclipse.ceylon.cmr.api.ModuleVersionResult)1 RepositoryManager (org.eclipse.ceylon.cmr.api.RepositoryManager)1