org.alltimeflashdreamer.filelister
Class FileListerConfig

java.lang.Object
  extended byorg.alltimeflashdreamer.filelister.FileListerConfig
All Implemented Interfaces:
Serializable

public class FileListerConfig
extends Object
implements Serializable

Title: FileListerConfig

Description: Stores the configuration settings of the current user/session.
These settings are initialized on processing of the initial site and may be altered on reloadings of the second, file-listing site.

Organization: All Time Flash Dreamer

Version:
0.5.1
Author:
Copyright (c) 2002-2004 by Florian Steinsiepe
See Also:
Serialized Form

Field Summary
(package private) static String CONTROLLERSERVLET
          the name of the controller servlet of the FileLister application
static String INITIALSITE
          the name of the initial site of the FileLister application
(package private) static int MINIMUMENTRIESINMEMORY
          defines the minimum length of one list of FileListerEntry objects
(package private) static int NEWSEARCH
          indicates the "new search" mode
static String RESULTSSITE
          the name of the (search) results site of the FileLister application
(package private) static int SEARCHAGAIN
          indicates a new search with the old settings
(package private) static int SEARCHWITHINRESULTS
          tells to search within the previous results
(package private) static String[] SORTCRITERIA
           
 
Constructor Summary
(package private) FileListerConfig(HttpServletRequest request, ServletContext context, PropertyFileParameters params, int iWindowID)
          The constructor initializes the class and constructs the URL's of each site to be shown.
(package private) FileListerConfig(PropertyFileParameters params)
          This constructor may be called from other classes than the FileListerViewerServlet, as used to build the initial index.
 
Method Summary
(package private)  void createDefineSearchParameters()
          Notifies the config class about the type of the next search.
(package private)  void createSearchParameters(HttpServletRequest request)
          Reads the URL parameters and stores those values within an instance of SearchParameters.
 void doBackButtonInBrowserCheck(HttpServletRequest request)
          Provides the check whether the user called the initial site "legally" or via the back button in the browser only.
 int getBufferSize()
          Returns a 100th of the max.
 String getConfigDescriptor()
          Returns a string describing the current configuration settings.
 int getCurrentSiteNumber()
          Returns the index of the currently shown site.
 DefineSearchParameters getDefineSearchParameters()
          Returns the previously created DefineSearchParameters instance.
 String getDirectoryOutput(String sDirectory)
          Shows the directory string that is visible in the web output .
(package private)  String getDownloadSite()
          Returns the fully qualified file name of the JSP download site which is filled dynamically to show a virtual progress bar and other interesting remarks during zip building.
 String getDownloadURL()
          Returns the full URL of the download servlet, ready to be placed into e.g.
 String getErrorURL()
          Returns the URL of the error site, to allow the redirect to this site.
 FileLister getFileLister()
          Returns the FileLister, if set previously, or null.
 FileListerException getFileListerException()
          Returns the currently set FileListerException instance or null, if none.
(package private)  int getIndexAging()
          Returns value of the ini-file parameter "index.aging" which defines how old database values are allowed to be before the directory search is started again (in seconds).
 String getIndexTime()
          Returns the index time of the search directory (which is taken as the index time of all results!).
 String getInitialSiteURL()
          Returns the URL of the initial site.
 String getInverseSortOrder(String sColumnName)
          Returns the inverse sort direction of the given column, i.e. asc, if it's currently set to desc and vice versa.
(package private)  String getJDBCTableName()
          Returns the value of the "jdbc.tablename" property of the config file.
 String getLinkPrefix()
          Returns the link prefix parameter from the config file (may be empty).
(package private)  int getMaxFileListerObjects()
          Returns the max. number of file lister objects to be stored in the memory, as defined in the property file.
 String getMetaRefreshContent()
          Returns the content of the meta-refresh tag (used by download.jsp only).
 String getNextSortOrder(String sColumnName)
          Returns the URL parameter value of the "column" parameter shown in the link of each sortable table column header.
(package private)  LinkedList getNoGoAreas()
          Returns the list of directories, inside which searching is prohibited.
 String getOptionBarURL()
          Returns the full URL of the option bar JSP site, ready to be placed into e.g.
 String getProgressBarWidth()
          Returns the current width of the progress bar describing the build status of the zip file (used by download.jsp only), formatted like "xy%".
