@Test( expected = NamespaceException.class ) public void shouldNotAllowUnregisteringBlankPrefix() throws Exception { registry.unregisterNamespace(""); }
@Override public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } checkURINotInUse(uri); boolean global = false; switch (behavior) { case WORKSPACE: { global = true; break; } case SESSION: { break; } default: { assert false; } } try { registry.unregister(uri); session.signalNamespaceChanges(global); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } }
JcrNamespaceRegistry implements org.modeshape.jcr.api.NamespaceRegistry { @Override public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } checkURINotInUse(uri); boolean global = false; switch (behavior) { case WORKSPACE: { global = true; break; } case SESSION: { break; } default: { assert false; } } try { registry.unregister(uri); session.signalNamespaceChanges(global); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } } }
JcrNamespaceRegistry implements org.modeshape.jcr.api.NamespaceRegistry { @Override public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } checkURINotInUse(uri); boolean global = false; switch (behavior) { case WORKSPACE: { global = true; break; } case SESSION: { break; } default: { assert false; } } try { registry.unregister(uri); session.signalNamespaceChanges(global); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } } protected  JcrNamespaceRegistry( NamespaceRegistry workspaceRegistry,
                                    JcrSession session );   JcrNamespaceRegistry( Behavior behavior,
                          NamespaceRegistry localRegistry,
                          NamespaceRegistry workspaceRegistry,
                          JcrSession session ); }
JcrNamespaceRegistry implements org.modeshape.jcr.api.NamespaceRegistry { @Override public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } checkURINotInUse(uri); boolean global = false; switch (behavior) { case WORKSPACE: { global = true; break; } case SESSION: { break; } default: { assert false; } } try { registry.unregister(uri); session.signalNamespaceChanges(global); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } } protected  JcrNamespaceRegistry( NamespaceRegistry workspaceRegistry,
                                    JcrSession session );   JcrNamespaceRegistry( Behavior behavior,
                          NamespaceRegistry localRegistry,
                          NamespaceRegistry workspaceRegistry,
                          JcrSession session ); @Override String getPrefix( String uri ); @Override String[] getPrefixes(); @Override String getURI( String prefix ); @Override String[] getURIs(); @Override boolean isRegisteredPrefix( String prefix ); @Override boolean isRegisteredUri( String uri ); @Override synchronized void registerNamespace( String prefix,
                                                String uri ); @Override synchronized void unregisterNamespace( String prefix ); @Override String registerNamespace( String uri ); @Override String toString(); }
JcrNamespaceRegistry implements org.modeshape.jcr.api.NamespaceRegistry { @Override public synchronized void unregisterNamespace( String prefix ) throws NamespaceException, AccessDeniedException, RepositoryException { CheckArg.isNotNull(prefix, "prefix"); checkSession(); if (behavior.equals(Behavior.WORKSPACE)) { try { session.checkWorkspacePermission(session.workspaceName(), ModeShapePermissions.REGISTER_NAMESPACE); } catch (AccessControlException ace) { throw new AccessDeniedException(ace); } } String uri = registry.getNamespaceForPrefix(prefix); if (uri == null) { throw new NamespaceException(JcrI18n.unableToUnregisterPrefixForNamespaceThatIsNotRegistered.text(prefix)); } if (STANDARD_BUILT_IN_PREFIXES.contains(prefix)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespacePrefix.text(prefix, uri)); } if (STANDARD_BUILT_IN_URIS.contains(uri)) { throw new NamespaceException(JcrI18n.unableToUnregisterReservedNamespaceUri.text(prefix, uri)); } checkURINotInUse(uri); boolean global = false; switch (behavior) { case WORKSPACE: { global = true; break; } case SESSION: { break; } default: { assert false; } } try { registry.unregister(uri); session.signalNamespaceChanges(global); } catch (RuntimeException e) { throw new RepositoryException(e.getMessage(), e.getCause()); } } protected  JcrNamespaceRegistry( NamespaceRegistry workspaceRegistry,
                                    JcrSession session );   JcrNamespaceRegistry( Behavior behavior,
                          NamespaceRegistry localRegistry,
                          NamespaceRegistry workspaceRegistry,
                          JcrSession session ); @Override String getPrefix( String uri ); @Override String[] getPrefixes(); @Override String getURI( String prefix ); @Override String[] getURIs(); @Override boolean isRegisteredPrefix( String prefix ); @Override boolean isRegisteredUri( String uri ); @Override synchronized void registerNamespace( String prefix,
                                                String uri ); @Override synchronized void unregisterNamespace( String prefix ); @Override String registerNamespace( String uri ); @Override String toString();  }