1 28 29 package org.objectweb.openccm.uml.transformation.ast; 30 31 import ispuml.mdaTransformation.RuleContext; 32 import ispuml.mdaTransformation.TransformationException; 33 import ispuml.mdaTransformation.ActionBase; 34 import ispuml.mdaTransformation.rules.xml.CompositeXmlAction; 35 36 37 40 public class WriteIdlFile extends CompositeXmlAction { 41 42 45 public WriteIdlFile() { 46 isSrcPropertyRequired = false; 49 isDstPropertyRequired = false; 50 action = new TransformAction(); 51 } 52 53 54 57 class TransformAction extends ActionBase { 58 64 public Object execute(Object bean, RuleContext request) throws TransformationException { 65 Object obj = request.getAttribute("declaration"); 66 org.objectweb.openccm.ast.api.CidlModuleDecl cidlModule; 67 cidlModule = (org.objectweb.openccm.ast.api.CidlModuleDecl) obj; 68 String cidlModuleName = cidlModule.getName(); 69 70 String outputdir = (String )request.engineContext.getAttribute("outputdir"); 72 String filename = outputdir + java.io.File.separator + cidlModuleName + ".idl3"; 73 org.objectweb.openccm.generator.idl.api.IDL3Generator idlGen; 74 idlGen = new org.objectweb.openccm.generator.idl.lib.IDL3Generator(CCMASTModelCreateUtils.getAst()); 75 idlGen.initialize(filename, new java.util.ArrayList (), "XMItoIDL3"); 76 try { 77 idlGen.generate(cidlModule); 78 } catch(org.objectweb.openccm.generator.common.lib.GenerationException ex) { 79 ex.printStackTrace(); 80 } 81 82 return cidlModule; 83 } 84 85 } } 87 | Popular Tags |