com.usefullittlethings.saw.apps.file
Class Mask

java.lang.Object
  |
  +--java.util.Observable
        |
        +--com.usefullittlethings.saw.apps.shared.AbstractPlugin
              |
              +--com.usefullittlethings.saw.apps.shared.AbstractFilterPlugin
                    |
                    +--com.usefullittlethings.saw.apps.file.AbstractFileFilterPlugin
                          |
                          +--com.usefullittlethings.saw.apps.file.Mask
All Implemented Interfaces:
FilterPluginIfc, PluginIfc

public class Mask
extends AbstractFileFilterPlugin
implements FilterPluginIfc

Filters files in result list on whether or not the file name matches a particular mask pattern or string.


Field Summary
 
Fields inherited from interface com.usefullittlethings.saw.model.FilterPluginIfc
CLASS_NAME, EXCLUDE, INCLUDE
 
Fields inherited from interface com.usefullittlethings.saw.model.PluginIfc
BLOCK, LINEAR, SINGLE_BLOCK, UNSUPPORTED
 
Constructor Summary
Mask()
           
Mask(java.lang.String pattern, boolean caseSensitive)
           
 
Method Summary
 void begin()
          This method of the plug-in will be invoked immediately before a search is performed, allowing the plug-in the "prepare" itself to perform a search.
 java.lang.Object clone()
          Returns a copy of the plug-in.
 void configure(java.lang.String xml)
          Used by the load process to configure the plug-in's state so that its state may be restored.
 void configure(java.lang.String[] args)
          Used by the command-line invocation process to configure the plug-in's state so that it may perform its task without displaying a user interface.
 java.lang.Object doExclude(java.lang.Object target)
           
 java.lang.Object doInclude(java.lang.Object target)
           
 void end()
          This method of the plug-in will be invoked immediately after a search has completed, allowing the plug-in the perform any post-search clean-up activities..
 java.lang.Object exclude(int pattern, java.lang.Object target)
          Given a search pattern and a target, the plug-in must decide whether or not to exclude the target or the target contents.
 boolean getCaseSensitive()
           
 java.lang.String getName()
          Returns the full name of the plug-in, such as "File date filter".
 java.lang.String getPattern()
           
 java.lang.String getShortName()
          Returns the short name of the plug-in, such as "Date".
 java.lang.String getState()
          Returns a text description of the plug-in's current state.
 java.awt.Component getUI()
          Returns the plug-in's user interface component.
 java.lang.String getUnixName()
          Returns the unique unix names assigned to the plug-in.
 boolean hasUI()
          Returns true/false indicating if the plug-in has a user interface for configuring the plug-in.
 java.lang.Object include(int pattern, java.lang.Object target)
          Given a search pattern and a target, the plug-in must decide whether or not to include the target or the target contents.
 void reset()
          This method is invoked by the search engine to clear any old settings.
 void setCaseSensitive(boolean sensitive)
           
 void setEnabled(boolean state)
          Sets the enabled flag for the plug-in.
 void setPattern(java.lang.String pattern)
           
 boolean supports(int pattern)
          Returns a flag indicating whether or not the specified search pattern is supported by the plug-in.
 java.lang.String toString()
           
 java.lang.String toXMLString(int indent)
          Renders the state of the plug-in in XML format.
 
Methods inherited from class com.usefullittlethings.saw.apps.file.AbstractFileFilterPlugin
getResultClass
 
Methods inherited from class com.usefullittlethings.saw.apps.shared.AbstractFilterPlugin
getOperation, setOperation
 
Methods inherited from class com.usefullittlethings.saw.apps.shared.AbstractPlugin
decodeXML, decodeXMLBoolean, encodeXML, getAuthor, getEmail, getWebsite, isEnabled, setBase, supportCommandLine
 
Methods inherited from class java.util.Observable
addObserver, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, notifyObservers
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.usefullittlethings.saw.model.FilterPluginIfc
getOperation, setBase, setOperation
 
Methods inherited from interface com.usefullittlethings.saw.model.PluginIfc
addObserver, deleteObserver, getAuthor, getEmail, getResultClass, getWebsite, isEnabled, supportCommandLine
 

Constructor Detail

Mask

public Mask()

Mask

public Mask(java.lang.String pattern,
            boolean caseSensitive)
Method Detail

setPattern

public void setPattern(java.lang.String pattern)

getPattern

public java.lang.String getPattern()

setCaseSensitive

public void setCaseSensitive(boolean sensitive)

getCaseSensitive

public boolean getCaseSensitive()

getName

public java.lang.String getName()
Description copied from interface: PluginIfc
Returns the full name of the plug-in, such as "File date filter".

Specified by:
getName in interface PluginIfc
Specified by:
getName in class AbstractPlugin

getShortName

public java.lang.String getShortName()
Description copied from interface: PluginIfc
Returns the short name of the plug-in, such as "Date".

Specified by:
getShortName in interface PluginIfc
Specified by:
getShortName in class AbstractPlugin

getUnixName

public java.lang.String getUnixName()
Description copied from interface: PluginIfc
Returns the unique unix names assigned to the plug-in.

Specified by:
getUnixName in interface PluginIfc

hasUI

