ServiceManagerProperties.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.generic_project.utils;

  21. import org.openspcoop2.generic_project.exception.ServiceException;
  22. import org.openspcoop2.utils.TipiDatabase;


  23. /**
  24.  * ServiceManagerProperties
  25.  *
  26.  * @author Poli Andrea (apoli@link.it)
  27.  * @author $Author$
  28.  * @version $Rev$, $Date$
  29.  */
  30. public class ServiceManagerProperties {

  31.     private String databaseType;
  32.     private boolean generateDdl;
  33.     private boolean showSql;
  34.     private boolean automaticTransactionManagement = true;
  35.     private int secondsToRefreshConnection = -1;
  36.    
  37.     public String getDatabaseType() {
  38.         return this.databaseType;
  39.     }
  40.     public TipiDatabase getDatabase() throws ServiceException {
  41.         TipiDatabase databaseType = TipiDatabase.toEnumConstant(this.databaseType);
  42.         if(TipiDatabase.DEFAULT.equals(databaseType)){
  43.             throw new ServiceException("Database ["+databaseType+"] not supported");
  44.         }
  45.         return databaseType;
  46.     }
  47.     public boolean isGenerateDdl() {
  48.         return this.generateDdl;
  49.     }
  50.     public boolean isShowSql() {
  51.         return this.showSql;
  52.     }
  53.     public void setDatabaseType(String databaseType) {
  54.         this.databaseType = databaseType;
  55.     }
  56.     public void setGenerateDdl(boolean generateDdl) {
  57.         this.generateDdl = generateDdl;
  58.     }
  59.     public void setShowSql(boolean showSql) {
  60.         this.showSql = showSql;
  61.     }
  62.     public boolean isAutomaticTransactionManagement() {
  63.         return this.automaticTransactionManagement;
  64.     }
  65.     public void setAutomaticTransactionManagement(
  66.             boolean automaticTransactionManagement) {
  67.         this.automaticTransactionManagement = automaticTransactionManagement;
  68.     }
  69.     public int getSecondsToRefreshConnection() {
  70.         return this.secondsToRefreshConnection;
  71.     }
  72.     public void setSecondsToRefreshConnection(int secondsToRefreshConnection) {
  73.         this.secondsToRefreshConnection = secondsToRefreshConnection;
  74.     }
  75. }