コード例 #1
0
 @Override
 public String getNamespaceForPrefix(String prefix) {
   Lock lock = this.namespacesLock.readLock();
   try {
     lock.lock();
     CheckArg.isNotNull(prefix, "prefix");
     return cache.getNamespaceForPrefix(prefix);
   } finally {
     lock.unlock();
   }
 }
コード例 #2
0
 @Override
 public Set<Namespace> getNamespaces() {
   final Lock lock = this.namespacesLock.readLock();
   try {
     lock.lock();
     // Just return what's in the cache ...
     return cache.getNamespaces();
   } finally {
     lock.unlock();
   }
 }
コード例 #3
0
 @Override
 public boolean isRegisteredNamespaceUri(String namespaceUri) {
   CheckArg.isNotNull(namespaceUri, "namespaceUri");
   Lock lock = this.namespacesLock.readLock();
   try {
     lock.lock();
     return cache.isRegisteredNamespaceUri(namespaceUri);
   } finally {
     lock.unlock();
   }
 }
コード例 #4
0
 @Override
 public Set<String> getRegisteredNamespaceUris() {
   final Lock lock = this.namespacesLock.readLock();
   try {
     lock.lock();
     // Just return what's in the cache ...
     return cache.getRegisteredNamespaceUris();
   } finally {
     lock.unlock();
   }
 }
コード例 #5
0
 @Override
 public String getPrefixForNamespaceUri(String namespaceUri, boolean generateIfMissing) {
   CheckArg.isNotNull(namespaceUri, "namespaceUri");
   Lock lock = this.namespacesLock.readLock();
   try {
     lock.lock();
     // Try the cache first ...
     String prefix = cache.getPrefixForNamespaceUri(namespaceUri, false);
     if (prefix == null && generateIfMissing) {
       SystemContent systemContent = systemContent(!generateIfMissing);
       prefix = systemContent.readNamespacePrefix(namespaceUri, generateIfMissing);
       if (prefix != null) {
         systemContent.save();
         cache.register(prefix, namespaceUri);
       }
     }
     return prefix;
   } finally {
     lock.unlock();
   }
 }