コード例 #1
0
  /**
   * Returns all the presently registered sniffers
   *
   * @return Collection (possibly empty but never null) of Sniffer
   */
  public Collection<Sniffer> getSniffers() {
    // this is a little bit of a hack, sniffers are now ordered by their names
    // which is useful since connector is before ejb which is before web so if
    // a standalone module happens to implement the three types of components,
    // they will be naturally ordered correctly. We might want to revisit this
    // later and formalize the ordering of sniffers. The hard thing as usual
    // is that sniffers are highly pluggable so you never know which sniffers
    // set you are working with depending on the distribution
    List<Sniffer> sniffers = new ArrayList<Sniffer>();
    sniffers.addAll(habitat.getAllByContract(Sniffer.class));
    Collections.sort(
        sniffers,
        new Comparator<Sniffer>() {
          public int compare(Sniffer o1, Sniffer o2) {
            return o1.getModuleType().compareTo(o2.getModuleType());
          }
        });

    return sniffers;
  }
コード例 #2
0
 /**
  * Returns all the presently registered composite sniffers
  *
  * @return Collection (possibly empty but never null) of CompositeSniffer
  */
 public Collection<CompositeSniffer> getCompositeSniffers() {
   return habitat.getAllByContract(CompositeSniffer.class);
 }