(package private)  SQLQueryBuilder getQueryBuilder()
          Returns the query builder instance defined in the property file.
 String getRegExpHelpLink()
          Returns the value of the property file parameter "link.regexphelp", to be shown in the "define search" site.
 String getRequestURL(boolean bOfInitialSite)
          Returns either the URL of the controller servlet or the URL of the results site, depending on bOfInitialSite.
 int getResultsPerSite()
          Returns the current results-per-site count.
 String getSearchDirectory()
          Returns the start directory of the (last) search as a string, formatted either absolutely or relatively, as defined in the properties file
(package private)  ArrayList getSearchParameters()
          Returns the list of SearchParameters instances entered by the client.
 String getSearchType()
          Returns the last stored search mode (may be null).
 String getSortDirection(String sColumnName)
          Scans the list of currently stored sort criteria for an entry starting with sColumnName.
 String getSortOrderOutput(int iSortOrderNumber)
          Builds the HTML to be put into a select box for the sort orders, specified within the sort orders by the given index (from 1 up to the total amount of defined sort orders).
(package private)  ArrayList getSortOrders()
          Returns the list currently active sort criteria.
 int getSortPriority(String sColumnName)
          Scans the list of currently stored sort criteria for an entry starting with sColumnName.
(package private)  File getStartDirectory()
          Returns the (validated, but nevertheless abstract) directory defined by the client/user, appended to the root directory value from the property file, if defined.
 int getStartIndex()
          Returns the index from which on the results shall be shown (default is 0, i.e. the first entry, but this value may change during navigation within the results).
 int getTotalSiteCount()
          Returns the total amount of sites that may be shown (of course only 1, if set to "show unlimited results").
 String getVersion()
          Returns the visible version string of the FileLister application.
 String getViewerServletURL()
          Returns the URL of the viewer servlet.
(package private)  String getViewerSite()
          Returns the fully qualified file name of the JSP results site which is filled dynamically with the found entries (currently visible subset).
