KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > sun > enterprise > config > backup > BackupCommand


1 /*
2  * BackupCommands.java
3  *
4  * Created on January 16, 2004, 11:27 AM
5  */

6
7 package com.sun.enterprise.config.backup;
8
9 /**
10  * A Java 'enum' for command types
11  * @author bnevins
12  */

13 public class BackupCommand
14 {
15     public static BackupCommand parse(String JavaDoc s)
16     {
17         s = s.toLowerCase();
18         
19         for(int i = 0; i < allCommands.length; i++)
20         {
21             if(s.equals(allCommands[i].name))
22                 return allCommands[i];
23         }
24
25         return null;
26     }
27         
28     
29     private BackupCommand(String JavaDoc name)
30     {
31         this.name = name;
32     }
33     
34     public static BackupCommand backup = new BackupCommand("backup");
35     public static BackupCommand restore = new BackupCommand("restore");
36     public static BackupCommand undorestore = new BackupCommand("undorestore");
37     public static BackupCommand listbackups = new BackupCommand("listbackups");
38     public static BackupCommand listhistory = new BackupCommand("listhistory");
39     private static BackupCommand[] allCommands = new BackupCommand[] { backup, restore, undorestore, listbackups, listhistory };
40     
41     private String JavaDoc name;
42 }
43
44
45
Popular Tags