1 19 20 package org.netbeans.mdrant; 21 22 import java.io.File ; 23 24 import javax.jmi.reflect.*; 25 26 import org.apache.tools.ant.BuildException; 27 28 import org.netbeans.api.xmi.XMIReaderFactory; 29 import org.netbeans.api.xmi.XMIReader; 30 31 35 public class ReadXMI extends MdrTask.Sub { 36 37 private File file; 39 private String extent; 41 42 public ReadXMI() { 43 } 44 45 public void execute() throws Exception { 46 47 if ( file == null ) { 48 throw new BuildException( "Import file has to be sppecified. Use the \"file\" attribute" ); 49 } 50 51 if ( extent == null ) { 52 throw new BuildException( "Extent to import file in has to be sppecified. Use the \"extent\" attribute" ); 53 } 55 56 XMIReader xmiReader = XMIReaderFactory.getDefault().createXMIReader(); 57 xmiReader.read( file.toURL().toString(), getRepository().getExtent( extent ) ); 58 59 } 60 61 63 public void setFile( File file ) { 64 this.file = file; 65 } 66 67 public void setExtent( String extent ) { 68 this.extent = extent; 69 } 70 71 72 } 73 | Popular Tags |