KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > ws > client > EJBCAWSRACommandFactory


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.core.protocol.ws.client;
15
16 import org.ejbca.ui.cli.IAdminCommand;
17
18 /**
19  * Factory for EJBCA WS RA Admin Commands.
20  *
21  * @version $Id: EJBCAWSRACommandFactory.java,v 1.2 2006/10/08 22:53:26 herrvendil Exp $
22  */

23 public class EJBCAWSRACommandFactory {
24     /**
25      * Cannot create an instance of this class, only use static methods.
26      */

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

37     public static IAdminCommand getCommand(String JavaDoc[] args) {
38         if (args.length < 1) {
39             return null;
40         }
41         
42         if (args[0].equals("edituser")) {
43             return new EditUserCommand(args);
44         }else if (args[0].equals("finduser")) {
45             return new FindUserCommand(args);
46         }else if (args[0].equals("findcerts")) {
47             return new FindCertsCommand(args);
48         }else if (args[0].equals("pkcs10req")) {
49             return new PKCS10ReqCommand(args);
50         } else if (args[0].equals("pkcs12req")) {
51             return new PKCS12ReqCommand(args);
52         } else if (args[0].equals("revokecert")) {
53             return new RevokeCertCommand(args);
54         } else if (args[0].equals("revoketoken")) {
55             return new RevokeTokenCommand(args);
56         } else if (args[0].equals("revokeuser")) {
57             return new RevokeUserCommand(args);
58         } else if (args[0].equals("checkrevokationstatus")) {
59             return new CheckRevokeStatusCommand(args);
60         }else if (args[0].equals("generatenewuser")) {
61             return new GenerateNewUserCommand(args);
62         }
63         
64         else {
65             return null;
66         }
67     }
68
69     // getCommand
70
}
71
72
73 // RaAdminCommandFactory
74
Popular Tags