adams.flow.source
Class FTPLister

java.lang.Object
  extended by adams.core.ConsoleObject
      extended by adams.core.option.AbstractOptionHandler
          extended by adams.flow.core.AbstractActor
              extended by adams.flow.source.AbstractSource
                  extended by adams.flow.source.AbstractArrayProvider
                      extended by adams.flow.source.FTPLister
All Implemented Interfaces:
AdditionalInformationHandler, CleanUpHandler, Debuggable, DebugOutputHandler, Destroyable, OptionHandler, QuickInfoSupporter, ShallowCopySupporter<AbstractActor>, SizeOfHandler, Stoppable, VariableChangeListener, ErrorHandler, OutputProducer, Serializable, Comparable

public class FTPLister
extends AbstractArrayProvider

Returns the contents of a FTP directory (files/dirs).

Input/output:
- generates:
   java.lang.String

Valid options are:

-D <int> (property: debugLevel)
    The greater the number the more additional info the scheme may output to
    the console (0 = off).
    default: 0
    minimum: 0
 
-name <java.lang.String> (property: name)
    The name of the actor.
    default: FTPLister
 
-annotation <adams.core.base.BaseText> (property: annotations)
    The annotations to attach to this actor.
    default:
 
-skip (property: skip)
    If set to true, transformation is skipped and the input token is just forwarded
    as it is.
 
-stop-flow-on-error (property: stopFlowOnError)
    If set to true, the flow gets stopped in case this actor encounters an error;
     useful for critical actors.
 
-output-array (property: outputArray)
    Whether to output the files as array or as single strings.
 
-remote-dir <java.lang.String> (property: remoteDir)
    The FTP directory to list the files for.
    default: /pub
 
-list-dirs (property: listDirs)
    Whether to include directories in the output.
 
-list-files (property: listFiles)
    Whether to include files in the output.
 
-regexp <adams.core.base.BaseRegExp> (property: regExp)
    The regular expression that the files/dirs must match (empty string matches
    all).
    default:
 
-sorting <NO_SORTING|SORT_BY_NAME|SORT_BY_LAST_MODIFIED> (property: sorting)
    The type of sorting to perform.
    default: NO_SORTING
 
-descending (property: sortDescending)
    If set to true, the files are sorted in descending manner.
 

Version:
$Revision: 4584 $
Author:
fracpete (fracpete at waikato dot ac dot nz)
See Also:
Serialized Form

Nested Class Summary
static class FTPLister.Sorting
          The type of sorting.
 
Field Summary
protected  FTPConnection m_Connection
          the FTP connection to use.
protected  boolean m_ListDirs
          whether to list directories.
protected  boolean m_ListFiles
          whether to list files.
protected  BaseRegExp m_RegExp
          the regular expression on the file/dir names.
protected  String m_RemoteDir
          the directory to list.
protected  boolean m_SortDescending
          whether to sort descending instead of ascending.
protected  FTPLister.Sorting m_Sorting
          the sorting.
 
Fields inherited from class adams.flow.source.AbstractArrayProvider
m_Index, m_OutputArray, m_Queue
 
Fields inherited from class adams.flow.core.AbstractActor
FILE_EXTENSION, FILE_EXTENSION_GZ, m_Annotations, m_BackupState, m_DetectedObjectVariables, m_DetectedVariables, m_ErrorHandler, m_Executed, m_FullName, m_Headless, m_Name, m_Parent, m_Root, m_Self, m_Skip, m_StopFlowOnError, m_StopMessage, m_Stopped, m_StorageHandler, m_VariablesUpdated
 
Fields inherited from class adams.core.option.AbstractOptionHandler
m_DebugLevel, m_OptionManager
 
Constructor Summary
FTPLister()
           
 
Method Summary
 void defineOptions()
          Adds options to the internal list of options.
protected  String doExecute()
          Executes the flow item.
protected  Class getItemClass()
          Returns the based class of the items.
 boolean getListDirs()
          Returns whether directories are listed.
 boolean getListFiles()
          Returns whether directories are listed.
 String getQuickInfo()
          Returns a quick info about the actor, which will be displayed in the GUI.
 BaseRegExp getRegExp()
          Returns the regular expression for the files/dirs.
 String getRemoteDir()
          Returns the remote directory.
 boolean getSortDescending()
          Returns whether to sort descendingly.
 FTPLister.Sorting getSorting()
          Returns the type of sorting to perform.
 String globalInfo()
          Returns a string describing the object.
 String listDirsTipText()
          Returns the tip text for this property.
 String listFilesTipText()
          Returns the tip text for this property.
 String outputArrayTipText()
          Returns the tip text for this property.
 String regExpTipText()
          Returns the tip text for this property.
 String remoteDirTipText()
          Returns the tip text for this property.
 void setListDirs(boolean value)
          Sets whether to list directories.
 void setListFiles(boolean value)
          Sets whether to list files.
 void setRegExp(BaseRegExp value)
          Sets the regular expression for the files/dirs.
 void setRemoteDir(String value)
          Sets the remote directory.
 void setSortDescending(boolean value)
          Sets whether to sort descendingly.
 void setSorting(FTPLister.Sorting value)
          Sets the type of sorting to perform.
 String setUp()
          Initializes the item for flow execution.
 String sortDescendingTipText()
          Returns the tip text for this property.
 String sortingTipText()
          Returns the tip text for this property.
 
