CostantiUtilities.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.web.ctrlstat.costanti;


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

  29.     public static String get_LOCAL_PATH(TipoProperties tipo, String prefix){
  30.         String p = prefix;
  31.         String v = null;
  32.         if(p!=null){
  33.             p = p.trim();
  34.         }
  35.         switch (tipo) {
  36.         case CONSOLE:
  37.             v = CostantiControlStation._OPENSPCOOP2_CONSOLE_LOCAL_PATH;
  38.             break;
  39.         case DATASOURCE:
  40.             v = CostantiControlStation._OPENSPCOOP2_DATASOURCE_LOCAL_PATH;
  41.             break;
  42.         case REGISTRO:
  43.             v = CostantiControlStation._OPENSPCOOP2_REGISTRO_SERVIZI_REMOTO_LOCAL_PATH;
  44.             break;
  45.         case LOGGER:
  46.             v = CostantiControlStation._OPENSPCOOP2_LOGGER_LOCAL_PATH;
  47.             break;
  48.         }
  49.        
  50.         if(v!=null) {
  51.             if(p==null || "".equals(p)){
  52.                 v = v.replace(CostantiControlStation.OPENSPCOOP2_PREFIX_LOCAL_PATH, CostantiControlStation.DEFAULT_OPENSPCOOP2_PREFIX_LOCAL_PATH);
  53.             }
  54.             else{
  55.                 v = v.replace(CostantiControlStation.OPENSPCOOP2_PREFIX_LOCAL_PATH, prefix);
  56.             }
  57.         }
  58.         //System.out.println("LOCALPATH["+tipo.name()+"]: "+v);
  59.         return v;
  60.     }
  61.    
  62.     public static String get_PROPERTY_NAME(TipoProperties tipo, String prefix){
  63.         String p = prefix;
  64.         String v = null;
  65.         if(p!=null){
  66.             p = p.trim();
  67.         }
  68.         switch (tipo) {
  69.         case CONSOLE:
  70.             v = CostantiControlStation._OPENSPCOOP2_CONSOLE_PROPERTIES;
  71.             break;
  72.         case DATASOURCE:
  73.             v = CostantiControlStation._OPENSPCOOP2_DATASOURCE_PROPERTIES;
  74.             break;
  75.         case REGISTRO:
  76.             v = CostantiControlStation._OPENSPCOOP2_REGISTRO_SERVIZI_REMOTO_PROPERTIES;
  77.             break;
  78.         case LOGGER:
  79.             v = CostantiControlStation._OPENSPCOOP2_LOGGER_PROPERTIES;
  80.             break;
  81.         }
  82.        
  83.         if(v!=null) {
  84.             if(p==null || "".equals(p)){
  85.                 v = v.replace(CostantiControlStation.OPENSPCOOP2_PROPERTIES_NAME, CostantiControlStation.DEFAULT_OPENSPCOOP2_PROPERTIES_NAME);
  86.             }
  87.             else{
  88.                 v = v.replace(CostantiControlStation.OPENSPCOOP2_PROPERTIES_NAME, prefix);
  89.             }
  90.         }
  91.         //System.out.println("PROPERTY["+tipo.name()+"]: "+v);
  92.         return v;
  93.     }
  94.    
  95. }