1 19 20 package org.netbeans.modules.j2ee.ant; 21 22 import java.io.File ; 23 import org.apache.tools.ant.BuildException; 24 import org.apache.tools.ant.Task; 25 import org.apache.tools.ant.taskdefs.LogOutputStream; 26 import org.netbeans.api.project.FileOwnerQuery; 27 import org.netbeans.api.project.Project; 28 import org.netbeans.modules.j2ee.deployment.devmodules.spi.J2eeModuleProvider; 29 import org.openide.filesystems.FileObject; 30 import org.openide.filesystems.FileUtil; 31 import org.openide.util.NbBundle; 32 33 38 39 public class Verify extends Task { 40 41 private String file; 42 public void setFile(String file) { 43 this.file = file; 44 } 45 public String getFile() { 46 return file; 47 } 48 49 public void execute() throws BuildException { 50 File f = getProject().resolveFile(file); 51 FileObject targetFO = FileUtil.toFileObject(f); 52 if (targetFO == null) { 53 log(NbBundle.getMessage(Verify.class, "MSG_FileNotFound", file)); 54 } 55 try { 56 FileObject fo = FileUtil.toFileObject(getProject().getBaseDir()); 57 Project project = FileOwnerQuery.getOwner(fo); 58 J2eeModuleProvider jmp = (J2eeModuleProvider) project.getLookup().lookup(J2eeModuleProvider.class); 59 jmp.verify(targetFO, new LogOutputStream(this, 0)); 60 } catch (Exception ex) { 61 throw new BuildException(ex); 62 } 63 } 64 } 65 | Popular Tags |