KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > ui > cli > RaAdminCommandFactory


1 /*************************************************************************
2  * *
3  * EJBCA: The OpenSource Certificate Authority *
4  * *
5  * This software is free software; you can redistribute it and/or *
6  * modify it under the terms of the GNU Lesser General Public *
7  * License as published by the Free Software Foundation; either *
8  * version 2.1 of the License, or any later version. *
9  * *
10  * See terms of license at gnu.org. *
11  * *
12  *************************************************************************/

13  
14 package org.ejbca.ui.cli;
15
16 /**
17  * Factory for RA Admin Commands.
18  *
19  * @version $Id: RaAdminCommandFactory.java,v 1.3 2006/07/12 16:10:22 anatom Exp $
20  */

21 public class RaAdminCommandFactory {
22     /**
23      * Cannot create an instance of this class, only use static methods.
24      */

25     private RaAdminCommandFactory() {
26     }
27
28     /**
29      * Returns an Admin Command object based on contents in args[0].
30      *
31      * @param args array of arguments typically passed from main().
32      *
33      * @return Command object or null if args[0] does not specify a valid command.
34      */

35     public static IAdminCommand getCommand(String JavaDoc[] args) {
36         if (args.length < 1) {
37             return null;
38         }
39
40         if (args[0].equals("adduser")) {
41             return new RaAddUserCommand(args);
42         } else if (args[0].equals("deluser")) {
43             return new RaDelUserCommand(args);
44         } else if (args[0].equals("setpwd")) {
45             return new RaSetPwdCommand(args);
46         } else if (args[0].equals("setclearpwd")) {
47             return new RaSetClearPwdCommand(args);
48         } else if (args[0].equals("setuserstatus")) {
49             return new RaSetUserStatusCommand(args);
50         } else if (args[0].equals("finduser")) {
51             return new RaFindUserCommand(args);
52         } else if (args[0].equals("listnewusers")) {
53             return new RaListNewUsersCommand(args);
54         } else if (args[0].equals("listusers")) {
55             return new RaListUsersCommand(args);
56         } else if (args[0].equals("revokeuser")) {
57             return new RaRevokeUserCommand(args);
58         } else if (args[0].equals("unrevokeuser")) {
59             return new RaUnRevokeUserCommand(args);
60         } else if (args[0].equals("keyrecover")) {
61             return new RaKeyRecoverCommand(args);
62         } else if (args[0].equals("keyrecovernewest")) {
63             return new RaKeyRecoverNewestCommand(args);
64         } else if (args[0].equals("setsubjectdirattr")) {
65             return new RaSetSubjDirAttrCommand(args);
66         } else {
67             return null;
68         }
69     }
70
71     // getCommand
72
}
73
74
75 // RaAdminCommandFactory
76
Popular Tags