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.allarmi.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.allarmi.dao.IAllarmeServiceSearch;
  26. import org.openspcoop2.core.allarmi.dao.IAllarmeService;
  27. import org.openspcoop2.core.allarmi.dao.IAllarmeHistoryServiceSearch;
  28. import org.openspcoop2.core.allarmi.dao.IAllarmeHistoryService;
  29. import org.openspcoop2.core.allarmi.dao.IAllarmeNotificaServiceSearch;
  30. import org.openspcoop2.core.allarmi.dao.IAllarmeNotificaService;

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

  38. public class JDBCLimitedServiceManager extends JDBCServiceManager {

  39.     private JDBCServiceManager unlimitedJdbcServiceManager;

  40.     public JDBCLimitedServiceManager(JDBCServiceManager jdbcServiceManager) {
  41.         this.datasource = jdbcServiceManager.getDatasourceInternalResource();
  42.         this.connection = jdbcServiceManager.getConnectionInternalResource();
  43.         this.log = jdbcServiceManager.getLoggerInternalResource();
  44.         this.jdbcProperties = jdbcServiceManager.getJdbcPropertiesInternalResource();
  45.         this.unlimitedJdbcServiceManager = jdbcServiceManager;
  46.     }
  47.    
  48.     private static final String CONNNECTION_MANAGED = "Connection managed from framework";
  49.    
  50.     @Override
  51.     public Connection getConnection() throws ServiceException {
  52.         throw new ServiceException(CONNNECTION_MANAGED);
  53.     }
  54.     @Override
  55.     public void closeConnection(Connection connection) throws ServiceException {
  56.         throw new ServiceException(CONNNECTION_MANAGED);
  57.     }
  58.     @Override
  59.     protected Connection getConnectionInternalResource() {
  60.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  61.     }
  62.     @Override
  63.     protected DataSource getDatasourceInternalResource() {
  64.         throw new org.openspcoop2.utils.UtilsRuntimeException(CONNNECTION_MANAGED);
  65.     }
  66.    
  67.    
  68.    
  69.     /*
  70.      =====================================================================================================================
  71.      Services relating to the object with name:allarme type:allarme
  72.      =====================================================================================================================
  73.     */
  74.    
  75.     /**
  76.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}
  77.      *
  78.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}  
  79.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  80.      * @throws NotImplementedException Exception thrown when the method is not implemented
  81.      */
  82.     @Override
  83.     public IAllarmeServiceSearch getAllarmeServiceSearch() throws ServiceException,NotImplementedException{
  84.         return new JDBCAllarmeServiceSearch(this.unlimitedJdbcServiceManager);
  85.     }
  86.    
  87.     /**
  88.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}
  89.      *
  90.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}  
  91.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  92.      * @throws NotImplementedException Exception thrown when the method is not implemented
  93.      */
  94.     @Override
  95.     public IAllarmeService getAllarmeService() throws ServiceException,NotImplementedException{
  96.         return new JDBCAllarmeService(this.unlimitedJdbcServiceManager);
  97.     }
  98.    
  99.    
  100.    
  101.     /*
  102.      =====================================================================================================================
  103.      Services relating to the object with name:allarme-history type:allarme-history
  104.      =====================================================================================================================
  105.     */
  106.    
  107.     /**
  108.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}
  109.      *
  110.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}  
  111.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  112.      * @throws NotImplementedException Exception thrown when the method is not implemented
  113.      */
  114.     @Override
  115.     public IAllarmeHistoryServiceSearch getAllarmeHistoryServiceSearch() throws ServiceException,NotImplementedException{
  116.         return new JDBCAllarmeHistoryServiceSearch(this.unlimitedJdbcServiceManager);
  117.     }
  118.    
  119.     /**
  120.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}
  121.      *
  122.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}    
  123.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  124.      * @throws NotImplementedException Exception thrown when the method is not implemented
  125.      */
  126.     @Override
  127.     public IAllarmeHistoryService getAllarmeHistoryService() throws ServiceException,NotImplementedException{
  128.         return new JDBCAllarmeHistoryService(this.unlimitedJdbcServiceManager);
  129.     }
  130.    
  131.    
  132.    
  133.     /*
  134.      =====================================================================================================================
  135.      Services relating to the object with name:allarme-notifica type:allarme-notifica
  136.      =====================================================================================================================
  137.     */
  138.    
  139.     /**
  140.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}
  141.      *
  142.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}  
  143.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  144.      * @throws NotImplementedException Exception thrown when the method is not implemented
  145.      */
  146.     @Override
  147.     public IAllarmeNotificaServiceSearch getAllarmeNotificaServiceSearch() throws ServiceException,NotImplementedException{
  148.         return new JDBCAllarmeNotificaServiceSearch(this.unlimitedJdbcServiceManager);
  149.     }
  150.    
  151.     /**
  152.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}
  153.      *
  154.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}  
  155.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  156.      * @throws NotImplementedException Exception thrown when the method is not implemented
  157.      */
  158.     @Override
  159.     public IAllarmeNotificaService getAllarmeNotificaService() throws ServiceException,NotImplementedException{
  160.         return new JDBCAllarmeNotificaService(this.unlimitedJdbcServiceManager);
  161.     }
  162.    
  163.    
  164.    
  165. }