Class GzipFileProcessor
- java.lang.Object
-
- ca.corefacility.bioinformatics.irida.processing.impl.GzipFileProcessor
-
- All Implemented Interfaces:
FileProcessor
@Component public class GzipFileProcessor extends java.lang.Object implements FileProcessor
Handle gzip-ed files (if necessary). This class partially assumes that gzip compressed files have the extension ".gz" (not for determining whether or not the file is compressed, but rather for naming the decompressed file). If the compressed file does not end with ".gz", then it will be renamed as such so that the decompressed file name will not conflict with the compressed file name.
-
-
Constructor Summary
Constructors Constructor Description GzipFileProcessor(SequenceFileRepository sequenceFileRepository)
GzipFileProcessor(SequenceFileRepository sequenceFileRepository, java.lang.Boolean removeCompressedFiles)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Boolean
modifiesFile()
If theFileProcessor
throws aFileProcessorException
, theFileProcessor
should inform the caller whether or not proceeding with the remainingFileProcessor
instances in the chain is safe.void
process(SequencingObject sequencingObject)
Process the providedSequenceFile
, then (optionally) proceed to the next processor in the chain.void
processSingleFile(SequenceFile sequenceFile)
Process a singleSequenceFile
void
setDisableFileProcessor(boolean disableFileProcessor)
Disables this file processor from processing files.void
setRemoveCompressedFiles(boolean removeCompressedFile)
Decide whether or not to delete the original compressed files that are uploaded once they're unzipped.boolean
shouldProcessFile(SequencingObject sequencingObject)
This method asks the file processor whether it should act on this file.
-
-
-
Constructor Detail
-
GzipFileProcessor
@Autowired public GzipFileProcessor(SequenceFileRepository sequenceFileRepository)
-
GzipFileProcessor
public GzipFileProcessor(SequenceFileRepository sequenceFileRepository, java.lang.Boolean removeCompressedFiles)
-
-
Method Detail
-
setRemoveCompressedFiles
public void setRemoveCompressedFiles(boolean removeCompressedFile)
Decide whether or not to delete the original compressed files that are uploaded once they're unzipped. Iffalse
they will be kept in their revision directories.- Parameters:
removeCompressedFile
- Whether or not to delete original compressed files.
-
setDisableFileProcessor
public void setDisableFileProcessor(boolean disableFileProcessor)
Disables this file processor from processing files.- Parameters:
disableFileProcessor
- True if this processor should be disabled, false otherwise.
-
process
@Transactional public void process(SequencingObject sequencingObject)
Process the providedSequenceFile
, then (optionally) proceed to the next processor in the chain. Any modifications to theSequenceFile
made by theFileProcessor
should be persisted by theFileProcessor
itself -- theFileProcessingChain
*does not* handle persistence.- Specified by:
process
in interfaceFileProcessor
- Parameters:
sequencingObject
- theSequencingObject
to process
-
processSingleFile
public void processSingleFile(SequenceFile sequenceFile) throws FileProcessorException
Process a singleSequenceFile
- Parameters:
sequenceFile
- file to process- Throws:
FileProcessorException
- if an error occurs while processing
-
modifiesFile
public java.lang.Boolean modifiesFile()
If theFileProcessor
throws aFileProcessorException
, theFileProcessor
should inform the caller whether or not proceeding with the remainingFileProcessor
instances in the chain is safe. If theFileProcessor
modifies the file, then proceeding with the remainingFileProcessor
in the chain is not safe.- Specified by:
modifiesFile
in interfaceFileProcessor
- Returns:
- whether or not the
FileProcessor
modifies theSequenceFile
.
-
shouldProcessFile
public boolean shouldProcessFile(SequencingObject sequencingObject)
Description copied from interface:FileProcessor
This method asks the file processor whether it should act on this file. The processor may have some settings that would not run on certain files.- Specified by:
shouldProcessFile
in interfaceFileProcessor
- Parameters:
sequencingObject
- theSequencingObject
to check- Returns:
- true if the processor should act on the file
-
-