KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ashkelon > AshkelonTask


1 package org.ashkelon;
2
3 import org.apache.tools.ant.*;
4 import org.apache.tools.ant.types.*;
5 import java.io.*;
6
7 /**
8  * @author Eitan Suez
9  */

10 public class AshkelonTask extends Task
11 {
12     private String JavaDoc cmd;
13     private String JavaDoc apifile = "";
14
15     /*
16      * <ashkelon cmd="add" apifile="someapi.xml">
17      * <arg name="source" value="1.4" />
18      * </ashkelon>
19      */

20     
21     public void setCmd(AshkelonCmd cmd)
22     {
23       this.cmd = cmd.getValue();
24     }
25     public void setApifile(File file)
26     {
27       this.apifile = file.getAbsolutePath();
28       log("api file is: "+apifile);
29     }
30     
31     public void execute()
32     {
33       if ("add".equals(cmd))
34       {
35         String JavaDoc[] args = new String JavaDoc[1];
36         args[0] = "@" + apifile;
37         Ashkelon.addapiCmd(args);
38       }
39     }
40     
41     public static class AshkelonCmd extends EnumeratedAttribute
42     {
43         public String JavaDoc[] getValues()
44         {
45             return new String JavaDoc[] {"add", "reset", "list", "remove", "updaterefs"};
46         }
47     }
48 }
49
Popular Tags