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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract booleanconfirmReplacement(File file, int id)Override this method if you want to display some GUI confirmation.abstract PreparedStatementabstract StringReturns the query to load the identifiers from a database table for that associated image is found (conflict).
The general contract ofgetSelectConflictIdsQueryis that the first column of the results is the identifier value asINTEGERSQL data type.
Example of query:abstract StringReturns the query to load the identifiers from a database table for that here is not yet an associated image.
The general contract ofgetSelectConflictIdsQueryis that the first column of the results is the identifier value asINTEGERSQL data type.
Example of query:abstract PreparedStatementlongparse(AbstractBrolWorker<Long> bgw)Parses files from the definedstart path, and call theAbstractFileParser.performOnFile(AbstractBrolWorker, File, int, int)on each file.protected booleanperformOnFile(AbstractBrolWorker<Long> bgw, File file, int progressPercent, int subDirDeep)Do something on each filevoidreadIds(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 ofgetSelectConflictIdsQueryis that the first column of the results is the identifier value asINTEGERSQL 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 ofgetSelectConflictIdsQueryis that the first column of the results is the identifier value asINTEGERSQL 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
falsein this basic implementation.
-
parse
Description copied from class:AbstractFileParserParses files from the definedstart path, and call theAbstractFileParser.performOnFile(AbstractBrolWorker, File, int, int)on each file.- Overrides:
parsein 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:AbstractFileParserDo something on each file- Specified by:
performOnFilein classAbstractFileParser<Long>- Parameters:
bgw-AbstractBrolWorkerto 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
-