TransactionProcessor.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.transaction;

  21. import org.apache.logging.log4j.Level;
  22. import org.openspcoop2.core.commons.dao.DAOFactory;
  23. import org.openspcoop2.monitor.engine.config.LoggerManager;
  24. import org.openspcoop2.monitor.engine.config.MonitorProperties;
  25. import org.openspcoop2.monitor.engine.constants.CostantiConfigurazione;

  26. import org.slf4j.Logger;
  27. import org.openspcoop2.protocol.engine.ProtocolFactoryManager;
  28. import org.openspcoop2.protocol.sdk.ConfigurazionePdD;
  29. import org.openspcoop2.utils.LoggerWrapperFactory;
  30. import org.openspcoop2.utils.resources.Loader;

  31. /**
  32.  * TransactionProcessor
  33.  *
  34.  * @author Poli Andrea (apoli@link.it)
  35.  * @author $Author$
  36.  * @version $Rev$, $Date$
  37.  */
  38. public class TransactionProcessor {
  39.    
  40.     public static void main(String[] args) throws Exception {
  41.        
  42.         LoggerWrapperFactory.setDefaultConsoleLogConfiguration(Level.ERROR);
  43.        
  44.         LoggerManager.initLogger();
  45.        
  46.         Logger logCore = LoggerWrapperFactory.getLogger("org.openspcoop2.monitor.engine.transaction");
  47.         Logger logSql = LoggerWrapperFactory.getLogger("org.openspcoop2.monitor.engine.transaction.sql");
  48.        
  49.         boolean debug = true;
  50.         int poolSize = 5;
  51.         int msgForThread = 10;
  52.        
  53.         String protocolloDefault = MonitorProperties.getInstance(logCore).getProperty(CostantiConfigurazione.PDD_MONITOR_DEFAULT_PROTOCOL, false, true);
  54.         ConfigurazionePdD configPdD = new ConfigurazionePdD();
  55.         configPdD.setLoader(new Loader());
  56.         configPdD.setLog(logCore);
  57.         configPdD.setAttesaAttivaJDBC(-1);
  58.         configPdD.setCheckIntervalJDBC(-1);
  59.         configPdD.setConfigurationDir(null);
  60.         ProtocolFactoryManager.initialize(logCore, configPdD, protocolloDefault);
  61.        
  62.         DAOFactory daoFactory = DAOFactory.getInstance(logSql);
  63.        
  64.         TransactionLibrary.process(logCore,daoFactory,debug,poolSize,msgForThread);
  65.     }

  66. }