ConfigurationServiceBindingSoap.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.message.config;

  21. import java.io.Serializable;
  22. import java.util.ArrayList;
  23. import java.util.List;

  24. import org.openspcoop2.message.constants.MessageType;
  25. import org.openspcoop2.message.constants.ServiceBinding;
  26. import org.openspcoop2.message.exception.MessageException;

  27. /**
  28.  * ConfigurationServiceBindingSoap
  29.  *
  30.  * @author Poli Andrea (apoli@link.it)
  31.  * @author $Author$
  32.  * @version $Rev$, $Date$
  33.  */
  34. public class ConfigurationServiceBindingSoap extends AbstractConfigurationServiceBinding implements Serializable {

  35.     /**
  36.      *
  37.      */
  38.     private static final long serialVersionUID = 1L;
  39.    
  40.     private SoapBinding binding;
  41.    
  42.     public ConfigurationServiceBindingSoap(boolean enabled,SoapBinding binding,
  43.             IntegrationErrorCollection internalIntegrationErrorConfiguration,
  44.             IntegrationErrorCollection externalIntegrationErrorConfiguration) throws MessageException{
  45.         super(ServiceBinding.SOAP, enabled, internalIntegrationErrorConfiguration, externalIntegrationErrorConfiguration);
  46.         if(this.enabled){
  47.             if(binding==null){
  48.                 throw new MessageException("SoapBinding not defined");
  49.             }
  50.             this.binding = binding;
  51.         }
  52.     }
  53.    
  54.     @Override
  55.     public void init(){
  56.         if(this.enabled){
  57.             this.request = new SoapMediaTypeCollection(this.binding);
  58.             this.response = new SoapMediaTypeCollection(this.binding);
  59.         }
  60.     }
  61.    
  62.     public SoapBinding getBinding() {
  63.         return this.binding;
  64.     }
  65.    
  66.     @Override
  67.     public List<MessageType> getMessageTypeSupported(){
  68.          List<MessageType> list = new ArrayList<MessageType>();
  69.          if(this.binding!=null) {
  70.              if(this.binding.isBinding_soap11()) {
  71.                  list.add(MessageType.SOAP_11);
  72.              }
  73.              if(this.binding.isBinding_soap12()) {
  74.                  list.add(MessageType.SOAP_12);
  75.              }
  76.          }
  77.          return list;
  78.     }
  79. }