Skip to content
Snippets Groups Projects
Commit 7dee39ba authored by Andreas Romeyke's avatar Andreas Romeyke
Browse files

- reenabled logger output

- updated SDK version
parent 95e738f6
Branches
Tags
No related merge requests found
...@@ -4,10 +4,10 @@ ...@@ -4,10 +4,10 @@
# von ExLibris an Rosetta übergibt. # von ExLibris an Rosetta übergibt.
# Pfad zu Java 7 # Pfad zu Java 7
JAVAPATH=$(wildcard /usr/lib/jvm/java-1.7.0-openjdk-*/bin/) JAVAPATH=$(wildcard /usr/lib/jvm/java-8-openjdk-*/bin/)
# Verwendete Rosetta-Version # Verwendete Rosetta-Version
ROSETTAVERSION=4.1.0 ROSETTAVERSION=5.5.0
# Pfad zum Rosetta-SDK # Pfad zum Rosetta-SDK
ROSETTASDK=/exlibris/dps/d4_1/system.dir/dps-sdk-${ROSETTAVERSION}/lib/ ROSETTASDK=/exlibris/dps/d4_1/system.dir/dps-sdk-${ROSETTAVERSION}/lib/
......
...@@ -49,7 +49,7 @@ ...@@ -49,7 +49,7 @@
</fr:x_form> </fr:x_form>
</pl:initParameters> </pl:initParameters>
<pl:description>SLUB Virus Check Plugin using installed ClamAV daemon via tcp-sockets</pl:description> <pl:description>SLUB Virus Check Plugin using installed ClamAV daemon via tcp-sockets</pl:description>
<pl:version>1.4</pl:version> <pl:version>1.5</pl:version>
<pl:materialType>DIGITAL</pl:materialType> <pl:materialType>DIGITAL</pl:materialType>
<pl:module>Repository</pl:module> <pl:module>Repository</pl:module>
<pl:generalType>TASK</pl:generalType> <pl:generalType>TASK</pl:generalType>
......
...@@ -23,6 +23,7 @@ limitations under the License. ...@@ -23,6 +23,7 @@ limitations under the License.
package org.slub.rosetta.dps.repository.plugin; package org.slub.rosetta.dps.repository.plugin;
import com.exlibris.core.infra.common.exceptions.logging.ExLogger;
import com.exlibris.dps.repository.plugin.virusChcek.VirusCheckPlugin; import com.exlibris.dps.repository.plugin.virusChcek.VirusCheckPlugin;
import java.io.DataOutputStream; import java.io.DataOutputStream;
...@@ -35,7 +36,6 @@ import java.net.SocketException; ...@@ -35,7 +36,6 @@ import java.net.SocketException;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
/** /**
* SLUBVirusCheckClamAVPlugin * SLUBVirusCheckClamAVPlugin
* <p/> * <p/>
...@@ -57,6 +57,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -57,6 +57,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
private static final String RESPONSEOK = "stream: OK"; private static final String RESPONSEOK = "stream: OK";
private static final String FOUND_SUFFIX = "FOUND"; private static final String FOUND_SUFFIX = "FOUND";
private static final String STREAM_PREFIX = "stream: "; private static final String STREAM_PREFIX = "stream: ";
private static final ExLogger log = ExLogger.getExLogger(SLUBVirusCheckClamAVPlugin.class);
private int timeout; private int timeout;
private String host; private String host;
private int port; private int port;
...@@ -76,8 +78,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -76,8 +78,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
this.host = initp.get("host"); this.host = initp.get("host");
this.port = Integer.parseInt(initp.get("port")); this.port = Integer.parseInt(initp.get("port"));
this.timeout = Integer.parseInt(initp.get("timeout")); this.timeout = Integer.parseInt(initp.get("timeout"));
//log.info("SLUBVirusCheckPlugin instantiated with host=" + host + " port=" + port + " timeout=" + timeout); log.info("SLUBVirusCheckPlugin instantiated with host=" + host + " port=" + port + " timeout=" + timeout);
System.out.println("SLUBVirusCheckPlugin instantiated with host=" + host + " port=" + port + " timeout=" + timeout); //System.out.println("SLUBVirusCheckPlugin instantiated with host=" + host + " port=" + port + " timeout=" + timeout);
} }
/** stand alone check, main file to call local installed clamd /** stand alone check, main file to call local installed clamd
* @param args list of files which should be scanned * @param args list of files which should be scanned
...@@ -181,8 +183,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -181,8 +183,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
try { try {
socket.setSoTimeout(getTimeOut()); socket.setSoTimeout(getTimeOut());
} catch (SocketException e) { } catch (SocketException e) {
System.out.println("Could not set socket timeout to " + getTimeOut() + "ms " + e); //System.out.println("Could not set socket timeout to " + getTimeOut() + "ms " + e);
//log.error( "Could not set socket timeout to " + getTimeOut() + "ms", e); log.error( "Could not set socket timeout to " + getTimeOut() + "ms", e);
} }
return socket; return socket;
} }
...@@ -196,14 +198,14 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -196,14 +198,14 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
if (dos != null) try { if (dos != null) try {
dos.close(); dos.close();
} catch (IOException e) { } catch (IOException e) {
// log.debug("exception closing DOS", e); log.error("exception closing DOS", e);
System.out.println("exception closing DOS " + e); //System.out.println("exception closing DOS " + e);
} }
try { try {
socket.close(); socket.close();
} catch (IOException e) { } catch (IOException e) {
// log.debug("exception closing socket", e); log.error("exception closing socket", e);
System.out.println("exception closing socket " + e); //System.out.println("exception closing socket " + e);
} }
} }
...@@ -266,23 +268,26 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -266,23 +268,26 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
byte[] command = INSTREAM; byte[] command = INSTREAM;
callSocketCommandStream(socket, command, in); callSocketCommandStream(socket, command, in);
in.close(); in.close();
//log.debug( "Response: " + response);
System.out.println("Response: " + response.trim());
// parse return code
String result = response.trim(); String result = response.trim();
log.debug( "Response: " + result);
//System.out.println("Response: " + result);
// parse return code
if (RESPONSEOK.equals(result)) { if (RESPONSEOK.equals(result)) {
setStatus(Status.PASSED); setStatus(Status.PASSED);
log.info("scan of file '" + fileFullPath + "' passed");
} else if (result.endsWith(FOUND_SUFFIX)) { } else if (result.endsWith(FOUND_SUFFIX)) {
setStatus(Status.FAILED); setStatus(Status.FAILED);
setSignature(result.substring(STREAM_PREFIX.length(), result.lastIndexOf(FOUND_SUFFIX) - 1)); setSignature(result.substring(STREAM_PREFIX.length(), result.lastIndexOf(FOUND_SUFFIX) - 1));
log.info("scan of file '" + fileFullPath + "' failed");
} else { } else {
setStatus(Status.FAILED); setStatus(Status.FAILED);
//log.warn("clamd protocol not fully implemented"); log.warn("clamd protocol not fully implemented, result='" + result + "'");
System.out.println("clamd protocol not fully implemented"); //System.out.println("clamd protocol not fully implemented");
} }
} catch (IOException e) { } catch (IOException e) {
//log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e); log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
System.out.println("exception creation socket, clamd not available at host=" + host + "port=" + port + " " + e); //System.out.println("exception creation socket, clamd not available at host=" + host + "port=" + port + " " + e);
setStatus(Status.FAILED); setStatus(Status.FAILED);
setSignature("ERROR: clamd not available"); setSignature("ERROR: clamd not available");
} }
...@@ -309,8 +314,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin { ...@@ -309,8 +314,8 @@ public class SLUBVirusCheckClamAVPlugin implements VirusCheckPlugin {
callSocketCommand(socket, command); callSocketCommand(socket, command);
return response.trim(); return response.trim();
} catch (IOException e) { } catch (IOException e) {
//log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e); log.error("exception creation socket, clamd not available at host=" + host + "port=" + port, e);
System.out.println("exception creation socket, clamd not available at host=" + host + "port=" + port + " " + e); //System.out.println("exception creation socket, clamd not available at host=" + host + "port=" + port + " " + e);
setStatus(Status.FAILED); setStatus(Status.FAILED);
setSignature("ERROR: clamd not available"); setSignature("ERROR: clamd not available");
return "ERROR: clamd not available"; return "ERROR: clamd not available";
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment