Class ClamScan

java.lang.Object
org.dspace.curate.AbstractCurationTask
org.dspace.ctask.general.ClamScan
All Implemented Interfaces:
CurationTask

@Suspendable(invoked=INTERACTIVE) public class ClamScan extends AbstractCurationTask
ClamScan.java A set of methods to scan using the clamav daemon. TODO: add a check for the inputstream size limit
Author:
wbossons
  • Field Details

  • Constructor Details

    • ClamScan

      public ClamScan()
  • Method Details

    • init

      public void init(Curator curator, String taskId) throws IOException
      Description copied from interface: CurationTask
      Initialize 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:
      init in interface CurationTask
      Overrides:
      init in class AbstractCurationTask
      Parameters:
      curator - the Curator controlling this task
      taskId - identifier task should use in invoking services
      Throws:
      IOException - if error
    • perform

      public int perform(DSpaceObject dso) throws IOException
      Description copied from interface: CurationTask
      Perform the curation task upon passed DSO
      Specified by:
      perform in interface CurationTask
      Specified by:
      perform in class AbstractCurationTask
      Parameters:
      dso - the DSpace object
      Returns:
      status code
      Throws:
      IOException - if error
    • openSession

      protected void openSession() throws IOException
      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

      protected int scan(Bitstream bitstream, InputStream inputstream, String itemHandle)
      Issue the INSTREAM command and return the response to and from the clamav daemon.
      Parameters:
      bitstream - the bitstream for reporting results
      inputstream - the InputStream to read
      itemHandle - the item handle for reporting results
      Returns:
      a ScanResult representing the server response
    • formatResults

      protected void formatResults(Item item) throws IOException
      Throws:
      IOException
    • getItemHandle

      protected String getItemHandle(Item item)
    • logDebugMessage

      protected void logDebugMessage(String message)