Class ImagesDirectoryHighMemoryParser
java.lang.Object
be.gaudry.model.file.AbstractFileParser<Long>
be.gaudry.bibliobrol.dao.derby.tools.ImagesDirectoryHighMemoryParser
- All Implemented Interfaces:
PropertyChangeListener
,EventListener
This is the first version of
ImagesDirectoryParser
, that parses all files
before inserting matching files into the database. OutOfMemoryError: Java heap space
may occurs- Since:
- 1.0 Feb 2, 2009
- Author:
- Steph GAUDRY
- See Also:
ImagesDirectoryParser
-
Field Summary
Fields inherited from class be.gaudry.model.file.AbstractFileParser
validPreviousProgress
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected abstract boolean
confirmReplacement(File file, int id)
Override this method if you want to display some GUI confirmation.abstract PreparedStatement
abstract String
Returns the query to load the identifiers from a database table for that associated image is found (conflict).
The general contract ofgetSelectConflictIdsQuery
is that the first column of the results is the identifier value asINTEGER
SQL data type.
Example of query:abstract String
Returns the query to load the identifiers from a database table for that here is not yet an associated image.
The general contract ofgetSelectConflictIdsQuery
is that the first column of the results is the identifier value asINTEGER
SQL data type.
Example of query:abstract PreparedStatement
long
parse(AbstractBrolWorker<Long> bgw)
Parses files from the definedstart path
, and call theAbstractFileParser.performOnFile(AbstractBrolWorker, File, int, int)
on each file.protected boolean
performOnFile(AbstractBrolWorker<Long> bgw, File file, int progressPercent, int subDirDeep)
Do something on each filevoid
readIds(AbstractBrolWorker<Long> bgw)
Methods inherited from class be.gaudry.model.file.AbstractFileParser
equals, finalize, getProgressMax, getStartPath, hashCode, init, isIncludeHiddenFiles, isIncludeSubFolders, isPauseProcessing, isPreCalcProgress, isPreCalculated, parseFiles, performOnDirectory, propertyChange, setIncludeHiddenFiles, setIncludeSubFolders, setLanguage, setPreCalcProgress, setStartPath, togglePause
-
Constructor Details
-
ImagesDirectoryHighMemoryParser
public ImagesDirectoryHighMemoryParser()
-
-
Method Details
-
getInsertImageStatement
- Returns:
- the insertImageStatement
-
getUpdateImageStatement
- Returns:
- the updateImageStatement
-
getSelectMatchingIdsQuery
Returns the query to load the identifiers from a database table for that here is not yet an associated image.
The general contract ofgetSelectConflictIdsQuery
is that the first column of the results is the identifier value asINTEGER
SQL data type.
Example of query:SELECT itemId FROM item WHERE itemImage IS NULL
- Returns:
- the selectMatchingIdsQuery
-
getSelectConflictIdsQuery
Returns the query to load the identifiers from a database table for that associated image is found (conflict).
The general contract ofgetSelectConflictIdsQuery
is that the first column of the results is the identifier value asINTEGER
SQL data type.
Example of query:SELECT itemId FROM item WHERE itemImage IS NOT NULL
- Returns:
- the selectConflictIdsQuery
-
confirmReplacement
Override this method if you want to display some GUI confirmation.- Parameters:
file
- possible matching file.id
- matching id, but with an existing file.- Returns:
- always
false
in this basic implementation.
-
parse
Description copied from class:AbstractFileParser
Parses files from the definedstart path
, and call theAbstractFileParser.performOnFile(AbstractBrolWorker, File, int, int)
on each file.- Overrides:
parse
in classAbstractFileParser<Long>
- Returns:
- the size of the matching files, not the size of the parsed directory
-
readIds
-
performOnFile
protected boolean performOnFile(AbstractBrolWorker<Long> bgw, File file, int progressPercent, int subDirDeep)Description copied from class:AbstractFileParser
Do something on each file- Specified by:
performOnFile
in classAbstractFileParser<Long>
- Parameters:
bgw
-AbstractBrolWorker
to perform cancel if needed, and report progressfile
- file to checkprogressPercent
- Progress percentagesubDirDeep
- Deep of the directory in comparison with start directory- Returns:
- true if we must stop the parsing of current directory (ie. if we have a vob file, we don't check the other files in this directory) false otherwise
-