namespace = desc.getNamespace();
target = String.format("%s:%s", namespace, desc.getName());
}
// Cache key is of the form "referencingNamespace>defNamespace:defName[.subDefName].defTypeOrdinal"
DefType defType = desc.getDefType();
String key = String.format("%s>%s.%d", referencingNamespace == null ? "" : referencingNamespace, target,
defType.ordinal());
String status = accessCheckCache.getIfPresent(key);
if (status == null) {
status = "";
// Protect against re-entry
accessCheckCache.put(key, status);
// System.out.printf("** MDR.miss.assertAccess() cache miss for: %s\n", key);
DefDescriptor<? extends Definition> descriptor = def.getDescriptor();
if (!configAdapter.isUnsecuredNamespace(namespace)
&& !configAdapter.isUnsecuredPrefix(descriptor.getPrefix())) {
if (referencingNamespace == null || referencingNamespace.isEmpty()) {
status = String
.format("Access to %s '%s' disallowed by MasterDefRegistry.assertAccess(): referencing namespace was empty or null",
defType, target);
} else if (!referencingNamespace.equals(namespace)) {
// The caller and the def are not in the same namespace
status = String
.format("Access to %s '%s' from namespace '%s' in '%s(%s)' disallowed by MasterDefRegistry.assertAccess()",
defType.toString().toLowerCase(), target, referencingNamespace,
referencingDescriptor, referencingDescriptor.getDefType());
}
}
if (!status.isEmpty()) {