JDBCLimitedServiceManager.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.config.statistiche.dao.jdbc;

  21. import org.openspcoop2.generic_project.exception.NotImplementedException;
  22. import org.openspcoop2.generic_project.exception.ServiceException;

  23. import java.sql.Connection;

  24. import javax.sql.DataSource;

  25. import org.openspcoop2.monitor.engine.config.statistiche.dao.IConfigurazioneStatisticaServiceSearch;
  26. import org.openspcoop2.monitor.engine.config.statistiche.dao.IConfigurazioneStatisticaService;

  27. /**    
  28.  * Manager that allows you to obtain the services of research and management of objects
  29.  *
  30.  * @author Poli Andrea (poli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */

  34. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  35.     private JDBCServiceManager unlimitedJdbcServiceManager;

  36.     public JDBCLimitedServiceManager(JDBCServiceManager jdbcServiceManager) {
  37.         this.datasource = jdbcServiceManager.getDatasourceInternalResource();
  38.         this.connection = jdbcServiceManager.getConnectionInternalResource();
  39.         this.log = jdbcServiceManager.getLoggerInternalResource();
  40.         this.jdbcProperties = jdbcServiceManager.getJdbcPropertiesInternalResource();
  41.         this.unlimitedJdbcServiceManager = jdbcServiceManager;
  42.     }
  43.    
  44.     private static final String CONNNECTION_MANAGED = "Connection managed from framework";
  45.    
  46.     @Override
  47.     public Connection getConnection() throws ServiceException {
  48.         throw new ServiceException(CONNNECTION_MANAGED);
  49.     }
  50.     @Override
  51.     public void closeConnection(Connection connection) throws ServiceException {
  52.         throw new ServiceException(CONNNECTION_MANAGED);
  53.     }
  54.     @Override
  55.     protected Connection getConnectionInternalResource() {
  56.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  57.     }
  58.     @Override
  59.     protected DataSource getDatasourceInternalResource() {
  60.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  61.     }
  62.    
  63.    
  64.    
  65.     /*
  66.      =====================================================================================================================
  67.      Services relating to the object with name:configurazione-statistica type:configurazione-statistica
  68.      =====================================================================================================================
  69.     */
  70.    
  71.     /**
  72.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.monitor.engine.config.statistiche.ConfigurazioneStatistica}
  73.      *
  74.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.monitor.engine.config.statistiche.ConfigurazioneStatistica}    
  75.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  76.      * @throws NotImplementedException Exception thrown when the method is not implemented
  77.      */
  78.     @Override
  79.     public IConfigurazioneStatisticaServiceSearch getConfigurazioneStatisticaServiceSearch() throws ServiceException,NotImplementedException{
  80.         return new JDBCConfigurazioneStatisticaServiceSearch(this.unlimitedJdbcServiceManager);
  81.     }
  82.    
  83.     /**
  84.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.monitor.engine.config.statistiche.ConfigurazioneStatistica}
  85.      *
  86.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.monitor.engine.config.statistiche.ConfigurazioneStatistica}
  87.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  88.      * @throws NotImplementedException Exception thrown when the method is not implemented
  89.      */
  90.     @Override
  91.     public IConfigurazioneStatisticaService getConfigurazioneStatisticaService() throws ServiceException,NotImplementedException{
  92.         return new JDBCConfigurazioneStatisticaService(this.unlimitedJdbcServiceManager);
  93.     }
  94.    
  95.    
  96.    
  97. }