org.apache.james.management
Class SpoolFilter

java.lang.Object
  extended by org.apache.james.management.SpoolFilter

public class SpoolFilter
extends java.lang.Object

immutual collection of filters used to specify which mail should be processed by SpoolManagement criterias are: exact state match headerValue regular expressions match all related headers


Field Summary
static java.lang.String ERROR_STATE
           
static SpoolFilter ERRORMAIL_FILTER
           
 
Constructor Summary
SpoolFilter(java.lang.String state)
          Construct the SpoolFilter
SpoolFilter(java.lang.String state, java.util.Map headerFilters)
          Construct the SpoolFilter
SpoolFilter(java.lang.String header, java.lang.String headerValueRegex)
          Construct the SpoolFilter
SpoolFilter(java.lang.String state, java.lang.String header, java.lang.String headerValueRegex)
          Construct the SpoolFilter
 
Method Summary
 boolean doFilter()
           
 boolean doFilterHeader()
          Return true if any filters should be used on the headers
 boolean doFilterState()
          Return true if any state was given on init the SpoolFilter
 java.util.Iterator getHeaders()
          Return an Iterator which contains all headers which should be filtered
 java.lang.String getHeaderValueRegex(java.lang.String header)
          Return the regex which should be used on the given header.
 org.apache.oro.text.regex.Pattern getHeaderValueRegexCompiled(java.lang.String header)
          Return the compiled Pattern for the given header.
 java.lang.String getState()
          Return the message state on which the filter will be used
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ERROR_STATE

public static final java.lang.String ERROR_STATE
See Also:
Constant Field Values

ERRORMAIL_FILTER

public static final SpoolFilter ERRORMAIL_FILTER
Constructor Detail

SpoolFilter

public SpoolFilter(java.lang.String state,
                   java.lang.String header,
                   java.lang.String headerValueRegex)
Construct the SpoolFilter

Parameters:
state - the message state on which message the filter should be used
header - the headername on which the given regex should be used
headerValueRegex - the regex to use on the value of the given header

SpoolFilter

public SpoolFilter(java.lang.String state)
Construct the SpoolFilter

Parameters:
state - the message state on which message the filter should be used

SpoolFilter

public SpoolFilter(java.lang.String header,
                   java.lang.String headerValueRegex)
Construct the SpoolFilter

Parameters:
header - the headername on which the given regex should be used
headerValueRegex - the regex to use on the value of the given header

SpoolFilter

public SpoolFilter(java.lang.String state,
                   java.util.Map headerFilters)
Construct the SpoolFilter

Parameters:
state - the message state on which message the filter should be used
headerFilters - a Map which contains filters to use
Method Detail

doFilter

public boolean doFilter()

doFilterState

public boolean doFilterState()
Return true if any state was given on init the SpoolFilter

Returns:
true if state was given on init. False otherwise

doFilterHeader

public boolean doFilterHeader()
Return true if any filters should be used on the headers

Returns:
true if filters should be used. False if not

getState

public java.lang.String getState()
Return the message state on which the filter will be used

Returns:
state the message state

getHeaders

public java.util.Iterator getHeaders()
Return an Iterator which contains all headers which should be filtered

Returns:
headers an Iterator which contains all headers which should be filtered

getHeaderValueRegex

public java.lang.String getHeaderValueRegex(java.lang.String header)
Return the regex which should be used on the given header. Return null if the header not exists in the Map

Parameters:
header - the headername for which the regex should be retrieven.
Returns:
regex the regex for the given header

getHeaderValueRegexCompiled

public org.apache.oro.text.regex.Pattern getHeaderValueRegexCompiled(java.lang.String header)
                                                              throws SpoolManagementException
Return the compiled Pattern for the given header. Return null if the header not exists in the Map

Parameters:
header - the header for which the pattern should be returned
Returns:
pattern the Pattern which was compiled for the given header
Throws:
SpoolManagementException - get thrown if an invalid regex is used with the given header


Copyright ? 2002-2009 The Apache Software Foundation. All Rights Reserved.