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.core.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.core.statistiche.dao.IStatisticaInfoServiceSearch;
  26. import org.openspcoop2.core.statistiche.dao.IStatisticaInfoService;
  27. import org.openspcoop2.core.statistiche.dao.IStatisticaOrariaServiceSearch;
  28. import org.openspcoop2.core.statistiche.dao.IStatisticaOrariaService;
  29. import org.openspcoop2.core.statistiche.dao.IStatisticaGiornalieraServiceSearch;
  30. import org.openspcoop2.core.statistiche.dao.IStatisticaGiornalieraService;
  31. import org.openspcoop2.core.statistiche.dao.IStatisticaSettimanaleServiceSearch;
  32. import org.openspcoop2.core.statistiche.dao.IStatisticaSettimanaleService;
  33. import org.openspcoop2.core.statistiche.dao.IStatisticaMensileServiceSearch;
  34. import org.openspcoop2.core.statistiche.dao.IStatisticaMensileService;

  35. /**    
  36.  * Manager that allows you to obtain the services of research and management of objects
  37.  *
  38.  * @author Poli Andrea (poli@link.it)
  39.  * @author $Author$
  40.  * @version $Rev$, $Date$
  41.  */

  42. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  43.     private JDBCServiceManager unlimitedJdbcServiceManager;

  44.     public JDBCLimitedServiceManager(JDBCServiceManager jdbcServiceManager) {
  45.         this.datasource = jdbcServiceManager.getDatasourceInternalResource();
  46.         this.connection = jdbcServiceManager.getConnectionInternalResource();
  47.         this.log = jdbcServiceManager.getLoggerInternalResource();
  48.         this.jdbcProperties = jdbcServiceManager.getJdbcPropertiesInternalResource();
  49.         this.unlimitedJdbcServiceManager = jdbcServiceManager;
  50.     }
  51.    
  52.     private static final String CONNNECTION_MANAGED = "Connection managed from framework";
  53.    
  54.     @Override
  55.     public Connection getConnection() throws ServiceException {
  56.         throw new ServiceException(CONNNECTION_MANAGED);
  57.     }
  58.     @Override
  59.     public void closeConnection(Connection connection) throws ServiceException {
  60.         throw new ServiceException(CONNNECTION_MANAGED);
  61.     }
  62.     @Override
  63.     protected Connection getConnectionInternalResource() {
  64.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  65.     }
  66.     @Override
  67.     protected DataSource getDatasourceInternalResource() {
  68.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  69.     }
  70.    
  71.    
  72.    
  73.     /*
  74.      =====================================================================================================================
  75.      Services relating to the object with name:statistica-info type:statistica-info
  76.      =====================================================================================================================
  77.     */
  78.    
  79.     /**
  80.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaInfo}
  81.      *
  82.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaInfo}  
  83.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  84.      * @throws NotImplementedException Exception thrown when the method is not implemented
  85.      */
  86.     @Override
  87.     public IStatisticaInfoServiceSearch getStatisticaInfoServiceSearch() throws ServiceException,NotImplementedException{
  88.         return new JDBCStatisticaInfoServiceSearch(this.unlimitedJdbcServiceManager);
  89.     }
  90.    
  91.     /**
  92.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaInfo}
  93.      *
  94.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaInfo}    
  95.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  96.      * @throws NotImplementedException Exception thrown when the method is not implemented
  97.      */
  98.     @Override
  99.     public IStatisticaInfoService getStatisticaInfoService() throws ServiceException,NotImplementedException{
  100.         return new JDBCStatisticaInfoService(this.unlimitedJdbcServiceManager);
  101.     }
  102.    
  103.    
  104.    
  105.     /*
  106.      =====================================================================================================================
  107.      Services relating to the object with name:statistica-oraria type:statistica-oraria
  108.      =====================================================================================================================
  109.     */
  110.    
  111.     /**
  112.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaOraria}
  113.      *
  114.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaOraria}
  115.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  116.      * @throws NotImplementedException Exception thrown when the method is not implemented
  117.      */
  118.     @Override
  119.     public IStatisticaOrariaServiceSearch getStatisticaOrariaServiceSearch() throws ServiceException,NotImplementedException{
  120.         return new JDBCStatisticaOrariaServiceSearch(this.unlimitedJdbcServiceManager);
  121.     }
  122.    
  123.     /**
  124.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaOraria}
  125.      *
  126.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaOraria}  
  127.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  128.      * @throws NotImplementedException Exception thrown when the method is not implemented
  129.      */
  130.     @Override
  131.     public IStatisticaOrariaService getStatisticaOrariaService() throws ServiceException,NotImplementedException{
  132.         return new JDBCStatisticaOrariaService(this.unlimitedJdbcServiceManager);
  133.     }
  134.    
  135.    
  136.    
  137.     /*
  138.      =====================================================================================================================
  139.      Services relating to the object with name:statistica-giornaliera type:statistica-giornaliera
  140.      =====================================================================================================================
  141.     */
  142.    
  143.     /**
  144.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaGiornaliera}
  145.      *
  146.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaGiornaliera}    
  147.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  148.      * @throws NotImplementedException Exception thrown when the method is not implemented
  149.      */
  150.     @Override
  151.     public IStatisticaGiornalieraServiceSearch getStatisticaGiornalieraServiceSearch() throws ServiceException,NotImplementedException{
  152.         return new JDBCStatisticaGiornalieraServiceSearch(this.unlimitedJdbcServiceManager);
  153.     }
  154.    
  155.     /**
  156.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaGiornaliera}
  157.      *
  158.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaGiornaliera}
  159.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  160.      * @throws NotImplementedException Exception thrown when the method is not implemented
  161.      */
  162.     @Override
  163.     public IStatisticaGiornalieraService getStatisticaGiornalieraService() throws ServiceException,NotImplementedException{
  164.         return new JDBCStatisticaGiornalieraService(this.unlimitedJdbcServiceManager);
  165.     }
  166.    
  167.    
  168.    
  169.     /*
  170.      =====================================================================================================================
  171.      Services relating to the object with name:statistica-settimanale type:statistica-settimanale
  172.      =====================================================================================================================
  173.     */
  174.    
  175.     /**
  176.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaSettimanale}
  177.      *
  178.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaSettimanale}    
  179.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  180.      * @throws NotImplementedException Exception thrown when the method is not implemented
  181.      */
  182.     @Override
  183.     public IStatisticaSettimanaleServiceSearch getStatisticaSettimanaleServiceSearch() throws ServiceException,NotImplementedException{
  184.         return new JDBCStatisticaSettimanaleServiceSearch(this.unlimitedJdbcServiceManager);
  185.     }
  186.    
  187.     /**
  188.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaSettimanale}
  189.      *
  190.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaSettimanale}
  191.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  192.      * @throws NotImplementedException Exception thrown when the method is not implemented
  193.      */
  194.     @Override
  195.     public IStatisticaSettimanaleService getStatisticaSettimanaleService() throws ServiceException,NotImplementedException{
  196.         return new JDBCStatisticaSettimanaleService(this.unlimitedJdbcServiceManager);
  197.     }
  198.    
  199.    
  200.    
  201.     /*
  202.      =====================================================================================================================
  203.      Services relating to the object with name:statistica-mensile type:statistica-mensile
  204.      =====================================================================================================================
  205.     */
  206.    
  207.     /**
  208.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaMensile}
  209.      *
  210.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaMensile}    
  211.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  212.      * @throws NotImplementedException Exception thrown when the method is not implemented
  213.      */
  214.     @Override
  215.     public IStatisticaMensileServiceSearch getStatisticaMensileServiceSearch() throws ServiceException,NotImplementedException{
  216.         return new JDBCStatisticaMensileServiceSearch(this.unlimitedJdbcServiceManager);
  217.     }
  218.    
  219.     /**
  220.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaMensile}
  221.      *
  222.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.statistiche.StatisticaMensile}
  223.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  224.      * @throws NotImplementedException Exception thrown when the method is not implemented
  225.      */
  226.     @Override
  227.     public IStatisticaMensileService getStatisticaMensileService() throws ServiceException,NotImplementedException{
  228.         return new JDBCStatisticaMensileService(this.unlimitedJdbcServiceManager);
  229.     }
  230.    
  231.    
  232.    
  233. }