KickJava   Java API By Example, From Geeks To Geeks.

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


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  * Issues a new CRL from the CA.
18  *
19  * @version $Id: CaCreateCrlCommand.java,v 1.1 2006/01/17 20:28:05 anatom Exp $
20  */

21 public class CaCreateCrlCommand extends BaseCaAdminCommand {
22     /**
23      * Creates a new instance of CaCreateCrlCommand
24      *
25      * @param args command line arguments
26      */

27     public CaCreateCrlCommand(String JavaDoc[] args) {
28         super(args);
29     }
30
31     /**
32      * Runs the command
33      *
34      * @throws IllegalAdminCommandException Error in command args
35      * @throws ErrorAdminCommandException Error running command
36      */

37     public void execute() throws IllegalAdminCommandException, ErrorAdminCommandException {
38         if (args.length < 1) {
39            throw new IllegalAdminCommandException("Usage: CA createcrl <caname>" +
40                                                                                "If no caname is given then will CRLs for all neccessary CAs be created.");
41         }
42         
43         if (args.length == 1) {
44             try{
45               createCRL((String JavaDoc) null);
46             } catch (Exception JavaDoc e) {
47                 throw new ErrorAdminCommandException(e);
48             }
49         }
50         
51         if(args.length == 2){
52           try {
53             String JavaDoc caname = args[1];
54             // createCRL prints info about crl generation
55
createCRL(getIssuerDN(caname));
56           } catch (Exception JavaDoc e) {
57             throw new ErrorAdminCommandException(e);
58           }
59         }
60     }
61
62     // execute
63
}
64
Popular Tags