Class FtpDirectorySearchWithCustomSort
- java.lang.Object
-
- adams.core.logging.LoggingObject
-
- adams.core.logging.CustomLoggingLevelObject
-
- adams.core.option.AbstractOptionHandler
-
- adams.flow.source.filesystemsearch.AbstractFileSystemSearchlet
-
- adams.flow.source.filesystemsearch.AbstractFtpDirectoryListerBasedSearchlet
-
- adams.flow.source.filesystemsearch.FtpDirectorySearchWithCustomSort
-
- All Implemented Interfaces:
Destroyable
,GlobalInfoSupporter
,LoggingLevelHandler
,LoggingSupporter
,OptionHandler
,QuickInfoSupporter
,ShallowCopySupporter<AbstractFileSystemSearchlet>
,SizeOfHandler
,Stoppable
,StoppableWithFeedback
,FlowContextHandler
,Serializable
- Direct Known Subclasses:
FtpFileSearchWithCustomSort
public class FtpDirectorySearchWithCustomSort extends AbstractFtpDirectoryListerBasedSearchlet
Searches only for directories, but uses a regular expression to reassemble the name and perform the sorting (FTP).
-logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel) The logging level for outputting errors and debugging output. default: WARNING
-directory <java.lang.String> (property: directory) The directory to search for directories. default: /pub
-max-items <int> (property: maxItems) The maximum number of dirs to return (<= 0 is unlimited). default: -1
-regexp <adams.core.base.BaseRegExp> (property: regExp) The regular expression that the dirs must match (empty string matches all ). default:
-sort-find <adams.core.base.BaseRegExp> (property: sortFind) The regular expression that extracts groups to be used in reassembling the string for sorting. default: ([\\\\s\\\\S]+)
-sort-replace <java.lang.String> (property: sortReplace) The reassmbly string making use of the groups extracted with the regular expression. default: $0
-descending <boolean> (property: sortDescending) If set to true, the directories are sorted in descending manner. default: false
-recursive <boolean> (property: recursive) Whether to search recursively or not. default: false
-max-depth <int> (property: maxDepth) The maximum depth to search in recursive mode (1 = only search directory, -1 = infinite). default: -1
- Version:
- $Revision$
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
- Serialized Form
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
FtpDirectorySearchWithCustomSort.SortContainer
Custom container for sorting the filenames.
-
Field Summary
Fields Modifier and Type Field Description protected boolean
m_Descending
whether to sort ascending or descending.protected BaseRegExp
m_SortFind
the regular expression for finding the data to use for sorting (groups).protected String
m_SortReplace
the string used for reassembling the groups extracted with the regular expression.-
Fields inherited from class adams.flow.source.filesystemsearch.AbstractFtpDirectoryListerBasedSearchlet
m_Lister
-
Fields inherited from class adams.flow.source.filesystemsearch.AbstractFileSystemSearchlet
m_FlowContext, m_Stopped
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description FtpDirectorySearchWithCustomSort()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
defineOptions()
Adds options to the internal list of options.String
directoryTipText()
Returns the tip text for this property.protected List<String>
doSearch()
Performs the actual search.String
getDirectory()
Returns the directory to search.int
getMaxDepth()
Returns the maximum depth to search (in recursive mode).int
getMaxItems()
Returns the maximum number of items to return.String
getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.boolean
getRecursive()
Returns whether search is recursively.BaseRegExp
getRegExp()
Returns the regular expression for the files/dirs.boolean
getSortDescending()
Returns whether to sort descendingly.BaseRegExp
getSortFind()
Returns the regular expression for extracting the groups.Sorting
getSorting()
Returns the type of sorting to perform.String
getSortReplace()
Returns the reassembly string for generating the sort string.String
globalInfo()
Returns a string describing the object.protected void
initialize()
Initializes the members.String
maxDepthTipText()
Returns the tip text for this property.String
maxItemsTipText()
Returns the tip text for this property.String
recursiveTipText()
Returns the tip text for this property.String
regExpTipText()
Returns the tip text for this property.void
setDirectory(String value)
Sets the directory to search.void
setMaxDepth(int value)
Sets the maximum depth to search (in recursive mode).void
setMaxItems(int value)
Sets the maximum number of items to return.void
setRecursive(boolean value)
Sets whether to search recursively.void
setRegExp(BaseRegExp value)
Sets the regular expression for the files/dirs.void
setSortDescending(boolean value)
Sets whether to sort descendingly.void
setSortFind(BaseRegExp value)
Sets the regular expression for extracting the groups.void
setSorting(Sorting value)
Sets the type of sorting to perform.void
setSortReplace(String value)
Sets the reassembly string for generating the sort string.String
sortDescendingTipText()
Returns the tip text for this property.String
sortFindTipText()
Returns the tip text for this property.String
sortingTipText()
Returns the tip text for this property.String
sortReplaceTipText()
Returns the tip text for this property.-
Methods inherited from class adams.flow.source.filesystemsearch.AbstractFtpDirectoryListerBasedSearchlet
check, setLoggingLevel, stopExecution
-
Methods inherited from class adams.flow.source.filesystemsearch.AbstractFileSystemSearchlet
getFlowContext, isStopped, search, setFlowContext, shallowCopy, shallowCopy
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, destroy, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
-
-
-
Field Detail
-
m_SortFind
protected BaseRegExp m_SortFind
the regular expression for finding the data to use for sorting (groups).
-
m_SortReplace
protected String m_SortReplace
the string used for reassembling the groups extracted with the regular expression.
-
m_Descending
protected boolean m_Descending
whether to sort ascending or descending.
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfo
in interfaceGlobalInfoSupporter
- Specified by:
globalInfo
in classAbstractOptionHandler
- 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 interfaceOptionHandler
- Overrides:
defineOptions
in classAbstractOptionHandler
-
initialize
protected void initialize()
Initializes the members.- Overrides:
initialize
in classAbstractFtpDirectoryListerBasedSearchlet
-
setDirectory
public void setDirectory(String value)
Sets the directory to search.- Parameters:
value
- the directory
-
getDirectory
public String getDirectory()
Returns the directory to search.- Returns:
- the directory.
-
directoryTipText
public String directoryTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxItems
public void setMaxItems(int value)
Sets the maximum number of items to return.- Parameters:
value
- the maximum number
-
getMaxItems
public int getMaxItems()
Returns the maximum number of items to return.- Returns:
- the maximum number
-
maxItemsTipText
public String maxItemsTipText()
Returns the tip text for this property.- 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.
-
setSortFind
public void setSortFind(BaseRegExp value)
Sets the regular expression for extracting the groups.- Parameters:
value
- the regular expression
-
getSortFind
public BaseRegExp getSortFind()
Returns the regular expression for extracting the groups.- Returns:
- the regular expression
-
sortFindTipText
public String sortFindTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setSortReplace
public void setSortReplace(String value)
Sets the reassembly string for generating the sort string.- Parameters:
value
- the string
-
getSortReplace
public String getSortReplace()
Returns the reassembly string for generating the sort string.- Returns:
- the string
-
sortReplaceTipText
public String sortReplaceTipText()
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(Sorting value)
Sets the type of sorting to perform.- Parameters:
value
- the type of sorting
-
getSorting
public 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.
-
setRecursive
public void setRecursive(boolean value)
Sets whether to search recursively.- Parameters:
value
- true if search is recursively
-
getRecursive
public boolean getRecursive()
Returns whether search is recursively.- Returns:
- true if search is recursively
-
recursiveTipText
public String recursiveTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
setMaxDepth
public void setMaxDepth(int value)
Sets the maximum depth to search (in recursive mode). 1 = only watch directory, -1 = infinite.- Parameters:
value
- the maximum number of directory levels to traverse
-
getMaxDepth
public int getMaxDepth()
Returns the maximum depth to search (in recursive mode). 1 = only watch directory, -1 = infinite.- Returns:
- the maximum number of directory levels to traverse
-
maxDepthTipText
public String maxDepthTipText()
Returns the tip text for this property.- Returns:
- tip text for this property suitable for displaying in the GUI or for listing the options.
-
getQuickInfo
public String getQuickInfo()
Returns a quick info about the actor, which will be displayed in the GUI.- Specified by:
getQuickInfo
in interfaceQuickInfoSupporter
- Overrides:
getQuickInfo
in classAbstractFileSystemSearchlet
- Returns:
- null if no info available, otherwise short string
-
-