FSRecoveryEventiImpl.java

  1. /*
  2.  * GovWay - A customizable API Gateway
  3.  * https://govway.org
  4.  *
  5.  * Copyright (c) 2005-2025 Link.it srl (https://link.it).
  6.  *
  7.  * This program is free software: you can redistribute it and/or modify
  8.  * it under the terms of the GNU General Public License version 3, as published by
  9.  * the Free Software Foundation.
  10.  *
  11.  * This program is distributed in the hope that it will be useful,
  12.  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  * GNU General Public License for more details.
  15.  *
  16.  * You should have received a copy of the GNU General Public License
  17.  * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  18.  *
  19.  */
  20. package org.openspcoop2.monitor.engine.fs_recovery;

  21. import org.openspcoop2.core.eventi.Evento;
  22. import org.openspcoop2.core.eventi.utils.serializer.JaxbDeserializer;
  23. import org.openspcoop2.utils.UtilsException;
  24. import org.openspcoop2.utils.UtilsMultiException;

  25. import java.io.File;
  26. import java.sql.Connection;

  27. import org.slf4j.Logger;

  28. /**
  29.  * FSRecoveryEventiImpl
  30.  *
  31.  * @author Poli Andrea (apoli@link.it)
  32.  * @author $Author$
  33.  * @version $Rev$, $Date$
  34.  */
  35. public class FSRecoveryEventiImpl extends AbstractFSRecovery {
  36.     private org.openspcoop2.core.eventi.dao.IServiceManager pluginsEventiSM;

  37.     public FSRecoveryEventiImpl(
  38.             Logger log,
  39.             boolean debug,
  40.             org.openspcoop2.core.eventi.dao.IServiceManager pluginsEventiSM,
  41.             File directory, File directoryDLQ,
  42.             int tentativi,
  43.             long msAttesaProcessingFile) {
  44.         super(log, debug, directory, directoryDLQ, tentativi, msAttesaProcessingFile);
  45.         this.pluginsEventiSM = pluginsEventiSM;
  46.     }

  47.     @Override
  48.     public void process(Connection connection) {
  49.         this.log.info("Recovery Eventi ...");
  50.         super.process(connection);
  51.         this.log.info("Recovery Eventi completato");
  52.     }

  53.     @Override
  54.     public void insertObject(File file, Connection connection) throws UtilsException, UtilsMultiException {
  55.         JaxbDeserializer deserializer = new JaxbDeserializer();
  56.         try {
  57.             Evento evento = deserializer.readEvento(file);
  58.             this.pluginsEventiSM.getEventoService().create(evento);
  59.         }catch(Exception e) {
  60.             throw new UtilsException(e.getMessage(),e);
  61.         }
  62.     }


  63. }