FSRecoveryTracceImpl.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 java.io.File;
  22. import java.sql.Connection;

  23. import org.slf4j.Logger;
  24. import org.openspcoop2.core.tracciamento.Traccia;
  25. import org.openspcoop2.core.tracciamento.utils.serializer.JaxbDeserializer;
  26. import org.openspcoop2.protocol.sdk.tracciamento.ITracciaProducer;
  27. import org.openspcoop2.utils.UtilsException;
  28. import org.openspcoop2.utils.UtilsMultiException;

  29. /**
  30.  * FSRecoveryTracceImpl
  31.  *
  32.  * @author Poli Andrea (apoli@link.it)
  33.  * @author $Author$
  34.  * @version $Rev$, $Date$
  35.  */
  36. public class FSRecoveryTracceImpl extends AbstractFSRecovery {
  37.     private ITracciaProducer tracciamentoAppender;

  38.     public FSRecoveryTracceImpl(
  39.             Logger log,
  40.             boolean debug,
  41.             ITracciaProducer tracciamentoAppender,
  42.             File directory, File directoryDLQ,
  43.             int tentativi,
  44.             long msAttesaProcessingFile) {
  45.         super(log, debug, directory, directoryDLQ, tentativi, msAttesaProcessingFile);
  46.         this.tracciamentoAppender = tracciamentoAppender;
  47.     }

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

  54.     @Override
  55.     public void insertObject(File file, Connection connection) throws UtilsException, UtilsMultiException {
  56.         JaxbDeserializer deserializer = new JaxbDeserializer();
  57.         Traccia traccia = null;
  58.         try {
  59.             traccia = deserializer.readTraccia(file);
  60.         }catch(Exception e) {
  61.             throw new UtilsException(e.getMessage(),e);
  62.         }
  63.         org.openspcoop2.protocol.sdk.tracciamento.Traccia tracciaOp2 = new org.openspcoop2.protocol.sdk.tracciamento.Traccia(traccia);
  64.         try {
  65.             this.tracciamentoAppender.log(connection, tracciaOp2);
  66.         }catch(Exception e) {
  67.             throw new UtilsException(e.getMessage(),e);
  68.         }
  69.     }


  70. }