1 6 7 package com.sun.enterprise.config.backup; 8 9 13 public class BackupCommand 14 { 15 public static BackupCommand parse(String 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 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 name; 42 } 43 44 45 | Popular Tags |