public void unregisterNamespace(String prefix) throws NamespaceException, RepositoryException
{
if (namespaces.get(prefix) == null)
{
throw new NamespaceException("Prefix " + prefix + " is not registered");
}
if (PROTECTED_NAMESPACES.contains(prefix))
{
throw new NamespaceException("Prefix " + prefix + " is protected");
}
String uri = getURI(prefix);
if (indexSearcherHolder != null)
{
final Set<String> nodes = indexSearcherHolder.getNodesByUri(uri);
if (nodes.size() > 0)
{
StringBuilder builder = new StringBuilder();
builder.append("Fail to unregister namespace '");
builder.append(prefix);
builder.append("' because of following nodes: ");
for (String uuid : nodes)
{
ItemData item = dataManager.getItemData(uuid);
if (item != null && item.isNode())
{
builder.append(" - ");
builder.append(item.getQPath().getAsString());
builder.append("\r\n");
}
}
builder.append(" uses this prefix.");
throw new NamespaceException(builder.toString());
}
}
prefixes.remove(uri);
namespaces.remove(prefix);
if (persister != null)