SdIXSDValidator.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 it.gov.fatturapa.sdi.ws.trasmissione.v1_0.types.utils;

  21. import org.slf4j.Logger;
  22. import org.openspcoop2.utils.xml.AbstractValidatoreXSD;
  23. import org.openspcoop2.generic_project.exception.ServiceException;

  24. import it.gov.fatturapa.sdi.ws.trasmissione.v1_0.types.FileSdIBaseType;

  25. /**
  26.  * XSD Validator    
  27.  *
  28.  * @author Poli Andrea (poli@link.it)
  29.  * @author $Author$
  30.  * @version $Rev$, $Date$
  31.  */

  32. public class SdIXSDValidator {

  33.     private static org.openspcoop2.generic_project.utils.XSDValidator validator_v1_0 = null;
  34.     private static org.openspcoop2.generic_project.utils.XSDValidator validator_v1_1 = null;
  35.    
  36.     private static synchronized void initValidatorTrasmissione_1_0(Class<?> validatorImpl,Logger log) throws ServiceException{
  37.         if(validator_v1_0==null){
  38.             validator_v1_0 = new org.openspcoop2.generic_project.utils.XSDValidator(log,FileSdIBaseType.class,
  39.                 "/trasmissione/TrasmissioneTypes_v1.0.xsd"
  40.                 // elencare in questa posizione altri schemi xsd che vengono inclusi/importati dallo schema /TrasmissioneTypes_mergev_1.0-1.1.xsd
  41.             );
  42.         }
  43.     }
  44.     private static synchronized void initValidatorTrasmissione_1_1(Class<?> validatorImpl,Logger log) throws ServiceException{
  45.         if(validator_v1_1==null){
  46.             validator_v1_1 = new org.openspcoop2.generic_project.utils.XSDValidator(log,FileSdIBaseType.class,
  47.                 "/trasmissione/TrasmissioneTypes_v1.1.xsd"
  48.                 // elencare in questa posizione altri schemi xsd che vengono inclusi/importati dallo schema /TrasmissioneTypes_mergev_1.0-1.1.xsd
  49.             );
  50.         }
  51.     }
  52.    
  53.     public static AbstractValidatoreXSD getXSDValidatorTrasmissione_1_0(Class<?> validatorImpl,Logger log) throws ServiceException{
  54.         if(validator_v1_0==null){
  55.             initValidatorTrasmissione_1_0(validatorImpl,log);
  56.         }
  57.         return validator_v1_0.getXsdValidator();
  58.     }
  59.     public static AbstractValidatoreXSD getXSDValidatorTrasmissione_1_0(Logger log) throws ServiceException{
  60.         if(validator_v1_0==null){
  61.             initValidatorTrasmissione_1_0(org.openspcoop2.utils.xml.ValidatoreXSD.class,log);
  62.         }
  63.         return validator_v1_0.getXsdValidator();
  64.     }
  65.    
  66.     public static AbstractValidatoreXSD getXSDValidatorTrasmissione_1_1(Class<?> validatorImpl,Logger log) throws ServiceException{
  67.         if(validator_v1_1==null){
  68.             initValidatorTrasmissione_1_1(validatorImpl,log);
  69.         }
  70.         return validator_v1_1.getXsdValidator();
  71.     }
  72.     public static AbstractValidatoreXSD getXSDValidatorTrasmissione_1_1(Logger log) throws ServiceException{
  73.         if(validator_v1_1==null){
  74.             initValidatorTrasmissione_1_1(org.openspcoop2.utils.xml.ValidatoreXSD.class,log);
  75.         }
  76.         return validator_v1_1.getXsdValidator();
  77.     }
  78.    
  79. }