com.usefullittlethings.saw.model
Interface PluginIfc

All Known Subinterfaces:
ActionPluginIfc, FilterPluginIfc
All Known Implementing Classes:
AbstractActionPlugin, AbstractFilterPlugin, AbstractPlugin, CompareTo, Compress, ContainsText, Copy, DateRange, Delete, ListToConsole, ManualSelection, Mask, Move, ReplaceText, Sawj2h, Size, WriteToFile

public interface PluginIfc

Base interface for Search and Whatever plug-ins.


Field Summary
static int BLOCK
          A block search pattern will pass blocks of "found" objects, grouped by context.
static int LINEAR
          A linear search pattern will pass each "found" object one at a time.
static int SINGLE_BLOCK
          A single-block search pattern will return one block of "found" objects.
static int UNSUPPORTED
          Convenience value for marking search methods as unsupported.
 
Method Summary
 void addObserver(java.util.Observer o)
          Adds the specified observer to a list of observers who will receive feedback from the plug-in.
 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.
 void deleteObserver(java.util.Observer o)
          Remvoes the specified observer from the list of observers who will receive feedback from the plug-in.
 java.lang.String getAuthor()
          Returns the name of the author/company.
 java.lang.String getEmail()
          Returns the e-mail address of the author
 java.lang.String getName()
          Returns the full name of the plug-in, such as "File date filter".
 java.lang.Class getResultClass()
          Returns a Class object representing the object type this plug-in will act upon.
 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.
 java.lang.String getWebsite()
          Returns the http address of the author's website.
 boolean hasUI()
          Returns true/false indicating if the plug-in has a user interface for configuring the plug-in.
 boolean isEnabled()
          Returns the enabled state of the plug-in.
 void reset()
          This method is invoked by the search engine to clear any old settings.
 void setEnabled(boolean state)
          Sets the enabled flag for the plug-in.
 boolean supportCommandLine()
          Indicates if this lpug-in can be used via the command-line interface.
 boolean supports(int pattern)
          Returns a flag indicating whether or not the specified search pattern is supported by the plug-in.
 java.lang.String toXMLString(int indent)
          Renders the state of the plug-in in XML format.
 

Field Detail

UNSUPPORTED

public static final int UNSUPPORTED
Convenience value for marking search methods as unsupported.

See Also:
Constant Field Values

LINEAR

public static final int LINEAR
A linear search pattern will pass each "found" object one at a time.

See Also:
Constant Field Values

BLOCK

public static final int BLOCK
A block search pattern will pass blocks of "found" objects, grouped by context. For example, a file search may return blocks of File objects grouped by the directory they are found in.

See Also:
Constant Field Values

SINGLE_BLOCK

public static final int SINGLE_BLOCK
A single-block search pattern will return one block of "found" objects.

See Also:
Constant Field Values
Method Detail

getName

public java.lang.String getName()
Returns the full name of the plug-in, such as "File date filter".


getShortName

public java.lang.String getShortName()
Returns the short name of the plug-in, such as "Date".


getUnixName

public java.lang.String getUnixName()
Returns the unique unix names assigned to the plug-in.


getAuthor

public java.lang.String getAuthor()
Returns the name of the author/company.


getWebsite

public java.lang.String getWebsite()
Returns the http address of the author's website.


getEmail

public java.lang.String getEmail()
Returns the e-mail address of the author


hasUI

public boolean hasUI()
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.


getUI

public java.awt.Component getUI()
Returns the plug-in's user interface component.


setEnabled

public void setEnabled(boolean state)
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.

Parameters:
state - The new value for the enabled attribute.

isEnabled

public boolean isEnabled()
Returns the enabled state of the plug-in.

Returns:
True or false indicating the current enabled state of the plug-in

clone

public java.lang.Object clone()
Returns a copy of the plug-in.


getState

public java.lang.String getState()
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".


reset

public void reset()
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.


supports

public boolean supports(int pattern)
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.

Parameters:
pattern - The pattern to test, such as LINEAR, BLOCK, or SINGLE_BLOCK.

addObserver

public void addObserver(java.util.Observer o)
Adds the specified observer to a list of observers who will receive feedback from the plug-in.


deleteObserver

public void deleteObserver(java.util.Observer o)
Remvoes the specified observer from the list of observers who will receive feedback from the plug-in.


toXMLString

public java.lang.String toXMLString(int indent)
Renders the state of the plug-in in XML format.


configure

public void configure(java.lang.String[] args)
               throws ArgumentException
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.

ArgumentException

configure

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

java.text.ParseException

getResultClass

public java.lang.Class getResultClass()
Returns a Class object representing the object type this plug-in will act upon.


supportCommandLine

public boolean supportCommandLine()
Indicates if this lpug-in can be used via the command-line interface.