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 WriteCidlFile extends CompositeXmlAction { 41 42 45 public WriteCidlFile() { 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 + ".cidl"; 73 org.objectweb.openccm.generator.cidl.lib.CIDLGenerator cidlGen; 74 cidlGen = new org.objectweb.openccm.generator.cidl.lib.CIDLGenerator(CCMASTModelCreateUtils.getAst()); 75 cidlGen.initialize(filename, "XMItoCIDL"); 76 try { 77 cidlGen.generate(cidlModule, org.objectweb.openccm.ast.api.DeclarationKind.dk_cidl); 78 } catch(org.objectweb.openccm.generator.common.lib.GenerationException ex) { 79 ex.printStackTrace(); 80 } 81 82 return cidlModule; 83 } 84 85 } } 87 | Popular Tags |