示例#1
0
 /**
  * Searches the set of servers in an attempt to locate the accounting information for the matching
  * server. <b>Note</b> that because the data structure is a {@link Set}, there <i>cannot</i> be
  * duplicate entries, so there is no need to worry about our criteria finding multiple matches.
  *
  * <p>Also note that none of the given parameters accept {@code null} values.
  *
  * @param address Address of the server.
  * @param group Dataset.
  * @param type Group type.
  * @return Either the {@link AddeAccount} for the given criteria, or {@link
  *     AddeEntry#DEFAULT_ACCOUNT} if there was no match.
  * @see RemoteAddeEntry#equals(Object)
  */
 public AddeAccount getAccountingFor(final String address, final String group, EntryType type) {
   Collection<AddeEntry> entries =
       trie.getPrefixedBy(address + '!' + group + '!' + type.name()).values();
   for (AddeEntry entry : entries) {
     if (!isInvalidEntry(entry)) {
       return entry.getAccount();
     }
   }
   return AddeEntry.DEFAULT_ACCOUNT;
 }
示例#2
0
  public Set<AddeServer.Group> getIdvStyleRemoteGroups(final String server, final EntryType type) {
    Set<AddeServer.Group> idvGroups = newLinkedHashSet(trie.size());
    String typeStr = type.name();
    for (AddeEntry matched : trie.getPrefixedBy(server).values()) {
      if (matched == RemoteAddeEntry.INVALID_ENTRY) {
        continue;
      }

      if ((matched.getEntryStatus() == EntryStatus.ENABLED)
          && (matched.getEntryValidity() == EntryValidity.VERIFIED)
          && (matched.getEntryType() == type)) {
        String group = matched.getGroup();
        idvGroups.add(new AddeServer.Group(typeStr, group, group));
      }
    }
    return idvGroups;
  }