com.usefullittlethings.saw.apps.file
Class ListToConsole

java.lang.Object
  |
  +--java.util.Observable
        |
        +--com.usefullittlethings.saw.apps.shared.AbstractPlugin
              |
              +--com.usefullittlethings.saw.apps.shared.AbstractActionPlugin
                    |
                    +--com.usefullittlethings.saw.apps.file.AbstractFileActionPlugin
                          |
                          +--com.usefullittlethings.saw.apps.file.ListToConsole
All Implemented Interfaces:
ActionPluginIfc, PluginIfc

public class ListToConsole
extends AbstractFileActionPlugin
implements ActionPluginIfc

List the files in the resultset to standard out, including file path, name, and extension. This is mainly a convenience action plug-in for use by Search and Whatever developers.

See Also:
System.out

Field Summary
 
Fields inherited from interface com.usefullittlethings.saw.model.ActionPluginIfc
CLASS_NAME
 
Fields inherited from interface com.usefullittlethings.saw.model.PluginIfc
BLOCK, LINEAR, SINGLE_BLOCK, UNSUPPORTED
 
Constructor Summary
ListToConsole()
          This is a combination controller/model class for the ListToConsole action plug-in.
 
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.
 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.String getName()
          Returns the full name of the plug-in, such as "File date filter".
 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.
 void handle(int pattern, java.lang.Object target)
          This method is called by the core application to invoke the plug-in's action.
 boolean hasUI()
          Returns true/false indicating if the plug-in has a user interface for configuring the plug-in.
 boolean isDangerous()
          Returns true or false indicating whether or not the use of this action could be considered dangerous to the user's resources.
 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 supports(int pattern)
          Returns a flag indicating whether or not the specified search pattern is supported by the plug-in.
 java.lang.String toString()
           
 
Methods inherited from class com.usefullittlethings.saw.apps.file.AbstractFileActionPlugin
getResultClass
 
Methods inherited from class com.usefullittlethings.saw.apps.shared.AbstractPlugin
decodeXML, decodeXMLBoolean, encodeXML, getAuthor, getEmail, getWebsite, isEnabled, setBase, supportCommandLine, toXMLString
 
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.ActionPluginIfc
setBase
 
Methods inherited from interface com.usefullittlethings.saw.model.PluginIfc
addObserver, deleteObserver, getAuthor, getEmail, getResultClass, getWebsite, isEnabled, supportCommandLine, toXMLString
 

Constructor Detail

ListToConsole

public ListToConsole()
This is a combination controller/model class for the ListToConsole action plug-in.

Method Detail

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

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.

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: ActionPluginIfc
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 ActionPluginIfc

end

public void end()
Description copied from interface: ActionPluginIfc
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 ActionPluginIfc

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.

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

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

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

handle

public void handle(int pattern,
                   java.lang.Object target)
            throws ActionInvocationException
Description copied from interface: ActionPluginIfc
This method is called by the core application to invoke the plug-in's action. The pattern parameter defines the type of search pattern that is be used (see PluginIfc). The target paramter is the object that the action plug-in should perform its operation on. The target may be an object, an object array, or any object instance. The class type should be defined in the search controller's API reference. For example, the File Edition will pass in a File or a File[] object depending on the search pattern.

Specified by:
handle in interface ActionPluginIfc
Parameters:
pattern - A constant from PluginIfc representing the type of search pattern that is being performed.
target - The target object to be acted upon.
ActionInvocationException
See Also:
PluginIfc.LINEAR, PluginIfc.BLOCK, PluginIfc.SINGLE_BLOCK

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 AbstractActionPlugin
java.text.ParseException

isDangerous

public boolean isDangerous()
Description copied from interface: ActionPluginIfc
Returns true or false indicating whether or not the use of this action could be considered dangerous to the user's resources. For example, the plug-in that deletes files would be considered dangerous.

Specified by:
isDangerous in interface ActionPluginIfc