Thema dieser Dokumentation / Das FirstSpirit 5 Modul- / Komponenten-Modell / Modul-Implementierung mit den Komponenten-Typen - PUBLIC, SERVICE, LIBRARY / Die PUBLIC-Komponente des Moduls

Die PUBLIC-Komponente des Moduls

Class: de.espirit.firstspirit.opt.vscan.VScanFilterProxy

Klasse: VScanFilterProxy

Package: de.espirit.firstspirit.opt.vscan

Erweitert die Klasse FileBasedUploadFilter, welche wiederum UploadFilter implementiert. Daraus ergibt sich der schon zuvor angesprochene Komponenten-Typ Public(siehe auch Public). Alle Aufrufe der Klasse werden an VscanServiceImpl delegiert.

Listing: de.espirit.firstspirit.opt.vscan.VScanFilterProxy

package de.espirit.firstspirit.opt.vscan;

import de.espirit.common.base.Logging;
import de.espirit.firstspirit.server.mediamanagement.FileBasedUploadFilter;

import java.io.File;
import java.io.IOException;

public class VScanFilterProxy extends FileBasedUploadFilter {

public static final String ENGINE_NAME = "VScanFilterProxy"; // NON-NLS
public static final Class<?> LOGGER = VScanFilterProxy.class;

public VScanFilterProxy() {
// no arg constructor needed, called from super class
}

@Override
public void init() {
if (Logging.isDebugEnabled(LOGGER)) {
Logging.logDebug("VScanFilterProxy.init() - ", LOGGER); // NON-NLS
}
}

// -- get VScanService, get VScanServiceConfiguration -- //

/**
* Get the VScanService by the serviceLocator
*
* @return the VScanService
*/
private VScanService getVScanService() {
return (VScanService) getServiceLocator()
.getService(VScanService.MODULE_SERVICE_NAME);
}

// -- Filter, Execute, Grant or Reject -- //

/** {@inheritDoc} */
@Override
public void doFilter(final File tempFile) throws IOException {
try {
getVScanService().scanFile(tempFile);
} catch (ClassNotFoundException e) {
Logging.logInfo("Loading of virus scanning engine failed!",
e, LOGGER); // NON-NLS
throw new IOException("Loading of virus scanning engine failed!");
}
}

}

© 2005 - 2024 Crownpeak Technology GmbH | Alle Rechte vorbehalten. | FirstSpirit 2024.4 | Datenschutz