/** uml2mediatorfile transformation script by Tibor Somodi @id uml2mediatorfile @name uml2mediatorfile @description It imports the given UML model into a VIATRA modelspace, and executes all of the VIATRA transformations to get the XML files for the input of XML2Axis application. It puts the generated files to the output path. @function uml2mediator "Transforms UML model to a mediator XML file for uml2axis tool based on UML components" @param uml2mediator umlFileName java.lang.String "The absolute path to the UML file to read from" @param uml2mediator outputDirectory java.lang.String "The absolute path to the output" @function umlobjects2mediator "Transforms UML model to a mediator XML file for uml2axis tool based on UML objects and components" @param umlobjects2mediator umlFileName java.lang.String "The absolute path to the UML file to read from" @param umlobjects2mediator outputDirectory java.lang.String "The absolute path to the output" */ function uml2mediator(umlFileName, outputDirectory) { viatra = sCore.findToolByName("Viatra").getServiceInterface(); vU = sCore.findToolByName("vUtil").getServiceInterface(); fw = viatra.createFramework(); vpml = vU.getInputStream(vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","model/uml2soa-R3.vpml")); viatra.mergeVPML(fw,vpml); /* load VTCL */ vtcl1 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/soa2axis.vtcl"); vtcl2 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/soarm2sandesha.vtcl"); vtcl3 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/uml2soa.vtcl"); vtcl4 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/uml2soaconnections.vtcl"); vtcl5 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/uml2soarm.vtcl"); vtcl6 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/uml2soasecurity.vtcl"); vtcl7 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/xmlgeneratorSoTi.vtcl"); vtcl8 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/uml2axis.vtcl"); viatra.loadTransformationFromFile(fw,vtcl1,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl2,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl3,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl4,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl5,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl6,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl7,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl8,"vtcl"); umlmodel_file = vU.getFile(umlFileName); viatra.nativeImportFromFile(fw,umlmodel_file,"uml"); umlmodel = umlFileName.substring(umlFileName.lastIndexOf("/")+1, umlFileName.lastIndexOf(".")); result = viatra.runTransformation(fw,"transformations.uml2axis", "Model=uml2.models."+umlmodel+"_uml;Output="+outputDirectory); //viatra.disposeFramework(fw); } function umlobjects2mediator(umlFileName, outputDirectory) { viatra = sCore.findToolByName("Viatra").getServiceInterface(); vU = sCore.findToolByName("vUtil").getServiceInterface(); fw = viatra.createFramework(); vpml = vU.getInputStream(vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","model/uml2soa-R3.vpml")); viatra.mergeVPML(fw,vpml); /* load VTCL */ vtcl1 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/soa2axis.vtcl"); vtcl2 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/soarm2sandesha.vtcl"); vtcl3 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/umlobjects2soa.vtcl"); vtcl4 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/umlobjects2soaconnections-stereot.vtcl"); vtcl5 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/umlobjects2soarm-stereot.vtcl"); vtcl6 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/umlobjects2soasecurity-stereot.vtcl"); vtcl7 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/xmlgeneratorSoTi.vtcl"); vtcl8 = vU.getFileFromBundle("hu.bme.mit.viatra.integration.sensoria.uml2axis","transformations/combinedtrafos/uml2axis.vtcl"); viatra.loadTransformationFromFile(fw,vtcl1,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl2,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl3,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl4,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl5,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl6,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl7,"vtcl"); viatra.loadTransformationFromFile(fw,vtcl8,"vtcl"); umlmodel_file = vU.getFile(umlFileName); viatra.nativeImportFromFile(fw,umlmodel_file,"uml"); umlmodel = umlFileName.substring(umlFileName.lastIndexOf("/")+1, umlFileName.lastIndexOf(".")); result = viatra.runTransformation(fw,"transformations.uml2axis", "Model=uml2.models."+umlmodel+"_uml;Output="+outputDirectory); //viatra.disposeFramework(fw); }