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.commons.search.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.commons.search.dao.ISoggettoServiceSearch;
  26. import org.openspcoop2.core.commons.search.dao.ISoggettoRuoloServiceSearch;
  27. import org.openspcoop2.core.commons.search.dao.IRuoloServiceSearch;
  28. import org.openspcoop2.core.commons.search.dao.IPortaDominioServiceSearch;
  29. import org.openspcoop2.core.commons.search.dao.IGruppoServiceSearch;
  30. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneServiceSearch;
  31. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneGruppoServiceSearch;
  32. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteComuneAzioneServiceSearch;
  33. import org.openspcoop2.core.commons.search.dao.IPortTypeServiceSearch;
  34. import org.openspcoop2.core.commons.search.dao.IOperationServiceSearch;
  35. import org.openspcoop2.core.commons.search.dao.IResourceServiceSearch;
  36. import org.openspcoop2.core.commons.search.dao.IAccordoServizioParteSpecificaServiceSearch;
  37. import org.openspcoop2.core.commons.search.dao.IFruitoreServiceSearch;
  38. import org.openspcoop2.core.commons.search.dao.IServizioApplicativoServiceSearch;
  39. import org.openspcoop2.core.commons.search.dao.IPortaDelegataServiceSearch;
  40. import org.openspcoop2.core.commons.search.dao.IPortaApplicativaServiceSearch;

  41. import org.openspcoop2.core.commons.search.dao.IServiceManager;

  42. import java.sql.Connection;
  43. import java.util.Properties;

  44. import javax.sql.DataSource;

  45. import org.slf4j.Logger;

  46. /**    
  47.  * Manager that allows you to obtain the services of research and management of objects
  48.  *
  49.  * @author Poli Andrea (poli@link.it)
  50.  * @author $Author$
  51.  * @version $Rev$, $Date$
  52.  */

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

  54.     protected Connection getConnectionInternalResource() {
  55.         return this.connection;
  56.     }
  57.     protected DataSource getDatasourceInternalResource() {
  58.         return this.datasource;
  59.     }
  60.     protected JDBCServiceManagerProperties getJdbcPropertiesInternalResource(){
  61.         return this.jdbcProperties;
  62.     }
  63.     protected Logger getLoggerInternalResource(){
  64.         return this.log;
  65.     }
  66.     @Override
  67.     protected Connection getConnection() throws ServiceException {
  68.         try{
  69.             return super.getConnection();
  70.         }catch(Exception e){
  71.             throw new ServiceException(e.getMessage(),e);
  72.         }
  73.     }
  74.     @Override
  75.     protected void closeConnection(Connection connection) throws ServiceException {
  76.         try{
  77.             super.closeConnection(connection);
  78.         }catch(Exception e){
  79.             throw new ServiceException(e.getMessage(),e);
  80.         }
  81.     }

  82.     protected JDBCServiceManager(){}

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


  155.    


  156.     /*
  157.      =====================================================================================================================
  158.      Services relating to the object with name:soggetto type:soggetto
  159.      =====================================================================================================================
  160.     */
  161.    
  162.     /**
  163.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Soggetto}
  164.      *
  165.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Soggetto}  
  166.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  167.      * @throws NotImplementedException Exception thrown when the method is not implemented
  168.      */
  169.     @Override
  170.     public ISoggettoServiceSearch getSoggettoServiceSearch() throws ServiceException,NotImplementedException{
  171.         return new JDBCSoggettoServiceSearch(this);
  172.     }
  173.    
  174.    
  175.    
  176.    
  177.     /*
  178.      =====================================================================================================================
  179.      Services relating to the object with name:soggetto-ruolo type:soggetto-ruolo
  180.      =====================================================================================================================
  181.     */
  182.    
  183.     /**
  184.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.SoggettoRuolo}
  185.      *
  186.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.SoggettoRuolo}
  187.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  188.      * @throws NotImplementedException Exception thrown when the method is not implemented
  189.      */
  190.     @Override
  191.     public ISoggettoRuoloServiceSearch getSoggettoRuoloServiceSearch() throws ServiceException,NotImplementedException{
  192.         return new JDBCSoggettoRuoloServiceSearch(this);
  193.     }
  194.    
  195.    
  196.    
  197.    
  198.     /*
  199.      =====================================================================================================================
  200.      Services relating to the object with name:ruolo type:ruolo
  201.      =====================================================================================================================
  202.     */
  203.    
  204.     /**
  205.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Ruolo}
  206.      *
  207.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Ruolo}
  208.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  209.      * @throws NotImplementedException Exception thrown when the method is not implemented
  210.      */
  211.     @Override
  212.     public IRuoloServiceSearch getRuoloServiceSearch() throws ServiceException,NotImplementedException{
  213.         return new JDBCRuoloServiceSearch(this);
  214.     }
  215.    
  216.    
  217.    
  218.    
  219.     /*
  220.      =====================================================================================================================
  221.      Services relating to the object with name:porta-dominio type:porta-dominio
  222.      =====================================================================================================================
  223.     */
  224.    
  225.     /**
  226.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDominio}
  227.      *
  228.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDominio}  
  229.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  230.      * @throws NotImplementedException Exception thrown when the method is not implemented
  231.      */
  232.     @Override
  233.     public IPortaDominioServiceSearch getPortaDominioServiceSearch() throws ServiceException,NotImplementedException{
  234.         return new JDBCPortaDominioServiceSearch(this);
  235.     }
  236.    
  237.    
  238.    
  239.    
  240.     /*
  241.      =====================================================================================================================
  242.      Services relating to the object with name:gruppo type:gruppo
  243.      =====================================================================================================================
  244.     */
  245.    
  246.     /**
  247.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Gruppo}
  248.      *
  249.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Gruppo}    
  250.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  251.      * @throws NotImplementedException Exception thrown when the method is not implemented
  252.      */
  253.     @Override
  254.     public IGruppoServiceSearch getGruppoServiceSearch() throws ServiceException,NotImplementedException{
  255.         return new JDBCGruppoServiceSearch(this);
  256.     }
  257.    
  258.    
  259.    
  260.    
  261.     /*
  262.      =====================================================================================================================
  263.      Services relating to the object with name:accordo-servizio-parte-comune type:accordo-servizio-parte-comune
  264.      =====================================================================================================================
  265.     */
  266.    
  267.     /**
  268.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComune}
  269.      *
  270.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComune}    
  271.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  272.      * @throws NotImplementedException Exception thrown when the method is not implemented
  273.      */
  274.     @Override
  275.     public IAccordoServizioParteComuneServiceSearch getAccordoServizioParteComuneServiceSearch() throws ServiceException,NotImplementedException{
  276.         return new JDBCAccordoServizioParteComuneServiceSearch(this);
  277.     }
  278.    
  279.    
  280.    
  281.    
  282.     /*
  283.      =====================================================================================================================
  284.      Services relating to the object with name:accordo-servizio-parte-comune-gruppo type:accordo-servizio-parte-comune-gruppo
  285.      =====================================================================================================================
  286.     */
  287.    
  288.     /**
  289.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneGruppo}
  290.      *
  291.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneGruppo}  
  292.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  293.      * @throws NotImplementedException Exception thrown when the method is not implemented
  294.      */
  295.     @Override
  296.     public IAccordoServizioParteComuneGruppoServiceSearch getAccordoServizioParteComuneGruppoServiceSearch() throws ServiceException,NotImplementedException{
  297.         return new JDBCAccordoServizioParteComuneGruppoServiceSearch(this);
  298.     }
  299.    
  300.    
  301.    
  302.    
  303.     /*
  304.      =====================================================================================================================
  305.      Services relating to the object with name:accordo-servizio-parte-comune-azione type:accordo-servizio-parte-comune-azione
  306.      =====================================================================================================================
  307.     */
  308.    
  309.     /**
  310.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneAzione}
  311.      *
  312.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteComuneAzione}  
  313.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  314.      * @throws NotImplementedException Exception thrown when the method is not implemented
  315.      */
  316.     @Override
  317.     public IAccordoServizioParteComuneAzioneServiceSearch getAccordoServizioParteComuneAzioneServiceSearch() throws ServiceException,NotImplementedException{
  318.         return new JDBCAccordoServizioParteComuneAzioneServiceSearch(this);
  319.     }
  320.    
  321.    
  322.    
  323.    
  324.     /*
  325.      =====================================================================================================================
  326.      Services relating to the object with name:port-type type:port-type
  327.      =====================================================================================================================
  328.     */
  329.    
  330.     /**
  331.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortType}
  332.      *
  333.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortType}  
  334.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  335.      * @throws NotImplementedException Exception thrown when the method is not implemented
  336.      */
  337.     @Override
  338.     public IPortTypeServiceSearch getPortTypeServiceSearch() throws ServiceException,NotImplementedException{
  339.         return new JDBCPortTypeServiceSearch(this);
  340.     }
  341.    
  342.    
  343.    
  344.    
  345.     /*
  346.      =====================================================================================================================
  347.      Services relating to the object with name:operation type:operation
  348.      =====================================================================================================================
  349.     */
  350.    
  351.     /**
  352.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Operation}
  353.      *
  354.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Operation}
  355.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  356.      * @throws NotImplementedException Exception thrown when the method is not implemented
  357.      */
  358.     @Override
  359.     public IOperationServiceSearch getOperationServiceSearch() throws ServiceException,NotImplementedException{
  360.         return new JDBCOperationServiceSearch(this);
  361.     }
  362.    
  363.    
  364.    
  365.    
  366.     /*
  367.      =====================================================================================================================
  368.      Services relating to the object with name:resource type:resource
  369.      =====================================================================================================================
  370.     */
  371.    
  372.     /**
  373.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Resource}
  374.      *
  375.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Resource}  
  376.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  377.      * @throws NotImplementedException Exception thrown when the method is not implemented
  378.      */
  379.     @Override
  380.     public IResourceServiceSearch getResourceServiceSearch() throws ServiceException,NotImplementedException{
  381.         return new JDBCResourceServiceSearch(this);
  382.     }
  383.    
  384.    
  385.    
  386.    
  387.     /*
  388.      =====================================================================================================================
  389.      Services relating to the object with name:accordo-servizio-parte-specifica type:accordo-servizio-parte-specifica
  390.      =====================================================================================================================
  391.     */
  392.    
  393.     /**
  394.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteSpecifica}
  395.      *
  396.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.AccordoServizioParteSpecifica}
  397.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  398.      * @throws NotImplementedException Exception thrown when the method is not implemented
  399.      */
  400.     @Override
  401.     public IAccordoServizioParteSpecificaServiceSearch getAccordoServizioParteSpecificaServiceSearch() throws ServiceException,NotImplementedException{
  402.         return new JDBCAccordoServizioParteSpecificaServiceSearch(this);
  403.     }
  404.    
  405.    
  406.    
  407.    
  408.     /*
  409.      =====================================================================================================================
  410.      Services relating to the object with name:fruitore type:fruitore
  411.      =====================================================================================================================
  412.     */
  413.    
  414.     /**
  415.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Fruitore}
  416.      *
  417.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.Fruitore}  
  418.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  419.      * @throws NotImplementedException Exception thrown when the method is not implemented
  420.      */
  421.     @Override
  422.     public IFruitoreServiceSearch getFruitoreServiceSearch() throws ServiceException,NotImplementedException{
  423.         return new JDBCFruitoreServiceSearch(this);
  424.     }
  425.    
  426.    
  427.    
  428.    
  429.     /*
  430.      =====================================================================================================================
  431.      Services relating to the object with name:servizio-applicativo type:servizio-applicativo
  432.      =====================================================================================================================
  433.     */
  434.    
  435.     /**
  436.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.ServizioApplicativo}
  437.      *
  438.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.ServizioApplicativo}  
  439.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  440.      * @throws NotImplementedException Exception thrown when the method is not implemented
  441.      */
  442.     @Override
  443.     public IServizioApplicativoServiceSearch getServizioApplicativoServiceSearch() throws ServiceException,NotImplementedException{
  444.         return new JDBCServizioApplicativoServiceSearch(this);
  445.     }
  446.    
  447.    
  448.    
  449.    
  450.     /*
  451.      =====================================================================================================================
  452.      Services relating to the object with name:porta-delegata type:porta-delegata
  453.      =====================================================================================================================
  454.     */
  455.    
  456.     /**
  457.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDelegata}
  458.      *
  459.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaDelegata}
  460.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  461.      * @throws NotImplementedException Exception thrown when the method is not implemented
  462.      */
  463.     @Override
  464.     public IPortaDelegataServiceSearch getPortaDelegataServiceSearch() throws ServiceException,NotImplementedException{
  465.         return new JDBCPortaDelegataServiceSearch(this);
  466.     }
  467.    
  468.    
  469.    
  470.    
  471.     /*
  472.      =====================================================================================================================
  473.      Services relating to the object with name:porta-applicativa type:porta-applicativa
  474.      =====================================================================================================================
  475.     */
  476.    
  477.     /**
  478.      * Return a service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaApplicativa}
  479.      *
  480.      * @return Service used to research on the backend on objects of type {@link org.openspcoop2.core.commons.search.PortaApplicativa}  
  481.      * @throws ServiceException Exception thrown when an error occurs during processing of the request
  482.      * @throws NotImplementedException Exception thrown when the method is not implemented
  483.      */
  484.     @Override
  485.     public IPortaApplicativaServiceSearch getPortaApplicativaServiceSearch() throws ServiceException,NotImplementedException{
  486.         return new JDBCPortaApplicativaServiceSearch(this);
  487.     }
  488.    
  489.    
  490.    
  491.    
  492.    

  493. }