Package org.dspace.ctask.general
Class ClamScan
java.lang.Object
org.dspace.curate.AbstractCurationTask
org.dspace.ctask.general.ClamScan
- All Implemented Interfaces:
CurationTask
ClamScan.java
A set of methods to scan using the
clamav daemon.
TODO: add a check for the inputstream size limit
- Author:
- wbossons
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected BitstreamServiceprotected final Stringprotected final Stringprotected DataOutputStreamprotected final intprotected final byte[]protected booleanprotected Stringprotected final byte[]protected final Stringprotected final byte[]protected final Stringprotected final byte[]protected final Stringprotected intprotected final Stringprotected Socketprotected final byte[]protected intprotected intFields inherited from class org.dspace.curate.AbstractCurationTask
communityService, configurationService, curator, handleService, itemService, taskId -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidcloseSession Close the IDSESSION in CLAMDprotected voidformatResults(Item item) protected StringgetItemHandle(Item item) voidInitialize task - parameters inform the task of it's invoking curator.protected voidlogDebugMessage(String message) protected voidopenSession This method opens a session.intperform(DSpaceObject dso) Perform the curation task upon passed DSOprotected intscan(Bitstream bitstream, InputStream inputstream, String itemHandle) Issue the INSTREAM command and return the response to and from the clamav daemon.Methods inherited from class org.dspace.curate.AbstractCurationTask
dereference, distribute, perform, performItem, performObject, report, setResult, taskArrayProperty, taskBooleanProperty, taskIntProperty, taskLongProperty, taskProperty
-
Field Details
-
DEFAULT_CHUNK_SIZE
protected final int DEFAULT_CHUNK_SIZE- See Also:
-
INSTREAM
protected final byte[] INSTREAM -
PING
protected final byte[] PING -
STATS
protected final byte[] STATS -
IDSESSION
protected final byte[] IDSESSION -
END
protected final byte[] END -
PLUGIN_PREFIX
- See Also:
-
INFECTED_MESSAGE
- See Also:
-
CLEAN_MESSAGE
- See Also:
-
CONNECT_FAIL_MESSAGE
- See Also:
-
SCAN_FAIL_MESSAGE
- See Also:
-
NEW_ITEM_HANDLE
- See Also:
-
host
-
port
protected int port -
timeout
protected int timeout -
failfast
protected boolean failfast -
status
protected int status -
results
-
socket
-
dataOutputStream
-
bitstreamService
-
-
Constructor Details
-
ClamScan
public ClamScan()
-
-
Method Details
-
init
Description copied from interface:CurationTaskInitialize task - parameters inform the task of it's invoking curator. Since the curator can provide services to the task, this represents curation DI.- Specified by:
initin interfaceCurationTask- Overrides:
initin classAbstractCurationTask- Parameters:
curator- the Curator controlling this tasktaskId- identifier task should use in invoking services- Throws:
IOException- if error
-
perform
Description copied from interface:CurationTaskPerform the curation task upon passed DSO- Specified by:
performin interfaceCurationTask- Specified by:
performin classAbstractCurationTask- Parameters:
dso- the DSpace object- Returns:
- status code
- Throws:
IOException- if error
-
openSession
openSession This method opens a session.- Throws:
IOException- A general class of exceptions produced by failed or interrupted I/O operations.
-
closeSession
protected void closeSession()closeSession Close the IDSESSION in CLAMD -
scan
Issue the INSTREAM command and return the response to and from the clamav daemon.- Parameters:
bitstream- the bitstream for reporting resultsinputstream- the InputStream to readitemHandle- the item handle for reporting results- Returns:
- a ScanResult representing the server response
-
formatResults
- Throws:
IOException
-
getItemHandle
-
logDebugMessage
-