ConnettoreNullApiHelper.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.config.rs.server.api.impl.erogazioni;

  21. import java.util.Map;

  22. import org.openspcoop2.core.config.rs.server.model.ConnettoreEnum;
  23. import org.openspcoop2.core.config.rs.server.model.ConnettoreNull;
  24. import org.openspcoop2.core.config.rs.server.model.OneOfApplicativoServerConnettore;
  25. import org.openspcoop2.core.config.rs.server.model.OneOfConnettoreErogazioneConnettore;
  26. import org.openspcoop2.core.config.rs.server.model.OneOfConnettoreFruizioneConnettore;
  27. import org.openspcoop2.core.constants.CostantiDB;
  28. import org.openspcoop2.core.constants.TipiConnettore;
  29. import org.openspcoop2.core.registry.Connettore;
  30. import org.openspcoop2.web.ctrlstat.servlet.connettori.ConnettoriCostanti;
  31. import org.openspcoop2.web.lib.mvc.ServletUtils;

  32. /**
  33.  * ConnettoreNullApiHelper
  34.  *
  35.  * @author $Author$
  36.  * @version $Rev$, $Date$
  37.  *
  38.  */
  39. public class ConnettoreNullApiHelper extends AbstractConnettoreApiHelper<ConnettoreNull> {

  40.     @Override
  41.     protected ConnettoreNull getConnettore(OneOfConnettoreErogazioneConnettore conn) throws Exception {
  42.         return (ConnettoreNull) conn;
  43.     }

  44.     @Override
  45.     protected ConnettoreNull getConnettore(OneOfConnettoreFruizioneConnettore conn) throws Exception {
  46.         return (ConnettoreNull) conn;
  47.     }

  48.     @Override
  49.     protected ConnettoreNull getConnettore(OneOfApplicativoServerConnettore conn) throws Exception {
  50.         return (ConnettoreNull) conn;
  51.     }

  52.     @Override
  53.     public boolean connettoreCheckData(ConnettoreNull conn, ErogazioniEnv env, boolean erogazione) throws Exception {
  54.         return true;
  55.     }

  56.     @Override
  57.     public Connettore fillConnettoreRegistro(org.openspcoop2.core.registry.Connettore regConnettore,
  58.             ErogazioniEnv env,
  59.             ConnettoreNull conn,
  60.             String oldConnT) throws Exception {
  61.         env.apsHelper.fillConnettore(
  62.                 regConnettore,
  63.                 conn.isDebug() != null && conn.isDebug() ? "true" : "false",                // this.connettoreDebug,
  64.                 TipiConnettore.NULL.getNome(),          // endpointtype
  65.                 oldConnT,                       // oldConnT
  66.                 "",                     // tipoConn Personalizzato
  67.                 null, // this.url,
  68.                 null,   // this.nome,
  69.                 null,   // this.tipo,
  70.                 null,
  71.                 null,
  72.                 null,   // this.initcont,
  73.                 null,   // this.urlpgk,
  74.                 null, // this.url,
  75.                 null,   // this.connfact,
  76.                 null,   // this.sendas,
  77.                 null, // this.httpsurl,
  78.                 null,               // this.httpstipologia
  79.                 false,  // this.httpshostverify,
  80.                 ConnettoriCostanti.DEFAULT_CONNETTORE_HTTPS_TRUST_VERIFY_CERTS, // httpsTrustVerifyCert
  81.                 null,               // this.httpspath
  82.                 null,   // this.httpstipo,
  83.                 null,           // this.httpspwd,
  84.                 null,                   // this.httpsalgoritmo
  85.                 false,
  86.                 null,           // this.httpskeystore,
  87.                 "",                                                                 //  this.httpspwdprivatekeytrust
  88.                 null,               // pathkey
  89.                 null,       // this.httpstipokey
  90.                 null,           // this.httpspwdkey
  91.                 null,               // this.httpspwdprivatekey,  
  92.                 null,               // this.httpsalgoritmokey,
  93.                 null,                   // httpsKeyAlias
  94.                 null,                   // httpsTrustStoreCRLs
  95.                 null,                   // httpsTrustStoreOCSPPolicy
  96.                 null,                   // httpsKeyStoreBYOKPolicy
  97.            
  98.                 ServletUtils.boolToCheckBoxStatus( false ),
  99.                 null,
  100.                 null,
  101.                 null,
  102.                 null,
  103.                
  104.                 ServletUtils.boolToCheckBoxStatus( false ),
  105.                 null,   // this.tempiRisposta_connectionTimeout,
  106.                 null, //null,   // this.tempiRisposta_readTimeout,
  107.                 null,   // this.tempiRisposta_tempoMedioRisposta,
  108.                 "no",   // this.opzioniAvanzate,
  109.                 "",     // this.transfer_mode,
  110.                 "",     // this.transfer_mode_chunk_size,
  111.                 "",     // this.redirect_mode,
  112.                 "",     // this.redirect_max_hop,
  113.                 null,   // this.requestOutputFileName,
  114.                 null,   // this.requestOutputFileName_permissions
  115.                 null,   // this.requestOutputFileNameHeaders,
  116.                 null,   // this.requestOutputFileNameHeaders_permissions
  117.                 null,   // this.requestOutputParentDirCreateIfNotExists,
  118.                 null,   // this.requestOutputOverwriteIfExists,
  119.                 null,   // this.responseInputMode,
  120.                 null,   // this.responseInputFileName,
  121.                 null,   // this.responseInputFileNameHeaders,
  122.                 null,   // this.responseInputDeleteAfterRead,
  123.                 null,   // this.responseInputWaitTime,
  124.                 null,   // tokenPolicy
  125.                 null, null, // apiKeyHeader,  apiKeyValue
  126.                 null, null, // appIdHeader, appIdValue
  127.                
  128.                 null, // connettoreStatusParams
  129.                 null // listExtendedConnettore
  130.                 );      
  131.         return regConnettore;
  132.     }

  133.     @Override
  134.     public org.openspcoop2.core.config.Connettore buildConnettoreConfigurazione(
  135.             org.openspcoop2.core.config.Connettore regConnettore, ErogazioniEnv env, ConnettoreNull conn,
  136.             String oldConnT) throws Exception {

  137.         env.apsHelper.fillConnettore(
  138.                 regConnettore,
  139.                 conn.isDebug() != null && conn.isDebug() ? "true" : "false",                // this.connettoreDebug,
  140.                 TipiConnettore.NULL.getNome(),          // endpointtype
  141.                 oldConnT,                       // oldConnT
  142.                 "",                     // tipoConn Personalizzato
  143.                 null, // this.url,
  144.                 null,   // this.nome,
  145.                 null,   // this.tipo,
  146.                 null,
  147.                 null,
  148.                 null,   // this.initcont,
  149.                 null,   // this.urlpgk,
  150.                 null, // this.url,
  151.                 null,   // this.connfact,
  152.                 null,   // this.sendas,
  153.                 null, // this.httpsurl,
  154.                 null,               // this.httpstipologia
  155.                 false,  // this.httpshostverify,
  156.                 ConnettoriCostanti.DEFAULT_CONNETTORE_HTTPS_TRUST_VERIFY_CERTS, // httpsTrustVerifyCert
  157.                 null,               // this.httpspath
  158.                 null,   // this.httpstipo,
  159.                 null,           // this.httpspwd,
  160.                 null,                   // this.httpsalgoritmo
  161.                 false,
  162.                 null,           // this.httpskeystore,
  163.                 "",                                                                 //  this.httpspwdprivatekeytrust
  164.                 null,               // pathkey
  165.                 null,       // this.httpstipokey
  166.                 null,           // this.httpspwdkey
  167.                 null,               // this.httpspwdprivatekey,  
  168.                 null,               // this.httpsalgoritmokey,
  169.                 null,                   // httpsKeyAlias
  170.                 null,                   // httpsTrustStoreCRLs
  171.                 null,                   // httpsTrustStoreOCSPPolicy
  172.                 null,                   // httpsKeyStoreBYOKPolicy
  173.            
  174.                 ServletUtils.boolToCheckBoxStatus( false ),
  175.                 null,
  176.                 null,
  177.                 null,
  178.                 null,
  179.                
  180.                 ServletUtils.boolToCheckBoxStatus( false ),
  181.                 null,   // this.tempiRisposta_connectionTimeout,
  182.                 null, //null,   // this.tempiRisposta_readTimeout,
  183.                 null,   // this.tempiRisposta_tempoMedioRisposta,
  184.                 "no",   // this.opzioniAvanzate,
  185.                 "",     // this.transfer_mode,
  186.                 "",     // this.transfer_mode_chunk_size,
  187.                 "",     // this.redirect_mode,
  188.                 "",     // this.redirect_max_hop,
  189.                 null,   // this.requestOutputFileName,
  190.                 null,   // this.requestOutputFileName_permissions
  191.                 null,   // this.requestOutputFileNameHeaders,
  192.                 null,   // this.requestOutputFileNameHeaders_permissions
  193.                 null,   // this.requestOutputParentDirCreateIfNotExists,
  194.                 null,   // this.requestOutputOverwriteIfExists,
  195.                 null,   // this.responseInputMode,
  196.                 null,   // this.responseInputFileName,
  197.                 null,   // this.responseInputFileNameHeaders,
  198.                 null,   // this.responseInputDeleteAfterRead,
  199.                 null,   // this.responseInputWaitTime,
  200.                 null,   // tokenPolicy
  201.                 null, null, // apiKeyHeader,  apiKeyValue
  202.                 null, null, // appIdHeader, appIdValue
  203.                
  204.                 null, // connettoreStatusParams
  205.                 null // listExtendedConnettore
  206.                 );          
  207.         return regConnettore;
  208.     }

  209.     @Override
  210.     public ConnettoreNull buildConnettore(Map<String, String> props, String tipo) {
  211.         ConnettoreNull c = new ConnettoreNull();
  212.        
  213.         c.setTipo(ConnettoreEnum.NULL);
  214.         c.setDebug(Boolean.parseBoolean(props.get(CostantiDB.CONNETTORE_DEBUG)));
  215.        
  216.         return c;
  217.     }

  218.     @Override
  219.     public String getUrlConnettore(Map<String, String> props, String tipoConnettore) throws Exception {
  220.         return "[null] govway://dev/null";
  221.     }

  222. }