ClientTest.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.spcoop.sica.dao.driver;

  21. import java.io.File;
  22. import java.net.URISyntaxException;
  23. import java.util.Date;
  24. import java.util.Iterator;
  25. import java.util.List;
  26. import java.util.Map;

  27. import javax.wsdl.Binding;
  28. import javax.wsdl.Message;
  29. import javax.wsdl.Service;

  30. import org.openspcoop2.core.id.IDAccordo;
  31. import org.openspcoop2.core.id.IDAccordoCooperazione;
  32. import org.openspcoop2.core.id.IDServizio;
  33. import org.openspcoop2.core.id.IDSoggetto;
  34. import org.openspcoop2.core.registry.AccordoCooperazionePartecipanti;
  35. import org.openspcoop2.core.registry.AccordoServizioParteComuneServizioComposto;
  36. import org.openspcoop2.core.registry.AccordoServizioParteComuneServizioCompostoServizioComponente;
  37. import org.openspcoop2.core.registry.ConfigurazioneServizio;
  38. import org.openspcoop2.core.registry.Connettore;
  39. import org.openspcoop2.core.registry.Operation;
  40. import org.openspcoop2.core.registry.PortType;
  41. import org.openspcoop2.core.registry.Property;
  42. import org.openspcoop2.core.registry.RegistroServizi;
  43. import org.openspcoop2.core.registry.Soggetto;
  44. import org.openspcoop2.core.registry.constants.TipologiaServizio;
  45. import org.openspcoop2.core.registry.driver.IDAccordoCooperazioneFactory;
  46. import org.openspcoop2.core.registry.driver.IDAccordoFactory;
  47. import org.openspcoop2.core.registry.driver.IDServizioFactory;
  48. import org.openspcoop2.core.registry.driver.xml.DriverRegistroServiziXML;
  49. import org.openspcoop2.protocol.basic.registry.RegistryReader;
  50. import org.openspcoop2.protocol.sdk.registry.IRegistryReader;
  51. import org.openspcoop2.protocol.spcoop.sica.SICAtoOpenSPCoopContext;
  52. import org.openspcoop2.protocol.spcoop.sica.SICAtoOpenSPCoopUtilities;
  53. import org.openspcoop2.utils.LoggerWrapperFactory;
  54. import org.openspcoop2.utils.io.ZipUtilities;
  55. import org.openspcoop2.utils.resources.FileSystemUtilities;
  56. import org.openspcoop2.utils.wsdl.DefinitionWrapper;
  57. import org.openspcoop2.utils.wsdl.WSDLUtilities;
  58. import org.openspcoop2.utils.xml.AbstractXMLUtils;
  59. import org.openspcoop2.utils.xml.XSDUtils;
  60. import org.slf4j.Logger;
  61. import org.w3c.dom.Document;
  62. import org.w3c.dom.Node;

  63. import it.cnipa.collprofiles.EgovDecllElement;
  64. import it.cnipa.collprofiles.OperationListType;
  65. import it.cnipa.collprofiles.OperationType;
  66. import it.gov.spcoop.sica.dao.AccordoCooperazione;
  67. import it.gov.spcoop.sica.dao.AccordoServizioComposto;
  68. import it.gov.spcoop.sica.dao.AccordoServizioParteComune;
  69. import it.gov.spcoop.sica.dao.AccordoServizioParteSpecifica;
  70. import it.gov.spcoop.sica.dao.Costanti;
  71. import it.gov.spcoop.sica.dao.Documento;
  72. import it.gov.spcoop.sica.manifest.AccordoServizio;
  73. import it.gov.spcoop.sica.manifest.DocumentoConversazione;
  74. import it.gov.spcoop.sica.manifest.DocumentoCoordinamento;
  75. import it.gov.spcoop.sica.manifest.DocumentoInterfaccia;
  76. import it.gov.spcoop.sica.manifest.DocumentoLivelloServizio;
  77. import it.gov.spcoop.sica.manifest.DocumentoSemiformale;
  78. import it.gov.spcoop.sica.manifest.DocumentoSicurezza;
  79. import it.gov.spcoop.sica.manifest.ElencoAllegati;
  80. import it.gov.spcoop.sica.manifest.ElencoPartecipanti;
  81. import it.gov.spcoop.sica.manifest.ElencoServiziComponenti;
  82. import it.gov.spcoop.sica.manifest.ElencoServiziComposti;
  83. import it.gov.spcoop.sica.manifest.ServizioComposto;
  84. import it.gov.spcoop.sica.manifest.SpecificaConversazione;
  85. import it.gov.spcoop.sica.manifest.SpecificaCoordinamento;
  86. import it.gov.spcoop.sica.manifest.SpecificaInterfaccia;
  87. import it.gov.spcoop.sica.manifest.SpecificaLivelliServizio;
  88. import it.gov.spcoop.sica.manifest.SpecificaPortiAccesso;
  89. import it.gov.spcoop.sica.manifest.SpecificaSemiformale;
  90. import it.gov.spcoop.sica.manifest.SpecificaSicurezza;
  91. import it.gov.spcoop.sica.manifest.constants.TipoDocumentoConversazione;
  92. import it.gov.spcoop.sica.manifest.constants.TipoDocumentoInterfaccia;
  93. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoConversazione;
  94. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoCoordinamento;
  95. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoInterfaccia;
  96. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoLivelloServizio;
  97. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoSemiformale;
  98. import it.gov.spcoop.sica.manifest.driver.TipiDocumentoSicurezza;
  99. import it.gov.spcoop.sica.wscp.ProfiloCollaborazioneEGOV;
  100. import it.gov.spcoop.sica.wscp.constants.ProfiloDiCollaborazioneType;


  101. /**
  102.  * ClientTest
  103.  *  
  104.  * @author Poli Andrea (apoli@link.it)
  105.  * @author $Author$
  106.  * @version $Rev$, $Date$
  107.  */
  108. public class ClientTest {

  109.    
  110.     public static final String wsdlImplementativo = "<wsdl:definitions targetNamespace=\"http://openspcoop.org/Example/service\" \n" +
  111.             "xmlns:apachesoap=\"http://xml.apache.org/xml-soap\" xmlns:service=\"http://openspcoop.org/Example/service\"\n" +
  112.             " xmlns:types=\"http://openspcoop.org/Example/types\" xmlns:wsdl=\"http://schemas.xmlsoap.org/wsdl/\"\n" +
  113.             " xmlns:wsdlsoap=\"http://schemas.xmlsoap.org/wsdl/soap/\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" >\n" +
  114.             "   \n" +
  115.             "   <!-- Example KEYWORD -->  \n" +
  116.             "   \n" +
  117.             "       <wsdl:import namespace=\"http://openspcoop.org/Example/service\" location=\"logicoKEYWORD.wsdl\" />\n" +
  118.             "  "+
  119.             "        <wsdl:binding name=\"ExampleSoapBinding\" type=\"service:Example\">\n" +
  120.             "           <wsdlsoap:binding style=\"document\" transport=\"http://schemas.xmlsoap.org/soap/http\"/>\n" +
  121.             "           <wsdl:operation name=\"movOneWayRequest\">\n" +
  122.             "               <wsdlsoap:operation soapAction=\"Example\"/>\n" +
  123.             "               <wsdl:input name=\"movOneWayRequest\">\n" +
  124.             "                       <wsdlsoap:body use=\"literal\"/>\n" +
  125.             "               </wsdl:input>\n" +
  126.             "           </wsdl:operation>\n" +
  127.             "       </wsdl:binding>\n" +
  128.             "\n" +
  129.             "       <wsdl:service name=\"ExampleService\">\n" +
  130.             "           <wsdl:port binding=\"service:ExampleSoapBinding\" name=\"Example\">\n" +
  131.             "               <wsdlsoap:address location=\"http://localhost:8080/exampleKEYWORD/service\"/>\n" +
  132.             "           </wsdl:port>\n" +
  133.             "       </wsdl:service>\n" +
  134.             "</wsdl:definitions>";
  135.    
  136.    
  137.    
  138.     public static SICAtoOpenSPCoopContext getContextSICAToOpenSPCoop(boolean invertiOpzioni,boolean invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione,
  139.             boolean sicaClientCompatibility) throws Exception{
  140.        
  141.         SICAtoOpenSPCoopContext context = new SICAtoOpenSPCoopContext();
  142.        
  143.         // Se richiesto inversione proprieta lo effettuo
  144.         if(invertiOpzioni){
  145.             context.setSICAClient_generaProject(!context.isSICAClient_generaProject());
  146.             if(invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione){
  147.                 context.setSICAClient_includiInfoRegistroGenerale(!context.isSICAClient_includiInfoRegistroGenerale());
  148.             }
  149.             context.setInformazioniEGov_specificaSemiformale(!context.isInformazioniEGov_specificaSemiformale());
  150.             context.setInformazioniEGov_wscp(!context.isInformazioniEGov_wscp());
  151.             context.setInformazioniEGov_wscpDisabled_namespaceCnipa(!context.isInformazioniEGov_wscpDisabled_namespaceCnipa());
  152.             context.setInformazioniEGov_wscpDisabled_childUnqualified(!context.isInformazioniEGov_wscpDisabled_childUnqualified());
  153.             context.setInformazioniEGov_wscpEnabled_childUnqualified(!context.isInformazioniEGov_wscpEnabled_childUnqualified());
  154.             context.setInformazioniEGov_nomiSPCoop_qualified(!context.isInformazioniEGov_nomiSPCoop_qualified());
  155.             context.setWSDL_XSD_prettyDocuments(!context.isWSDL_XSD_prettyDocuments());
  156.             if(invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione){
  157.                 context.setWSDL_XSD_allineaImportInclude(!context.isWSDL_XSD_allineaImportInclude());
  158.                 context.setWSDL_XSD_accordiParteSpecifica_openspcoopToSica_eliminazioneImportParteComune(!context.isWSDL_XSD_accordiParteSpecifica_openspcoopToSica_eliminazioneImportParteComune());
  159.             }
  160.             context.setWSDL_XSD_accordiParteSpecifica_gestioneParteComune(!context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune());
  161.             context.setWSDL_XSD_accordiParteSpecifica_wsdlEmpty(!context.isWSDL_XSD_accordiParteSpecifica_wsdlEmpty());
  162.             context.setWSDL_XSD_accordiParteSpecifica_sicaToOpenspcoop_aggiuntaImportParteComune(!context.isWSDL_XSD_accordiParteSpecifica_sicaToOpenspcoop_aggiuntaImportParteComune());
  163.         }
  164.        
  165.         // Compatibilita SICA Client
  166.         context.setSICAClientCompatibility(sicaClientCompatibility);
  167.        
  168.         return context;
  169.     }
  170.    
  171.    
  172.     /**
  173.      *
  174.      * For run:
  175.      * java
  176.      *    it.gov.spcoop.sica.dao.driver.ClientTest example/registroServizi/registroServiziXML [0/1/2/SICA]
  177.      *    
  178.      *    Dove invertiComportamentoDefinitoOpzioni
  179.      *    - 0: comportamento normale
  180.      *    - 1: comportamento completamente invertito
  181.      *    - 2: comportamento invertito tranne opzioni fondamentali per la validazione WSDL e per la ritrasformazione in oggetti openspcoop: verificaCorreggiWSDLImportInclude e generaInformazioniRegistroSICAGenerale
  182.      *    - SICA: package SICA Client compatibility
  183.      *
  184.      * @param args
  185.      */
  186.     public static void main(String[] args) {
  187.         // TODO Auto-generated method stub

  188.         try{
  189.            
  190.             if(args==null || args.length<1){
  191.                 System.out.println("Error, java use:");
  192.                 System.out.println("\t java -classpath CLASSPATH it.gov.spcoop.sica.dao.driver.ClientTest \"example/registroServizi/registroServiziXML\" [0/1/2/SICA]");
  193.                 return;
  194.             }
  195.            
  196.             boolean invertiOpzioni = false;
  197.             boolean invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione = false;
  198.             boolean sicaClientCompatibility = false;
  199.             if(args!=null && args.length>1){
  200.                 if("0".equals(args[1].trim())){
  201.                     invertiOpzioni = false;
  202.                 }
  203.                 else if("1".equals(args[1].trim())){
  204.                     invertiOpzioni = true;
  205.                     invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione = true;
  206.                 }
  207.                 else if("2".equals(args[1].trim())){
  208.                     invertiOpzioni = true;
  209.                     invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione = false;
  210.                 }
  211.                 else if("SICA".equalsIgnoreCase(args[1].trim())){
  212.                     sicaClientCompatibility = true;
  213.                 }
  214.                 else{
  215.                     throw new Exception("Proprieta' ["+args[1].trim()+"] non gestita. (Forse volevi usare la proprieta' '0/1/2'?) ");
  216.                 }
  217.             }
  218.                        
  219.             SICAtoOpenSPCoopContext context = ClientTest.getContextSICAToOpenSPCoop(invertiOpzioni, invertireOpzioniCheCausanoFallimentoPerValidazioneETrasformazione, sicaClientCompatibility);
  220.            
  221.             String dir = args[0].trim();
  222.             File dirRegistroServizi = new File(dir);
  223.             if(dirRegistroServizi.exists()==false){
  224.                 throw new Exception("Directory ["+dirRegistroServizi.getAbsolutePath()+"] non esistente");
  225.             }
  226.             if(dirRegistroServizi.canRead()==false){
  227.                 throw new Exception("Directory ["+dirRegistroServizi.getAbsolutePath()+"] non accessibile");
  228.             }
  229.            
  230.            
  231.             java.util.Properties loggerProperties = new java.util.Properties();
  232.             loggerProperties.load(RegistroServizi.class.getResourceAsStream("/govway.log4j2.properties"));
  233.             LoggerWrapperFactory.setLogConfiguration(loggerProperties);
  234.             Logger log = LoggerWrapperFactory.getLogger("openspcoop2.core");
  235.            
  236.             DriverRegistroServiziXML driver = new DriverRegistroServiziXML("/etc/govway/registroServizi.xml", log);
  237.             IRegistryReader registryReader = new RegistryReader(driver, log);
  238.            
  239.             XMLUtils xmlSICAUtilities = new XMLUtils(context,log);
  240.            
  241.             IDAccordoFactory idAccordoFactory = IDAccordoFactory.getInstance();
  242.             IDAccordoCooperazioneFactory idAccordoCooperazioneFactory = IDAccordoCooperazioneFactory.getInstance();
  243.            
  244.            
  245.             System.out.println("********* TEST PER FUNZIONAMENTO DRIVER **************** \n\n");
  246.            
  247.            
  248.            
  249.            
  250.             /* ---- TEST Accordo di Servizio parte comune  ----- */
  251.            
  252.             // 1. Crezione oggetto Java
  253.            
  254.             AccordoServizioParteComune asPC = new AccordoServizioParteComune();
  255.             // Manifest
  256.             AccordoServizio manAsPC = ClientTest.getManifestoAS_ParteComune(context.isInformazioniEGov_specificaSemiformale(),context.isInformazioniEGov_wscp());
  257.             asPC.setManifesto(manAsPC);
  258.             // Allegato
  259.             Documento dAllegato1 = new Documento("Allegato1.doc","DOC","PROVA".getBytes());
  260.             Documento dAllegato2 = new Documento("Allegato2.doc","DOC","PROVA2".getBytes());
  261.             asPC.addAllegato(dAllegato1);
  262.             asPC.addAllegato(dAllegato2);
  263.             // SpecificaSemiformale
  264.             Documento dSS1 = new Documento("Collaborazione.doc",TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString(),"SS".getBytes());
  265.             Documento dSS2 = new Documento("Schemi.xml",TipiDocumentoSemiformale.XML.toString(),"<test/>".getBytes());
  266.             asPC.addSpecificaSemiformale(dSS1);
  267.             asPC.addSpecificaSemiformale(dSS2);
  268.             // Specifica Conversazioni
  269.             Documento conversazioneConcettuale = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_CONCETTUALE_WSBL,
  270.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>concettuale</wsbl>".getBytes());
  271.             asPC.setConversazioneConcettuale(conversazioneConcettuale);
  272.             Documento conversazioneLogicaErogatore = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_LOGICA_LATO_EROGATORE_WSBL,
  273.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>erogatore</wsbl>".getBytes());
  274.             asPC.setConversazioneLogicaErogatore(conversazioneLogicaErogatore);
  275.             Documento conversazioneLogicaFruitore = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_LOGICA_LATO_FRUITORE_WSBL,
  276.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>fruitore</wsbl>".getBytes());
  277.             asPC.setConversazioneLogicaFruitore(conversazioneLogicaFruitore);
  278.             // Specifica Interfacce
  279.             Documento interfacciaConcettuale = new Documento(Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL,
  280.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>concettuale</wsdl>".getBytes());
  281.             asPC.setInterfacciaConcettuale(interfacciaConcettuale);
  282.             Documento interfacciaLogicaErogatore = new Documento(Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL,
  283.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>erogatore</wsdl>".getBytes());
  284.             asPC.setInterfacciaLogicaLatoErogatore(interfacciaLogicaErogatore);
  285.             Documento interfacciaLogicaFruitore = new Documento(Costanti.SPECIFICA_INTERFACCIA_LOGICA_FRUITORE_WSDL,
  286.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>fruitore</wsdl>".getBytes());
  287.             asPC.setInterfacciaLogicaLatoFruitore(interfacciaLogicaFruitore);
  288.             // ModalitaEsplicitaCNIPA per info egov di tipo
  289.             byte[] egovBytes = null;
  290.             String nomeFileInfoEGov = null;
  291.             if(context.isInformazioniEGov_wscp()){
  292.                 ProfiloCollaborazioneEGOV dichiarazioneEGov = ClientTest.getDichiarazioneEGovFormatoClientSICA(manAsPC.getNome());
  293.                 egovBytes = it.gov.spcoop.sica.wscp.driver.XMLUtils.generateDichiarazioneEGov(dichiarazioneEGov,context.isInformazioniEGov_wscpEnabled_childUnqualified());
  294.                 nomeFileInfoEGov = it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV;
  295.             }else{
  296.                 EgovDecllElement dichiarazioneEGov = ClientTest.getDichiarazioneEGov(manAsPC.getNome());
  297.                 egovBytes = it.cnipa.collprofiles.driver.XMLUtils.generateDichiarazioneEGov(dichiarazioneEGov,context.isInformazioniEGov_wscpDisabled_namespaceCnipa());
  298.                 nomeFileInfoEGov = it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV;
  299.             }
  300.             Documento docModalitaEsplicitaCNIPA = new Documento(nomeFileInfoEGov,TipiDocumentoSemiformale.XML.toString(),egovBytes);
  301.             if(context.isInformazioniEGov_specificaSemiformale())
  302.                 asPC.addSpecificaSemiformale(docModalitaEsplicitaCNIPA);
  303.             else
  304.                 asPC.addAllegato(docModalitaEsplicitaCNIPA);
  305.             // Definitorio.xsd
  306.             Documento dAllegatoDEFINITORIO = new Documento(Costanti.ALLEGATO_DEFINITORIO_XSD,"XSD","<xsd>DEFINITORIO</xsd>".getBytes());
  307.             asPC.addAllegato(dAllegatoDEFINITORIO);
  308.            
  309.             // 2. Trasformazione in package
  310.             String fileName = "package.apc";
  311.             xmlSICAUtilities.generateAccordoServizioParteComune(asPC, fileName);
  312.            
  313.             // 3. Ritrasformazione in oggetto java
  314.             AccordoServizioParteComune asParteComune = xmlSICAUtilities.getAccordoServizioParteComune(fileName);
  315.             org.openspcoop2.core.registry.AccordoServizioParteComune asParteComuneOpenSPCoop =
  316.                 SICAtoOpenSPCoopUtilities.accordoServizioParteComune_sicaToOpenspcoop(registryReader,asParteComune,context,log);
  317.             ClientTest.printAccordoServizioParteComune(log,asParteComuneOpenSPCoop,false,false);
  318.            
  319.            
  320.            
  321.            
  322.            
  323.            
  324.            
  325.             /* ---- TEST Accordo di Servizio parte specifica  ----- */
  326.            
  327.             // 1. Crezione oggetto Java
  328.            
  329.             AccordoServizioParteSpecifica asPS = new AccordoServizioParteSpecifica();
  330.             // Manifest
  331.             AccordoServizio manAsPS = ClientTest.getManifestoAS_ParteSpecifica();
  332.             asPS.setManifesto(manAsPS);
  333.             // Allegato
  334.             dAllegato1 = new Documento("Allegato1.doc","DOC","PROVA".getBytes());
  335.             dAllegato2 = new Documento("Allegato2.doc","DOC","PROVA2".getBytes());
  336.             asPS.addAllegato(dAllegato1);
  337.             asPS.addAllegato(dAllegato2);
  338.             // SpecificaSemiformale
  339.             dSS1 = new Documento("Collaborazione.doc",TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString(),"SS".getBytes());
  340.             dSS2 = new Documento("Schemi.xml",TipiDocumentoSemiformale.XML.toString(),"<test/>".getBytes());
  341.             asPS.addSpecificaSemiformale(dSS1);
  342.             asPS.addSpecificaSemiformale(dSS2);
  343.             // Specifica Porti Accesso
  344.             Documento portiAccessoErogatore = new Documento(Costanti.SPECIFICA_PORTI_ACCESSO_EROGATORE_WSDL,
  345.                     TipiDocumentoInterfaccia.WSDL.toString(),ClientTest.wsdlImplementativo.replaceAll("KEYWORD", "EROGATORE").getBytes());
  346.             asPS.setPortiAccessoErogatore(portiAccessoErogatore);
  347.             Documento portiAccessoFruitore = new Documento(Costanti.SPECIFICA_PORTI_ACCESSO_FRUITORE_WSDL,
  348.                     TipiDocumentoInterfaccia.WSDL.toString(),ClientTest.wsdlImplementativo.replaceAll("KEYWORD", "FRUITORE").getBytes());
  349.             asPS.setPortiAccessoFruitore(portiAccessoFruitore);
  350.             // SpecificaLivelliServizio
  351.             Documento servizioMinimo = new Documento("LivelloServizioMinimo.wsla",
  352.                     TipiDocumentoLivelloServizio.WSLA.toString(),"<sla>minimo</sla>".getBytes());
  353.             asPS.addSpecificaLivelloServizio(servizioMinimo);
  354.             Documento servizioMax = new Documento("LivelloServizioOttimale.wsla",
  355.                     TipiDocumentoLivelloServizio.WSLA.toString(),"<sla>max</sla>".getBytes());
  356.             asPS.addSpecificaLivelloServizio(servizioMax);
  357.             // Specifica Sicurezza
  358.             Documento sicurezza1 = new Documento("SicurezzaDelCanale.wspolicy",
  359.                     TipiDocumentoSicurezza.WSPOLICY.toString(),"<sec>wss</sec>".getBytes());
  360.             asPS.addSpecificaSicurezza(sicurezza1);
  361.             Documento sicurezza2 = new Documento("LineeGuida.doc",
  362.                     TipiDocumentoSicurezza.LINGUAGGIO_NATURALE.toString(),"LINEE GUIDA".getBytes());
  363.             asPS.addSpecificaSicurezza(sicurezza2);
  364.            
  365.             // 2. Trasformazione in package
  366.             fileName = "package.aps";
  367.             xmlSICAUtilities.generateAccordoServizioParteSpecifica(asPS, fileName);
  368.            
  369.             // 3. Ritrasformazione in oggetto java
  370.             AccordoServizioParteSpecifica asParteSpecifica = xmlSICAUtilities.getAccordoServizioParteSpecifica(fileName);
  371.             org.openspcoop2.core.registry.AccordoServizioParteSpecifica asParteSpecificaOpenSPCoop =
  372.                 SICAtoOpenSPCoopUtilities.accordoServizioParteSpecifica_sicaToOpenspcoop(registryReader,asParteSpecifica,context,log);
  373.             ClientTest.printAccordoServizioParteSpecifica(log,asParteSpecificaOpenSPCoop,false);
  374.            
  375.             // 4. Trasformazione in package (package.aps) per il servizio composto
  376.             fileName = "package2.aps";
  377.             asPS.getManifesto().setNome(asPS.getManifesto().getNome()+"2");
  378.             xmlSICAUtilities.generateAccordoServizioParteSpecifica(asPS, fileName);
  379.            
  380.            
  381.            
  382.            
  383.            
  384.            
  385.            
  386.            
  387.            
  388.             /* ---- TEST Accordo di Cooperazione  ----- */
  389.            
  390.             // 1. Crezione oggetto Java
  391.            
  392.             AccordoCooperazione ac = new AccordoCooperazione();
  393.             // Manifest
  394.             ac.setManifesto(ClientTest.getManifestoAC());
  395.             // Allegato
  396.             dAllegato1 = new Documento("Allegato1.doc","DOC","PROVA".getBytes());
  397.             dAllegato2 = new Documento("Allegato2.doc","DOC","PROVA2".getBytes());
  398.             ac.addAllegato(dAllegato1);
  399.             ac.addAllegato(dAllegato2);
  400.             // SpecificaSemiformale
  401.             dSS1 = new Documento("Collaborazione.doc",TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString(),"SS".getBytes());
  402.             dSS2 = new Documento("Schemi.xml",TipiDocumentoSemiformale.XML.toString(),"<test/>".getBytes());
  403.             ac.addSpecificaSemiformale(dSS1);
  404.             ac.addSpecificaSemiformale(dSS2);
  405.            
  406.             // 2. Trasformazione in package
  407.             fileName = "package.adc";
  408.             xmlSICAUtilities.generateAccordoCooperazione(ac, fileName);
  409.            
  410.             // 3. Ritrasformazione in oggetto java
  411.             AccordoCooperazione acSICA = xmlSICAUtilities.getAccordoCooperazione(fileName);
  412.             org.openspcoop2.core.registry.AccordoCooperazione acOpenSPCoop = SICAtoOpenSPCoopUtilities.accordoCooperazione_sicaToOpenspcoop(registryReader,acSICA,context,log);
  413.             ClientTest.printAccordoCooperazione(acOpenSPCoop);
  414.            
  415.            
  416.            
  417.            
  418.            
  419.            
  420.            
  421.            
  422.            
  423.             /* ---- TEST Accordo di Servizio composto  ----- */
  424.            
  425.             // 1. Crezione oggetto Java
  426.            
  427.             AccordoServizioComposto aSC = new AccordoServizioComposto();
  428.             // Manifest
  429.             ServizioComposto manASC = ClientTest.getManifestoASComposto(context.isInformazioniEGov_specificaSemiformale(),context.isInformazioniEGov_wscp());
  430.             aSC.setManifesto(manASC);
  431.             // Allegato
  432.             dAllegato1 = new Documento("Allegato1.doc","DOC","PROVA".getBytes());
  433.             dAllegato2 = new Documento("Allegato2.doc","DOC","PROVA2".getBytes());
  434.             aSC.addAllegato(dAllegato1);
  435.             aSC.addAllegato(dAllegato2);
  436.             // SpecificaSemiformale
  437.             dSS1 = new Documento("Collaborazione.doc",TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString(),"SS".getBytes());
  438.             dSS2 = new Documento("Schemi.xml",TipiDocumentoSemiformale.XML.toString(),"<test/>".getBytes());
  439.             aSC.addSpecificaSemiformale(dSS1);
  440.             aSC.addSpecificaSemiformale(dSS2);
  441.             // Specifica Conversazioni
  442.             conversazioneConcettuale = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_CONCETTUALE_WSBL,
  443.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>concettuale</wsbl>".getBytes());
  444.             aSC.setConversazioneConcettuale(conversazioneConcettuale);
  445.             conversazioneLogicaErogatore = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_LOGICA_LATO_EROGATORE_WSBL,
  446.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>erogatore</wsbl>".getBytes());
  447.             aSC.setConversazioneLogicaErogatore(conversazioneLogicaErogatore);
  448.             conversazioneLogicaFruitore = new Documento(Costanti.SPECIFICA_CONVERSAZIONE_LOGICA_LATO_FRUITORE_WSBL,
  449.                     TipiDocumentoConversazione.WSBL.toString(),"<wsbl>fruitore</wsbl>".getBytes());
  450.             aSC.setConversazioneLogicaFruitore(conversazioneLogicaFruitore);
  451.             // Specifica Interfacce
  452.             interfacciaConcettuale = new Documento(Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL,
  453.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>concettuale</wsdl>".getBytes());
  454.             aSC.setInterfacciaConcettuale(interfacciaConcettuale);
  455.             interfacciaLogicaErogatore = new Documento(Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL,
  456.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>erogatore</wsdl>".getBytes());
  457.             aSC.setInterfacciaLogicaLatoErogatore(interfacciaLogicaErogatore);
  458.             interfacciaLogicaFruitore = new Documento(Costanti.SPECIFICA_INTERFACCIA_LOGICA_FRUITORE_WSDL,
  459.                     TipiDocumentoInterfaccia.WSDL.toString(),"<wsdl>fruitore</wsdl>".getBytes());
  460.             aSC.setInterfacciaLogicaLatoFruitore(interfacciaLogicaFruitore);
  461.             // Specifica Coordinamento
  462.             Documento specificaCoordinamento = new Documento("Generica Orchestrazione.bpel",
  463.                     TipiDocumentoCoordinamento.BPEL.toString(),"<bpel>coordinamento</bpel>".getBytes());
  464.             aSC.addSpecificaCoordinamento(specificaCoordinamento);
  465.             Documento specificaCoordinamento2 = new Documento("Generica Orchestrazione.wscdl",
  466.                     TipiDocumentoCoordinamento.WSCDL.toString(),"<wscdl>coordinamento</wscdl>".getBytes());
  467.             aSC.addSpecificaCoordinamento(specificaCoordinamento2);
  468.             // ModalitaEsplicitaCNIPA per info egov
  469.             byte[] egovBytesServizioComposto = null;
  470.             String nomeFileInfoEGovServizioComposto = null;
  471.             if(context.isInformazioniEGov_wscp()){
  472.                 ProfiloCollaborazioneEGOV dichiarazioneEGov = ClientTest.getDichiarazioneEGovFormatoClientSICA(manAsPC.getNome());
  473.                 egovBytesServizioComposto = it.gov.spcoop.sica.wscp.driver.XMLUtils.generateDichiarazioneEGov(dichiarazioneEGov,context.isInformazioniEGov_wscpEnabled_childUnqualified());
  474.                 nomeFileInfoEGovServizioComposto = it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV;
  475.             }else{
  476.                 EgovDecllElement dichiarazioneEGov = ClientTest.getDichiarazioneEGov(manAsPC.getNome());
  477.                 egovBytesServizioComposto = it.cnipa.collprofiles.driver.XMLUtils.generateDichiarazioneEGov(dichiarazioneEGov,context.isInformazioniEGov_wscpDisabled_namespaceCnipa());
  478.                 nomeFileInfoEGovServizioComposto = it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV;
  479.             }
  480.             Documento docModalitaEsplicitaCNIPAServizioComposto = new Documento(nomeFileInfoEGovServizioComposto,TipiDocumentoSemiformale.XML.toString(),egovBytesServizioComposto);
  481.             if(context.isInformazioniEGov_specificaSemiformale())
  482.                 aSC.addSpecificaSemiformale(docModalitaEsplicitaCNIPAServizioComposto);
  483.             else
  484.                 aSC.addAllegato(docModalitaEsplicitaCNIPAServizioComposto);
  485.             // Definitorio.xsd
  486.             dAllegatoDEFINITORIO = new Documento(Costanti.ALLEGATO_DEFINITORIO_XSD,"XSD","<xsd>DEFINITORIO</xsd>".getBytes());
  487.             aSC.addAllegato(dAllegatoDEFINITORIO);

  488.            
  489.             // 2. Trasformazione in package
  490.             fileName = "package.asc";
  491.             xmlSICAUtilities.generateAccordoServizioComposto(aSC, fileName);
  492.            
  493.             // 3. Ritrasformazione in oggetto java
  494.             AccordoServizioComposto asComposto = xmlSICAUtilities.getAccordoServizioComposto(fileName);
  495.             // aggiungo mapping dei servizi SPCoop to uriAPS
  496.             context.addMappingServizioToUriAPS(registryReader, IDServizioFactory.getInstance().getIDServizioFromValues("spc", "ASParteSpecifica","spc", "SoggettoEsempio",2));
  497.             context.addMappingServizioToUriAPS(registryReader, IDServizioFactory.getInstance().getIDServizioFromValues("spc", "ASParteSpecifica2","spc", "SoggettoEsempio",2));
  498.             org.openspcoop2.core.registry.AccordoServizioParteComune asCompostoOpenSPCoop =
  499.                 SICAtoOpenSPCoopUtilities.accordoServizioComposto_sicaToOpenspcoop(registryReader,asComposto,context,log);
  500.             ClientTest.printAccordoServizioParteComune(log,asCompostoOpenSPCoop,false,true);
  501.            
  502.            
  503.            
  504.            
  505.            
  506.            
  507.            
  508.            
  509.            
  510.            
  511.            
  512.            
  513.            
  514.            
  515.             System.out.println("\n\n\n********* SCENARIO REALE AS PARTE COMUNE E SPECIFICA **************** \n\n");
  516.            
  517.            
  518.            
  519.            
  520.            
  521.             /* ---- TEST Scenario Accordo di Servizio ParteComune e partiSpecifiche  ----- */
  522.            
  523.             DriverRegistroServiziXML driverRegistroServiziASParteComuneESpecificaXML = new DriverRegistroServiziXML(dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiServizio"+File.separatorChar+"registroServizi.xml",null);
  524.             if(driverRegistroServiziASParteComuneESpecificaXML.create==false){
  525.                 throw new Exception("RegistroServiziXML non istanziato");
  526.             }
  527.             String DIR_ESEMPI_AS = "ESEMPI_PACKAGE_AS";
  528.             File fDIR_ESEMPI_AS = new File(DIR_ESEMPI_AS);
  529.             if(fDIR_ESEMPI_AS.exists()==false){
  530.                 if(fDIR_ESEMPI_AS.mkdir()==false){
  531.                     throw new Exception("Creazione directory "+fDIR_ESEMPI_AS.getAbsolutePath()+" non riuscita");
  532.                 }
  533.             }else{
  534.                 FileSystemUtilities.deleteDir(fDIR_ESEMPI_AS.getAbsolutePath());
  535.                 if(fDIR_ESEMPI_AS.mkdir()==false){
  536.                     throw new Exception("Creazione directory "+fDIR_ESEMPI_AS.getAbsolutePath()+" non riuscita");
  537.                 }
  538.             }
  539.            
  540.             List<IDAccordo> idAccordi = driverRegistroServiziASParteComuneESpecificaXML.getAllIdAccordiServizioParteComune(null);
  541.             if(idAccordi!=null){
  542.                 for(int i=0; i<idAccordi.size(); i++){
  543.                     org.openspcoop2.core.registry.AccordoServizioParteComune as = driverRegistroServiziASParteComuneESpecificaXML.getAccordoServizioParteComune(idAccordi.get(i));
  544.                     String nomeFile = idAccordoFactory.getUriFromIDAccordo(idAccordi.get(i)).replace(":", "_")+"."+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_PARTE_COMUNE;
  545.                     nomeFile = nomeFile.replace("/", "");
  546.                     nomeFile = DIR_ESEMPI_AS+File.separatorChar+nomeFile;
  547.                     String dirFiles = dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiServizio"+File.separatorChar;
  548.                     boolean servizioComposto = false;
  549.                    
  550.                     // traduzione in package CNIPA
  551.                     ClientTest.normalizzaPackageCNIPA(as,dirFiles,servizioComposto);
  552.                     AccordoServizioParteComune tmp =
  553.                         SICAtoOpenSPCoopUtilities.accordoServizioParteComune_openspcoopToSica(registryReader,as,context,log);
  554.                     if(tmp==null){
  555.                         throw new Exception("AccordoServizioParteComune ["+idAccordi.get(i)+"] non generato in formato CNIPA?");
  556.                     }
  557.                     xmlSICAUtilities.generateAccordoServizioParteComune(tmp, nomeFile);
  558.                    
  559.                     // Verifica package CNIPA
  560.                     if(context.isWSDL_XSD_allineaImportInclude()){
  561.                         System.out.println("------------------------------------------------------------------------------------------------");
  562.                         System.out.println("Accordo di Servizio ["+idAccordoFactory.getUriFromAccordo(as)+"] verifica WSDL");
  563.                         ClientTest.verificaAccordoServizioParteComune(nomeFile,as);
  564.                         System.out.println("------------------------------------------------------------------------------------------------");
  565.                     }else{
  566.                         System.out.println("------------------------------------------------------------------------------------------------");
  567.                         System.out.println("Accordo di Servizio ["+idAccordoFactory.getUriFromAccordo(as)+"] verifica WSDL non attuata poiche' non vi e' abilitata l'opzione 'WSDL_XSD.allineaImportInclude'");
  568.                         System.out.println("------------------------------------------------------------------------------------------------");
  569.                     }
  570.                    
  571.                     // Ritrasformazione in oggetto java
  572.                     if(context.isSICAClient_includiInfoRegistroGenerale()){
  573.                         AccordoServizioParteComune tmpRitrasformato = xmlSICAUtilities.getAccordoServizioParteComune(nomeFile);
  574.                         org.openspcoop2.core.registry.AccordoServizioParteComune asRitrasformatopenSPCoop =
  575.                             SICAtoOpenSPCoopUtilities.accordoServizioParteComune_sicaToOpenspcoop(registryReader,tmpRitrasformato,context,log);
  576.                         ClientTest.printAccordoServizioParteComune(log,asRitrasformatopenSPCoop,true,false);
  577.                     }else{
  578.                         System.out.println("------------------------------------------------------------------------------------------------");
  579.                         System.out.println("Accordo di Servizio ["+idAccordoFactory.getUriFromAccordo(as)+"] non ritrasformato in oggetto openspcoop, poiche' mancano le informazioni del registro SICA Generale (es. Soggetto Referente)");
  580.                         System.out.println("------------------------------------------------------------------------------------------------");
  581.                     }
  582.                 }
  583.             }  
  584.            
  585.            
  586.             List<IDServizio> idServizio = driverRegistroServiziASParteComuneESpecificaXML.getAllIdServizi(null);
  587.             if(idServizio!=null){
  588.                 for(int i=0; i<idServizio.size(); i++){
  589.                     org.openspcoop2.core.registry.AccordoServizioParteSpecifica asps =
  590.                         driverRegistroServiziASParteComuneESpecificaXML.getAccordoServizioParteSpecifica(idServizio.get(i));
  591.                     String nomeServizio = asps.getTipoSoggettoErogatore()+asps.getNomeSoggettoErogatore()+"_"+
  592.                             asps.getTipo()+asps.getNome()+asps.getVersione();
  593.                     String nomeFile = nomeServizio+"."+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_PARTE_SPECIFICA;
  594.                     nomeFile = nomeFile.replace("/", "");
  595.                     nomeFile = DIR_ESEMPI_AS+File.separatorChar+nomeFile;
  596.                     String dirFiles = dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiServizio"+File.separatorChar;
  597.                     boolean implementazioneServizioComposto = false;
  598.                     org.openspcoop2.core.registry.AccordoServizioParteComune asParteComuneDaIncludere = null;
  599.                     if(context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune()){
  600.                         asParteComuneDaIncludere = driverRegistroServiziASParteComuneESpecificaXML.getAccordoServizioParteComune(idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  601.                         if(asParteComuneDaIncludere==null){
  602.                             throw new Exception("Accordo di servizio parte comune ["+asps.getAccordoServizioParteComune()+"] per il Servizio SPCoop ["+nomeServizio+"] non trovata sul Registro dei Servizi");
  603.                         }
  604.                     }
  605.                     Soggetto soggettoErogatore = driverRegistroServiziASParteComuneESpecificaXML.getSoggetto(new IDSoggetto(asps.getTipoSoggettoErogatore(),asps.getNomeSoggettoErogatore()));
  606.                     if(soggettoErogatore==null){
  607.                         throw new Exception("Soggetto erogatore ["+asps.getTipoSoggettoErogatore()+"/"+asps.getNomeSoggettoErogatore()+"] per il Servizio SPCoop ["+nomeServizio+"] non trovato sul Registro dei Servizi");
  608.                     }
  609.                    
  610.                     // traduzione in package CNIPA
  611.                     ClientTest.normalizzaPackageCNIPA(asps,dirFiles,soggettoErogatore.getConnettore());
  612.                     AccordoServizioParteSpecifica tmp =
  613.                         SICAtoOpenSPCoopUtilities.accordoServizioParteSpecifica_openspcoopToSica(registryReader,asps,implementazioneServizioComposto,asParteComuneDaIncludere,context,log);
  614.                     if(tmp==null){
  615.                         throw new Exception("AccordoServizioParteSpecifica ["+idAccordi.get(i)+"] non generato in formato CNIPA?");
  616.                     }
  617.                     xmlSICAUtilities.generateAccordoServizioParteSpecifica(tmp, nomeFile);

  618.                     // Verifica package CNIPA
  619.                     if(context.isWSDL_XSD_allineaImportInclude() && ( (!context.isWSDL_XSD_accordiParteSpecifica_openspcoopToSica_eliminazioneImportParteComune()) || context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune()) ){
  620.                         System.out.println("------------------------------------------------------------------------------------------------");
  621.                         System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL");
  622.                         ClientTest.verificaAccordoServizioParteSpecifica(nomeFile,asps,context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune(),DIR_ESEMPI_AS,false);
  623.                         System.out.println("------------------------------------------------------------------------------------------------");
  624.                     }else{
  625.                         System.out.println("------------------------------------------------------------------------------------------------");
  626.                         if(!context.isWSDL_XSD_allineaImportInclude())
  627.                             System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL non attuata poiche' non vi e' abilitata l'opzione 'WSDL_XSD.allineaImportInclude'");
  628.                         else {
  629.                             System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL non attuata poiche'  vi e' sia abilitata l'opzione 'WSDL_XSD.accordiParteSpecifica.openspcoopToSica.eliminazioneImportParteComune' che disabilitata l'opzione 'WSDL_XSD.accordiParteSpecifica.gestioneParteComune'");
  630.                         }
  631.                         System.out.println("------------------------------------------------------------------------------------------------");
  632.                     }
  633.                    
  634.                     // Ritrasformazione in oggetto java
  635.                     if(context.isSICAClient_includiInfoRegistroGenerale()){
  636.                         AccordoServizioParteSpecifica tmpRitrasformato = xmlSICAUtilities.getAccordoServizioParteSpecifica(nomeFile);
  637.                         org.openspcoop2.core.registry.AccordoServizioParteSpecifica asRitrasformatopenSPCoop =
  638.                             SICAtoOpenSPCoopUtilities.accordoServizioParteSpecifica_sicaToOpenspcoop(registryReader,tmpRitrasformato,context,log);
  639.                         ClientTest.printAccordoServizioParteSpecifica(log,asRitrasformatopenSPCoop,true);
  640.                     }else{
  641.                         System.out.println("------------------------------------------------------------------------------------------------");
  642.                         System.out.println("Servizio SPCoop ["+nomeServizio+"] non ritrasformato in oggetto openspcoop, poiche' mancano le informazioni del registro SICA Generale (es. Soggetto Referente)");
  643.                         System.out.println("------------------------------------------------------------------------------------------------");
  644.                     }
  645.                 }
  646.             }
  647.            
  648.            
  649.            

  650.            
  651.            
  652.            
  653.            
  654.            
  655.            
  656.            
  657.            
  658.            
  659.            
  660.             System.out.println("\n\n\n********* SCENARIO REALE AS SERVIZI COMPOSTI E ACCORDI DI COOPERAZIONE **************** \n\n");
  661.            
  662.            
  663.            
  664.            
  665.            
  666.             /* ---- TEST Scenario Accordo di Cooperazione e servizi composti  ----- */
  667.            
  668.             DriverRegistroServiziXML driverRegistroServiziASCompostiEACooperazioneXML = new DriverRegistroServiziXML(dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiCooperazione"+File.separatorChar+"registroServizi.xml",null);
  669.             if(driverRegistroServiziASCompostiEACooperazioneXML.create==false){
  670.                 throw new Exception("RegistroServiziXML non istanziato");
  671.             }
  672.             String DIR_ESEMPI_AC = "ESEMPI_PACKAGE_AC";
  673.             File fDIR_ESEMPI_AC = new File(DIR_ESEMPI_AC);
  674.             if(fDIR_ESEMPI_AC.exists()==false){
  675.                 if(fDIR_ESEMPI_AC.mkdir()==false){
  676.                     throw new Exception("Creazione directory "+fDIR_ESEMPI_AC.getAbsolutePath()+" non riuscita");
  677.                 }
  678.             }else{
  679.                 FileSystemUtilities.deleteDir(fDIR_ESEMPI_AC.getAbsolutePath());
  680.                 if(fDIR_ESEMPI_AC.mkdir()==false){
  681.                     throw new Exception("Creazione directory "+fDIR_ESEMPI_AC.getAbsolutePath()+" non riuscita");
  682.                 }
  683.             }
  684.            
  685.             // Lo scenario di accordi di cooperazione richiede anche il servizio sincrono precedentemente generato.
  686.             String nomeFileTMP = "SPCMinisteroReferente_EsempioASParteComune_1."+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_PARTE_COMUNE;
  687.             String nomeFileAS = DIR_ESEMPI_AS+File.separatorChar+nomeFileTMP;
  688.             String nomeFileAC = DIR_ESEMPI_AC+File.separatorChar+nomeFileTMP;
  689.             FileSystemUtilities.copy(nomeFileAS, nomeFileAC);
  690.            
  691.            
  692.            
  693.             List<IDAccordoCooperazione> idAccordiCooperazione = driverRegistroServiziASCompostiEACooperazioneXML.getAllIdAccordiCooperazione(null);
  694.             if(idAccordiCooperazione!=null){
  695.                 for(int i=0; i<idAccordiCooperazione.size(); i++){
  696.                     org.openspcoop2.core.registry.AccordoCooperazione acoop = driverRegistroServiziASCompostiEACooperazioneXML.getAccordoCooperazione(idAccordiCooperazione.get(i));
  697.                     String nomeFile = idAccordoCooperazioneFactory.getUriFromIDAccordo(idAccordiCooperazione.get(i)).replace(":", "_")+"."+Costanti.ESTENSIONE_ACCORDO_COOPERAZIONE;
  698.                     nomeFile = nomeFile.replace("/", "");
  699.                     nomeFile = DIR_ESEMPI_AC+File.separatorChar+nomeFile;
  700.                     String dirFiles = dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiCooperazione"+File.separatorChar;
  701.                    
  702.                     // traduzione in package CNIPA
  703.                     ClientTest.normalizzaPackageCNIPA(acoop,dirFiles);
  704.                     AccordoCooperazione tmp =
  705.                         SICAtoOpenSPCoopUtilities.accordoCooperazione_openspcoopToSica(registryReader,acoop,context,log);
  706.                     if(tmp==null){
  707.                         throw new Exception("AccordoCooperazione ["+idAccordiCooperazione.get(i)+"] non generato in formato CNIPA?");
  708.                     }
  709.                     xmlSICAUtilities.generateAccordoCooperazione(tmp, nomeFile);
  710.                    
  711.                     // Verifica package CNIPA non esistente, non vi sono WSDL, e' solo un documento istitutivo
  712.                     /*if(context.isWSDL_XSD_allineaImportInclude()){
  713.                         System.out.println("------------------------------------------------------------------------------------------------");
  714.                         System.out.println("Accordo di Cooperazione ["+IDAccordoCooperazione.getUriFromAccordo(acoop)+"] verifica WSDL");
  715.                         verificaAccordoServizioParteComune(nomeFile,ac);
  716.                         System.out.println("------------------------------------------------------------------------------------------------");
  717.                     }else{
  718.                         System.out.println("------------------------------------------------------------------------------------------------");
  719.                         System.out.println("Accordo di Cooperazione ["+IDAccordoCooperazione.getUriFromAccordo(acoop)+"] verifica WSDL non attuata poiche' non vi e' abilitata l'opzione 'WSDL_XSD.allineaImportInclude'");
  720.                         System.out.println("------------------------------------------------------------------------------------------------");
  721.                     }*/
  722.                    
  723.                     // Ritrasformazione in oggetto java
  724.                     if(context.isSICAClient_includiInfoRegistroGenerale()){
  725.                         AccordoCooperazione tmpRitrasformato = xmlSICAUtilities.getAccordoCooperazione(nomeFile);
  726.                         org.openspcoop2.core.registry.AccordoCooperazione acRitrasformatopenSPCoop =
  727.                             SICAtoOpenSPCoopUtilities.accordoCooperazione_sicaToOpenspcoop(registryReader,tmpRitrasformato,context,log);
  728.                         ClientTest.printAccordoCooperazione(acRitrasformatopenSPCoop);
  729.                     }else{
  730.                         System.out.println("------------------------------------------------------------------------------------------------");
  731.                         System.out.println("Accordo di Cooperazione ["+idAccordoCooperazioneFactory.getUriFromAccordo(acoop)+"] non ritrasformato in oggetto openspcoop, poiche' mancano le informazioni del registro SICA Generale (es. Soggetto Referente)");
  732.                         System.out.println("------------------------------------------------------------------------------------------------");
  733.                     }
  734.                 }
  735.             }  
  736.            
  737.            
  738.            
  739.            
  740.            
  741.            
  742.             List<IDAccordo> idAccordiServiziComposti = driverRegistroServiziASCompostiEACooperazioneXML.getAllIdAccordiServizioParteComune(null);
  743.             if(idAccordiServiziComposti!=null){
  744.                 for(int i=0; i<idAccordiServiziComposti.size(); i++){
  745.                     org.openspcoop2.core.registry.AccordoServizioParteComune as = driverRegistroServiziASCompostiEACooperazioneXML.getAccordoServizioParteComune(idAccordiServiziComposti.get(i));
  746.                     if(as.getServizioComposto()==null){
  747.                         throw new Exception("Accordo di servizio Composto ["+idAccordiServiziComposti.get(i).toString()+"] non e' un accordo di servizio composto");
  748.                     }
  749.                     String nomeFile = idAccordoFactory.getUriFromIDAccordo(idAccordiServiziComposti.get(i)).replace(":", "_")+"."+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_COMPOSTO;
  750.                     nomeFile = nomeFile.replace("/", "");
  751.                     nomeFile = DIR_ESEMPI_AC+File.separatorChar+nomeFile;
  752.                     String dirFiles = dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiCooperazione"+File.separatorChar;
  753.                     boolean servizioComposto = true;
  754.                    
  755.                     // addMapping tra uriAPS e IDServizio SPCoop
  756.                     if(as.getServizioComposto()!=null){
  757.                         for(int j=0;j<as.getServizioComposto().sizeServizioComponenteList();j++){
  758.                             AccordoServizioParteComuneServizioCompostoServizioComponente sc = as.getServizioComposto().getServizioComponente(j);
  759.                             IDServizio idServizioComponente = IDServizioFactory.getInstance().getIDServizioFromValues(sc.getTipo(), sc.getNome(),
  760.                                     sc.getTipoSoggetto(), sc.getNomeSoggetto(),
  761.                                     sc.getVersione());
  762.                             context.addMappingServizioToUriAPS(registryReader, idServizioComponente);
  763.                         }
  764.                     }
  765.                    
  766.                     // traduzione in package CNIPA
  767.                     ClientTest.normalizzaPackageCNIPA(as,dirFiles,servizioComposto);
  768.                     AccordoServizioComposto tmp =
  769.                         SICAtoOpenSPCoopUtilities.accordoServizioComposto_openspcoopToSica(registryReader,as,context,log);
  770.                     if(tmp==null){
  771.                         throw new Exception("AccordoServizioComposto ["+idAccordiServiziComposti.get(i)+"] non generato in formato CNIPA?");
  772.                     }
  773.                     xmlSICAUtilities.generateAccordoServizioComposto(tmp, nomeFile);
  774.                    
  775.                     // Verifica package CNIPA
  776.                     if(context.isWSDL_XSD_allineaImportInclude()){
  777.                         System.out.println("------------------------------------------------------------------------------------------------");
  778.                         System.out.println("Accordo di Servizio Composto  ["+idAccordoFactory.getUriFromAccordo(as)+"] verifica WSDL");
  779.                         ClientTest.verificaAccordoServizioParteComune(nomeFile,as);
  780.                         System.out.println("------------------------------------------------------------------------------------------------");
  781.                     }else{
  782.                         System.out.println("------------------------------------------------------------------------------------------------");
  783.                         System.out.println("Accordo di Servizio Composto ["+idAccordoFactory.getUriFromAccordo(as)+"] verifica WSDL non attuata poiche' non vi e' abilitata l'opzione 'WSDL_XSD.allineaImportInclude'");
  784.                         System.out.println("------------------------------------------------------------------------------------------------");
  785.                     }
  786.                    
  787.                     // Ritrasformazione in oggetto java
  788.                     if(context.isSICAClient_includiInfoRegistroGenerale()){
  789.                         AccordoServizioComposto tmpRitrasformato = xmlSICAUtilities.getAccordoServizioComposto(nomeFile);
  790.                         org.openspcoop2.core.registry.AccordoServizioParteComune asRitrasformatopenSPCoop =
  791.                             SICAtoOpenSPCoopUtilities.accordoServizioComposto_sicaToOpenspcoop(registryReader,tmpRitrasformato,context,log);
  792.                         ClientTest.printAccordoServizioParteComune(log,asRitrasformatopenSPCoop,true,true);
  793.                     }else{
  794.                         System.out.println("------------------------------------------------------------------------------------------------");
  795.                         System.out.println("Accordo di Servizio ["+idAccordoFactory.getUriFromAccordo(as)+"] non ritrasformato in oggetto openspcoop, poiche' mancano le informazioni del registro SICA Generale (es. Soggetto Referente)");
  796.                         System.out.println("------------------------------------------------------------------------------------------------");
  797.                     }
  798.                 }
  799.             }  
  800.            
  801.            
  802.            
  803.            
  804.             List<IDServizio> idServiziComponenti = driverRegistroServiziASCompostiEACooperazioneXML.getAllIdServizi(null);
  805.             if(idServiziComponenti!=null){
  806.                 for(int i=0; i<idServiziComponenti.size(); i++){
  807.                     org.openspcoop2.core.registry.AccordoServizioParteSpecifica asps =
  808.                         driverRegistroServiziASCompostiEACooperazioneXML.getAccordoServizioParteSpecifica(idServiziComponenti.get(i));
  809.                     String nomeServizio = asps.getTipoSoggettoErogatore()+asps.getNomeSoggettoErogatore()+"_"+
  810.                             asps.getTipo()+asps.getNome()+asps.getVersione();
  811.                     String nomeFile = nomeServizio+"."+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_PARTE_SPECIFICA;
  812.                     nomeFile = nomeFile.replace("/", "");
  813.                     nomeFile = DIR_ESEMPI_AC+File.separatorChar+nomeFile;
  814.                     String dirFiles = dirRegistroServizi.getAbsolutePath()+File.separatorChar+"accordiCooperazione"+File.separatorChar;
  815.                     boolean implementazioneServizioComposto = "EsempioServizioComposto".equals(asps.getNome());
  816.                     org.openspcoop2.core.registry.AccordoServizioParteComune asParteComuneDaIncludere = null;
  817.                     if(context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune()){
  818.                         if("EsempioServizioComposto".equals(asps.getNome())){
  819.                             asParteComuneDaIncludere = driverRegistroServiziASCompostiEACooperazioneXML.getAccordoServizioParteComune(idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  820.                         }else{
  821.                             asParteComuneDaIncludere = driverRegistroServiziASParteComuneESpecificaXML.getAccordoServizioParteComune(idAccordoFactory.getIDAccordoFromUri(asps.getAccordoServizioParteComune()));
  822.                         }
  823.                         if(asParteComuneDaIncludere==null){
  824.                             throw new Exception("Accordo di servizio parte comune ["+asps.getAccordoServizioParteComune()+"] per il Servizio SPCoop ["+nomeServizio+"] non trovata sul Registro dei Servizi");
  825.                         }
  826.                     }
  827.                     Soggetto soggettoErogatore = driverRegistroServiziASCompostiEACooperazioneXML.getSoggetto(new IDSoggetto(asps.getTipoSoggettoErogatore(),asps.getNomeSoggettoErogatore()));
  828.                     if(soggettoErogatore==null){
  829.                         throw new Exception("Soggetto erogatore ["+asps.getTipoSoggettoErogatore()+"/"+asps.getNomeSoggettoErogatore()+"] per il Servizio SPCoop ["+nomeServizio+"] non trovato sul Registro dei Servizi");
  830.                     }
  831.                    
  832.                     // traduzione in package CNIPA
  833.                     ClientTest.normalizzaPackageCNIPA(asps,dirFiles,soggettoErogatore.getConnettore());
  834.                     AccordoServizioParteSpecifica tmp =
  835.                         SICAtoOpenSPCoopUtilities.accordoServizioParteSpecifica_openspcoopToSica(registryReader,asps,implementazioneServizioComposto,asParteComuneDaIncludere,context,log);
  836.                     if(tmp==null){
  837.                         throw new Exception("AccordoServizioParteSpecifica ["+idAccordi.get(i)+"] non generato in formato CNIPA?");
  838.                     }
  839.                     xmlSICAUtilities.generateAccordoServizioParteSpecifica(tmp, nomeFile);

  840.                     // Verifica package CNIPA
  841.                     if(context.isWSDL_XSD_allineaImportInclude() && ( (!context.isWSDL_XSD_accordiParteSpecifica_openspcoopToSica_eliminazioneImportParteComune()) || context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune()) ){
  842.                         System.out.println("------------------------------------------------------------------------------------------------");
  843.                         System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL");
  844.                         ClientTest.verificaAccordoServizioParteSpecifica(nomeFile,asps,context.isWSDL_XSD_accordiParteSpecifica_gestioneParteComune(),DIR_ESEMPI_AC,implementazioneServizioComposto);
  845.                         System.out.println("------------------------------------------------------------------------------------------------");
  846.                     }else{
  847.                         System.out.println("------------------------------------------------------------------------------------------------");
  848.                         if(!context.isWSDL_XSD_allineaImportInclude())
  849.                             System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL non attuata poiche' non vi e' abilitata l'opzione 'WSDL_XSD.allineaImportInclude'");
  850.                         else {
  851.                             System.out.println("Servizio SPCoop ["+nomeServizio+"] verifica WSDL non attuata poiche'  vi e' sia abilitata l'opzione 'WSDL_XSD.accordiParteSpecifica.openspcoopToSica.eliminazioneImportParteComune' che disabilitata l'opzione 'WSDL_XSD.accordiParteSpecifica.gestioneParteComune'");
  852.                         }
  853.                         System.out.println("------------------------------------------------------------------------------------------------");
  854.                     }
  855.                    
  856.                     // Ritrasformazione in oggetto java
  857.                     if(context.isSICAClient_includiInfoRegistroGenerale()){
  858.                         AccordoServizioParteSpecifica tmpRitrasformato = xmlSICAUtilities.getAccordoServizioParteSpecifica(nomeFile);
  859.                         org.openspcoop2.core.registry.AccordoServizioParteSpecifica asRitrasformatopenSPCoop =
  860.                             SICAtoOpenSPCoopUtilities.accordoServizioParteSpecifica_sicaToOpenspcoop(registryReader,tmpRitrasformato,context,log);
  861.                         ClientTest.printAccordoServizioParteSpecifica(log,asRitrasformatopenSPCoop,true);
  862.                     }else{
  863.                         System.out.println("------------------------------------------------------------------------------------------------");
  864.                         System.out.println("Servizio SPCoop ["+nomeServizio+"] non ritrasformato in oggetto openspcoop, poiche' mancano le informazioni del registro SICA Generale (es. Soggetto Referente)");
  865.                         System.out.println("------------------------------------------------------------------------------------------------");
  866.                     }
  867.                 }
  868.             }
  869.            
  870.            
  871.            
  872.            
  873.            
  874.         }catch(Exception e){
  875.             e.printStackTrace(System.out);
  876.         }
  877.        
  878.     }

  879.     private static void printImportFromWSDL(Logger log,byte[] doc)throws Exception{
  880.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;        
  881.         WSDLUtilities wsdlUtilities = WSDLUtilities.getInstance(xmlUtils);
  882.         if(xmlUtils.isDocument(doc)){
  883.             Document d = xmlUtils.newDocument(doc);
  884.             List<Node> imports = wsdlUtilities.readImports(d);
  885.             for(int i=0; i<imports.size(); i++){
  886.                 Node n = imports.get(i);
  887.                 String namespaceImport = null;
  888.                 try{
  889.                     namespaceImport = wsdlUtilities.getImportNamespace(n);
  890.                 }catch(Exception e){
  891.                     // ignore
  892.                 }
  893.                 String location = null;
  894.                 try{
  895.                     location = wsdlUtilities.getImportLocation(n);
  896.                 }catch(Exception e){
  897.                     // ignore
  898.                 }
  899.                 System.out.println("          Import namespace=\""+namespaceImport+"\" location=\""+location+"\"");
  900.             }
  901.         }
  902.     }
  903.     private static void printImportIntoTypesFromWSDL(Logger log,byte[] doc)throws Exception{
  904.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;
  905.         WSDLUtilities wsdlUtilities = WSDLUtilities.getInstance(xmlUtils);
  906.         XSDUtils xsdUtils = new XSDUtils(xmlUtils);
  907.         if(xmlUtils.isDocument(doc)){
  908.             Document d = xmlUtils.newDocument(doc);
  909.             List<Node> imports = wsdlUtilities.readImportsSchemaIntoTypes(d);
  910.             for(int i=0; i<imports.size(); i++){
  911.                 Node n = imports.get(i);
  912.                 String namespaceImport = null;
  913.                 try{
  914.                     namespaceImport = xsdUtils.getImportNamespace(n);
  915.                 }catch(Exception e){
  916.                     // ignore
  917.                 }
  918.                 String location = null;
  919.                 try{
  920.                     location = xsdUtils.getImportSchemaLocation(n);
  921.                 }catch(Exception e){
  922.                     // ignore
  923.                 }
  924.                 System.out.println("          Import (types.schema) namespace=\""+namespaceImport+"\" schemaLocation=\""+location+"\"");
  925.             }
  926.         }
  927.     }
  928.     private static void printIncludeIntoTypesFromWSDL(Logger log,byte[] doc)throws Exception{
  929.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;    
  930.         WSDLUtilities wsdlUtilities = WSDLUtilities.getInstance(xmlUtils);
  931.         XSDUtils xsdUtils = new XSDUtils(xmlUtils);
  932.         if(xmlUtils.isDocument(doc)){
  933.             Document d = xmlUtils.newDocument(doc);
  934.             List<Node> include = wsdlUtilities.readIncludesSchemaIntoTypes(d);
  935.             for(int i=0; i<include.size(); i++){
  936.                 Node n = include.get(i);
  937.                 String location = null;
  938.                 try{
  939.                     location = xsdUtils.getIncludeSchemaLocation(n);
  940.                 }catch(Exception e){
  941.                     // ignore
  942.                 }
  943.                 System.out.println("          Include (types.schema) schemaLocation=\""+location+"\"");
  944.             }
  945.         }
  946.     }
  947.     private static void printImportFromXSD(Logger log,byte[] doc)throws Exception{
  948.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;        
  949.         XSDUtils xsdUtils = new XSDUtils(xmlUtils);
  950.         if(xmlUtils.isDocument(doc)){
  951.             Document d = xmlUtils.newDocument(doc);
  952.             List<Node> imports = xsdUtils.readImports(d);
  953.             for(int i=0; i<imports.size(); i++){
  954.                 Node n = imports.get(i);
  955.                 String namespaceImport = null;
  956.                 try{
  957.                     namespaceImport = xsdUtils.getImportNamespace(n);
  958.                 }catch(Exception e){
  959.                     // ignore
  960.                 }
  961.                 String location = null;
  962.                 try{
  963.                     location = xsdUtils.getImportSchemaLocation(n);
  964.                 }catch(Exception e){
  965.                     // ignore
  966.                 }
  967.                 System.out.println("          Import namespace=\""+namespaceImport+"\" schemaLocation=\""+location+"\"");
  968.             }
  969.         }
  970.     }
  971.     private static void printIncludeFromXSD(Logger log,byte[] doc)throws Exception{
  972.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;        
  973.         XSDUtils xsdUtils = new XSDUtils(xmlUtils);
  974.         if(xmlUtils.isDocument(doc)){
  975.             Document d = xmlUtils.newDocument(doc);
  976.             List<Node> includes = xsdUtils.readIncludes(d);
  977.             for(int i=0; i<includes.size(); i++){
  978.                 Node n = includes.get(i);
  979.                 String location = null;
  980.                 try{
  981.                     location = xsdUtils.getIncludeSchemaLocation(n);
  982.                 }catch(Exception e){
  983.                     // ignore
  984.                 }
  985.                 System.out.println("          Include schemaLocation=\""+location+"\"");
  986.             }
  987.         }
  988.     }
  989.     private static void printElementIntoWSDL(Logger log,byte[] doc)throws Exception{
  990.    
  991.         AbstractXMLUtils xmlUtils = org.openspcoop2.message.xml.MessageXMLUtils.DEFAULT;        
  992.         WSDLUtilities wsdlUtilities = WSDLUtilities.getInstance(xmlUtils);
  993.         Document d = xmlUtils.newDocument(doc);
  994.         wsdlUtilities.removeTypes(d);
  995.         wsdlUtilities.removeImports(d);
  996.                
  997.         DefinitionWrapper wsdl = new DefinitionWrapper(d,xmlUtils);
  998.        
  999.         //System.out.println("PRESENTI "+wsdl.toString());
  1000.        
  1001.         // messages.
  1002.         Map<?, ?> messages = wsdl.getMessages();
  1003.         if(messages!=null && messages.size()>0){
  1004.             Iterator<?> it = messages.keySet().iterator();
  1005.             while(it.hasNext()){
  1006.                 javax.xml.namespace.QName key = (javax.xml.namespace.QName) it.next();
  1007.                 Message msg = (Message) messages.get(key);
  1008.                 System.out.println("          Message="+msg.getQName().toString());
  1009.             }
  1010.         }
  1011.        
  1012.         // port types
  1013.         Map<?, ?> porttypes = wsdl.getAllPortTypes();
  1014.         if(porttypes!=null && porttypes.size()>0){
  1015.             Iterator<?> it = porttypes.keySet().iterator();
  1016.             while(it.hasNext()){
  1017.                 javax.xml.namespace.QName key = (javax.xml.namespace.QName) it.next();
  1018.                 javax.wsdl.PortType pt = (javax.wsdl.PortType) porttypes.get(key);
  1019.                 System.out.println("          PortType="+pt.getQName().toString()+" ("+pt.getOperations().size()+" operations)");
  1020.                 for(int i=0; i<pt.getOperations().size();i++){
  1021.                     javax.wsdl.Operation op = (javax.wsdl.Operation) pt.getOperations().get(i);
  1022.                     String tipo="InputOutput";
  1023.                     if(op.getOutput()==null){
  1024.                         tipo="InputOnly";
  1025.                     }
  1026.                     System.out.println("                  Operation="+op.getName()+" ("+tipo+")" );
  1027.                 }
  1028.             }
  1029.         }
  1030.        
  1031.         // binding
  1032.         Map<?, ?> bindings = wsdl.getAllBindings();
  1033.         if(bindings!=null && bindings.size()>0){
  1034.             Iterator<?> it = bindings.keySet().iterator();
  1035.             while(it.hasNext()){
  1036.                 javax.xml.namespace.QName key = (javax.xml.namespace.QName) it.next();
  1037.                 Binding binding = (Binding) bindings.get(key);
  1038.                 System.out.println("          Binding="+binding.getQName().toString());
  1039.             }
  1040.         }
  1041.        
  1042.         // service
  1043.         Map<?, ?> services = wsdl.getAllServices();
  1044.         if(services!=null && services.size()>0){
  1045.             Iterator<?> it = services.keySet().iterator();
  1046.             while(it.hasNext()){
  1047.                 javax.xml.namespace.QName key = (javax.xml.namespace.QName) it.next();
  1048.                 Service service = (Service) services.get(key);
  1049.                 System.out.println("          Service="+service.getQName().toString());
  1050.             }
  1051.         }
  1052.     }
  1053.    
  1054.    
  1055.     private static void printAccordoServizioParteComune(Logger log,org.openspcoop2.core.registry.AccordoServizioParteComune asParteComuneOpenSPCoop,boolean readWSDL_XSD,boolean servizioComposto) throws Exception{
  1056.        
  1057.         IDAccordoFactory idAccordoFactory = IDAccordoFactory.getInstance();
  1058.        
  1059.         System.out.println("------------------------------------------------------------------------------------------------");
  1060.         System.out.println("Accordo di Servizio ["+idAccordoFactory.getUriFromAccordo(asParteComuneOpenSPCoop)+"] gestito correttamente");
  1061.         if(asParteComuneOpenSPCoop.getByteWsdlDefinitorio()!=null){
  1062.             System.out.println("- WSDL Definitorio");
  1063.             if(readWSDL_XSD){
  1064.                 ClientTest.printImportFromXSD(log,asParteComuneOpenSPCoop.getByteWsdlDefinitorio());
  1065.                 ClientTest.printIncludeFromXSD(log,asParteComuneOpenSPCoop.getByteWsdlDefinitorio());
  1066.             }
  1067.         }
  1068.         System.out.println("- Allegati: "+asParteComuneOpenSPCoop.sizeAllegatoList());
  1069.         for(int i=0; i<asParteComuneOpenSPCoop.sizeAllegatoList(); i++){
  1070.             org.openspcoop2.core.registry.Documento doc = asParteComuneOpenSPCoop.getAllegato(i);
  1071.             System.out.println("    - ("+doc.getTipo()+") "+doc.getFile());
  1072.             if(readWSDL_XSD){
  1073.                 ClientTest.printImportFromXSD(log,doc.getByteContenuto());
  1074.                 ClientTest.printIncludeFromXSD(log,doc.getByteContenuto());
  1075.             }
  1076.         }
  1077.         System.out.println("- SpecificheSemiformali: "+asParteComuneOpenSPCoop.sizeSpecificaSemiformaleList());
  1078.         for(int i=0; i<asParteComuneOpenSPCoop.sizeSpecificaSemiformaleList(); i++){
  1079.             org.openspcoop2.core.registry.Documento doc = asParteComuneOpenSPCoop.getSpecificaSemiformale(i);
  1080.             System.out.println("    - ("+doc.getTipo()+") "+doc.getFile());
  1081.             if(readWSDL_XSD){
  1082.                 ClientTest.printImportFromXSD(log,doc.getByteContenuto());
  1083.                 ClientTest.printIncludeFromXSD(log,doc.getByteContenuto());
  1084.             }
  1085.         }
  1086.         if(servizioComposto){
  1087.             AccordoServizioParteComuneServizioComposto asComposto = asParteComuneOpenSPCoop.getServizioComposto();
  1088.             System.out.println("- SpecificheCoordinamento: "+asComposto.sizeSpecificaCoordinamentoList());
  1089.             for(int i=0; i<asComposto.sizeSpecificaCoordinamentoList(); i++){
  1090.                 org.openspcoop2.core.registry.Documento doc = asComposto.getSpecificaCoordinamento(i);
  1091.                 System.out.println("    - ("+doc.getTipo()+") "+doc.getFile());
  1092.             }
  1093.             System.out.println("- ServiziComponenti: "+asComposto.sizeServizioComponenteList());
  1094.             for(int i=0; i<asComposto.sizeServizioComponenteList(); i++){
  1095.                 AccordoServizioParteComuneServizioCompostoServizioComponente sComponente = asComposto.getServizioComponente(i);
  1096.                 String s = "    - "+sComponente.getTipoSoggetto()+"/"+sComponente.getNomeSoggetto()+"_"+
  1097.                     sComponente.getTipo()+"/"+sComponente.getNome();
  1098.                 if(sComponente.getAzione()!=null){
  1099.                     s = s+"_"+sComponente.getAzione();
  1100.                 }
  1101.                 System.out.println(s);
  1102.             }
  1103.         }
  1104.         if(asParteComuneOpenSPCoop.getByteWsdlConcettuale()!=null){
  1105.             System.out.println("- WSDL Concettuale");
  1106.             if(readWSDL_XSD){
  1107.                 ClientTest.printImportFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlConcettuale());
  1108.                 ClientTest.printImportIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlConcettuale());
  1109.                 ClientTest.printIncludeIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlConcettuale());
  1110.                 ClientTest.printElementIntoWSDL(log,asParteComuneOpenSPCoop.getByteWsdlConcettuale());
  1111.             }
  1112.         }
  1113.         if(asParteComuneOpenSPCoop.getByteWsdlLogicoErogatore()!=null){
  1114.             System.out.println("- WSDL Logico Erogatore");
  1115.             if(readWSDL_XSD){
  1116.                 ClientTest.printImportFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoErogatore());
  1117.                 ClientTest.printImportIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoErogatore());
  1118.                 ClientTest.printIncludeIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoErogatore());
  1119.                 ClientTest.printElementIntoWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoErogatore());
  1120.             }
  1121.         }
  1122.         if(asParteComuneOpenSPCoop.getByteWsdlLogicoFruitore()!=null){
  1123.             System.out.println("- WSDL Logico Fruitore");
  1124.             if(readWSDL_XSD){
  1125.                 ClientTest.printImportFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoFruitore());
  1126.                 ClientTest.printImportIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoFruitore());
  1127.                 ClientTest.printIncludeIntoTypesFromWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoFruitore());
  1128.                 ClientTest.printElementIntoWSDL(log,asParteComuneOpenSPCoop.getByteWsdlLogicoFruitore());
  1129.             }
  1130.         }
  1131.         System.out.println("- PortTypes: "+asParteComuneOpenSPCoop.sizePortTypeList());
  1132.         for(int i=0; i<asParteComuneOpenSPCoop.sizePortTypeList(); i++){
  1133.             PortType pt = asParteComuneOpenSPCoop.getPortType(i);
  1134.             System.out.println("\tPortType["+i+"]="+pt.getNome()+" (sizeAzioni:"+pt.sizeAzioneList()+") (ProfiloCollaborazione:"+pt.getProfiloCollaborazione()+")");
  1135.             for(int j=0; j<pt.sizeAzioneList(); j++){
  1136.                 Operation op = pt.getAzione(j);
  1137.                 if(op.getCorrelata()!=null || op.getCorrelataServizio()!=null)
  1138.                     System.out.println("\t\tOperation["+j+"]="+op.getNome()+" (ProfiloCollaborazione:"+op.getProfiloCollaborazione()+") (servizioCorrelato:"+op.getCorrelataServizio()+") (correlata:"+op.getCorrelata()+")");
  1139.                 else
  1140.                     System.out.println("\t\tOperation["+j+"]="+op.getNome()+" (ProfiloCollaborazione:"+op.getProfiloCollaborazione()+")");
  1141.             }
  1142.         }
  1143.         System.out.println("------------------------------------------------------------------------------------------------");
  1144.     }
  1145.     private static void printAccordoServizioParteSpecifica(Logger log,org.openspcoop2.core.registry.AccordoServizioParteSpecifica aspsOpenSPCoop, boolean readWSDL) throws Exception {
  1146.        
  1147.         System.out.println("------------------------------------------------------------------------------------------------");
  1148.         System.out.println("Servizio SPCoop (tipologia:"+aspsOpenSPCoop.getTipologiaServizio()+") ["+aspsOpenSPCoop.getTipo()+"/"+aspsOpenSPCoop.getNome()+" v"+aspsOpenSPCoop.getVersione()
  1149.             +"] (erogatore:"+
  1150.             aspsOpenSPCoop.getTipoSoggettoErogatore()+"/"+aspsOpenSPCoop.getNomeSoggettoErogatore()+") gestito correttamente");
  1151.         System.out.println("- Allegati: "+aspsOpenSPCoop.sizeAllegatoList());
  1152.         System.out.println("- SpecificheSemiformali: "+aspsOpenSPCoop.sizeSpecificaSemiformaleList());
  1153.         System.out.println("- SpecificheLivelliServizio: "+aspsOpenSPCoop.sizeSpecificaLivelloServizioList());
  1154.         System.out.println("- SpecificheSicurezza: "+aspsOpenSPCoop.sizeSpecificaSicurezzaList());
  1155.         if(aspsOpenSPCoop.getConfigurazioneServizio()!=null){
  1156.             System.out.println("- Connettore servizio: "+aspsOpenSPCoop.getConfigurazioneServizio().getConnettore().getProperty(0).getValore());
  1157.         }
  1158.         if(aspsOpenSPCoop.getByteWsdlImplementativoErogatore()!=null){
  1159.             System.out.println("- WSDL Implementativo Erogatore");
  1160.             if(readWSDL){
  1161.                 ClientTest.printImportFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoErogatore());
  1162.                 ClientTest.printImportIntoTypesFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoErogatore());
  1163.                 ClientTest.printIncludeIntoTypesFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoErogatore());
  1164.                 ClientTest.printElementIntoWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoErogatore());
  1165.             }
  1166.         }
  1167.         if(aspsOpenSPCoop.getByteWsdlImplementativoFruitore()!=null){
  1168.             System.out.println("- WSDL Implementativo Fruitore");
  1169.             if(readWSDL){
  1170.                 ClientTest.printImportFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoFruitore());
  1171.                 ClientTest.printImportIntoTypesFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoFruitore());
  1172.                 ClientTest.printIncludeIntoTypesFromWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoFruitore());
  1173.                 ClientTest.printElementIntoWSDL(log,aspsOpenSPCoop.getByteWsdlImplementativoFruitore());
  1174.             }
  1175.         }
  1176.         System.out.println("------------------------------------------------------------------------------------------------");
  1177.     }
  1178.     private static void printAccordoCooperazione(org.openspcoop2.core.registry.AccordoCooperazione acOpenSPCoop) throws Exception {
  1179.         System.out.println("------------------------------------------------------------------------------------------------");
  1180.         System.out.println("Accordo di Cooperazione ["+IDAccordoCooperazioneFactory.getInstance().getUriFromAccordo(acOpenSPCoop)+"] gestito correttamente");
  1181.         System.out.println("- Allegati: "+acOpenSPCoop.sizeAllegatoList());
  1182.         System.out.println("- SpecificheSemiformali: "+acOpenSPCoop.sizeSpecificaSemiformaleList());
  1183.         if(acOpenSPCoop.getElencoPartecipanti()!=null){
  1184.             AccordoCooperazionePartecipanti acp = acOpenSPCoop.getElencoPartecipanti();
  1185.             System.out.println("- Partecipanti: "+acp.sizeSoggettoPartecipanteList());
  1186.             for(int i=0; i<acp.sizeSoggettoPartecipanteList(); i++){
  1187.                 System.out.println("          - "+acp.getSoggettoPartecipante(i).getTipo()+"/"+acp.getSoggettoPartecipante(i).getNome());
  1188.             }
  1189.         }else{
  1190.             System.out.println("- Partecipanti: non presenti");
  1191.         }
  1192.         System.out.println("- URIServiziComposti: "+acOpenSPCoop.sizeUriServiziCompostiList());
  1193.         for(int i=0; i<acOpenSPCoop.sizeUriServiziCompostiList(); i++){
  1194.             System.out.println("          - "+acOpenSPCoop.getUriServiziComposti(i));
  1195.         }
  1196.         System.out.println("------------------------------------------------------------------------------------------------");
  1197.     }  

  1198.     private static void normalizzaPackageCNIPA(org.openspcoop2.core.registry.AccordoServizioParteComune as,String dirFiles, boolean servizioComposto) throws Exception{
  1199.         // imposto campi necessari per la traduzione in package CNIPA
  1200.         as.setOraRegistrazione(new Date());
  1201.        
  1202.         // WSDL
  1203.         if(as.getWsdlDefinitorio()!=null){
  1204.             String path = dirFiles + as.getWsdlDefinitorio();
  1205.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1206.             as.setByteWsdlDefinitorio(contenuto);
  1207.         }
  1208.         if(as.getWsdlConcettuale()!=null){
  1209.             String path = dirFiles + as.getWsdlConcettuale();
  1210.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1211.             as.setByteWsdlConcettuale(contenuto);
  1212.         }
  1213.         if(as.getWsdlLogicoErogatore()!=null){
  1214.             String path = dirFiles + as.getWsdlLogicoErogatore();
  1215.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1216.             as.setByteWsdlLogicoErogatore(contenuto);
  1217.         }
  1218.         if(as.getWsdlLogicoFruitore()!=null){
  1219.             String path = dirFiles + as.getWsdlLogicoFruitore();
  1220.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1221.             as.setByteWsdlLogicoFruitore(contenuto);
  1222.         }
  1223.        
  1224.         // ALLEGATI
  1225.         for(int i=0; i<as.sizeAllegatoList(); i++){
  1226.             org.openspcoop2.core.registry.Documento doc = as.getAllegato(i);
  1227.             String path = dirFiles + doc.getFile();
  1228.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1229.             doc.setByteContenuto(contenuto);
  1230.             File f = new File(path);
  1231.             doc.setFile(f.getName());
  1232.         }
  1233.        
  1234.         // SPECIFICHE SEMIFORMALI
  1235.         for(int i=0; i<as.sizeSpecificaSemiformaleList(); i++){
  1236.             org.openspcoop2.core.registry.Documento doc = as.getSpecificaSemiformale(i);
  1237.             String path = dirFiles + doc.getFile();
  1238.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1239.             doc.setByteContenuto(contenuto);
  1240.             File f = new File(path);
  1241.             doc.setFile(f.getName());
  1242.         }
  1243.        
  1244.         if(servizioComposto){
  1245.             if(as.getServizioComposto()==null){
  1246.                 throw new Exception("ServizioComposto non e' presente");
  1247.             }else{
  1248.                 for(int j=0 ; j< as.getServizioComposto().sizeSpecificaCoordinamentoList(); j++){
  1249.                     org.openspcoop2.core.registry.Documento doc = as.getServizioComposto().getSpecificaCoordinamento(j);
  1250.                     String path = dirFiles + doc.getFile();
  1251.                     byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1252.                     doc.setByteContenuto(contenuto);
  1253.                     File f = new File(path);
  1254.                     doc.setFile(f.getName());
  1255.                 }
  1256.             }
  1257.         }
  1258.     }
  1259.    
  1260.    
  1261.    
  1262.     private static void normalizzaPackageCNIPA(org.openspcoop2.core.registry.AccordoServizioParteSpecifica asps,String dirFiles,Connettore connettoreSoggetto) throws Exception{
  1263.         // imposto campi necessari per la traduzione in package CNIPA
  1264.         asps.setOraRegistrazione(new Date());
  1265.         // Adesione automatica
  1266.         //asps.setTipoAdesione(TipiAdesione.AUTOMATICA.toString());
  1267.        
  1268.         // Connettore
  1269.         String url = connettoreSoggetto.getProperty(0).getValore();
  1270.         //System.out.println("URL "+url+"/TEST_"+servizio.getTipo()+servizio.getNome());
  1271.         Connettore con = new Connettore();
  1272.         con.setTipo("http");
  1273.         con.setNome("Connettore per servizio "+asps.getNome());
  1274.         Property cp = new Property();
  1275.         cp.setNome("location");
  1276.         cp.setValore(url+"/TEST_"+asps.getTipo()+asps.getNome());
  1277.         con.addProperty(cp);
  1278.         if(asps.getConfigurazioneServizio()==null){
  1279.             asps.setConfigurazioneServizio(new ConfigurazioneServizio());
  1280.         }
  1281.         asps.getConfigurazioneServizio().setConnettore(con);

  1282.        
  1283.         // WSDL
  1284.         if(asps.getWsdlImplementativoErogatore()!=null){
  1285.             String path = dirFiles + asps.getWsdlImplementativoErogatore();
  1286.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1287.             asps.setByteWsdlImplementativoErogatore(contenuto);
  1288.         }
  1289.         if(asps.getWsdlImplementativoFruitore()!=null){
  1290.             String path = dirFiles + asps.getWsdlImplementativoFruitore();
  1291.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1292.             asps.setByteWsdlImplementativoFruitore(contenuto);
  1293.         }
  1294.        
  1295.         // ALLEGATI
  1296.         for(int i=0; i<asps.sizeAllegatoList(); i++){
  1297.             org.openspcoop2.core.registry.Documento doc = asps.getAllegato(i);
  1298.             String path = dirFiles + doc.getFile();
  1299.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1300.             doc.setByteContenuto(contenuto);
  1301.             File f = new File(path);
  1302.             doc.setFile(f.getName());
  1303.         }
  1304.        
  1305.         // SPECIFICHE SEMIFORMALI
  1306.         for(int i=0; i<asps.sizeSpecificaSemiformaleList(); i++){
  1307.             org.openspcoop2.core.registry.Documento doc = asps.getSpecificaSemiformale(i);
  1308.             String path = dirFiles + doc.getFile();
  1309.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1310.             doc.setByteContenuto(contenuto);
  1311.             File f = new File(path);
  1312.             doc.setFile(f.getName());
  1313.         }
  1314.        
  1315.         // SPECIFICHE LIVELLI SERVIZIO
  1316.         for(int i=0; i<asps.sizeSpecificaLivelloServizioList(); i++){
  1317.             org.openspcoop2.core.registry.Documento doc = asps.getSpecificaLivelloServizio(i);
  1318.             String path = dirFiles + doc.getFile();
  1319.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1320.             doc.setByteContenuto(contenuto);
  1321.             File f = new File(path);
  1322.             doc.setFile(f.getName());
  1323.         }
  1324.        
  1325.         // SPECIFICHE SICUREZZA
  1326.         for(int i=0; i<asps.sizeSpecificaSicurezzaList(); i++){
  1327.             org.openspcoop2.core.registry.Documento doc = asps.getSpecificaSicurezza(i);
  1328.             String path = dirFiles + doc.getFile();
  1329.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1330.             doc.setByteContenuto(contenuto);
  1331.             File f = new File(path);
  1332.             doc.setFile(f.getName());
  1333.         }
  1334.     }
  1335.    
  1336.    
  1337.    
  1338.     private static void normalizzaPackageCNIPA(org.openspcoop2.core.registry.AccordoCooperazione ac,String dirFiles) throws Exception{
  1339.         // imposto campi necessari per la traduzione in package CNIPA
  1340.         ac.setOraRegistrazione(new Date());
  1341.        
  1342.         // ALLEGATI
  1343.         for(int i=0; i<ac.sizeAllegatoList(); i++){
  1344.             org.openspcoop2.core.registry.Documento doc = ac.getAllegato(i);
  1345.             String path = dirFiles + doc.getFile();
  1346.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1347.             doc.setByteContenuto(contenuto);
  1348.             File f = new File(path);
  1349.             doc.setFile(f.getName());
  1350.         }
  1351.        
  1352.         // SPECIFICHE SEMIFORMALI
  1353.         for(int i=0; i<ac.sizeSpecificaSemiformaleList(); i++){
  1354.             org.openspcoop2.core.registry.Documento doc = ac.getSpecificaSemiformale(i);
  1355.             String path = dirFiles + doc.getFile();
  1356.             byte [] contenuto = FileSystemUtilities.readBytesFromFile(path);
  1357.             doc.setByteContenuto(contenuto);
  1358.             File f = new File(path);
  1359.             doc.setFile(f.getName());
  1360.         }

  1361.     }
  1362.    
  1363.    
  1364.    
  1365.    
  1366.    
  1367.     private static void verificaAccordoServizioParteComune(String nomeFile,org.openspcoop2.core.registry.AccordoServizioParteComune as) throws Exception{
  1368.        
  1369.                
  1370.         File f = new File(nomeFile);
  1371.         if(f.exists()==false){
  1372.             throw new Exception("Accordo ["+nomeFile+"] non esistente");
  1373.         }
  1374.         if(f.canRead()==false){
  1375.             throw new Exception("Accordo ["+nomeFile+"] non leggibile");
  1376.         }
  1377.            
  1378.         // Interfaccia Concettuale
  1379.         String dir = "DIR_CONCETTUALE_"+nomeFile.replace("/", "");
  1380.         FileSystemUtilities.deleteDir(dir); // per essere sicuri di partire da una situazione pulita
  1381.         ZipUtilities.unzipFile(nomeFile, dir);
  1382.         System.out.println(Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL +" in corso di verifica (sintassi/import/include) ...");
  1383.         if(as.getServizioComposto()==null)
  1384.             ClientTest.verificaAccordoServizioParteComune(dir, as.getNome(),Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL,true,true);
  1385.         else
  1386.             ClientTest.verificaAccordoServizioComposto(dir, as.getNome(),Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL);
  1387.         System.out.println(Costanti.SPECIFICA_INTERFACCIA_CONCETTUALE_WSDL +" correttamente formato");
  1388.         FileSystemUtilities.deleteDir(dir);
  1389.        
  1390.         // Interfaccia Logica Erogatore
  1391.         dir = "DIR_LOGICA_EROGATORE_"+nomeFile.replace("/", "");
  1392.         FileSystemUtilities.deleteDir(dir); // per essere sicuri di partire da una situazione pulita
  1393.         ZipUtilities.unzipFile(nomeFile, dir);
  1394.         System.out.println(Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL +" in corso di verifica (sintassi/import/include) ...");
  1395.         if(as.getServizioComposto()==null)
  1396.             ClientTest.verificaAccordoServizioParteComune(dir, as.getNome(),Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL,true,false);
  1397.         else
  1398.             ClientTest.verificaAccordoServizioComposto(dir, as.getNome(),Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL);
  1399.         System.out.println(Costanti.SPECIFICA_INTERFACCIA_LOGICA_EROGATORE_WSDL +" correttamente formato");
  1400.         FileSystemUtilities.deleteDir(dir);
  1401.        
  1402.         // Interfaccia Logica Fruitore
  1403.         if(as.getServizioComposto()==null){
  1404.             dir = "DIR_LOGICA_FRUITORE_"+nomeFile.replace("/", "");
  1405.             FileSystemUtilities.deleteDir(dir); // per essere sicuri di partire da una situazione pulita
  1406.             ZipUtilities.unzipFile(nomeFile, dir);
  1407.             System.out.println(Costanti.SPECIFICA_INTERFACCIA_LOGICA_FRUITORE_WSDL +" in corso di verifica (sintassi/import/include) ...");
  1408.             ClientTest.verificaAccordoServizioParteComune(dir, as.getNome(),Costanti.SPECIFICA_INTERFACCIA_LOGICA_FRUITORE_WSDL,false,true);
  1409.             System.out.println(Costanti.SPECIFICA_INTERFACCIA_LOGICA_FRUITORE_WSDL +" correttamente formato");
  1410.             FileSystemUtilities.deleteDir(dir);
  1411.         }
  1412.        
  1413.     }
  1414.     private static void verificaAccordoServizioParteComune(String dirName,String nomeAccordoServizioParteComune,String fileWSDL,boolean logicoErogatore,boolean logicoFruitore) throws Exception{
  1415.        
  1416.         WSDL2JAVA wsdl2java = new WSDL2JAVA();
  1417.         boolean todo = true;
  1418.         if(todo){
  1419.             throw new Exception("Implementare WSDL2JAVA indipendente dal framwework soap");
  1420.         }
  1421.                
  1422.         // Genero STUB e SKELETON PER VERIFICARE CORRETTEZZA DEI WSDL
  1423.         String [] args = new String[5];
  1424.         args[0] = "-S";
  1425.         args[1] = "true";
  1426.         args[2] = "-o";
  1427.         args[3] = "STUB_SKELETON_"+dirName;
  1428.         String dirWSDL = dirName + File.separatorChar + nomeAccordoServizioParteComune + File.separatorChar + Costanti.SPECIFICA_INTERFACCIA_DIR +  File.separatorChar;
  1429.        
  1430.         // Delete directory dove vengono prodotte le classi prima di produrre il test.
  1431.         FileSystemUtilities.deleteDir(args[3]);
  1432.        
  1433.         // Interfaccia Concettuale
  1434.         args[4] = dirWSDL + fileWSDL;
  1435.         wsdl2java.run(args);
  1436.         if(wsdl2java.getError()!=null){
  1437.             throw wsdl2java.getError();
  1438.         }
  1439.         String baseDir = args[3]+File.separatorChar+"org"+File.separatorChar+"openspcoop"+File.separatorChar+"www"+File.separatorChar+"example"+File.separatorChar;
  1440.         // file comuni
  1441.         ClientTest.isFileExists(baseDir+"deploy.wsdd");
  1442.         ClientTest.isFileExists(baseDir+"Esito.java");
  1443.         ClientTest.isFileExists(baseDir+"PresaInCarico.java");
  1444.         ClientTest.isFileExists(baseDir+"IdentificativoRichiestaAsincrona.java");
  1445.         ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneRequest.java");
  1446.         ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneResponse.java");
  1447.         ClientTest.isFileExists(baseDir+"undeploy.wsdd");
  1448.         // file per logico erogatore
  1449.         if(logicoErogatore){
  1450.             ClientTest.isFileExists(baseDir+"AggiornamentoRequest.java");
  1451.             ClientTest.isFileExists(baseDir+"AggiornamentoResponse.java");
  1452.             ClientTest.isFileExists(baseDir+"Dati.java");
  1453.             ClientTest.isFileExists(baseDir+"EsempioAllegatoInclude1.java");
  1454.             ClientTest.isFileExists(baseDir+"EsempioAllegatoInclude2.java");
  1455.             ClientTest.isFileExists(baseDir+"EsempioSpecificaSemiformaleInclude1.java");
  1456.             ClientTest.isFileExists(baseDir+"EsempioSpecificaSemiformaleInclude2.java");
  1457.             ClientTest.isFileExists(baseDir+"NotificaRequest.java");
  1458.             ClientTest.isFileExists(baseDir+"RichiestaAggiornamentoRequest.java");
  1459.             ClientTest.isFileExists(baseDir+"RichiestaAggiornamentoResponse.java");
  1460.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneRequest.java");
  1461.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneResponse.java");
  1462.             // Allegati
  1463.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"EsempioAllegatoImport1.java");
  1464.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"EsempioAllegatoImport2.java");
  1465.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"allegato"+File.separatorChar+"interno"+File.separatorChar+"EsempioAllegatoInterno.java");
  1466.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"import2"+File.separatorChar+"AltroOggettoImportato.java");
  1467.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"importwsdl"+File.separatorChar+"AllegatoImportatoDirettamenteInWSDL.java");
  1468.             // SpecificaSemiformale
  1469.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"EsempioSpecificaSemiformaleImport1.java");
  1470.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"EsempioSpecificaSemiformaleImport2.java");
  1471.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"specificasemiformale"+File.separatorChar+"interno"+File.separatorChar+"EsempioSpecificaSemiformaleInterno.java");
  1472.             //isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"importwsdl"+File.separatorChar+"SpecificaSemiformaleImportatoDirettamenteInWSDL.java");
  1473.         }
  1474.         // file per logico fruitore
  1475.         if(logicoFruitore){
  1476.             ClientTest.isFileExists(baseDir+"EsitoAggiornamentoRequest.java");
  1477.             ClientTest.isFileExists(baseDir+"EsitoAggiornamentoResponse.java");
  1478.         }
  1479.        
  1480.         // Delete directory dove vengono prodotte le classi.
  1481.         FileSystemUtilities.deleteDir(args[3]);
  1482.        
  1483.     }
  1484.     private static void verificaAccordoServizioComposto(String dirName,String nomeAccordoServizioParteComune,String fileWSDL) throws Exception{
  1485.        
  1486.         WSDL2JAVA wsdl2java = new WSDL2JAVA();
  1487.                
  1488.         // Genero STUB e SKELETON PER VERIFICARE CORRETTEZZA DEI WSDL
  1489.         String [] args = new String[5];
  1490.         args[0] = "-S";
  1491.         args[1] = "true";
  1492.         args[2] = "-o";
  1493.         args[3] = "STUB_SKELETON_"+dirName;
  1494.         String dirWSDL = dirName + File.separatorChar + nomeAccordoServizioParteComune + File.separatorChar + Costanti.SPECIFICA_INTERFACCIA_DIR +  File.separatorChar;
  1495.        
  1496.         // Delete directory dove vengono prodotte le classi prima di produrre il test.
  1497.         FileSystemUtilities.deleteDir(args[3]);
  1498.        
  1499.         // Interfaccia Concettuale
  1500.         args[4] = dirWSDL + fileWSDL;
  1501.         wsdl2java.run(args);
  1502.         if(wsdl2java.getError()!=null){
  1503.             throw wsdl2java.getError();
  1504.         }
  1505.         String baseDir = args[3]+File.separatorChar+"org"+File.separatorChar+"openspcoop"+File.separatorChar+"www"+File.separatorChar+"example"+File.separatorChar;
  1506.         // file comuni
  1507.         ClientTest.isFileExists(baseDir+"deploy.wsdd");
  1508.         ClientTest.isFileExists(baseDir+"Esito.java");
  1509.         ClientTest.isFileExists(baseDir+"Dati.java");
  1510.         ClientTest.isFileExists(baseDir+"ServizioCompostoRequest.java");
  1511.         ClientTest.isFileExists(baseDir+"ServizioCompostoResponse.java");
  1512.         ClientTest.isFileExists(baseDir+"undeploy.wsdd");
  1513.        
  1514.         // Delete directory dove vengono prodotte le classi.
  1515.         FileSystemUtilities.deleteDir(args[3]);
  1516.        
  1517.     }
  1518.     private static void verificaAccordoServizioParteSpecifica(String nomeFile,org.openspcoop2.core.registry.AccordoServizioParteSpecifica asps,
  1519.             boolean parteSpecificaContieneParteComune,String DIR_ESEMPI_AS,
  1520.             boolean implementazioneServizioComposto) throws Exception{
  1521.        
  1522.        
  1523.         File f = new File(nomeFile);
  1524.         if(f.exists()==false){
  1525.             throw new Exception("Accordo ["+nomeFile+"] non esistente");
  1526.         }
  1527.         if(f.canRead()==false){
  1528.             throw new Exception("Accordo ["+nomeFile+"] non leggibile");
  1529.         }
  1530.            
  1531.         String dir = null;
  1532.         if(TipologiaServizio.CORRELATO.equals(asps.getTipologiaServizio())){
  1533.             dir = "DIR_IMPL_FRUITORE_"+nomeFile.replace("/", "");
  1534.         }else{
  1535.             dir = "DIR_IMPL_EROGATORE_"+nomeFile.replace("/", "");
  1536.         }
  1537.         FileSystemUtilities.deleteDir(dir); // per essere sicuri di partire da una situazione pulita
  1538.        
  1539.        
  1540.         if(parteSpecificaContieneParteComune==false){
  1541.             // Serve unzippato anche la parte comune
  1542.             String fPC = asps.getAccordoServizioParteComune().replace(":", "_")+".";
  1543.             if(implementazioneServizioComposto){
  1544.                 fPC = fPC+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_COMPOSTO;
  1545.             }else{
  1546.                 fPC = fPC+Costanti.ESTENSIONE_ACCORDO_SERVIZIO_PARTE_COMUNE;
  1547.             }
  1548.             fPC = fPC.replace("/", "");
  1549.             fPC = DIR_ESEMPI_AS+File.separatorChar+fPC;
  1550.             File parteComune = new File(fPC);
  1551.             if(parteComune.exists()==false){
  1552.                 throw new Exception("Accordo Parte Comune ["+parteComune.getAbsolutePath()+"] non esistente");
  1553.             }
  1554.             if(parteComune.canRead()==false){
  1555.                 throw new Exception("Accordo Parte Comune ["+parteComune.getAbsolutePath()+"] non leggibile");
  1556.             }
  1557.             ZipUtilities.unzipFile(parteComune.getAbsolutePath(), dir);
  1558.         }
  1559.        
  1560.        
  1561.         ZipUtilities.unzipFile(nomeFile, dir);
  1562.         if(TipologiaServizio.CORRELATO.equals(asps.getTipologiaServizio())){
  1563.             System.out.println(Costanti.SPECIFICA_PORTI_ACCESSO_FRUITORE_WSDL +" in corso di verifica (sintassi/import/include) ...");
  1564.             if(implementazioneServizioComposto){
  1565.                 ClientTest.verificaAccordoServizioCompostoParteSpecifica(dir, asps.getNome(),asps.getNome(),Costanti.SPECIFICA_PORTI_ACCESSO_FRUITORE_WSDL);
  1566.             }else{
  1567.                 ClientTest.verificaAccordoServizioParteSpecifica(dir, asps.getNome(),asps.getNome(),Costanti.SPECIFICA_PORTI_ACCESSO_FRUITORE_WSDL);
  1568.             }
  1569.             System.out.println(Costanti.SPECIFICA_PORTI_ACCESSO_FRUITORE_WSDL +" correttamente formato");
  1570.         }else{
  1571.             System.out.println(Costanti.SPECIFICA_PORTI_ACCESSO_EROGATORE_WSDL +" in corso di verifica (sintassi/import/include) ...");
  1572.             if(implementazioneServizioComposto){
  1573.                 ClientTest.verificaAccordoServizioCompostoParteSpecifica(dir, asps.getNome(),asps.getNome(),Costanti.SPECIFICA_PORTI_ACCESSO_EROGATORE_WSDL);
  1574.             }else{
  1575.                 ClientTest.verificaAccordoServizioParteSpecifica(dir, asps.getNome(),asps.getNome(),Costanti.SPECIFICA_PORTI_ACCESSO_EROGATORE_WSDL);
  1576.             }
  1577.             System.out.println(Costanti.SPECIFICA_PORTI_ACCESSO_EROGATORE_WSDL +" correttamente formato");
  1578.         }
  1579.        
  1580.         FileSystemUtilities.deleteDir(dir);
  1581.        
  1582.     }
  1583.     private static void verificaAccordoServizioParteSpecifica(String dirName,String nomeAccordoServizioParteSpecifica,String nomeServizio,String fileWSDL) throws Exception{
  1584.        
  1585.         WSDL2JAVA wsdl2java = new WSDL2JAVA();
  1586.                
  1587.         // Genero STUB e SKELETON PER VERIFICARE CORRETTEZZA DEI WSDL
  1588.         String [] args = new String[5];
  1589.         args[0] = "-S";
  1590.         args[1] = "true";
  1591.         args[2] = "-o";
  1592.         args[3] = "STUB_SKELETON_"+dirName;

  1593.         String dirWSDL = dirName + File.separatorChar + nomeAccordoServizioParteSpecifica + File.separatorChar + Costanti.SPECIFICA_PORTI_ACCESSO_DIR +  File.separatorChar;
  1594.        
  1595.         // Delete directory dove vengono prodotte le classi prima di produrre il test.
  1596.         FileSystemUtilities.deleteDir(args[3]);
  1597.        
  1598.         // Interfaccia Concettuale
  1599.         args[4] = dirWSDL + fileWSDL;
  1600.         wsdl2java.run(args);
  1601.         if(wsdl2java.getError()!=null){
  1602.             throw wsdl2java.getError();
  1603.         }
  1604.         String baseDir = args[3]+File.separatorChar+"org"+File.separatorChar+"openspcoop"+File.separatorChar+"www"+File.separatorChar+"example"+File.separatorChar;
  1605.         // file comuni
  1606.         ClientTest.isFileExists(baseDir+"deploy.wsdd");
  1607.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingImpl.java");
  1608.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingSkeleton.java");
  1609.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingStub.java");
  1610.         ClientTest.isFileExists(baseDir+nomeServizio+".java");
  1611.         ClientTest.isFileExists(baseDir+nomeServizio+"Service.java");
  1612.         ClientTest.isFileExists(baseDir+nomeServizio+"ServiceLocator.java");
  1613.         ClientTest.isFileExists(baseDir+"undeploy.wsdd");
  1614.         // File specifici per il servizio oneway
  1615.         if("Oneway".equals(nomeServizio)){
  1616.             ClientTest.isFileExists(baseDir+"Dati.java");
  1617.             ClientTest.isFileExists(baseDir+"EsempioAllegatoInclude1.java");
  1618.             ClientTest.isFileExists(baseDir+"EsempioAllegatoInclude2.java");
  1619.             ClientTest.isFileExists(baseDir+"EsempioSpecificaSemiformaleInclude1.java");
  1620.             ClientTest.isFileExists(baseDir+"EsempioSpecificaSemiformaleInclude2.java");
  1621.             ClientTest.isFileExists(baseDir+"NotificaRequest.java");
  1622.             // Allegati
  1623.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"EsempioAllegatoImport1.java");
  1624.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"EsempioAllegatoImport2.java");
  1625.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"_import"+File.separatorChar+"allegato"+File.separatorChar+"interno"+File.separatorChar+"EsempioAllegatoInterno.java");
  1626.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"import2"+File.separatorChar+"AltroOggettoImportato.java");
  1627.             ClientTest.isFileExists(baseDir+"allegato"+File.separatorChar+"importwsdl"+File.separatorChar+"AllegatoImportatoDirettamenteInWSDL.java");
  1628.             // SpecificaSemiformale
  1629.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"EsempioSpecificaSemiformaleImport1.java");
  1630.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"EsempioSpecificaSemiformaleImport2.java");
  1631.             ClientTest.isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"_import"+File.separatorChar+"specificasemiformale"+File.separatorChar+"interno"+File.separatorChar+"EsempioSpecificaSemiformaleInterno.java");
  1632.             //isFileExists(baseDir+"specificasemiformale"+File.separatorChar+"importwsdl"+File.separatorChar+"SpecificaSemiformaleImportatoDirettamenteInWSDL.java");
  1633.         }
  1634.         else if("Sincrono".equals(nomeServizio)){
  1635.             ClientTest.isFileExists(baseDir+"AggiornamentoRequest.java");
  1636.             ClientTest.isFileExists(baseDir+"AggiornamentoResponse.java");
  1637.             ClientTest.isFileExists(baseDir+"Dati.java");
  1638.             ClientTest.isFileExists(baseDir+"Esito.java");
  1639.         }
  1640.         else if("AsincronoSimmetricoRichiesta".equals(nomeServizio)){
  1641.             ClientTest.isFileExists(baseDir+"RichiestaAggiornamentoRequest.java");
  1642.             ClientTest.isFileExists(baseDir+"RichiestaAggiornamentoResponse.java");
  1643.             ClientTest.isFileExists(baseDir+"Dati.java");
  1644.             ClientTest.isFileExists(baseDir+"PresaInCarico.java");
  1645.         }
  1646.         else if("AsincronoSimmetricoRisposta".equals(nomeServizio)){
  1647.             ClientTest.isFileExists(baseDir+"EsitoAggiornamentoRequest.java");
  1648.             ClientTest.isFileExists(baseDir+"EsitoAggiornamentoResponse.java");
  1649.             ClientTest.isFileExists(baseDir+"Esito.java");
  1650.             ClientTest.isFileExists(baseDir+"PresaInCarico.java");
  1651.         }
  1652.         else if("AsincronoAsimmetrico".equals(nomeServizio)){
  1653.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneRequest.java");
  1654.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneResponse.java");
  1655.             ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneRequest.java");
  1656.             ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneResponse.java");
  1657.             ClientTest.isFileExists(baseDir+"Dati.java");
  1658.             ClientTest.isFileExists(baseDir+"Esito.java");
  1659.             ClientTest.isFileExists(baseDir+"IdentificativoRichiestaAsincrona.java");
  1660.             ClientTest.isFileExists(baseDir+"PresaInCarico.java");
  1661.         }
  1662.         else if("AsincronoAsimmetricoRichiesta".equals(nomeServizio)){
  1663.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneRequest.java");
  1664.             ClientTest.isFileExists(baseDir+"RichiestaRegistrazioneResponse.java");
  1665.             ClientTest.isFileExists(baseDir+"Dati.java");
  1666.             ClientTest.isFileExists(baseDir+"PresaInCarico.java");
  1667.         }
  1668.         else if("AsincronoAsimmetricoRisposta".equals(nomeServizio)){
  1669.             ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneRequest.java");
  1670.             ClientTest.isFileExists(baseDir+"RichiestaStatoRegistrazioneResponse.java");
  1671.             ClientTest.isFileExists(baseDir+"Esito.java");
  1672.             ClientTest.isFileExists(baseDir+"IdentificativoRichiestaAsincrona.java");
  1673.         }
  1674.         else{
  1675.             throw new Exception("Servizio ["+nomeServizio+"] non gestito ?");
  1676.         }
  1677.        
  1678.         // Delete directory dove vengono prodotte le classi.
  1679.         FileSystemUtilities.deleteDir(args[3]);
  1680.        
  1681.     }
  1682.     private static void verificaAccordoServizioCompostoParteSpecifica(String dirName,String nomeAccordoServizioParteSpecifica,String nomeServizio,String fileWSDL) throws Exception{
  1683.        
  1684.         WSDL2JAVA wsdl2java = new WSDL2JAVA();
  1685.                
  1686.         // Genero STUB e SKELETON PER VERIFICARE CORRETTEZZA DEI WSDL
  1687.         String [] args = new String[5];
  1688.         args[0] = "-S";
  1689.         args[1] = "true";
  1690.         args[2] = "-o";
  1691.         args[3] = "STUB_SKELETON_"+dirName;

  1692.         String dirWSDL = dirName + File.separatorChar + nomeAccordoServizioParteSpecifica + File.separatorChar + Costanti.SPECIFICA_PORTI_ACCESSO_DIR +  File.separatorChar;
  1693.        
  1694.         // Delete directory dove vengono prodotte le classi prima di produrre il test.
  1695.         FileSystemUtilities.deleteDir(args[3]);
  1696.        
  1697.         // Interfaccia Concettuale
  1698.         args[4] = dirWSDL + fileWSDL;
  1699.         wsdl2java.run(args);
  1700.         if(wsdl2java.getError()!=null){
  1701.             throw wsdl2java.getError();
  1702.         }
  1703.         String baseDir = args[3]+File.separatorChar+"org"+File.separatorChar+"openspcoop"+File.separatorChar+"www"+File.separatorChar+"example"+File.separatorChar;
  1704.         // file comuni
  1705.         ClientTest.isFileExists(baseDir+"deploy.wsdd");
  1706.         ClientTest.isFileExists(baseDir+"Dati.java");
  1707.         ClientTest.isFileExists(baseDir+"Esito.java");
  1708.         ClientTest.isFileExists(baseDir+"ServizioCompostoRequest.java");
  1709.         ClientTest.isFileExists(baseDir+"ServizioCompostoResponse.java");
  1710.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingImpl.java");
  1711.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingSkeleton.java");
  1712.         ClientTest.isFileExists(baseDir+nomeServizio+"BindingStub.java");
  1713.         ClientTest.isFileExists(baseDir+nomeServizio+".java");
  1714.         ClientTest.isFileExists(baseDir+nomeServizio+"Service.java");
  1715.         ClientTest.isFileExists(baseDir+nomeServizio+"ServiceLocator.java");
  1716.         ClientTest.isFileExists(baseDir+"undeploy.wsdd");
  1717.        
  1718.         // Delete directory dove vengono prodotte le classi.
  1719.         FileSystemUtilities.deleteDir(args[3]);
  1720.        
  1721.     }
  1722.    
  1723.     private static AccordoServizio getManifestoAS_ParteComune(boolean generaInfoEGovComeSpecificaSemiformale,boolean generaInfoEGovFormatoClientSICA) throws Exception{
  1724.         // Manifesto
  1725.         AccordoServizio manifest = new AccordoServizio();
  1726.         manifest.setDataCreazione(new Date());
  1727.         manifest.setDataPubblicazione(new Date());
  1728.         manifest.setDescrizione("Descrizione di esempio");
  1729.         manifest.setFirmato(false);
  1730.         manifest.setNome("ASParteComune");
  1731.         manifest.setRiservato(true);
  1732.         manifest.setVersione("2");
  1733.        
  1734.         // Parte comune manifest
  1735.         it.gov.spcoop.sica.manifest.AccordoServizioParteComune parteComune = new it.gov.spcoop.sica.manifest.AccordoServizioParteComune();
  1736.         parteComune.setPubblicatore(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", true)));
  1737.         // -- SpecificaConversazione
  1738.         SpecificaConversazione conversazione = new SpecificaConversazione();
  1739.         DocumentoConversazione doc = new DocumentoConversazione();
  1740.         doc.setTipo(TipoDocumentoConversazione.WSBL);
  1741.         doc.setBase("ConversazioneConcettuale.wsbl");
  1742.         conversazione.setConversazioneConcettuale(doc);
  1743.         DocumentoConversazione docErogatore = new DocumentoConversazione();
  1744.         docErogatore.setTipo(TipoDocumentoConversazione.WSBL);
  1745.         docErogatore.setBase("ConversazioneLogicaLatoErogatore.wsbl");
  1746.         conversazione.setConversazioneLogicaLatoErogatore(docErogatore);
  1747.         DocumentoConversazione docFruitore = new DocumentoConversazione();
  1748.         docFruitore.setTipo(TipoDocumentoConversazione.WSBL);
  1749.         docFruitore.setBase("ConversazioneLogicaLatoFruitore.wsbl");
  1750.         conversazione.setConversazioneLogicaLatoFruitore(docFruitore);
  1751.         parteComune.setSpecificaConversazione(conversazione);
  1752.         // -- SpecificaInterfaccia
  1753.         SpecificaInterfaccia interfaccia = new SpecificaInterfaccia();
  1754.         DocumentoInterfaccia docI = new DocumentoInterfaccia();
  1755.         docI.setTipo(TipoDocumentoInterfaccia.WSDL);
  1756.         docI.setBase("InterfacciaConcettuale.wsdl");
  1757.         interfaccia.setInterfacciaConcettuale(docI);
  1758.         DocumentoInterfaccia docIErogatore = new DocumentoInterfaccia();
  1759.         docIErogatore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1760.         docIErogatore.setBase("InterfacciaLogicaErogatore.wsdl");
  1761.         interfaccia.setInterfacciaLogicaLatoErogatore(docIErogatore);
  1762.         DocumentoInterfaccia docIFruitore = new DocumentoInterfaccia();
  1763.         docIFruitore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1764.         docIFruitore.setBase("InterfacciaLogicaFruitore.wsdl");
  1765.         interfaccia.setInterfacciaLogicaLatoFruitore(docIFruitore);
  1766.         parteComune.setSpecificaInterfaccia(interfaccia);
  1767.        
  1768.            
  1769.         manifest.setParteComune(parteComune);
  1770.        
  1771.         // Allegati
  1772.         ElencoAllegati allegati = new ElencoAllegati();
  1773.         allegati.addGenericoDocumento("Allegato1.doc");
  1774.         allegati.addGenericoDocumento("Allegato2.doc");
  1775.         allegati.addGenericoDocumento(Costanti.ALLEGATO_DEFINITORIO_XSD); // DefinitorioXSD
  1776.         manifest.setAllegati(allegati);
  1777.        
  1778.         // SpecificheSemiformali
  1779.         SpecificaSemiformale specifiche = new SpecificaSemiformale();
  1780.        
  1781.         DocumentoSemiformale docS1 = new DocumentoSemiformale();
  1782.         docS1.setTipo(TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString());
  1783.         docS1.setBase("Collaborazione.doc");
  1784.         specifiche.addDocumentoSemiformale(docS1);

  1785.         DocumentoSemiformale docS2 = new DocumentoSemiformale();
  1786.         docS2.setTipo(TipiDocumentoSemiformale.XML.toString());
  1787.         docS2.setBase("Schemi.xml");
  1788.         specifiche.addDocumentoSemiformale(docS2);
  1789.        
  1790.         manifest.setSpecificaSemiformale(specifiche);
  1791.                
  1792.         // ModalitaEsplicitaCNIPA per info egov
  1793.         if(generaInfoEGovComeSpecificaSemiformale){
  1794.             DocumentoSemiformale docSpecificaEGOV = new DocumentoSemiformale();
  1795.             docSpecificaEGOV.setTipo(TipiDocumentoSemiformale.XML.toString());
  1796.             if(generaInfoEGovFormatoClientSICA)
  1797.                 docSpecificaEGOV.setBase(it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  1798.             else
  1799.                 docSpecificaEGOV.setBase(it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  1800.             specifiche.addDocumentoSemiformale(docSpecificaEGOV);
  1801.             manifest.setSpecificaSemiformale(specifiche);
  1802.         }
  1803.         else{
  1804.             if(generaInfoEGovFormatoClientSICA)
  1805.                 allegati.addGenericoDocumento(it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  1806.             else
  1807.                 allegati.addGenericoDocumento(it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  1808.             manifest.setAllegati(allegati);
  1809.         }
  1810.        
  1811.        
  1812.        
  1813.         return manifest;
  1814.     }
  1815.    
  1816.    
  1817.     private static AccordoServizio getManifestoAS_ParteSpecifica() throws Exception{
  1818.         // Manifesto
  1819.         AccordoServizio manifest = new AccordoServizio();
  1820.         manifest.setDataCreazione(new Date());
  1821.         manifest.setDataPubblicazione(new Date());
  1822.         manifest.setDescrizione("Descrizione di esempio");
  1823.         manifest.setFirmato(false);
  1824.         manifest.setNome("ASParteSpecifica");
  1825.         manifest.setRiservato(true);
  1826.         manifest.setVersione("2");
  1827.        
  1828.         // Parte specifica manifest
  1829.         it.gov.spcoop.sica.manifest.AccordoServizioParteSpecifica parteSpecifica = new it.gov.spcoop.sica.manifest.AccordoServizioParteSpecifica();
  1830.         parteSpecifica.setRiferimentoParteComune(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_PARTE_COMUNE,
  1831.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", false), "ASParteComune", 2)));
  1832.         parteSpecifica.setAdesione(it.gov.spcoop.sica.manifest.constants.TipoAdesione.AUTOMATICA);
  1833.         parteSpecifica.setErogatore(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", true)));
  1834.         // -- SpecificaPortiAccesso
  1835.         SpecificaPortiAccesso portiAccesso = new SpecificaPortiAccesso();
  1836.         DocumentoInterfaccia docErogatore = new DocumentoInterfaccia();
  1837.         docErogatore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1838.         docErogatore.setBase("PortiAccessoErogatore.wsdl");
  1839.         portiAccesso.setPortiAccessoErogatore(docErogatore);
  1840.         DocumentoInterfaccia docFruitore = new DocumentoInterfaccia();
  1841.         docFruitore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1842.         docFruitore.setBase("PortiAccessoFruitore.wsdl");
  1843.         portiAccesso.setPortiAccessoFruitore(docFruitore);
  1844.         parteSpecifica.setSpecificaPortiAccesso(portiAccesso);
  1845.         // -- SpecificheLivelliServizio
  1846.         SpecificaLivelliServizio sLivServizio = new SpecificaLivelliServizio();
  1847.         DocumentoLivelloServizio dsLivServ1 = new DocumentoLivelloServizio();
  1848.         dsLivServ1.setTipo(TipiDocumentoLivelloServizio.WSLA.toString());
  1849.         dsLivServ1.setBase("LivelloServizioMinimo.wsla");
  1850.         sLivServizio.addDocumentoLivelloServizio(dsLivServ1);
  1851.         DocumentoLivelloServizio dsLivServ2 = new DocumentoLivelloServizio();
  1852.         dsLivServ2.setTipo(TipiDocumentoLivelloServizio.WSLA.toString());
  1853.         dsLivServ2.setBase("LivelloServizioOttimale.wsla");
  1854.         sLivServizio.addDocumentoLivelloServizio(dsLivServ2);
  1855.         parteSpecifica.setSpecificaLivelliServizio(sLivServizio);
  1856.         // -- SpecificheSicurezza
  1857.         SpecificaSicurezza sSicurezza = new SpecificaSicurezza();
  1858.         DocumentoSicurezza dsSicurezza1 = new DocumentoSicurezza();
  1859.         dsSicurezza1.setTipo(TipiDocumentoSicurezza.WSPOLICY.toString());
  1860.         dsSicurezza1.setBase("SicurezzaDelCanale.wspolicy");
  1861.         sSicurezza.addDocumentoSicurezza(dsSicurezza1);
  1862.         DocumentoSicurezza dsSicurezza2 = new DocumentoSicurezza();
  1863.         dsSicurezza2.setTipo(TipiDocumentoSicurezza.LINGUAGGIO_NATURALE.toString());
  1864.         dsSicurezza2.setBase("LineeGuida.doc");
  1865.         sSicurezza.addDocumentoSicurezza(dsSicurezza2);
  1866.         parteSpecifica.setSpecificaSicurezza(sSicurezza);
  1867.        
  1868.         manifest.setParteSpecifica(parteSpecifica);
  1869.        
  1870.         // Allegati
  1871.         ElencoAllegati elenco = new ElencoAllegati();
  1872.         elenco.addGenericoDocumento("Allegato1.doc");
  1873.         elenco.addGenericoDocumento("Allegato2.doc");
  1874.         manifest.setAllegati(elenco);
  1875.        
  1876.         // SpecificheSemiformali
  1877.         SpecificaSemiformale specifiche = new SpecificaSemiformale();
  1878.        
  1879.         DocumentoSemiformale docS1 = new DocumentoSemiformale();
  1880.         docS1.setTipo(TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString());
  1881.         docS1.setBase("Collaborazione.doc");
  1882.         specifiche.addDocumentoSemiformale(docS1);
  1883.        
  1884.         DocumentoSemiformale docS2 = new DocumentoSemiformale();
  1885.         docS2.setTipo(TipiDocumentoSemiformale.XML.toString());
  1886.         docS2.setBase("Schemi.xml");
  1887.         specifiche.addDocumentoSemiformale(docS2);
  1888.        
  1889.         manifest.setSpecificaSemiformale(specifiche);
  1890.        
  1891.         return manifest;
  1892.     }
  1893.    
  1894.    
  1895.     private static it.gov.spcoop.sica.manifest.AccordoCooperazione getManifestoAC() throws Exception{
  1896.         // Manifesto
  1897.         it.gov.spcoop.sica.manifest.AccordoCooperazione manifest = new it.gov.spcoop.sica.manifest.AccordoCooperazione();
  1898.         manifest.setDataCreazione(new Date());
  1899.         manifest.setDataPubblicazione(new Date());
  1900.         manifest.setDescrizione("Descrizione di esempio");
  1901.         manifest.setFirmato(false);
  1902.         manifest.setNome("AC");
  1903.         manifest.setRiservato(true);
  1904.         manifest.setVersione("2");
  1905.        
  1906.         manifest.setCoordinatore(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempioCoordinatore", true)));
  1907.                
  1908.         // Allegati
  1909.         ElencoAllegati elenco = new ElencoAllegati();
  1910.         elenco.addGenericoDocumento("Allegato1.doc");
  1911.         elenco.addGenericoDocumento("Allegato2.doc");
  1912.         manifest.setAllegati(elenco);
  1913.        
  1914.         // SpecificheSemiformali
  1915.         SpecificaSemiformale specifiche = new SpecificaSemiformale();
  1916.        
  1917.         DocumentoSemiformale docS1 = new DocumentoSemiformale();
  1918.         docS1.setTipo(TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString());
  1919.         docS1.setBase("Collaborazione.doc");
  1920.         specifiche.addDocumentoSemiformale(docS1);
  1921.        
  1922.         DocumentoSemiformale docS2 = new DocumentoSemiformale();
  1923.         docS2.setTipo(TipiDocumentoSemiformale.XML.toString());
  1924.         docS2.setBase("Schemi.xml");
  1925.         specifiche.addDocumentoSemiformale(docS2);
  1926.        
  1927.         manifest.setSpecificaSemiformale(specifiche);
  1928.        
  1929.         // Elenco Partecipanti
  1930.         ElencoPartecipanti ePartecipanti = new ElencoPartecipanti();
  1931.         ePartecipanti.addPartecipante(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoPartecipante1", true)));
  1932.         ePartecipanti.addPartecipante(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoPartecipante2", true)));
  1933.         manifest.setElencoPartecipanti(ePartecipanti);
  1934.        
  1935.         // ServiziComposti
  1936.         ElencoServiziComposti eSC = new ElencoServiziComposti();
  1937.         eSC.addServizioComposto(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_COMPOSTO,
  1938.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoErogatoreServizioComposto1", false), "ASServizioComposto1", 2)));
  1939.         eSC.addServizioComposto(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_COMPOSTO,
  1940.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoErogatoreServizioComposto2", false), "ASServizioComposto2", 2)));
  1941.         eSC.addServizioComposto(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_COMPOSTO,
  1942.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoErogatoreServizioComposto3", false), "ASServizioComposto3", 2)));
  1943.         manifest.setServiziComposti(eSC);
  1944.        
  1945.         return manifest;
  1946.     }
  1947.    
  1948.    
  1949.    
  1950.     private static ServizioComposto getManifestoASComposto(boolean generaInfoEGovComeSpecificaSemiformale,boolean generaInfoEGovFormatoClientSICA) throws Exception{
  1951.         // Manifesto
  1952.         ServizioComposto manifest = new ServizioComposto();
  1953.         manifest.setDataCreazione(new Date());
  1954.         manifest.setDataPubblicazione(new Date());
  1955.         manifest.setDescrizione("Descrizione di esempio");
  1956.         manifest.setFirmato(false);
  1957.         manifest.setNome("ASServizioComposto");
  1958.         manifest.setRiservato(true);
  1959.         manifest.setVersione("2");
  1960.        
  1961.         manifest.setPubblicatore(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", true)));
  1962.         manifest.setRiferimentoAccordoCooperazione(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoCooperazioneSica("AC", 2)));
  1963.        
  1964.         // -- SpecificaConversazione
  1965.         SpecificaConversazione conversazione = new SpecificaConversazione();
  1966.         DocumentoConversazione doc = new DocumentoConversazione();
  1967.         doc.setTipo(TipoDocumentoConversazione.WSBL);
  1968.         doc.setBase("ConversazioneConcettuale.wsbl");
  1969.         conversazione.setConversazioneConcettuale(doc);
  1970.         DocumentoConversazione docErogatore = new DocumentoConversazione();
  1971.         docErogatore.setTipo(TipoDocumentoConversazione.WSBL);
  1972.         docErogatore.setBase("ConversazioneLogicaLatoErogatore.wsbl");
  1973.         conversazione.setConversazioneLogicaLatoErogatore(docErogatore);
  1974.         DocumentoConversazione docFruitore = new DocumentoConversazione();
  1975.         docFruitore.setTipo(TipoDocumentoConversazione.WSBL);
  1976.         docFruitore.setBase("ConversazioneLogicaLatoFruitore.wsbl");
  1977.         conversazione.setConversazioneLogicaLatoFruitore(docFruitore);
  1978.         manifest.setSpecificaConversazione(conversazione);
  1979.        
  1980.         // -- SpecificaInterfaccia
  1981.         SpecificaInterfaccia interfaccia = new SpecificaInterfaccia();
  1982.         DocumentoInterfaccia docI = new DocumentoInterfaccia();
  1983.         docI.setTipo(TipoDocumentoInterfaccia.WSDL);
  1984.         docI.setBase("InterfacciaConcettuale.wsdl");
  1985.         interfaccia.setInterfacciaConcettuale(docI);
  1986.         DocumentoInterfaccia docIErogatore = new DocumentoInterfaccia();
  1987.         docIErogatore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1988.         docIErogatore.setBase("InterfacciaLogicaErogatore.wsdl");
  1989.         interfaccia.setInterfacciaLogicaLatoErogatore(docIErogatore);
  1990.         DocumentoInterfaccia docIFruitore = new DocumentoInterfaccia();
  1991.         docIFruitore.setTipo(TipoDocumentoInterfaccia.WSDL);
  1992.         docIFruitore.setBase("InterfacciaLogicaFruitore.wsdl");
  1993.         interfaccia.setInterfacciaLogicaLatoFruitore(docIFruitore);
  1994.         manifest.setSpecificaInterfaccia(interfaccia);
  1995.        
  1996.         // Specifica Coordinamento
  1997.         SpecificaCoordinamento speCorr = new SpecificaCoordinamento();
  1998.         DocumentoCoordinamento docCoor = new DocumentoCoordinamento();
  1999.         docCoor.setTipo(TipiDocumentoCoordinamento.BPEL.toString());
  2000.         docCoor.setBase("Generica Orchestrazione.bpel");
  2001.         speCorr.addDocumentoCoordinamento(docCoor);
  2002.         DocumentoCoordinamento docCoor2 = new DocumentoCoordinamento();
  2003.         docCoor2.setTipo(TipiDocumentoCoordinamento.WSCDL.toString());
  2004.         docCoor2.setBase("Generica Orchestrazione.wscdl");
  2005.         speCorr.addDocumentoCoordinamento(docCoor2);
  2006.         manifest.setSpecificaCoordinamento(speCorr);
  2007.        
  2008.         // Servizi Componente
  2009.         ElencoServiziComponenti componenti = new ElencoServiziComponenti();
  2010.         componenti.addServizioComponente(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_PARTE_SPECIFICA,
  2011.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", false), "ASParteSpecifica", 2)));
  2012.         componenti.addServizioComponente(new java.net.URI(SICAtoOpenSPCoopUtilities.buildIDAccordoSica(Costanti.TIPO_ACCORDO_SERVIZIO_PARTE_SPECIFICA,
  2013.                 SICAtoOpenSPCoopUtilities.buildIDSoggettoSica("SoggettoEsempio", false), "ASParteSpecifica2", 2)));
  2014.         manifest.setServiziComponenti(componenti);
  2015.        
  2016.         // Allegati
  2017.         ElencoAllegati allegati = new ElencoAllegati();
  2018.         allegati.addGenericoDocumento("Allegato1.doc");
  2019.         allegati.addGenericoDocumento("Allegato2.doc");
  2020.         allegati.addGenericoDocumento(Costanti.ALLEGATO_DEFINITORIO_XSD); // DefinitorioXSD
  2021.         manifest.setAllegati(allegati);
  2022.        
  2023.         // SpecificheSemiformali
  2024.         SpecificaSemiformale specifiche = new SpecificaSemiformale();
  2025.        
  2026.         DocumentoSemiformale docS1 = new DocumentoSemiformale();
  2027.         docS1.setTipo(TipiDocumentoSemiformale.LINGUAGGIO_NATURALE.toString());
  2028.         docS1.setBase("Collaborazione.doc");
  2029.         specifiche.addDocumentoSemiformale(docS1);
  2030.        
  2031.         DocumentoSemiformale docS2 = new DocumentoSemiformale();
  2032.         docS2.setTipo(TipiDocumentoSemiformale.XML.toString());
  2033.         docS2.setBase("Schemi.xml");
  2034.         specifiche.addDocumentoSemiformale(docS2);
  2035.        
  2036.         manifest.setSpecificaSemiformale(specifiche);
  2037.        
  2038.         // ModalitaEsplicitaCNIPA per info egov
  2039.         if(generaInfoEGovComeSpecificaSemiformale){
  2040.             DocumentoSemiformale docSpecificaEGOV = new DocumentoSemiformale();
  2041.             docSpecificaEGOV.setTipo(TipiDocumentoSemiformale.XML.toString());
  2042.             if(generaInfoEGovFormatoClientSICA)
  2043.                 docSpecificaEGOV.setBase(it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  2044.             else
  2045.                 docSpecificaEGOV.setBase(it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  2046.             specifiche.addDocumentoSemiformale(docSpecificaEGOV);
  2047.             manifest.setSpecificaSemiformale(specifiche);
  2048.         }
  2049.         else{
  2050.             if(generaInfoEGovFormatoClientSICA)
  2051.                 allegati.addGenericoDocumento(it.gov.spcoop.sica.wscp.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  2052.             else
  2053.                 allegati.addGenericoDocumento(it.cnipa.collprofiles.driver.Costanti.SPECIFICA_SEMIFORMALE_INFORMAZIONI_EGOV);
  2054.             manifest.setAllegati(allegati);
  2055.         }
  2056.        
  2057.         return manifest;
  2058.     }
  2059.    
  2060.    
  2061.     private static EgovDecllElement getDichiarazioneEGov(String nomeAccordo) throws URISyntaxException{
  2062.        
  2063.         EgovDecllElement egov = new EgovDecllElement();
  2064.         egov.setEGovVersion(it.cnipa.collprofiles.driver.Costanti.VERSIONE_BUSTA);
  2065.         egov.setRifDefinizioneInterfaccia(new java.net.URI(nomeAccordo));
  2066.        
  2067.         OperationListType operations = new OperationListType();
  2068.        
  2069.         OperationType tipoOneWay = new OperationType();
  2070.         tipoOneWay.setOperazione("nomeOperationOneWay");
  2071.         tipoOneWay.setProfiloDiCollaborazione(it.cnipa.collprofiles.constants.ProfiloDiCollaborazioneType.ONE_WAY);
  2072.         tipoOneWay.setServizio("nomeServizioOneWay");
  2073.         operations.addOperation(tipoOneWay);
  2074.        
  2075.         OperationType tipoSincrono = new OperationType();
  2076.         tipoSincrono.setOperazione("nomeOperationSincrono");
  2077.         tipoSincrono.setProfiloDiCollaborazione(it.cnipa.collprofiles.constants.ProfiloDiCollaborazioneType.SINCRONO);
  2078.         tipoSincrono.setServizio("nomeServizioSincrono");
  2079.         operations.addOperation(tipoSincrono);
  2080.        
  2081.         OperationType tipoAsincronoSimmetrico = new OperationType();
  2082.         tipoAsincronoSimmetrico.setOperazione("nomeOperationAsincronoSimmetricoRichiesta");
  2083.         tipoAsincronoSimmetrico.setProfiloDiCollaborazione(it.cnipa.collprofiles.constants.ProfiloDiCollaborazioneType.ASINCRONO_SIMMETRICO);
  2084.         tipoAsincronoSimmetrico.setServizio("nomeServizioAsincronoSimmetrico");
  2085.         tipoAsincronoSimmetrico.setOperazioneCorrelata("nomeOperationAsincronoSimmetricoRisposta");
  2086.         tipoAsincronoSimmetrico.setServizioCorrelato("nomeServizioCorrelatoAsincronoSimmetrico");
  2087.         operations.addOperation(tipoAsincronoSimmetrico);
  2088.                
  2089.         OperationType tipoAsincronoAsimmetrico = new OperationType();
  2090.         tipoAsincronoAsimmetrico.setOperazione("nomeOperationAsincronoAsimmetricoRichiesta");
  2091.         tipoAsincronoAsimmetrico.setProfiloDiCollaborazione(it.cnipa.collprofiles.constants.ProfiloDiCollaborazioneType.ASINCRONO_ASIMMETRICO);
  2092.         tipoAsincronoAsimmetrico.setServizio("nomeServizioAsincronoAsimmetrico");
  2093.         tipoAsincronoAsimmetrico.setOperazioneCorrelata("nomeOperationAsincronoAsimmetricoRichiestaStato");
  2094.         tipoAsincronoAsimmetrico.setServizioCorrelato("nomeServizioAsincronoAsimmetrico");
  2095.         operations.addOperation(tipoAsincronoAsimmetrico);
  2096.        
  2097.         egov.setOperationList(operations);
  2098.        
  2099.         return egov;
  2100.     }
  2101.    
  2102.     private static ProfiloCollaborazioneEGOV getDichiarazioneEGovFormatoClientSICA(String nomeAccordo) throws URISyntaxException{
  2103.        
  2104.         ProfiloCollaborazioneEGOV egov = new ProfiloCollaborazioneEGOV();
  2105.         egov.setVersioneEGOV(it.gov.spcoop.sica.wscp.driver.Costanti.VERSIONE_BUSTA);
  2106.         egov.setRiferimentoDefinizioneInterfaccia(new java.net.URI(nomeAccordo));
  2107.        
  2108.         it.gov.spcoop.sica.wscp.OperationListType operations = new it.gov.spcoop.sica.wscp.OperationListType();
  2109.        
  2110.         it.gov.spcoop.sica.wscp.OperationType tipoOneWay = new it.gov.spcoop.sica.wscp.OperationType();
  2111.         tipoOneWay.setOperazione("nomeOperationOneWay");
  2112.         tipoOneWay.setProfiloDiCollaborazione(ProfiloDiCollaborazioneType.EGOV_IT_MESSAGGIO_SINGOLO_ONE_WAY);
  2113.         tipoOneWay.setServizio("nomeServizioOneWay");
  2114.         operations.addCollaborazione(tipoOneWay);
  2115.        
  2116.         it.gov.spcoop.sica.wscp.OperationType tipoSincrono = new it.gov.spcoop.sica.wscp.OperationType();
  2117.         tipoSincrono.setOperazione("nomeOperationSincrono");
  2118.         tipoSincrono.setProfiloDiCollaborazione(ProfiloDiCollaborazioneType.EGOV_IT_SERVIZIO_SINCRONO);
  2119.         tipoSincrono.setServizio("nomeServizioSincrono");
  2120.         operations.addCollaborazione(tipoSincrono);
  2121.        
  2122.         it.gov.spcoop.sica.wscp.OperationType tipoAsincronoSimmetrico = new it.gov.spcoop.sica.wscp.OperationType();
  2123.         tipoAsincronoSimmetrico.setOperazione("nomeOperationAsincronoSimmetricoRichiesta");
  2124.         tipoAsincronoSimmetrico.setProfiloDiCollaborazione(ProfiloDiCollaborazioneType.EGOV_IT_SERVIZIO_ASINCRONO_SIMMETRICO);
  2125.         tipoAsincronoSimmetrico.setServizio("nomeServizioAsincronoSimmetrico");
  2126.         tipoAsincronoSimmetrico.setOperazioneCorrelata("nomeOperationAsincronoSimmetricoRisposta");
  2127.         tipoAsincronoSimmetrico.setServizioCorrelato("nomeServizioCorrelatoAsincronoSimmetrico");
  2128.         operations.addCollaborazione(tipoAsincronoSimmetrico);
  2129.                
  2130.         it.gov.spcoop.sica.wscp.OperationType tipoAsincronoAsimmetrico = new it.gov.spcoop.sica.wscp.OperationType();
  2131.         tipoAsincronoAsimmetrico.setOperazione("nomeOperationAsincronoAsimmetricoRichiesta");
  2132.         tipoAsincronoAsimmetrico.setProfiloDiCollaborazione(ProfiloDiCollaborazioneType.EGOV_IT_SERVIZIO_ASINCRONO_ASIMMETRICO);
  2133.         tipoAsincronoAsimmetrico.setServizio("nomeServizioAsincronoAsimmetrico");
  2134.         tipoAsincronoAsimmetrico.setOperazioneCorrelata("nomeOperationAsincronoAsimmetricoRichiestaStato");
  2135.         tipoAsincronoAsimmetrico.setServizioCorrelato("nomeServizioAsincronoAsimmetrico");
  2136.         operations.addCollaborazione(tipoAsincronoAsimmetrico);
  2137.        
  2138.         egov.setListaCollaborazioni(operations);
  2139.        
  2140.         return egov;
  2141.     }  
  2142.    
  2143.     public static void isFileExists(String file) throws Exception{
  2144.         if ((new File(file)).exists()==false){
  2145.             throw new Exception(file+" non esistente? Wsdl2Java non ha prodotto l'output atteso");
  2146.         }
  2147.     }
  2148.    
  2149.     /*
  2150.     protected static class WSDL2JAVA extends WSDL2Java {
  2151.        
  2152.         private Exception error;
  2153.        
  2154.         public Exception getError() {
  2155.             return this.error;
  2156.         }

  2157.         @SuppressWarnings("unqualified-field-access")
  2158.         @Override
  2159.         public void run(String[] args) {

  2160.             // Parse the arguments
  2161.             CLArgsParser argsParser = new CLArgsParser(args, options);

  2162.             // Print parser errors, if any
  2163.             if (null != argsParser.getErrorString()) {
  2164.                 printUsage();
  2165.                 this.error = new Exception(Messages.getMessage("error01", argsParser.getErrorString()));
  2166.                 return;
  2167.             }

  2168.             // Get a list of parsed options
  2169.             List<?> clOptions = argsParser.getArguments();
  2170.             int size = clOptions.size();

  2171.             try {

  2172.                 // Parse the options and configure the emitter as appropriate.
  2173.                 for (int i = 0; i < size; i++) {
  2174.                     parseOption((CLOption) clOptions.get(i));
  2175.                 }

  2176.                 // validate argument combinations
  2177.                 //
  2178.                 validateOptions();
  2179.                 parser.run(wsdlURI);

  2180.             } catch (Throwable t) {
  2181.                 this.error = new Exception("Generazione Stub/Skeleton tramite WSDL2Java fallita: "+t.getMessage(),t);
  2182.             }
  2183.         }  
  2184.     }
  2185.     */
  2186.     protected static class WSDL2JAVA{
  2187.         private Exception error;
  2188.        
  2189.         public void setError(Exception error) {
  2190.             this.error = error;
  2191.         }
  2192.         public Exception getError() {
  2193.             return this.error;
  2194.         }
  2195.         public void run(String[] args) {
  2196.            
  2197.         }
  2198.     }
  2199. }