KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > protocol > xkms > client > XKMSCLICommandFactory


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.xkms.client;
15
16 import org.ejbca.ui.cli.IAdminCommand;
17
18 /**
19  * Factory for XKMS CLI Commands.
20  *
21  * @version $Id: XKMSCLICommandFactory.java,v 1.2 2007/01/07 00:31:51 herrvendil Exp $
22  * @author Philip Vendil
23  */

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

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

38     public static IAdminCommand getCommand(String JavaDoc[] args) {
39         if (args.length < 1) {
40             return null;
41         }
42         
43         if (args[0].equals("locate")) {
44             return new LocateCommand(args);
45         }
46         
47         if (args[0].equals("register")) {
48             return new RegisterCommand(args);
49         }
50         
51         if (args[0].equals("reissue")) {
52             return new ReissueCommand(args);
53         }
54         
55         if (args[0].equals("recover")) {
56             return new RecoverCommand(args);
57         }
58         
59         if (args[0].equals("revoke")) {
60             return new RevokeCommand(args);
61         }
62         
63         else {
64             return null;
65         }
66     }
67
68     // getCommand
69
}
70
71
72
Popular Tags