AbstractGestoreIntegrazionePAUrlBasedBC.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.pdd.core.integrazione.backward_compatibility;

  21. import org.slf4j.Logger;
  22. import org.openspcoop2.pdd.core.AbstractCore;
  23. import org.openspcoop2.pdd.core.integrazione.HeaderIntegrazione;
  24. import org.openspcoop2.pdd.core.integrazione.HeaderIntegrazioneException;
  25. import org.openspcoop2.pdd.core.integrazione.IGestoreIntegrazionePA;
  26. import org.openspcoop2.pdd.core.integrazione.InRequestPAMessage;
  27. import org.openspcoop2.pdd.core.integrazione.InResponsePAMessage;
  28. import org.openspcoop2.pdd.core.integrazione.OutRequestPAMessage;
  29. import org.openspcoop2.pdd.core.integrazione.OutResponsePAMessage;
  30. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;
  31. import org.openspcoop2.protocol.sdk.constants.TipoIntegrazione;
  32. import org.openspcoop2.utils.LoggerWrapperFactory;




  33. /**
  34.  * Classe utilizzata per la spedizione di informazioni di integrazione
  35.  * dalla porta di dominio verso i servizi applicativi.
  36.  *
  37.  * @author Poli Andrea (apoli@link.it)
  38.  * @author $Author$
  39.  * @version $Rev$, $Date$
  40.  */
  41. public abstract class AbstractGestoreIntegrazionePAUrlBasedBC extends AbstractCore implements IGestoreIntegrazionePA{

  42.     /** Utility per l'integrazione */
  43.     UtilitiesIntegrazioneBC utilitiesBC = null;
  44.    
  45.     /** Logger utilizzato per debug. */
  46.     private Logger log = null;
  47.    
  48.     public AbstractGestoreIntegrazionePAUrlBasedBC(boolean openspcoop2){
  49.         this.log = OpenSPCoop2Logger.getLoggerOpenSPCoopCore();
  50.         if(this.log==null){
  51.             this.log = LoggerWrapperFactory.getLogger(AbstractGestoreIntegrazionePAUrlBasedBC.class);
  52.         }
  53.         try{
  54.             this.utilitiesBC = UtilitiesIntegrazioneBC.getInstancePARequest(this.log, openspcoop2, false);
  55.         }catch(Exception e){
  56.             this.log.error("Errore durante l'inizializzazione delle UtilitiesIntegrazione: "+e.getMessage(),e);
  57.         }
  58.     }
  59.    
  60.    
  61.     // IN - Request
  62.    
  63.     @Override
  64.     public void readInRequestHeader(HeaderIntegrazione integrazione,
  65.             InRequestPAMessage inRequestPAMessage) throws HeaderIntegrazioneException {
  66.         try{
  67.             String protocollo = this.getProtocolFactory()!=null ? this.getProtocolFactory().getProtocol() : null;
  68.            
  69.             this.utilitiesBC.readUrlProperties(inRequestPAMessage.getUrlProtocolContext().getParameters(),
  70.                     integrazione,
  71.                     protocollo);    
  72.         }catch(Exception e){
  73.             throw new HeaderIntegrazioneException("GestoreIntegrazionePAUrlBased, "+e.getMessage(),e);
  74.         }
  75.     }
  76.    
  77.     // OUT - Request
  78.    
  79.     @Override
  80.     public void setOutRequestHeader(HeaderIntegrazione integrazione,
  81.             OutRequestPAMessage outRequestPAMessage) throws HeaderIntegrazioneException{
  82.         try{
  83.             String protocollo = this.getProtocolFactory()!=null ? this.getProtocolFactory().getProtocol() : null;
  84.            
  85.             this.utilitiesBC.setUrlProperties(integrazione, outRequestPAMessage.getParameters(),
  86.                     this.getProtocolFactory().createProtocolManager().buildIntegrationProperties(outRequestPAMessage.getBustaRichiesta(), true, TipoIntegrazione.URL),
  87.                     protocollo);            
  88.         }catch(Exception e){
  89.             throw new HeaderIntegrazioneException("GestoreIntegrazionePAUrlBased, "+e.getMessage(),e);
  90.         }
  91.     }
  92.    
  93.     // IN - Response
  94.    
  95.     @Override
  96.     public void readInResponseHeader(HeaderIntegrazione integrazione,
  97.             InResponsePAMessage inResponsePAMessage) throws HeaderIntegrazioneException{
  98.         // NOP
  99.         // Non esiste un header di integrazione basato sulla url per la risposta
  100.     }

  101.     // OUT - Response

  102.     @Override
  103.     public void setOutResponseHeader(HeaderIntegrazione integrazione,
  104.             OutResponsePAMessage outResponsePAMessage) throws HeaderIntegrazioneException{
  105.        
  106.         // nop;
  107.        
  108.     }
  109. }