ProtocolPropertiesCore.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.web.ctrlstat.servlet.protocol_properties;

  21. import java.sql.Connection;

  22. import org.openspcoop2.core.config.driver.DriverConfigurazioneException;
  23. import org.openspcoop2.core.registry.ProtocolProperty;
  24. import org.openspcoop2.core.registry.driver.DriverRegistroServiziException;
  25. import org.openspcoop2.web.ctrlstat.core.ControlStationCore;
  26. import org.openspcoop2.web.ctrlstat.driver.DriverControlStationDB;

  27. /**
  28.  * ProtocolPropertiesCore
  29.  *
  30.  * @author Pintori Giuliano (pintori@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */
  34. public class ProtocolPropertiesCore  extends ControlStationCore {

  35.     public ProtocolPropertiesCore() throws Exception {
  36.         super();
  37.     }
  38.     public ProtocolPropertiesCore(ControlStationCore core) throws Exception {
  39.         super(core);
  40.     }
  41.    
  42.     public ProtocolProperty getProtocolPropertyBinaria(long idProperty) throws DriverRegistroServiziException {
  43.         Connection con = null;
  44.         String nomeMetodo = "getProtocolPropertyBinaria";
  45.         DriverControlStationDB driver = null;

  46.         try {
  47.             // prendo una connessione
  48.             con = ControlStationCore.dbM.getConnection();
  49.             // istanzio il driver
  50.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  51.             return driver.getDriverRegistroServiziDB().getProtocolProperty(idProperty);
  52.         }  catch (Exception e) {
  53.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  54.             throw new DriverRegistroServiziException(getPrefixError(nomeMetodo,  e),e);
  55.         } finally {
  56.             ControlStationCore.dbM.releaseConnection(con);
  57.         }
  58.     }
  59.    
  60.     public org.openspcoop2.core.config.ProtocolProperty getProtocolPropertyConfigBinaria(long idProperty) throws DriverConfigurazioneException {
  61.         Connection con = null;
  62.         String nomeMetodo = "getProtocolPropertyConfigBinaria";
  63.         DriverControlStationDB driver = null;

  64.         try {
  65.             // prendo una connessione
  66.             con = ControlStationCore.dbM.getConnection();
  67.             // istanzio il driver
  68.             driver = new DriverControlStationDB(con, null, this.tipoDB);

  69.             return driver.getDriverConfigurazioneDB().getProtocolProperty(idProperty);
  70.         }  catch (Exception e) {
  71.             ControlStationCore.logError(getPrefixError(nomeMetodo,  e), e);
  72.             throw new DriverConfigurazioneException(getPrefixError(nomeMetodo,  e),e);
  73.         } finally {
  74.             ControlStationCore.dbM.releaseConnection(con);
  75.         }
  76.     }
  77. }