*
* @param session the session; may not be null
* @return true if the session overrides one or more namespace mappings used in this schemata, or false otherwise
*/
private boolean overridesNamespaceMappings( JcrSession session ) {
NamespaceRegistry registry = session.context().getNamespaceRegistry();
if (registry instanceof LocalNamespaceRegistry) {
Set<Namespace> localNamespaces = ((LocalNamespaceRegistry)registry).getLocalNamespaces();
if (localNamespaces.isEmpty()) {
// There are no local mappings ...
return false;
}
for (Namespace namespace : localNamespaces) {
if (prefixesByUris.containsKey(namespace.getNamespaceUri())) return true;
}
// None of the local namespace mappings overrode any namespaces used by this schemata ...
return false;
}
// We can't find the local mappings, so brute-force it ...
for (Namespace namespace : registry.getNamespaces()) {
String expectedPrefix = prefixesByUris.get(namespace.getNamespaceUri());
if (expectedPrefix == null) {
// This namespace is not used by this schemata ...
continue;
}