org.polliwog.collectors
Class PageCollector

java.lang.Object
  extended by org.polliwog.collectors.PageCollector
All Implemented Interfaces:
Collector

public class PageCollector
extends java.lang.Object
implements Collector

A collector implementation to allow the filtering of entries that are not "pages". This class can only work with either: RequestLineField or RefererHeaderField. The collector should be inited with a comma-separated list of file types, such as *.html, *.pdf, *.doc, *.php and so on.

Also the following special values are also supported:

A setExclude(boolean) method is provided to allow the meaning of the pages to be reversed, i.e. consider everything to be a page except those specified.

File extension checking is case-insensitive.

Examples:

   PageCollector pc = new PageCollector ();

   // Allow html, php, jsp pages, the root / page and pages that end with / (i.e. directory
   // indexes).
   pc.init ("*.html, *.php, *.jsp, /, */");
 
   // Set the the specs to be reversed, that is consider everything to be a page except
   // those file extensions specified.
   pc.setExclude (true);
 
   
 Last Modified By: $Author: barrygently $
 Last Modified On: $Date: 2005/07/04 14:00:01 $
 Current Revision: $Revision: 1.3 $
 

See Also:
RequestLineField, RefererHeaderField

Constructor Summary
PageCollector()
           
 
Method Summary
 boolean accept(AbstractField af)
          The accept method.
 void init(java.lang.String val)
          Init this collector.
 void setExclude(boolean e)
          When true is passed to this method it causes the logic to be reversed such that only file extensions that are not in the list are considered to be pages.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PageCollector

public PageCollector()
Method Detail

accept

public boolean accept(AbstractField af)
The accept method. This method only supports instances of RequestLineField and RefererHeaderField. If the path in either of the supported field types matches then true is returned, false otherwise. Note that is setExclude(boolean) is called with true then the logic is reversed.

Specified by:
accept in interface Collector
Parameters:
af - The field to perform the check on.
Returns:
true if the field is accepted, false if not.
See Also:
org.polliwog.data.LogEntryFormat#createEntry(String,Map)

setExclude

public void setExclude(boolean e)
When true is passed to this method it causes the logic to be reversed such that only file extensions that are not in the list are considered to be pages.

Parameters:
e - The exclude flag.

init

public void init(java.lang.String val)
          throws WeblogException
Init this collector. val should be a comma separted list of file extensions. Each extension should be in the form "*.[name]", where name is some set of characters usually used as a "file extension", such as "html", "htm", "php", "jsp" and so on. The following special values are also supported: It should be noted that the case of the file extensions are irrelevant.

Specified by:
init in interface Collector
Parameters:
val - The value to init the collector with.
Throws:
WeblogException - If token is not / and not */ and does not start with "*.".


  Copyright © 2007 Gary Bentley. All Rights Reserved.