Exemplo n.º 1
0
 @Override
 public synchronized boolean updateIfChanged(String identifier)
     throws IOException, RegistryException {
   // identify installed vocabulary by identifier
   Vocabulary installed = get(identifier);
   if (installed != null) {
     // match vocabulary by identifier and issued date
     Vocabulary matched = null;
     for (Vocabulary v : registryManager.getVocabularies()) {
       if (v.getUriString() != null
           && v.getUriString().equalsIgnoreCase(identifier)
           && installed.getIssued() != null
           && v.getIssued() != null
           && installed.getIssued().compareTo(v.getIssued()) == 0) {
         matched = v;
         break;
       }
     }
     // verify the version was updated
     if (matched != null && matched.getUriResolvable() != null) {
       File vocabFile = getVocabFile(matched.getUriResolvable());
       return downloader.downloadIfChanged(matched.getUriResolvable().toURL(), vocabFile);
     }
   }
   return false;
 }