public boolean hasUI()
Description copied from interface: PluginIfc
Returns true/false indicating if the plug-in has a user interface for configuring the plug-in. Not all plug-ins will have a ui.

Specified by:
hasUI in interface PluginIfc
Specified by:
hasUI in class AbstractPlugin

getUI

public java.awt.Component getUI()
Description copied from interface: PluginIfc
Returns the plug-in's user interface component.

Specified by:
getUI in interface PluginIfc
Specified by:
getUI in class AbstractPlugin

reset

public void reset()
Description copied from interface: PluginIfc
This method is invoked by the search engine to clear any old settings. For example, a "Copy" filter may have its "Copy to" attribute cleared or set back to a default value.

Specified by:
reset in interface PluginIfc
Specified by:
reset in class AbstractPlugin

begin

public void begin()
Description copied from interface: FilterPluginIfc
This method of the plug-in will be invoked immediately before a search is performed, allowing the plug-in the "prepare" itself to perform a search.

Specified by:
begin in interface FilterPluginIfc

end

public void end()
Description copied from interface: FilterPluginIfc
This method of the plug-in will be invoked immediately after a search has completed, allowing the plug-in the perform any post-search clean-up activities..

Specified by:
end in interface FilterPluginIfc

setEnabled

public void setEnabled(boolean state)
Description copied from interface: PluginIfc
Sets the enabled flag for the plug-in. Used to add/remove or enable/disable the plug-in within the context of the user interface. May or may not have an affect on the plug-in's UI(see hasUI); such behavior is up to the plug-in author.

Specified by:
setEnabled in interface PluginIfc
Overrides:
setEnabled in class AbstractPlugin
Parameters:
state - The new value for the enabled attribute.

clone

public java.lang.Object clone()
Description copied from interface: PluginIfc
Returns a copy of the plug-in.

Specified by:
clone in interface PluginIfc
Specified by:
clone in class AbstractPlugin

supports

public boolean supports(int pattern)
Description copied from interface: PluginIfc
Returns a flag indicating whether or not the specified search pattern is supported by the plug-in. For example, a filter that returns only the largest file in a directory will only support BLOCK and SINGLE_BLOCK search patterns.

All search controllers will have a preferred heirarchy by which filters and actions are applied to the search results.

A search pattern should not be arbitrarily unsupported! This may create a condition where there is no commonly supported search pattern for both the search plug-in and the filter/action plug-ins. Under such conditions, the search operation will be cancelled and the user notified of the problem.

Specified by:
supports in interface PluginIfc
Specified by:
supports in class AbstractPlugin
Parameters:
pattern - The pattern to test, such as LINEAR, BLOCK, or SINGLE_BLOCK.

getState

public java.lang.String getState()
Description copied from interface: PluginIfc
Returns a text description of the plug-in's current state. For example, a "Delete" plug-in may return something like "Delete file with confirmation" or "Delete file, no confirmation".

Specified by:
getState in interface PluginIfc
Specified by:
getState in class AbstractPlugin

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

include

public java.lang.Object include(int pattern,
                                java.lang.Object target)
                         throws FilterInvocationException
Description copied from interface: FilterPluginIfc
Given a search pattern and a target, the plug-in must decide whether or not to include the target or the target contents.

Specified by:
include in interface FilterPluginIfc
Parameters:
pattern - The search pattern that is being applied to this search operation (LINEAR, BLOCK, SINGLE_BLOCK, etc.)
target - The object or object set that is to be filtered
Returns:
A reference to the target or a subset of the target's contents that have passed the filtering process
FilterInvocationException

exclude

public java.lang.Object exclude(int pattern,
                                java.lang.Object target)
                         throws FilterInvocationException
Description copied from interface: FilterPluginIfc
Given a search pattern and a target, the plug-in must decide whether or not to exclude the target or the target contents.

Specified by:
exclude in interface FilterPluginIfc
Parameters:
pattern - The search pattern that is being applied to this search operation (LINEAR, BLOCK, SINGLE_BLOCK, etc.)
target - The object or object set that is to be filtered
Returns:
A reference to the target or a subset of the target's contents that have passed the filtering process
FilterInvocationException

doInclude

public java.lang.Object doInclude(java.lang.Object target)
                           throws FilterInvocationException
FilterInvocationException

doExclude

public java.lang.Object doExclude(java.lang.Object target)
                           throws FilterInvocationException
FilterInvocationException

toXMLString

public java.lang.String toXMLString(int indent)
Description copied from interface: PluginIfc
Renders the state of the plug-in in XML format.

Specified by:
toXMLString in interface PluginIfc
Overrides:
toXMLString in class AbstractFilterPlugin

configure

public void configure(java.lang.String[] args)
               throws ArgumentException
Description copied from interface: PluginIfc
Used by the command-line invocation process to configure the plug-in's state so that it may perform its task without displaying a user interface.

Specified by:
configure in interface PluginIfc
ArgumentException

configure

public void configure(java.lang.String xml)
               throws java.text.ParseException
Description copied from interface: PluginIfc
Used by the load process to configure the plug-in's state so that its state may be restored.

Specified by:
configure in interface PluginIfc
Overrides:
configure in class AbstractFilterPlugin
java.text.ParseException