1 19 20 package org.netbeans.modules.apisupport.ant; 21 22 import java.io.File ; 23 import java.io.IOException ; 24 import org.apache.tools.ant.BuildException; 25 import org.apache.tools.ant.Task; 26 import org.apache.tools.ant.types.EnumeratedAttribute; 27 import org.netbeans.core.startup.TestModuleDeployer; 28 29 31 public class InstallModuleTask extends Task { 32 33 private File module = null; 34 private String action = null; 35 36 public static class Action extends EnumeratedAttribute { 37 public String [] getValues () { 38 return new String [] { "reinstall" }; } 40 } 41 42 public void setModule (File f) { 43 module = f; 44 } 45 46 public void setAction (Action a) { 47 action = a.getValue (); 48 } 49 50 public void execute () throws BuildException { 51 if (module == null) throw new BuildException ("Required attribute: module", getLocation()); if (action == null) throw new BuildException ("Required attribute: action", getLocation()); try { 54 if (action.equals ("reinstall")) { TestModuleDeployer.deployTestModule(module); 56 } else { 57 throw new BuildException ("Unsupported action: " + action, getLocation()); } 59 } catch (IOException ioe) { 60 throw new BuildException (ioe, getLocation()); 61 } 62 } 63 64 } 65 | Popular Tags |