smbdav.filters
Class NotFilter

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

public class NotFilter
extends java.lang.Object
implements DavenportFileFilter

This class inverts the result of an underlying filter; a file will be accepted by the filter only if the underlying filter rejects the file. This is effectively a logical NOT.

This filter accepts a filter parameter containing the underlying filter class. If the filter class implements the smbdav.DavenportFileFilter interface, the instance will be initialized with a copy of this filter's properties (excluding the "filter" property itself). For example:

 <init-param>
     <param-name>fileFilters</param-name>
     <param-value>myNotFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myNotFilter</param-name>
     <param-value>smbdav.filters.NotFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myNotFilter.filter</param-name>
     <param-value>com.foo.MyFilter</param-value> 
 </init-param>
 <init-param>
     <param-name>myNotFilter.subProperty</param-name>
     <param-value>subValue</param-value> 
 </init-param>
 

The fileFilters parameter declares a single NotFilter ("myNotFilter"). This filter is passed the "filter" property, specifying com.foo.MyFilter as the subfilter class. This subfilter class is instantiated, and provided a copy of this filter's properties (containing the single property "subProperty" with the value "subValue"). Note that the "filter" property is removed from the properties copy provided to the subfilter.

Author:
Eric Glass

Constructor Summary
NotFilter()
           
 
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

NotFilter

public NotFilter()
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