1 20 package org.objectweb.modfact.corba.xmi; 21 22 import org.objectweb.modfact.corba.generator.ZipGenerator; 23 import org.objectweb.modfact.corba.helper.MOFCommon; 24 import org.objectweb.modfact.corba.helper.XMICommon; 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 XMI1_1DTDGenerator extends ZipGenerator { 37 38 private org.omg.mof.Model.Package[] input; 39 40 private MOFCommon mofHelper; 41 private XMICommon xmiHelper; 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.setXmiHelper(xmiHelper); 85 packageGenerator.setMofHelper(mofHelper); 86 packageGenerator.generate(); 87 88 String entryName = 89 xmiHelper.format1(input[i].name()) + ".dtd"; 90 writeEntry(entryName, entryOutput1); 91 entryOutput1.close(); 92 } 94 out.finish(); 95 96 } 97 98 102 public MOFCommon getMofHelper() { 103 return mofHelper; 104 } 105 106 107 111 public void setMofHelper(MOFCommon mofHelper) { 112 this.mofHelper = mofHelper; 113 } 114 115 119 public XMICommon getXmiHelper() { 120 return xmiHelper; 121 } 122 123 127 public void setXmiHelper(XMICommon xmiHelper) { 128 this.xmiHelper = xmiHelper; 129 } 130 131 } 132 | Popular Tags |