com.usefullittlethings.saw.apps.shared
Class AbstractPlugin

java.lang.Object
  |
  +--java.util.Observable
        |
        +--com.usefullittlethings.saw.apps.shared.AbstractPlugin
All Implemented Interfaces:
PluginIfc
Direct Known Subclasses:
AbstractActionPlugin, AbstractFilterPlugin

public abstract class AbstractPlugin
extends java.util.Observable
implements PluginIfc

Abstract implementation of the PluginIfc interface that provides default methods for items such as setBase, getAuthor, etc.


Field Summary
 
Fields inherited from interface com.usefullittlethings.saw.model.PluginIfc
BLOCK, LINEAR, SINGLE_BLOCK, UNSUPPORTED
 
Constructor Summary
AbstractPlugin()
           
 
Method Summary
abstract  java.lang.Object clone()
          Returns a copy of the plug-in.
static java.lang.String decodeXML(java.lang.String xml)
           
static boolean decodeXMLBoolean(java.lang.String xml)
           
static java.lang.String encodeXML(java.lang.String xml)
           
 java.lang.String getAuthor()
          Returns the name of the author/company.
 java.lang.String getEmail()
          Returns the e-mail address of the author
abstract  java.lang.String getName()
          Returns the full name of the plug-in, such as "File date filter".
abstract  java.lang.String getShortName()
          Returns the short name of the plug-in, such as "Date".
abstract  java.lang.String getState()
          Returns a text description of the plug-in's current state.
abstract  java.awt.Component getUI()
          Returns the plug-in's user interface component.
 java.lang.String getWebsite()
          Returns the http address of the author's website.
abstract  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.
abstract  void reset()
          This method is invoked by the search engine to clear any old settings.
 void setBase(java.lang.Object base)
          Sets the base refernce point for this plug-in.
 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.
abstract  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.
 
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, toString, wait, wait, wait
 
Methods inherited from interface com.usefullittlethings.saw.model.PluginIfc
addObserver, configure, configure, deleteObserver, getResultClass, getUnixName
 

Constructor Detail

AbstractPlugin

public AbstractPlugin()
Method Detail

setBase

public void setBase(java.lang.Object base)
Sets the base refernce point for this plug-in.


getAuthor

public java.lang.String getAuthor()
Description copied from interface: PluginIfc
Returns the name of the author/company.

Specified by:
getAuthor in interface PluginIfc

getWebsite

public java.lang.String getWebsite()
Description copied from interface: PluginIfc
Returns the http address of the author's website.

Specified by:
getWebsite in interface PluginIfc

getEmail

public java.lang.String getEmail()
Description copied from interface: PluginIfc
Returns the e-mail address of the author

Specified by:
getEmail in interface PluginIfc

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
Parameters:
state - The new value for the enabled attribute.

isEnabled

public boolean isEnabled()
Description copied from interface: PluginIfc
Returns the enabled state of the plug-in.

Specified by:
isEnabled in interface PluginIfc
Returns:
True or false indicating the current enabled state of the plug-in

encodeXML

public static java.lang.String encodeXML(java.lang.String xml)

decodeXML

public static java.lang.String decodeXML(java.lang.String xml)

decodeXMLBoolean

public static boolean decodeXMLBoolean(java.lang.String xml)

supportCommandLine

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

Specified by:
supportCommandLine in interface PluginIfc

getName

public abstract 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

getShortName

public abstract 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

hasUI

public abstract 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

getUI

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

Specified by:
getUI in interface PluginIfc

clone

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

Specified by:
clone in interface PluginIfc
Overrides:
clone in class java.lang.Object

getState

public abstract 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

reset

public abstract 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

supports

public abstract 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
Parameters:
pattern - The pattern to test, such as LINEAR, BLOCK, or SINGLE_BLOCK.

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