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. import org.openspcoop2.core.statistiche.dao.IStatistichePdndTracingServiceSearch;
  36. import org.openspcoop2.core.statistiche.dao.IStatistichePdndTracingService;

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

  45. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  46.     private JDBCServiceManager unlimitedJdbcServiceManager;

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