JDBCServiceManager.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 org.openspcoop2.generic_project.dao.jdbc.JDBCServiceManagerProperties;
  24. import org.openspcoop2.generic_project.utils.ServiceManagerProperties;

  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. import org.openspcoop2.core.allarmi.dao.IServiceManager;

  32. import java.sql.Connection;
  33. import java.util.Properties;

  34. import javax.sql.DataSource;

  35. import org.slf4j.Logger;

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

  43. public class JDBCServiceManager extends org.openspcoop2.generic_project.dao.jdbc.JDBCServiceManagerBase implements IServiceManager {

  44.     protected Connection getConnectionInternalResource() {
  45.         return this.connection;
  46.     }
  47.     protected DataSource getDatasourceInternalResource() {
  48.         return this.datasource;
  49.     }
  50.     protected JDBCServiceManagerProperties getJdbcPropertiesInternalResource(){
  51.         return this.jdbcProperties;
  52.     }
  53.     protected Logger getLoggerInternalResource(){
  54.         return this.log;
  55.     }
  56.     @Override
  57.     protected Connection getConnection() throws ServiceException {
  58.         try{
  59.             return super.getConnection();
  60.         }catch(Exception e){
  61.             throw new ServiceException(e.getMessage(),e);
  62.         }
  63.     }
  64.     @Override
  65.     protected void closeConnection(Connection connection) throws ServiceException {
  66.         try{
  67.             super.closeConnection(connection);
  68.         }catch(Exception e){
  69.             throw new ServiceException(e.getMessage(),e);
  70.         }
  71.     }

  72.     protected JDBCServiceManager(){}

  73.     public JDBCServiceManager(String jndiName, Properties contextJNDI,
  74.             ServiceManagerProperties smProperties) throws ServiceException {
  75.         super(jndiName, contextJNDI, smProperties);
  76.     }
  77.     public JDBCServiceManager(String jndiName, Properties contextJNDI,
  78.             JDBCServiceManagerProperties jdbcProperties) throws ServiceException {
  79.         super(jndiName, contextJNDI, jdbcProperties);
  80.     }
  81.     public JDBCServiceManager(String jndiName, Properties contextJNDI,
  82.             ServiceManagerProperties smProperties, Logger alog) throws ServiceException {
  83.         super(jndiName, contextJNDI, smProperties, alog);
  84.     }
  85.     public JDBCServiceManager(String jndiName, Properties contextJNDI,
  86.             JDBCServiceManagerProperties jdbcProperties, Logger alog) throws ServiceException {
  87.         super(jndiName, contextJNDI, jdbcProperties, alog);
  88.     }
  89.    
  90.    
  91.     public JDBCServiceManager(DataSource ds, ServiceManagerProperties smProperties)
  92.             throws ServiceException {
  93.         super(ds, smProperties);
  94.     }
  95.     public JDBCServiceManager(DataSource ds, JDBCServiceManagerProperties jdbcProperties)
  96.             throws ServiceException {
  97.         super(ds, jdbcProperties);
  98.     }
  99.     public JDBCServiceManager(DataSource ds, ServiceManagerProperties smProperties, Logger alog)
  100.             throws ServiceException {
  101.         super(ds, smProperties, alog);
  102.     }
  103.     public JDBCServiceManager(DataSource ds, JDBCServiceManagerProperties jdbcProperties, Logger alog)
  104.             throws ServiceException {
  105.         super(ds, jdbcProperties, alog);
  106.     }
  107.    
  108.    
  109.     public JDBCServiceManager(String connectionUrl, String driverJDBC,
  110.             String username, String password, ServiceManagerProperties smProperties)
  111.             throws ServiceException {
  112.         super(connectionUrl, driverJDBC, username, password, smProperties);
  113.     }
  114.     public JDBCServiceManager(String connectionUrl, String driverJDBC,
  115.             String username, String password, JDBCServiceManagerProperties jdbcProperties)
  116.             throws ServiceException {
  117.         super(connectionUrl, driverJDBC, username, password, jdbcProperties);
  118.     }
  119.     public JDBCServiceManager(String connectionUrl, String driverJDBC,
  120.             String username, String password, ServiceManagerProperties smProperties, Logger alog)
  121.             throws ServiceException {
  122.         super(connectionUrl, driverJDBC, username, password, smProperties, alog);
  123.     }
  124.     public JDBCServiceManager(String connectionUrl, String driverJDBC,
  125.             String username, String password, JDBCServiceManagerProperties jdbcProperties, Logger alog)
  126.             throws ServiceException {
  127.         super(connectionUrl, driverJDBC, username, password, jdbcProperties, alog);
  128.     }
  129.    
  130.    
  131.     public JDBCServiceManager(Connection connection, ServiceManagerProperties smProperties)
  132.             throws ServiceException {
  133.         super(connection, smProperties);
  134.     }
  135.     public JDBCServiceManager(Connection connection, JDBCServiceManagerProperties jdbcProperties)
  136.             throws ServiceException {
  137.         super(connection, jdbcProperties);
  138.     }
  139.     public JDBCServiceManager(Connection connection, ServiceManagerProperties smProperties, Logger alog) throws ServiceException {
  140.         super(connection, smProperties, alog);
  141.     }
  142.     public JDBCServiceManager(Connection connection, JDBCServiceManagerProperties jdbcProperties, Logger alog) throws ServiceException {
  143.         super(connection, jdbcProperties, alog);
  144.     }


  145.    


  146.     /*
  147.      =====================================================================================================================
  148.      Services relating to the object with name:allarme type:allarme
  149.      =====================================================================================================================
  150.     */
  151.    
  152.     /**
  153.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}
  154.      *
  155.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}  
  156.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  157.      * @throws NotImplementedException Exception thrown when the method is not implemented
  158.      */
  159.     @Override
  160.     public IAllarmeServiceSearch getAllarmeServiceSearch() throws ServiceException,NotImplementedException{
  161.         return new JDBCAllarmeServiceSearch(this);
  162.     }
  163.    
  164.     /**
  165.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}
  166.      *
  167.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.Allarme}  
  168.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  169.      * @throws NotImplementedException Exception thrown when the method is not implemented
  170.      */
  171.     @Override
  172.     public IAllarmeService getAllarmeService() throws ServiceException,NotImplementedException{
  173.         return new JDBCAllarmeService(this);
  174.     }
  175.    
  176.    
  177.    
  178.     /*
  179.      =====================================================================================================================
  180.      Services relating to the object with name:allarme-history type:allarme-history
  181.      =====================================================================================================================
  182.     */
  183.    
  184.     /**
  185.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}
  186.      *
  187.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}  
  188.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  189.      * @throws NotImplementedException Exception thrown when the method is not implemented
  190.      */
  191.     @Override
  192.     public IAllarmeHistoryServiceSearch getAllarmeHistoryServiceSearch() throws ServiceException,NotImplementedException{
  193.         return new JDBCAllarmeHistoryServiceSearch(this);
  194.     }
  195.    
  196.     /**
  197.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}
  198.      *
  199.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeHistory}    
  200.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  201.      * @throws NotImplementedException Exception thrown when the method is not implemented
  202.      */
  203.     @Override
  204.     public IAllarmeHistoryService getAllarmeHistoryService() throws ServiceException,NotImplementedException{
  205.         return new JDBCAllarmeHistoryService(this);
  206.     }
  207.    
  208.    
  209.    
  210.     /*
  211.      =====================================================================================================================
  212.      Services relating to the object with name:allarme-notifica type:allarme-notifica
  213.      =====================================================================================================================
  214.     */
  215.    
  216.     /**
  217.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}
  218.      *
  219.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}  
  220.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  221.      * @throws NotImplementedException Exception thrown when the method is not implemented
  222.      */
  223.     @Override
  224.     public IAllarmeNotificaServiceSearch getAllarmeNotificaServiceSearch() throws ServiceException,NotImplementedException{
  225.         return new JDBCAllarmeNotificaServiceSearch(this);
  226.     }
  227.    
  228.     /**
  229.      * Return a service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}
  230.      *
  231.      * @return Service used to research and manage on the backend on objects of type {@link org.openspcoop2.core.allarmi.AllarmeNotifica}  
  232.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  233.      * @throws NotImplementedException Exception thrown when the method is not implemented
  234.      */
  235.     @Override
  236.     public IAllarmeNotificaService getAllarmeNotificaService() throws ServiceException,NotImplementedException{
  237.         return new JDBCAllarmeNotificaService(this);
  238.     }
  239.    
  240.    
  241.    
  242.    

  243. }