Exemplo n.º 1
0
 public void saveForShutdown() {
   idvStore.put(PREF_ADDE_ENTRIES, arrList(getPersistedEntrySet()));
   idvStore.saveIfNeeded();
   try {
     EntryTransforms.writeResolvFile(ADDE_RESOLV, getPersistedLocalEntries());
   } catch (IOException e) {
     logger.error("EntryStore: RESOLV.SRV missing; expected=\"" + ADDE_RESOLV + "\"");
   }
 }
Exemplo n.º 2
0
  /**
   * Returns the {@link edu.wisc.ssec.mcidasv.servermanager.AddeEntry AddeEntrys} stored in the
   * user's preferences.
   *
   * @param store Object store that represents the user's preferences. Cannot be {@code null}.
   * @return Either the {@code AddeEntrys} stored in the prefs or an empty {@link java.util.Set
   *     Set}.
   */
  private Set<AddeEntry> extractPreferencesEntries(final IdvObjectStore store) {
    assert store != null;

    // this is valid--the only thing ever written to
    // PREF_REMOTE_ADDE_ENTRIES is an ArrayList of RemoteAddeEntry objects.
    @SuppressWarnings("unchecked")
    List<AddeEntry> asList = (List<AddeEntry>) store.get(PREF_ADDE_ENTRIES);
    Set<AddeEntry> entries;
    if (asList == null) {
      entries = Collections.emptySet();
    } else {
      entries = newLinkedHashSet(asList.size());
      for (AddeEntry entry : asList) {
        if (entry instanceof RemoteAddeEntry) {
          entries.add(entry);
        }
      }
    }
    return entries;
  }