JDBCDumpMessaggioStream.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.core.transazioni.dao.jdbc;

  21. import java.io.InputStream;
  22. import java.sql.Connection;
  23. import java.sql.PreparedStatement;
  24. import java.sql.ResultSet;

  25. /**
  26.  * JDBCDumpMessaggioStream
  27.  *
  28.  *
  29.  * @author Poli Andrea (apoli@link.it)
  30.  * @author $Author$
  31.  * @version $Rev$, $Date$
  32.  */
  33. public class JDBCDumpMessaggioStream {
  34.    
  35.     public JDBCDumpMessaggioStream(InputStream is,
  36.             ResultSet rs, PreparedStatement pstmt,
  37.             Connection con, JDBCServiceManager jdbcServiceManager) {
  38.         this.is = is;
  39.         this.rs = rs;
  40.         this.pstmt = pstmt;
  41.         this.con = con;
  42.         this.jdbcServiceManager = jdbcServiceManager;
  43.     }

  44.     private InputStream is;

  45.     private ResultSet rs;
  46.     private PreparedStatement pstmt;
  47.     private Connection con;
  48.     private JDBCServiceManager jdbcServiceManager;

  49.     public InputStream getIs() {
  50.         return this.is;
  51.     }
  52.    
  53.     public void closeJdbcResources() {
  54.         try {
  55.             if(this.rs!=null) {
  56.                 this.rs.close();
  57.             }
  58.         }catch(Exception eClose) {
  59.             // ignore
  60.         }
  61.         try {
  62.             if(this.pstmt!=null) {
  63.                 this.pstmt.close();
  64.             }
  65.         }catch(Exception eClose) {
  66.             // ignore
  67.         }
  68.         try {
  69.             if(this.con!=null && this.jdbcServiceManager!=null){
  70.                 this.jdbcServiceManager.closeConnection(this.con);
  71.             }
  72.         }catch(Exception eClose) {
  73.             // ignore
  74.         }
  75.     }
  76.    
  77.    
  78. }