(package private)  String getVirtualRoot()
          Returns the value of the ini-file parameter "directory.root", if defined.
 int getWindowID()
          Returns the window id (or the number of this class within the user's session) that was set during initialization.
 String getZipArchiveSize()
          Returns the descriptor for the current archive size of the zip file the user is waiting for.
(package private)  ZipBuilderThread getZipBuilderThread()
          Returns the current ZipBuilderThread pointer, which is null if no such thread is running.
(package private)  String getZipCreationDirectory()
          Returns the directory path, ending with a "/", to write the created zip files in.
 String getZipCurrentlyAdding()
          Returns the currently-added-file descriptor.
 String getZipFilesDone()
          Returns the descriptor of the progress of files packed into the current zip.
(package private)  int getZipLevel()
          Returns the package strength of the download zips.
 String getZipProgressPercentage()
          Asks the ZipBuilderThread for its generation/progress percentage, formats it to one fraction digit and appends a % sign to it.
 String getZipTimeElapsed()
          Returns the descriptor for the time already elapsed since the start of the zip building.
 String getZipWarnings()
          Returns the list of warnings generated while creating the zip file.
(package private)  boolean hasVirtualRoot()
          Returns whether the property file contains a virtual root or not.
 boolean isAdvancedSearch()
          Returns whether the advanced mode (which includes size and date search input in the GUI) is active or not.
 boolean isAllowedToZip()
          Returns wether the "zip.isallowedtozip" switch is set to true in the property file or not.
 boolean isArchiveMode()
          Tells whether the the archive mode or the directory input mode is active.
 boolean isCaseSensitiveSearch()
          Returns whether the search string shall be handled in the case sensitive fashion or not.
 boolean isDirectoryListing()
          Tells whether the directories shall be listed.
 boolean isExactMatch()
          Returns whether the search string shall be matched exactly or not.
 boolean isFileListing()
          Tells whether the files shall be listed.
(package private)  boolean isInitialArchivingProcess()
          Returns whether this config object was initialized to run the initial archiving process or not.
 boolean isListingAllEntries()
          Returns whether all contents shall be listed (client entered the empty string as the search string) or not.
 boolean isReadyToStream()
          Returns whether there is currently a ZipBuilderThread in the pipeline and this thread is ready to stream the finished zip file.
(package private)  boolean isShowingAbsolutePaths()
          Tells whether absolute or relative paths shall be shown in the output.
 boolean isSortCriterium(String sColumnName)
          Scans the list of currently stored sort criteria for an entry starting with sColumnName.
 boolean isUsingRegExp()
          Returns whether the user selected to use regular expressions for the search string or not.
(package private)  boolean isZipBuilding()
          Returns whether getZipBuilderThread is existing and still working on a zip file or not.
(package private)  void jumpToSite(String sURLInput)
          Redirects the client to a specific site.
(package private)  void navigate(String sURLParameterName)
          Navigates according to the URL input parameter: to the first, to the previous, to the next or to the last position.
(package private)  void processModeChange(String sNewMode, HttpServletRequest request)
          Reacts to a click on the simple/advanced search button.
(package private)  void removeLastSearchParametersFromList()
          Removes the last instance of SearchParameters from the internal list of SearchParameters.
 void resetZipBuilderThread()
          Stops the ZipBuilderThread, if one is set, including the deletion of its zip file (after creation).
(package private)  void setAdvancedSearch(boolean bIsAdvancedSearch)
          Sets the search mode (advanced or simple).
(package private)  void setFileLister(FileLister fileLister)
          Sets the FileLister instance which contains the (filtered) list of files and/or directories that match the user's search criteria.
 void setFileListerException(FileListerException fle)
          Allows to set a FileListerException from anywhere, including JSP sites.
(package private)  void setInitialSiteWasCalledLegally()
          This method provides a "security" plugin: If the user didn't click on the option bar link but on the back button of the browser, the former search configuration must be removed (in case of "search within results").
(package private)  void setResultsPerSite(String sURLInput)
          Verifies the URL input and sets the new results-per-site count.
 void setSearchMode(String sURLInput)
          Parses the URL input value; if "simple" or "advanced", the search mode parameter is updated to the new mode setting.
(package private)  void setSearchType(String sURLInput)
          Sets the current search type (may be null).
(package private)  void setSelectedIndexesForZip(int[] iSelectedIndexes)
          Steps through the currently visible FileListerEntries and marks them as selected-for-zip, if their index is within iSelectedIndexes.
(package private)  void setSortCriteria(String[] sSortCriteria)
          Sets the given list of sort orders defined by the client to the internal list of sort orders.
(package private)  void setZipBuilderThread(ZipBuilderThread zipBuilderThread)
          Sets an instance of ZipBuilderThread indicating that the owner session of this class is building a zip file.
(package private)  void sortByColumn(String sURLInput)
          Verifies the URL input and sets the new sort mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

INITIALSITE

public static final String INITIALSITE
the name of the initial site of the FileLister application

See Also:
Constant Field Values

RESULTSSITE

public static final String RESULTSSITE
the name of the (search) results site of the FileLister application

See Also:
Constant Field Values

CONTROLLERSERVLET

static final String CONTROLLERSERVLET
the name of the controller servlet of the FileLister application

See Also:
Constant Field Values

NEWSEARCH

static final int NEWSEARCH
indicates the "new search" mode

See Also:
Constant Field Values

SEARCHWITHINRESULTS

static final int SEARCHWITHINRESULTS
tells to search within the previous results

See Also:
Constant Field Values

SEARCHAGAIN

static final int SEARCHAGAIN
indicates a new search with the old settings

See Also:
Constant Field Values

MINIMUMENTRIESINMEMORY

static final int MINIMUMENTRIESINMEMORY
defines the minimum length of one list of FileListerEntry objects

See Also:
Constant Field Values

SORTCRITERIA

static final String[] SORTCRITERIA
Constructor Detail

FileListerConfig

FileListerConfig(HttpServletRequest request,
                 ServletContext context,
                 PropertyFileParameters params,
                 int iWindowID)
The constructor initializes the class and constructs the URL's of each site to be shown.

Parameters:
request - the request to get the request URL from
context - the servlet context to get the full (physical) paths for each DimDom template file
params - the object containing the property file parameters
iWindowID - the id of the session window to which this instance belongs (generated by the FileListerFactory)

FileListerConfig

FileListerConfig(PropertyFileParameters params)
This constructor may be called from other classes than the FileListerViewerServlet, as used to build the initial index.

Parameters:
params - the object containing the property file parameters
Method Detail

isDirectoryListing

public boolean isDirectoryListing()
Tells whether the directories shall be listed.

Returns:
list the directories?

isFileListing

public boolean isFileListing()
Tells whether the files shall be listed.

Returns:
list the files?

isAllowedToZip

public boolean isAllowedToZip()
Returns wether the "zip.isallowedtozip" switch is set to true in the property file or not. If true, the GUI shows the "add to zip" checkboxes and the "get zip file" button, else not.

Returns:
is allowed to (download) zip (files)?

isArchiveMode

public boolean isArchiveMode()
Tells whether the the archive mode or the directory input mode is active.

Returns:
archive or directory input mode?

getSearchDirectory

public String getSearchDirectory()
                          throws FileListerException
Returns the start directory of the (last) search as a string, formatted either absolutely or relatively, as defined in the properties file

Returns:
the search directory string
Throws:
FileListerException - in case the virtual root is not the beginning of the directory entries in the database, which means that the index is not up to date

createDefineSearchParameters

void createDefineSearchParameters()
Notifies the config class about the type of the next search. Possible types are: NEWSEARCH, SEARCHAGAIN, SEARCHWITHINRESULTS.
The first type leads to a full reset of the class' parameters, the second keeps the settings, but allows to enter a new directory, the third keeps anything so that the search is done within the same results as before.


getDefineSearchParameters

public DefineSearchParameters getDefineSearchParameters()
Returns the previously created DefineSearchParameters instance.

Returns:
the current/last search configuration object

getIndexTime

public String getIndexTime()
Returns the index time of the search directory (which is taken as the index time of all results!).

Returns:
the formatted index time, as a String

getRegExpHelpLink

public String getRegExpHelpLink()
Returns the value of the property file parameter "link.regexphelp", to be shown in the "define search" site.

Returns:
as defined in the property file

isListingAllEntries

public boolean isListingAllEntries()
Returns whether all contents shall be listed (client entered the empty string as the search string) or not.

Returns:
whether to list all contents or filtered ones only

getRequestURL

public String getRequestURL(boolean bOfInitialSite)
Returns either the URL of the controller servlet or the URL of the results site, depending on bOfInitialSite. The returned URL is followed by "?window=" + getWindowID to make sure that the correct instance of FileListerConfig is mapped to the link target.

Parameters:
bOfInitialSite - show initial site (via the controller servlet)?
Returns:
the appropriate URL
See Also:
getWindowID()

getViewerServletURL

public String getViewerServletURL()
Returns the URL of the viewer servlet. The returned URL is followed by "?window=" + getWindowID to make sure that the correct instance of FileListerConfig is mapped to the link target.

Returns:
the URL of the viewer servlet
See Also:
getWindowID()

getInitialSiteURL

public String getInitialSiteURL()
Returns the URL of the initial site. The returned URL is followed by "?window=" + getWindowID to make sure that the correct instance of FileListerConfig is mapped to the link target.

Returns:
the URL of the initial site
See Also:
getWindowID()

getErrorURL

public String getErrorURL()
Returns the URL of the error site, to allow the redirect to this site. Thereturned URL is followed by "?window=" + getWindowID to make sure that the correct instance of FileListerConfig is mapped to the link target.

Returns:
the appropriate URL
See Also:
getWindowID()

getDownloadURL

public String getDownloadURL()
Returns the full URL of the download servlet, ready to be placed into e.g. the form tag of the results site.

Returns:
the fully qualified URL of the download servlet
See Also:
getWindowID()

getOptionBarURL

public String getOptionBarURL()
Returns the full URL of the option bar JSP site, ready to be placed into e.g. the lower frame tag of the results site.

Returns:
the fully qualified URL of the option bar JSP site
See Also:
getWindowID()

getResultsPerSite

public int getResultsPerSite()
Returns the current results-per-site count.

Returns:
the results-per-site count

isUsingRegExp

public boolean isUsingRegExp()
Returns whether the user selected to use regular expressions for the search string or not.

Returns:
user's using regexp?

isCaseSensitiveSearch

public boolean isCaseSensitiveSearch()
Returns whether the search string shall be handled in the case sensitive fashion or not.

Returns:
case sensitive compares?

isExactMatch

public boolean isExactMatch()
Returns whether the search string shall be matched exactly or not.

Returns:
case sensitive compares?

getTotalSiteCount

public int getTotalSiteCount()
Returns the total amount of sites that may be shown (of course only 1, if set to "show unlimited results").

Returns:
the total site count (at least 1)

getCurrentSiteNumber

public int getCurrentSiteNumber()
Returns the index of the currently shown site.

Returns:
the site index (at least 1)

getFileListerException

public FileListerException getFileListerException()
Returns the currently set FileListerException instance or null, if none. Because FileListerException extends ServletException, it implements the getRootException mechanism too, to allow the user to see what happened effectively.

Returns:
the currently set FileListerException or null

setFileListerException

public void setFileListerException(FileListerException fle)
Allows to set a FileListerException from anywhere, including JSP sites.

Parameters:
fle - which error happened (root causes are stored internally)

getBufferSize

public int getBufferSize()
Returns a 100th of the max. FileListerEntry objects parameter of the config file, but at least 100. This value is used as the buffer size by the FileLister class and defines how many results are loaded at a time

Returns:
the (current) FileListerEntry buffer's size

isAdvancedSearch

public boolean isAdvancedSearch()
Returns whether the advanced mode (which includes size and date search input in the GUI) is active or not.

Returns:
advanced search?

setSearchMode

public void setSearchMode(String sURLInput)
Parses the URL input value; if "simple" or "advanced", the search mode parameter is updated to the new mode setting.

Parameters:
sURLInput - handled only if equals "simple" or "advanced"

getWindowID

public int getWindowID()
Returns the window id (or the number of this class within the user's session) that was set during initialization.

Returns:
the window id representing this class

getSortOrderOutput

public String getSortOrderOutput(int iSortOrderNumber)
Builds the HTML to be put into a select box for the sort orders, specified within the sort orders by the given index (from 1 up to the total amount of defined sort orders). If the given index is higher than 1 , the first option in the list is empty, having the URL value "none". The URL value of all the other entries is the same as the visible output.
The method is settled within FileListerConfig (and not within SearchParameters like the other "Output" methods) because of the special situation with the sort orders: There kept in / controlled by this class (because they're overall settings), unlike all the other search parameters that form the SQL where conditions.

Parameters:
iSortOrderNumber - the number of the sort criterium within the list of sort criteria, starting with 1
Returns:
the full HTML string to fill the iSortOrderNumber-th select box with an option list

getZipProgressPercentage

public String getZipProgressPercentage()
Asks the ZipBuilderThread for its generation/progress percentage, formats it to one fraction digit and appends a % sign to it. The fully formatted string is returned.

Returns:
e.g. "17.9%"

getZipWarnings

public String getZipWarnings()
Returns the list of warnings generated while creating the zip file. Such a warning might be the information that a selected entry is missing or that a file is contained in the zip that hasn't been in the selection before, because the index is somewhat out of sync.

Returns:
a list of warnings, one per line (if any, else "")

getZipArchiveSize

public String getZipArchiveSize()
Returns the descriptor for the current archive size of the zip file the user is waiting for.

Returns:
something like "...archive size: 5.23 MB (13% packed)"

getZipFilesDone

public String getZipFilesDone()
Returns the descriptor of the progress of files packed into the current zip.

Returns:
something like "29 of 314 files done (215.2 KB of 2.234 MB)"

getZipCurrentlyAdding

public String getZipCurrentlyAdding()
Returns the currently-added-file descriptor.

Returns:
e.g. "Currently adding: /temp/xyz.gif"

getZipTimeElapsed

public String getZipTimeElapsed()
Returns the descriptor for the time already elapsed since the start of the zip building.

Returns:
e.g. "time elapsed: 1 min 27s (less than 1 minute remaining)"

getMetaRefreshContent

public String getMetaRefreshContent()
Returns the content of the meta-refresh tag (used by download.jsp only).

Returns:
the modified meta-refresh tag, having either 0 or 2 seconds delay, depending on whether the zip file is built already or not

getProgressBarWidth

public String getProgressBarWidth()
Returns the current width of the progress bar describing the build status of the zip file (used by download.jsp only), formatted like "xy%".

Returns:
something like "xy%", where xy is from 0 up to 100

createSearchParameters

void createSearchParameters(HttpServletRequest request)
                      throws FileListerException
Reads the URL parameters and stores those values within an instance of SearchParameters. This instance itself is stored in the internal list of SearchParameters instances.

Parameters:
request - the request to get the search parameters from
Throws:
FileListerException - wraps/describes the possibly upcoming input errors

getStartDirectory

File getStartDirectory()
Returns the (validated, but nevertheless abstract) directory defined by the client/user, appended to the root directory value from the property file, if defined.

Returns:
the "fully qualified" search directory

isShowingAbsolutePaths

boolean isShowingAbsolutePaths()
Tells whether absolute or relative paths shall be shown in the output.

Returns:
show absolute or relative paths?

getSearchParameters

ArrayList getSearchParameters()
Returns the list of SearchParameters instances entered by the client.

Returns:
the user's search string(s) or the empty String, as a List

setFileLister

void setFileLister(FileLister fileLister)
Sets the FileLister instance which contains the (filtered) list of files and/or directories that match the user's search criteria.
If the given parameter is null, this leads to an unsetting of the list.

Parameters:
fileLister - the previously created FileLister instance or null

getFileLister

public FileLister getFileLister()
Returns the FileLister, if set previously, or null.

Returns:
the stored FileLister or null

getDownloadSite

String getDownloadSite()
Returns the fully qualified file name of the JSP download site which is filled dynamically to show a virtual progress bar and other interesting remarks during zip building.

Returns:
the formatted download site URL

getViewerSite

String getViewerSite()
Returns the fully qualified file name of the JSP results site which is filled dynamically with the found entries (currently visible subset).

Returns:
the formatted results site URL

sortByColumn

void sortByColumn(String sURLInput)
            throws FileListerException
Verifies the URL input and sets the new sort mode.
Allowed values are: name, directory, size, lastmodified, each followed by either asc or desc. The sorting work is minimized as much as possible...

Parameters:
sURLInput - the URL input for the new sort mode
Throws:
FileListerException - thrown on bad or missing input

getSortOrders

ArrayList getSortOrders()
Returns the list currently active sort criteria. Each entry is a String that starts with either name or location or size or lastmodified and ends with asc or desc.

Returns:
the current list of sort criteria

getNextSortOrder

public String getNextSortOrder(String sColumnName)
Returns the URL parameter value of the "column" parameter shown in the link of each sortable table column header. The returned value consists of the column name itself, followed by either "asc", "desc" or "none". "Next" means, that the current sort order is asked and the follower is returned, i.e. if not a sort criterium (= "none" or not existent), "asc" is returned, then "desc" and finally "none".

Parameters:
sColumnName - which column's sort order shall be returned
Returns:
the URL parameter value, as described above

isSortCriterium

public boolean isSortCriterium(String sColumnName)
Scans the list of currently stored sort criteria for an entry starting with sColumnName. If such an entry exists, true is returned, else false.

Parameters:
sColumnName - the column name to check
Returns:
whether this column name is stored to be a sort criterium or not

getSortDirection

public String getSortDirection(String sColumnName)
Scans the list of currently stored sort criteria for an entry starting with sColumnName. If such an entry exists, its sort direction is returned ("asc", "desc" or "none"), if not, "none" is returned.

Parameters:
sColumnName - the column name to check
Returns:
the sort direction of this column

getInverseSortOrder

public String getInverseSortOrder(String sColumnName)
Returns the inverse sort direction of the given column, i.e. asc, if it's currently set to desc and vice versa. If no sorting is set to this column, none is returned.

Parameters:
sColumnName - the column name to check
Returns:
the inverse sort direction of this column or "none"

getSortPriority

public int getSortPriority(String sColumnName)
Scans the list of currently stored sort criteria for an entry starting with sColumnName. If such an entry exists, its index within the list of criteria, i.e. the sort priority, is returned. is returned.

Parameters:
sColumnName - the column name to check
Returns:
the sort priority of the given column or 0, if not a sort criterium

getConfigDescriptor

public String getConfigDescriptor()
                           throws FileListerException
Returns a string describing the current configuration settings.

Returns:
ready to be shown on the viewer site
Throws:
FileListerException - in case the virtual root is not the beginning of the directory entries in the database, which means that the index is not up to date

getDirectoryOutput

public String getDirectoryOutput(String sDirectory)
                          throws FileListerException
Shows the directory string that is visible in the web output . This is not the absolute path only if directory.showabsolutepaths is set to false AND a virtual root is defined. In this case, the path is relative to this virtual root.

Parameters:
sDirectory - the directory to transform
Returns:
the virtual directory or sDirectory itself
Throws:
FileListerException - in case the virtual root is not the beginning of the directory entries in the database, which means that the index is not up to date

jumpToSite

void jumpToSite(String sURLInput)
          throws FileListerException
Redirects the client to a specific site. If the URL input value is not a number, an exception is thrown. If it's < 1, it's set to 1, if it's > than the last site, it's set to the last possible site number.

Parameters:
sURLInput - what the user entered in the jump-to-site text field
Throws:
FileListerException - if the input is not a number

setResultsPerSite

void setResultsPerSite(String sURLInput)
                 throws FileListerException
Verifies the URL input and sets the new results-per-site count.
Allowed values are: 10, 25, 50 and the value returned by the getBufferSize method.

Parameters:
sURLInput - the URL input for the new results-per-site count
Throws:
FileListerException - thrown on bad input

getStartIndex

public int getStartIndex()
Returns the index from which on the results shall be shown (default is 0, i.e. the first entry, but this value may change during navigation within the results).

Returns:
the start/base index to show the appropriate results

getLinkPrefix

public String getLinkPrefix()
Returns the link prefix parameter from the config file (may be empty).

Returns:
the link prefix or ""

navigate

void navigate(String sURLParameterName)
        throws FileListerException
Navigates according to the URL input parameter: to the first, to the previous, to the next or to the last position.

Parameters:
sURLParameterName - how to navigate
Throws:
FileListerException - if the URL input is not a valid parameter

getIndexAging

int getIndexAging()
Returns value of the ini-file parameter "index.aging" which defines how old database values are allowed to be before the directory search is started again (in seconds).

Returns:
seconds until next directory search is executed

getVirtualRoot

String getVirtualRoot()
Returns the value of the ini-file parameter "directory.root", if defined. If it's defined, it indicates the directory root which is allowed to be searched/listed only, to restrict the access to the file system to a single directory.

Returns:
the root of the searchable directory or null, if not defined in the property file

hasVirtualRoot

boolean hasVirtualRoot()
Returns whether the property file contains a virtual root or not.

Returns:
virtual root defined?

getNoGoAreas

LinkedList getNoGoAreas()
Returns the list of directories, inside which searching is prohibited.

Returns:
list of directories, where searching is prohibited.

isInitialArchivingProcess

boolean isInitialArchivingProcess()
Returns whether this config object was initialized to run the initial archiving process or not.

Returns:
run initial archiving (i.e. indexing) process?

getMaxFileListerObjects

int getMaxFileListerObjects()
Returns the max. number of file lister objects to be stored in the memory, as defined in the property file.

Returns:
max. number of FileListerEntry objects

getJDBCTableName

String getJDBCTableName()
Returns the value of the "jdbc.tablename" property of the config file.

Returns:
the name of the table

getQueryBuilder

SQLQueryBuilder getQueryBuilder()
Returns the query builder instance defined in the property file.

Returns:
the database-related, SQLQueryBuilder-implementing query builder class which is able to form the SQL strings in the database-specific format

getZipCreationDirectory

String getZipCreationDirectory()
Returns the directory path, ending with a "/", to write the created zip files in.

Returns:
the zip directory

getZipLevel

int getZipLevel()
Returns the package strength of the download zips. This strength is commonly named "level". Allowed values are 0 - 9, default is 5, in case an illegal value was defined in the property file.

Returns:
0 - 9, indicating the zip level / package strength

setSelectedIndexesForZip

void setSelectedIndexesForZip(int[] iSelectedIndexes)
Steps through the currently visible FileListerEntries and marks them as selected-for-zip, if their index is within iSelectedIndexes. If not, they're unmarked. This stores the selection state even if the user navigated to another view/site, at most until the FileLister is reinitialized or some very old entries are removed from FileLister, out of memory reasons...

Parameters:
iSelectedIndexes - the list of selected indexes or null, indicating that none was selected

setAdvancedSearch

void setAdvancedSearch(boolean bIsAdvancedSearch)
Sets the search mode (advanced or simple).

Parameters:
bIsAdvancedSearch - if false, it's the simple, else the advanced mode

setSortCriteria

void setSortCriteria(String[] sSortCriteria)
Sets the given list of sort orders defined by the client to the internal list of sort orders. Because the list contains only sort criteria, but no sort orders, each criterium in the list is treated as "asc".

Parameters:
sSortCriteria - the list of sort criteria from the URL input

setZipBuilderThread

void setZipBuilderThread(ZipBuilderThread zipBuilderThread)
Sets an instance of ZipBuilderThread indicating that the owner session of this class is building a zip file. If the building of the zip file is finished, this method must be called again with a null pointer to notify this class about the finished process.

Parameters:
zipBuilderThread - a new thread or null, if the old one's finished

getZipBuilderThread

ZipBuilderThread getZipBuilderThread()
Returns the current ZipBuilderThread pointer, which is null if no such thread is running.

Returns:
the currently running zipping thread or null

isZipBuilding

boolean isZipBuilding()
Returns whether getZipBuilderThread is existing and still working on a zip file or not.

Returns:
true, if existing and still building a zip file, false, if not set or finished building the zip

resetZipBuilderThread

public void resetZipBuilderThread()
Stops the ZipBuilderThread, if one is set, including the deletion of its zip file (after creation). This is done by simply marking the ZipBuilderThread in a way that it cleans up itself after finishing its run method.


isReadyToStream

public boolean isReadyToStream()
Returns whether there is currently a ZipBuilderThread in the pipeline and this thread is ready to stream the finished zip file. If so, the method returns true, else false.

Returns:
is there a zip file ready to be streamed?

getVersion

public String getVersion()
Returns the visible version string of the FileLister application.

Returns:
a String describing the app version

getSearchType

public String getSearchType()
Returns the last stored search mode (may be null).

Returns:
the currently configured search mode URL parameter

setSearchType

void setSearchType(String sURLInput)
Sets the current search type (may be null).

Parameters:
sURLInput - the search type, read from the URL parameter "search"

setInitialSiteWasCalledLegally

void setInitialSiteWasCalledLegally()
This method provides a "security" plugin: If the user didn't click on the option bar link but on the back button of the browser, the former search configuration must be removed (in case of "search within results"). Therefore, the boolean indicates whether the call was "legal"; on each call of the FileListerControllerServlet, this method is called using "true" while on each call of the results.jsp, the back-button check is done and the switch is set back to "false".

See Also:
doBackButtonInBrowserCheck(javax.servlet.http.HttpServletRequest)

doBackButtonInBrowserCheck

public void doBackButtonInBrowserCheck(HttpServletRequest request)
Provides the check whether the user called the initial site "legally" or via the back button in the browser only. To find this out, the following checks are done: Is the call from the initial site? Is the search type currently set to "search within results"? Is the "security" switch value "false"? If all those checks return true, the last search configuration object is removed from the internal list of configuration objects because in this case, the user clicked the back browser of the button in a moment where he definitely shouldn't do that.

Parameters:
request - where to read the URL parameters for the above described checks from

removeLastSearchParametersFromList

void removeLastSearchParametersFromList()
Removes the last instance of SearchParameters from the internal list of SearchParameters. This method is used to correct the behaviour of FileLister under certain special circumstances.


processModeChange

void processModeChange(String sNewMode,
                       HttpServletRequest request)
                 throws FileListerException
Reacts to a click on the simple/advanced search button. This leads into the creation of a "temporary" DefineSearchParameters instance whose underlying SearchParameters isn't stored in the internal list of SearchParameters instances (happens only on processing of a real search).

Parameters:
sNewMode - the new mode of the define-search site
request - where to read the URL parameters from
Throws:
FileListerException - if the URL parameters are somehow invalid