1 20 package org.objectweb.modfact.corba.idl; 21 22 import org.objectweb.modfact.corba.generator.ZipGenerator; 23 import org.objectweb.modfact.corba.helper.MOFCommon; 24 import org.objectweb.modfact.corba.helper.IDLCommon; 25 import org.objectweb.modfact.corba.logging.ModFactLogger; 26 27 import java.io.ByteArrayOutputStream ; 28 import java.io.IOException ; 29 import org.omg.mof.Reflective.*; 30 31 import org.omg.CORBA.TypeCodePackage.*; 32 33 36 public class MOFIDL1_3Generator extends ZipGenerator { 37 38 private org.omg.mof.Model.Package[] input; 39 40 private MOFCommon mofHelper; 41 private IDLCommon idlHelper; 42 43 private ModFactLogger logger; 44 45 48 public void setInput(org.omg.mof.Model.ModelElement[] elt) { 49 input = new org.omg.mof.Model.Package[elt.length]; 50 for (int i = 0; i < input.length; i++) { 51 input[i] = (org.omg.mof.Model.Package) elt[i]; 52 } 53 } 54 55 58 public void setLogger(ModFactLogger log) { 59 logger = log; 60 } 61 62 65 public void generate() 66 throws 67 MofError, 68 NotSet, 69 BadKind, 70 org.omg.CORBA.TypeCodePackage.Bounds , 71 IOException { 72 73 for (int i = 0; i < input.length; i++) { 74 org.omg.mof.Model.Package[] apackage = 75 new org.omg.mof.Model.Package[1]; 76 apackage[0] = input[i]; 77 78 PackageGenerator packageGenerator = new PackageGenerator(); 80 packageGenerator.setInput(apackage); 81 packageGenerator.setLogger(logger); 82 ByteArrayOutputStream entryOutput1 = new ByteArrayOutputStream (); 83 packageGenerator.setOutput(entryOutput1); 84 packageGenerator.setIdlHelper(idlHelper); 85 packageGenerator.setMofHelper(mofHelper); 86 packageGenerator.generate(); 87 88 String entryName = 89 idlHelper.format1(input[i].name()) + ".idl"; 90 writeEntry(entryName, entryOutput1); 91 entryOutput1.close(); 92 } 94 out.finish(); 95 96 } 97 98 102 public IDLCommon getIdlHelper() { 103 return idlHelper; 104 } 105 106 110 public MOFCommon getMofHelper() { 111 return mofHelper; 112 } 113 114 118 public void setIdlHelper(IDLCommon idlHelper) { 119 this.idlHelper = idlHelper; 120 } 121 122 126 public void setMofHelper(MOFCommon mofHelper) { 127 this.mofHelper = mofHelper; 128 } 129 130 } 131 | Popular Tags |