smbdav.filters
Class AndFilter

java.lang.Object
  extended bysmbdav.filters.AndFilter
All Implemented Interfaces:
DavenportFileFilter, jcifs.smb.SmbFileFilter

public class AndFilter
extends java.lang.Object
implements DavenportFileFilter

This class chains one or more underlying filters together; a file will be accepted by the filter only if all subfilters accept the file. This is effectively a logical AND.

Subfilters are installed using a mechanism very similar to the global filter installation; this filter accepts a fileFilters parameter containing a list of whitespace-separated subfilter names. An additional parameter is specified for each name, indicating the filter class. If the filter class implements the smbdav.DavenportFileFilter interface, the instance will be initialized using a java.util.Properties object containing name-value pairs from this filter's properties, scoped by the subfilter's name. For example:

 <init-param>
     <param-name>fileFilters</param-name>
     <param-value>myAndFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myAndFilter</param-name>
     <param-value>smbdav.filters.AndFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myAndFilter.fileFilters</param-name>
     <param-value>mySubFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myAndFilter.mySubFilter</param-name>
     <param-value>com.foo.MyFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myAndFilter.mySubFilter.subProperty</param-name>
     <param-value>subValue</param-value> 
 </init-param>
 

The fileFilters parameter declares a single AndFilter ("myAndFilter"). This filter is passed its own "fileFilters" property, containing the single subfilter name "mySubFilter". A corresponding property is provided, specifying com.foo.MyFilter as the subfilter class. This subfilter class is instantiated, and provided its own set of properties (containing the single property "subProperty" with the value "subValue"). Note that the subfilter's namespace prefix ("mySubFilter.") will be stripped off when the properties are delivered to the subfilter instance.

Author:
Eric Glass

Constructor Summary
AndFilter()
           
 
Method Summary
 boolean accept(jcifs.smb.SmbFile file)
           
 void destroy()
          Destroys the filter instance.
 void init(java.util.Properties properties)
          Initializes the filter with the provided properties.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AndFilter

public AndFilter()
Method Detail

init

public void init(java.util.Properties properties)
          throws java.lang.Exception
Description copied from interface: DavenportFileFilter
Initializes the filter with the provided properties.

Specified by:
init in interface DavenportFileFilter
Parameters:
properties - The filter's initialization properties.
Throws:
java.lang.Exception - If an error occurs during initialization.

destroy

public void destroy()
Description copied from interface: DavenportFileFilter
Destroys the filter instance.

Specified by:
destroy in interface DavenportFileFilter

accept

public boolean accept(jcifs.smb.SmbFile file)
               throws jcifs.smb.SmbException
Specified by:
accept in interface jcifs.smb.SmbFileFilter
Throws:
jcifs.smb.SmbException


Copyright © 2004 Eric Glass