@Override
public Resource addResource(Resource res, MavenCoordinates mavenid) {
Capability icap = res.getIdentityCapability();
String attkey = ContentNamespace.CAPABILITY_MAVEN_IDENTITY_ATTRIBUTE;
MavenCoordinates attval = (MavenCoordinates) icap.getAttributes().get(attkey);
if (attval != null && !attval.equals(mavenid))
throw new IllegalArgumentException("Resource already contains a " + attkey + " attribute: " + attval);
ResourceBuilder builder = new DefaultResourceBuilder();
for (Capability aux : res.getCapabilities(null)) {
Capability cap = builder.addCapability(aux.getNamespace(), aux.getAttributes(), aux.getDirectives());