Exemplo n.º 1
0
 /**
  * Returns the {@link Set} of {@literal "groups"} associated with the given {@code address}.
  *
  * @param address Address of a server.
  * @return Either all of the {@literal "groups"} on {@code address} or an empty {@code Set}.
  */
 public Set<String> getGroups(final String address) {
   notNull(address);
   Set<String> groups = newLinkedHashSet(trie.size());
   for (AddeEntry entry : trie.getPrefixedBy(address + '!').values()) {
     groups.add(entry.getGroup());
   }
   return groups;
 }
Exemplo n.º 2
0
 /**
  * Returns the {@link Set} of {@link AddeEntry#getGroup()}s that match the given {@code address}
  * and {@code type}.
  *
  * @param address ADDE server address whose groups are needed. Cannot be {@code null}.
  * @param type Only include groups that match {@link EntryType}. Cannot be {@code null}.
  * @return Either a set containing the desired groups, or an empty set if there were no matches.
  */
 public Set<String> getGroupsFor(final String address, EntryType type) {
   notNull(address);
   notNull(type);
   Set<String> groups = newLinkedHashSet(trie.size());
   for (AddeEntry entry : trie.getPrefixedBy(address + '!').values()) {
     if (entry.getAddress().equals(address) && entry.getEntryType() == type) {
       groups.add(entry.getGroup());
     }
   }
   return groups;
 }
Exemplo n.º 3
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;
  }