GestoreIntegrazionePAUrlBased.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;

  21. import org.slf4j.Logger;
  22. import org.openspcoop2.pdd.core.AbstractCore;
  23. import org.openspcoop2.pdd.logger.OpenSPCoop2Logger;
  24. import org.openspcoop2.protocol.sdk.constants.TipoIntegrazione;
  25. import org.openspcoop2.utils.LoggerWrapperFactory;




  26. /**
  27.  * Classe utilizzata per la spedizione di informazioni di integrazione
  28.  * dalla porta di dominio verso i servizi applicativi.
  29.  *
  30.  * @author Poli Andrea (apoli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */
  34. public class GestoreIntegrazionePAUrlBased extends AbstractCore implements IGestoreIntegrazionePA{

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

  88.     // OUT - Response

  89.     @Override
  90.     public void setOutResponseHeader(HeaderIntegrazione integrazione,
  91.             OutResponsePAMessage outResponsePAMessage) throws HeaderIntegrazioneException{
  92.        
  93.         // nop;
  94.        
  95.     }
  96. }