wyvern.kernel.commands.filters
Interface CommandFilter

All Known Implementing Classes:
GrepFilter, HeadFilter, SortFilter, TailFilter, UniqFilter, WCFilter

public interface CommandFilter

Interface for objects that can filter event output. Filters typically work on a line-by-line basis, so they're passed the event output as a list of lines, and they operate on the list when performing the filtering.

Version:
1.0, Jun 12, 2003
Author:
Steve Yegge

Method Summary
 java.util.ArrayList filter(java.util.ArrayList lines)
          Filters the event output according to whatever rules the filter uses.
 void parseArguments(java.lang.String verb, java.lang.String args)
          Parses the argument string passed to a filter command.
 

Method Detail

filter

public java.util.ArrayList filter(java.util.ArrayList lines)
Filters the event output according to whatever rules the filter uses. It can sort, grep, egrep, mail the output, or whatever.

Parameters:
lines - the lines of the message to filter
Returns:
a new list of filtered lines. Can return the passed list if the operation was done in-place on the list, or if no changes were made.
Throws:
java.lang.IllegalArgumentException - if the filter runs into a problem that should stop processing of the message. Detail message will to go the agent.

parseArguments

public void parseArguments(java.lang.String verb,
                           java.lang.String args)
Parses the argument string passed to a filter command. For example, if the command is "grep telnet", the CommandFilterFactory will try to find a registered CommandFilter implementation that wants to handle "grep", and it'll call

Parameters:
verb - the command verb (e.g. "grep").
args - the argument string passed to the command, not including the command verb. Null if no arguments were passed to the filter.
Throws:
java.lang.IllegalArgumentException - if the arguments were invalid.