KickJava   Java API By Example, From Geeks To Geeks.

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


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 CA Admin Commands.
18  *
19  * @version $Id: CaAdminCommandFactory.java,v 1.2.10.1 2007/04/02 08:22:52 jeklund Exp $
20  */

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

25     private CaAdminCommandFactory() {
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         if (args[0].equals("getrootcert")) {
40             return new CaGetRootCertCommand(args);
41         } else if (args[0].equals("listexpired")) {
42             return new CaListExpiredCommand(args);
43         } else if (args[0].equals("info")) {
44             return new CaInfoCommand(args);
45         } else if (args[0].equals("listcas")) {
46             return new CaListCAsCommand(args);
47         } else if (args[0].equals("init")) {
48             return new CaInitCommand(args);
49         } else if (args[0].equals("createcrl")) {
50             return new CaCreateCrlCommand(args);
51         } else if (args[0].equals("getcrl")) {
52             return new CaGetCrlCommand(args);
53         } else if (args[0].equals("exportprofiles")) {
54             return new CaExportProfilesCommand(args);
55         } else if (args[0].equals("importprofiles")) {
56             return new CaImportProfilesCommand(args);
57         } else if (args[0].equals("exportca")) {
58             return new CaExportCACommand(args);
59         } else if (args[0].equals("importca")) {
60             return new CaImportCACommand(args);
61         } else if (args[0].equals("importcert")) {
62             return new CaImportCertCommand(args);
63         } else if (args[0].equals("republish")) {
64             return new CARepublishCommand(args);
65         } else if (args[0].equals("activateca")) {
66             return new CaActivateCACommand(args);
67         } else if (args[0].equals("deactivateca")) {
68             return new CaDeactivateCACommand(args);
69         }
70         else {
71             return null;
72         }
73     } // getCommand
74
} // CaAdminCommandFactory
75
Popular Tags