1 19 20 package org.netbeans.mdrant; 21 22 import java.io.File ; 23 import java.io.FileOutputStream ; 24 25 import javax.jmi.reflect.*; 26 27 import org.apache.tools.ant.BuildException; 28 import org.netbeans.api.mdr.DTDProducer; 29 30 34 public class WriteDTD extends MdrTask.Sub { 35 36 private File file; 38 39 private String extent; 41 42 public WriteDTD() { 43 } 44 45 public void execute() throws Exception { 46 47 if ( file == null ) { 48 throw new BuildException( "Export file has to be sppecified. Use the \"file\" attribute" ); 49 } 50 51 if ( extent == null ) { 52 throw new BuildException( "Extent to export has to be sppecified. Use the \"extent\" attribute" ); 53 } 54 55 DTDProducer.getDefault().generate( new FileOutputStream ( file ), getRepository().getExtent( extent ) ); 56 57 } 58 59 61 public void setFile( File file ) { 62 this.file = file; 63 } 64 65 public void setExtent( String extent ) { 66 this.extent = extent; 67 } 68 69 70 } 71 | Popular Tags |