1 19 package org.netbeans.lib.jmi.xmi; 20 21 import java.util.Collection ; 22 import java.io.OutputStream ; 23 import java.io.IOException ; 24 import javax.jmi.reflect.RefPackage; 25 import org.netbeans.api.xmi.XMIWriter; 26 import org.netbeans.api.xmi.XMIOutputConfig; 27 28 public class DelegatingWriter extends XMIWriter { 29 30 public static final String XMI_VERSION_20 = "2.0"; 31 32 private XMIOutputConfig config; 33 34 public DelegatingWriter () { 35 config = new OutputConfig (); 36 } 37 38 public DelegatingWriter (XMIOutputConfig config) { 39 this.config = config; 40 } 41 42 public XMIOutputConfig getConfiguration() { 43 return config; 44 } 45 46 public void write(OutputStream stream, String uri, Collection objects, String xmiVersion) throws IOException { 47 getWriter (xmiVersion).write (stream, uri, objects, xmiVersion); 48 } 49 50 public void write(OutputStream stream, String uri, RefPackage extent, String xmiVersion) throws IOException { 51 getWriter (xmiVersion).write (stream, uri, extent, xmiVersion); 52 } 53 54 private WriterBase getWriter (String xmiVersion) { 55 if ((xmiVersion != null) && (xmiVersion.equals (XMI_VERSION_20))) 56 return new XMI20Writer (config); 57 else 58 return new WriterBase (config); 59 } 60 61 } 62 | Popular Tags |