Methods inherited from class adams.flow.source.AbstractArrayProvider
generates, getOutputArray, hasPendingOutput, output, preExecute, reset, setOutputArray, wrapUp
 
Methods inherited from class adams.flow.core.AbstractActor
annotationsTipText, backupState, canInspectOptions, canPerformSetUpCheck, cleanUp, compareTo, debug, destroy, equals, execute, findVariables, findVariables, findVariables, forceVariables, forCommandLine, forName, getAdditionalInformation, getAnnotations, getDefaultName, getDetectedVariables, getErrorHandler, getFlowActors, getFullName, getName, getNextSibling, getParent, getPreviousSibling, getRoot, getSkip, getStopFlowOnError, getStopMessage, getStorageHandler, getVariables, handleError, hasErrorHandler, hasStopMessage, index, initialize, isBackedUp, isExecuted, isFinished, isHeadless, isStopped, nameTipText, performSetUpChecks, postExecute, pruneBackup, pruneBackup, restoreState, setAnnotations, setErrorHandler, setHeadless, setName, setParent, setSkip, setStopFlowOnError, setVariables, shallowCopy, shallowCopy, sizeOf, skipTipText, stopExecution, stopExecution, stopFlowOnErrorTipText, updateDetectedVariables, updatePrefix, updateVariables, variableChanged
 
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, debug, debugLevelTipText, finishInit, getDebugLevel, getOptionManager, isDebugOn, newOptionManager, setDebugLevel, toCommandLine, toString
 
Methods inherited from class adams.core.ConsoleObject
getDebugging, getSystemErr, getSystemOut
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_RemoteDir

protected String m_RemoteDir
the directory to list.


m_RegExp

protected BaseRegExp m_RegExp
the regular expression on the file/dir names.


m_ListDirs

protected boolean m_ListDirs
whether to list directories.


m_ListFiles

protected boolean m_ListFiles
whether to list files.


m_Sorting

protected FTPLister.Sorting m_Sorting
the sorting.


m_SortDescending

protected boolean m_SortDescending
whether to sort descending instead of ascending.


m_Connection

protected FTPConnection m_Connection
the FTP connection to use.

Constructor Detail

FTPLister

public FTPLister()
Method Detail

globalInfo

public String globalInfo()
Returns a string describing the object.

Specified by:
globalInfo in class AbstractOptionHandler
Returns:
a description suitable for displaying in the gui

defineOptions

public void defineOptions()
Adds options to the internal list of options.

Specified by:
defineOptions in interface OptionHandler
Overrides:
defineOptions in class AbstractArrayProvider

getQuickInfo

public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.

Specified by:
getQuickInfo in interface QuickInfoSupporter
Overrides:
getQuickInfo in class AbstractActor
Returns:
null if no info available, otherwise short string

setRemoteDir

public void setRemoteDir(String value)
Sets the remote directory.

Parameters:
value - the remote directory

getRemoteDir

public String getRemoteDir()
Returns the remote directory.

Returns:
the remote directory.

remoteDirTipText

public String remoteDirTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

outputArrayTipText

public String outputArrayTipText()
Returns the tip text for this property.

Specified by:
outputArrayTipText in class AbstractArrayProvider
Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setRegExp

public void setRegExp(BaseRegExp value)
Sets the regular expression for the files/dirs.

Parameters:
value - the regular expression

getRegExp

public BaseRegExp getRegExp()
Returns the regular expression for the files/dirs.

Returns:
the regular expression

regExpTipText

public String regExpTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setListDirs

public void setListDirs(boolean value)
Sets whether to list directories.

Parameters:
value - true if directories are to be listed

getListDirs

public boolean getListDirs()
Returns whether directories are listed.

Returns:
true if directories are listed

listDirsTipText

public String listDirsTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setListFiles

public void setListFiles(boolean value)
Sets whether to list files.

Parameters:
value - true if files are to be listed

getListFiles

public boolean getListFiles()
Returns whether directories are listed.

Returns:
true if directories are listed

listFilesTipText

public String listFilesTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setSorting

public void setSorting(FTPLister.Sorting value)
Sets the type of sorting to perform.

Parameters:
value - the type of sorting

getSorting

public FTPLister.Sorting getSorting()
Returns the type of sorting to perform.

Returns:
the type of sorting

sortingTipText

public String sortingTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

setSortDescending

public void setSortDescending(boolean value)
Sets whether to sort descendingly.

Parameters:
value - true if sorting in descending order

getSortDescending

public boolean getSortDescending()
Returns whether to sort descendingly.

Returns:
true if sorting in descending order

sortDescendingTipText

public String sortDescendingTipText()
Returns the tip text for this property.

Returns:
tip text for this property suitable for displaying in the GUI or for listing the options.

getItemClass

protected Class getItemClass()
Returns the based class of the items.

Specified by:
getItemClass in class AbstractArrayProvider
Returns:
the class

setUp

public String setUp()
Initializes the item for flow execution.

Overrides:
setUp in class AbstractActor
Returns:
null if everything is fine, otherwise error message

doExecute

protected String doExecute()
Executes the flow item.

Specified by:
doExecute in class AbstractActor
Returns:
null if everything is fine, otherwise error message


Copyright © 2012 University of Waikato, Hamilton, NZ. All Rights Reserved.