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.plugins.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.plugins.dao.IPluginServiceSearch;
  26. import org.openspcoop2.core.plugins.dao.IPluginService;
  27. import org.openspcoop2.core.plugins.dao.IConfigurazioneServizioServiceSearch;
  28. import org.openspcoop2.core.plugins.dao.IConfigurazioneServizioService;
  29. import org.openspcoop2.core.plugins.dao.IConfigurazioneServizioAzioneServiceSearch;
  30. import org.openspcoop2.core.plugins.dao.IConfigurazioneServizioAzioneService;
  31. import org.openspcoop2.core.plugins.dao.IConfigurazioneFiltroServiceSearch;
  32. import org.openspcoop2.core.plugins.dao.IConfigurazioneFiltroService;

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

  40. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  41.     private JDBCServiceManager unlimitedJdbcServiceManager;

  42.     public JDBCLimitedServiceManager(JDBCServiceManager jdbcServiceManager) {
  43.         this.datasource = jdbcServiceManager.getDatasourceInternalResource();
  44.         this.connection = jdbcServiceManager.getConnectionInternalResource();
  45.         this.log = jdbcServiceManager.getLoggerInternalResource();
  46.         this.jdbcProperties = jdbcServiceManager.getJdbcPropertiesInternalResource();
  47.         this.unlimitedJdbcServiceManager = jdbcServiceManager;
  48.     }
  49.    
  50.     private static final String CONNNECTION_MANAGED = "Connection managed from framework";
  51.    
  52.     @Override
  53.     public Connection getConnection() throws ServiceException {
  54.         throw new ServiceException(CONNNECTION_MANAGED);
  55.     }
  56.     @Override
  57.     public void closeConnection(Connection connection) throws ServiceException {
  58.         throw new ServiceException(CONNNECTION_MANAGED);
  59.     }
  60.     @Override
  61.     protected Connection getConnectionInternalResource() {
  62.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  63.     }
  64.     @Override
  65.     protected DataSource getDatasourceInternalResource() {
  66.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  67.     }
  68.    
  69.    
  70.    
  71.     /*
  72.      =====================================================================================================================
  73.      Services relating to the object with name:plugin type:plugin
  74.      =====================================================================================================================
  75.     */
  76.    
  77.     /**
  78.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.Plugin}
  79.      *
  80.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.Plugin}  
  81.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  82.      * @throws NotImplementedException Exception thrown when the method is not implemented
  83.      */
  84.     @Override
  85.     public IPluginServiceSearch getPluginServiceSearch() throws ServiceException,NotImplementedException{
  86.         return new JDBCPluginServiceSearch(this.unlimitedJdbcServiceManager);
  87.     }
  88.    
  89.     /**
  90.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.Plugin}
  91.      *
  92.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.Plugin}    
  93.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  94.      * @throws NotImplementedException Exception thrown when the method is not implemented
  95.      */
  96.     @Override
  97.     public IPluginService getPluginService() throws ServiceException,NotImplementedException{
  98.         return new JDBCPluginService(this.unlimitedJdbcServiceManager);
  99.     }
  100.    
  101.    
  102.    
  103.     /*
  104.      =====================================================================================================================
  105.      Services relating to the object with name:configurazione-servizio type:configurazione-servizio
  106.      =====================================================================================================================
  107.     */
  108.    
  109.     /**
  110.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizio}
  111.      *
  112.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizio}  
  113.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  114.      * @throws NotImplementedException Exception thrown when the method is not implemented
  115.      */
  116.     @Override
  117.     public IConfigurazioneServizioServiceSearch getConfigurazioneServizioServiceSearch() throws ServiceException,NotImplementedException{
  118.         return new JDBCConfigurazioneServizioServiceSearch(this.unlimitedJdbcServiceManager);
  119.     }
  120.    
  121.     /**
  122.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizio}
  123.      *
  124.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizio}    
  125.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  126.      * @throws NotImplementedException Exception thrown when the method is not implemented
  127.      */
  128.     @Override
  129.     public IConfigurazioneServizioService getConfigurazioneServizioService() throws ServiceException,NotImplementedException{
  130.         return new JDBCConfigurazioneServizioService(this.unlimitedJdbcServiceManager);
  131.     }
  132.    
  133.    
  134.    
  135.     /*
  136.      =====================================================================================================================
  137.      Services relating to the object with name:configurazione-servizio-azione type:configurazione-servizio-azione
  138.      =====================================================================================================================
  139.     */
  140.    
  141.     /**
  142.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizioAzione}
  143.      *
  144.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizioAzione}
  145.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  146.      * @throws NotImplementedException Exception thrown when the method is not implemented
  147.      */
  148.     @Override
  149.     public IConfigurazioneServizioAzioneServiceSearch getConfigurazioneServizioAzioneServiceSearch() throws ServiceException,NotImplementedException{
  150.         return new JDBCConfigurazioneServizioAzioneServiceSearch(this.unlimitedJdbcServiceManager);
  151.     }
  152.    
  153.     /**
  154.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizioAzione}
  155.      *
  156.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneServizioAzione}  
  157.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  158.      * @throws NotImplementedException Exception thrown when the method is not implemented
  159.      */
  160.     @Override
  161.     public IConfigurazioneServizioAzioneService getConfigurazioneServizioAzioneService() throws ServiceException,NotImplementedException{
  162.         return new JDBCConfigurazioneServizioAzioneService(this.unlimitedJdbcServiceManager);
  163.     }
  164.    
  165.    
  166.    
  167.     /*
  168.      =====================================================================================================================
  169.      Services relating to the object with name:configurazione-filtro type:configurazione-filtro
  170.      =====================================================================================================================
  171.     */
  172.    
  173.     /**
  174.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneFiltro}
  175.      *
  176.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneFiltro}
  177.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  178.      * @throws NotImplementedException Exception thrown when the method is not implemented
  179.      */
  180.     @Override
  181.     public IConfigurazioneFiltroServiceSearch getConfigurazioneFiltroServiceSearch() throws ServiceException,NotImplementedException{
  182.         return new JDBCConfigurazioneFiltroServiceSearch(this.unlimitedJdbcServiceManager);
  183.     }
  184.    
  185.     /**
  186.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneFiltro}
  187.      *
  188.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.plugins.ConfigurazioneFiltro}  
  189.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  190.      * @throws NotImplementedException Exception thrown when the method is not implemented
  191.      */
  192.     @Override
  193.     public IConfigurazioneFiltroService getConfigurazioneFiltroService() throws ServiceException,NotImplementedException{
  194.         return new JDBCConfigurazioneFiltroService(this.unlimitedJdbcServiceManager);
  195.     }
  196.    
  197.    
  198.    
  199. }