Package org.primefaces.virusscan.impl
Class ClamDaemonScanner
java.lang.Object
org.primefaces.virusscan.impl.ClamDaemonScanner
- All Implemented Interfaces:
VirusScanner
ClamAV Daemon custom
VirusScanner
provider bundled with PrimeFaces.
Streams the file over TCP to a ClamAV service running on host:port.
It requires
CONTEXT_PARAM_HOST
and CONTEXT_PARAM_PORT
to be specified.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected String
createErrorMessage
(UploadedFile file, String response) Returns a new ClamAvClient which can be overridden in unit tests.boolean
Indicate whether thisVirusScanner
is enabled or not.void
scan
(UploadedFile file) Scan file using send to ClamAV service running at host and port over TCP.
-
Constructor Details
-
ClamDaemonScanner
public ClamDaemonScanner()
-
-
Method Details
-
isEnabled
public boolean isEnabled()Description copied from interface:VirusScanner
Indicate whether thisVirusScanner
is enabled or not.- Specified by:
isEnabled
in interfaceVirusScanner
- Returns:
true
if enabled,false
otherwise
-
scan
Scan file using send to ClamAV service running at host and port over TCP.- Specified by:
scan
in interfaceVirusScanner
- Parameters:
file
- file to perform virus scan on- Throws:
VirusException
- if a virus has been detected by the scanner
-
createErrorMessage
-
getClamAvClient
Returns a new ClamAvClient which can be overridden in unit tests.- Returns:
- the
ClamDaemonClient
-