Esempio n. 1
0
 /**
  * This method accepts the name of a repository (as it appears in the CampaignProperties) and
  * updates it by adding the additional mappings that are in <code>add</code>.
  *
  * <p>This method first retrieves the mapping from the AssetLoader. It then adds in the new
  * assets. Last, it has to create the new index file. The index file should be stored in the local
  * repository cache. Note that this function <b>does not</b> update the original (network storage)
  * repository location.
  *
  * <p>If the calling function does not update the network storage for <b>index.gz</b>, a restart
  * of MapTool will lose the information when the index is downloaded again.
  *
  * @param repo name of the repository to update
  * @param add entries to add to the repository
  * @return the contents of the new repository in uploadable format
  */
 public static byte[] updateRepositoryMap(String repo, Map<String, String> add) {
   Map<String, String> repoMap = assetLoader.getRepositoryMap(repo);
   repoMap.putAll(add);
   byte[] index = assetLoader.createIndexFile(repo);
   try {
     assetLoader.storeIndexFile(repo, index);
   } catch (IOException e) {
     log.error("Couldn't save updated index to local repository cache", e);
     e.printStackTrace();
   }
   return index;
 }