es.gob.afirma.standalone.ui.restoreconfig.RestoreConfigManager Maven / Gradle / Ivy
/* Copyright (C) 2011 [Gobierno de Espana]
* This file is part of "Cliente @Firma".
* "Cliente @Firma" is free software; you can redistribute it and/or modify it under the terms of:
* - the GNU General Public License as published by the Free Software Foundation;
* either version 2 of the License, or (at your option) any later version.
* - or The European Software License; either version 1.1 or (at your option) any later version.
* You may contact the copyright holder at: [email protected]
*/
package es.gob.afirma.standalone.ui.restoreconfig;
import java.util.logging.Logger;
import es.gob.afirma.core.misc.Platform;
/**
* Clase que contiene la lógica para iniciar el proceso de restauración decidiendo
* el sistema operativo objetivo.
*
*/
public class RestoreConfigManager {
private static final Logger LOGGER = Logger.getLogger("es.gob.afirma"); //$NON-NLS-1$
private RestoreConfig configurator;
/**
* Constructor del restaurador de configuración
* de Autofirma
*/
public RestoreConfigManager() {
if (Platform.OS.WINDOWS.equals(Platform.getOS())) {
this.configurator = new RestoreConfigWindows();
}
else if (Platform.OS.LINUX == Platform.getOS()){
this.configurator = new RestoreConfigLinux();
}
else if (Platform.OS.MACOSX == Platform.getOS()){
this.configurator = new RestoreConfigMacOSX();
}
else {
LOGGER.warning(
"El sistema operativo '" + Platform.getOS() + "' no tiene definida una secuencia de configuracion/desinstalacion" //$NON-NLS-1$ //$NON-NLS-2$
);
this.configurator = null;
}
}
/** Repara la configuración de navegadores para permitir la correcta ejecución de AutoFirma.
* @param configPanel Panel de configuración con las trazas de ejecución. */
public void restoreConfigAutoFirma(final RestoreConfigPanel configPanel) {
if (this.configurator == null) {
LOGGER.warning("No se realizara ninguna accion"); //$NON-NLS-1$
return;
}
this.configurator.restore(configPanel);
}
}