if (primaryType.isDerivedFrom(mixinName)) {
throw new RepositoryException(mixinName + ": already contained in primary node type");
}
// build effective node type of mixin's & primary type in order to detect conflicts
NodeTypeRegistry ntReg = ntMgr.getNodeTypeRegistry();
EffectiveNodeType entExisting;
try {
// existing mixin's
HashSet set = new HashSet(((NodeState) state).getMixinTypeNames());
// primary type
set.add(primaryTypeName);
// build effective node type representing primary type including existing mixin's
entExisting = ntReg.getEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
if (entExisting.includesNodeType(mixinName)) {
throw new RepositoryException(mixinName + ": already contained in mixin types");
}
// add new mixin
set.add(mixinName);
// try to build new effective node type (will throw in case of conflicts)
ntReg.getEffectiveNodeType((QName[]) set.toArray(new QName[set.size()]));
} catch (NodeTypeConflictException ntce) {
throw new ConstraintViolationException(ntce.getMessage());
}
// do the actual modifications implied by the new mixin;