FactoryDriverRegistroServiziUDDICreator.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.registry.driver.uddi;

  21. import java.util.Enumeration;
  22. import java.util.Properties;

  23. import org.openspcoop2.core.commons.FactoryDriverCreator;
  24. import org.openspcoop2.core.commons.IDriverWS;

  25. /**
  26.  *
  27.  *
  28.  * @author Stefano Corallo (corallo@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */
  32. public class FactoryDriverRegistroServiziUDDICreator extends
  33. FactoryDriverCreator {

  34.     private String inquiryURL;
  35.     private String publishURL;
  36.     private String user;
  37.     private String password;
  38.     private String urlPrefix;
  39.     private String pathPrefix;



  40.     public FactoryDriverRegistroServiziUDDICreator(String fileProperties) {
  41.         super(fileProperties);
  42.     }

  43.     /**
  44.      * Ritorna una nuova istanza del {@link DriverRegistroServiziUDDI}
  45.      */
  46.     @Override
  47.     public IDriverWS getDriver() throws Exception {

  48.         //Leggo infoGeneral Properties
  49.         Properties prop = this.readProperties(this.getFilePropertiesName());
  50.         Enumeration<?> en = prop.propertyNames();
  51.         while (en.hasMoreElements()) {
  52.             String property = (String) en.nextElement();
  53.             if (property.equals("UddiInquiryURL")) {
  54.                 String value = prop.getProperty(property);
  55.                 if (value!=null) {
  56.                     value = value.trim();
  57.                     this.inquiryURL = value;
  58.                 }
  59.             }
  60.             if (property.equals("UddiPublishURL")) {
  61.                 String value = prop.getProperty(property);
  62.                 if (value!=null) {
  63.                     value = value.trim();
  64.                     this.publishURL = value;
  65.                 }
  66.             }
  67.             if (property.equals("UddiUser")) {
  68.                 String value = prop.getProperty(property);
  69.                 if (value!=null) {
  70.                     value = value.trim();
  71.                     this.user = value;
  72.                 }
  73.             }
  74.             if (property.equals("UddiPassword")) {
  75.                 String value = prop.getProperty(property);
  76.                 if (value!=null) {
  77.                     value = value.trim();
  78.                     this.password = value;
  79.                 }
  80.             }
  81.             if (property.equals("WebUrlPrefix")) {
  82.                 String value = prop.getProperty(property);
  83.                 if (value!=null) {
  84.                     value = value.trim();
  85.                     this.urlPrefix = value;
  86.                 }
  87.             }
  88.             if (property.equals("WebPathPrefix")) {
  89.                 String value = prop.getProperty(property);
  90.                 if (value!=null) {
  91.                     value = value.trim();
  92.                     this.pathPrefix = value;
  93.                 }
  94.             }
  95.         }//chiudo while

  96. //      if (property.equals("sincronizzazioneRegistro")) {
  97. //      String value = prop.getProperty(property);
  98. //      if (value!=null) {
  99. //      value = value.trim();
  100. //      try{
  101. //      engineRegistro = Boolean.parseBoolean(value);
  102. //      }catch(Exception e){
  103. //      log.error("Errore durante la lettura della proprieta': sincronizzazioneRegistro");
  104. //      }
  105. //      }
  106. //      }

  107.         if( this.inquiryURL==null ){
  108.             throw new Exception("InquiryURL non fornita.");
  109.         }
  110.         if( this.publishURL==null ){
  111.             throw new Exception("PublishURL non fornita.");
  112.         }
  113.         if( this.urlPrefix==null ){
  114.             throw new Exception("URLPrefix non fornito.");
  115.         }
  116.         if( this.pathPrefix==null ){
  117.             throw new Exception("PathPrefix non fornito.");
  118.         }


  119.         //Init Driver
  120.         return new DriverRegistroServiziUDDI(this.inquiryURL,this.publishURL,this.user,this.password,this.urlPrefix,this.pathPrefix,null);

  121.     }

  122. }