コード例 #1
0
  @Test
  public void shouldUnregisterNamespace() {
    Map<String, String> urisByPrefix = new HashMap<String, String>();
    String uri = "http://foo.bar";
    String prefix = "foobar";
    urisByPrefix.put(prefix, uri);

    system.registerNamespaces(urisByPrefix);
    assertTrue(system.unregisterNamespace(uri));
    assertNull(system.readNamespacePrefix(uri, false));
  }
コード例 #2
0
 @Override
 public boolean unregister(String namespaceUri) {
   CheckArg.isNotNull(namespaceUri, "namespaceUri");
   namespaceUri = namespaceUri.trim();
   final Lock lock = this.namespacesLock.writeLock();
   try {
     lock.lock();
     // Remove it from the cache ...
     boolean found = this.cache.unregister(namespaceUri);
     // Then from the source ...
     SystemContent systemContent = systemContent(false);
     boolean foundPersistent = systemContent.unregisterNamespace(namespaceUri);
     systemContent.save();
     return foundPersistent || found;
   } finally {
     lock.unlock();
   }
 }