KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ca > caadmin > CAInfo


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.model.ca.caadmin;
15
16 import java.io.Serializable JavaDoc;
17 import java.util.Collection JavaDoc;
18 import java.util.Date JavaDoc;
19
20 import org.ejbca.core.model.ca.catoken.CATokenInfo;
21
22 /**
23  * Holds nonsensitive information about a CA.
24  *
25  * @version $Id: CAInfo.java,v 1.7 2007/01/12 09:43:07 anatom Exp $
26  */

27 public abstract class CAInfo implements Serializable JavaDoc {
28
29     public static final int CATYPE_X509 = 1;
30     
31     /**
32      * Constants indicating that the CA is selfsigned.
33      */

34     public static final int SELFSIGNED = 1;
35     /**
36      * Constant indicating that the CA is signed by an external CA.
37      */

38     public static final int SIGNEDBYEXTERNALCA = 2;
39     
40     /**
41      * Constant indicating where the special caid border is. All CAs with CA id not below this value
42      * should be created
43      */

44     public static final int SPECIALCAIDBORDER = 10;
45     
46     
47     /**
48      * Constants indicating approvalsettings for this CA
49      */

50     public static final int REQ_APPROVAL_ADDEDITENDENTITY = 1;
51     
52     /**
53      * Constants indicating approvalsettings for key recover this CA
54      */

55     public static final int REQ_APPROVAL_KEYRECOVER = 2;
56         
57     public static final int[] AVAILABLE_APPROVALSETTINGS={REQ_APPROVAL_ADDEDITENDENTITY, REQ_APPROVAL_KEYRECOVER};
58     public static final String JavaDoc[] AVAILABLE_APPROVALSETTINGS_TEXTS={"APPROVEADDEDITENDENTITY","APPROVEKEYRECOVER"};
59     
60     protected String JavaDoc subjectdn;
61     protected int caid;
62     protected String JavaDoc name;
63     protected int status;
64     protected int validity;
65     protected Date JavaDoc expiretime;
66     protected Date JavaDoc updatetime;
67     protected int catype;
68     protected int signedby;
69     protected Collection JavaDoc certificatechain;
70     protected CATokenInfo catokeninfo;
71     protected String JavaDoc description;
72     protected int revokationreason;
73     protected Date JavaDoc revokationdate;
74     protected int certificateprofileid;
75     protected int crlperiod;
76     protected int crlIssueInterval = 0;
77     protected int crlOverlapTime = 10;
78     protected Collection JavaDoc crlpublishers;
79     protected boolean finishuser;
80     protected Collection JavaDoc extendedcaserviceinfos;
81     protected Collection JavaDoc approvalSettings;
82     protected int numOfReqApprovals;
83     
84     public CAInfo(){}
85     
86     public String JavaDoc getSubjectDN() {return subjectdn;}
87     public int getCAId(){return this.caid;}
88     public String JavaDoc getName() {return this.name;}
89     public int getStatus() {return status;}
90     public int getCAType() {return catype;}
91     public int getSignedBy() {return signedby;}
92     
93     public int getValidity() { return validity;}
94     public void setValidity(int validity) { this.validity = validity; }
95     
96     public Date JavaDoc getExpireTime() {return this.expiretime;}
97     public Date JavaDoc getUpdateTime() {return this.updatetime;}
98
99       
100     /** Retrieves the certificate chain for the CA. The returned certificate chain MUST have the
101      * RootCA certificate in the last position and the CAs certificate in the first.
102      */

103     public Collection JavaDoc getCertificateChain(){ return certificatechain;}
104     public CATokenInfo getCATokenInfo() {return this.catokeninfo;}
105     
106     public String JavaDoc getDescription(){ return this.description;}
107     public void setDescription(String JavaDoc description){ this.description = description;}
108     
109     public int getRevokationReason(){ return this.revokationreason;}
110     public Date JavaDoc getRevokationDate(){ return this.revokationdate;}
111     
112     public int getCertificateProfileId(){ return this.certificateprofileid; }
113     
114     public int getCRLPeriod(){ return crlperiod;}
115     public void setCRLPeriod(int crlperiod){ this.crlperiod=crlperiod;}
116     
117     public int getCRLIssueInterval(){ return crlIssueInterval;}
118     public void setCRLIssueInterval(int crlissueinterval){ this.crlIssueInterval = crlissueinterval;}
119   
120     public int getCRLOverlapTime(){ return crlOverlapTime;}
121     public void setCRLOverlapTime(int crloverlaptime){ this.crlOverlapTime = crloverlaptime;}
122
123     public Collection JavaDoc getCRLPublishers(){ return crlpublishers;}
124     public void setCRLPublishers(Collection JavaDoc crlpublishers){this.crlpublishers=crlpublishers;}
125         
126     public boolean getFinishUser(){ return finishuser;}
127     public void setFinishUser(boolean finishuser){ this.finishuser=finishuser;}
128     
129     /** Lists the extended CA services.
130      *
131      * @return Collection of ExtendedCAServiceInfo
132      */

133     public Collection JavaDoc getExtendedCAServiceInfos(){ return this.extendedcaserviceinfos;}
134     public void setExtendedCAServiceInfos(Collection JavaDoc extendedcaserviceinfos){ this.extendedcaserviceinfos = extendedcaserviceinfos;}
135
136     /**
137      * Returns a collection of Integers (CAInfo.REQ_APPROVAL_ constants) of which
138      * action that requires approvals, default none
139      *
140      * Never null
141      */

142     public Collection JavaDoc getApprovalSettings() {return approvalSettings;}
143     /**
144      * Collection of Integers (CAInfo.REQ_APPROVAL_ constants) of which
145      * action that requires approvals
146      */

147     public void setApprovalSettings(Collection JavaDoc approvalSettings) {this.approvalSettings = approvalSettings;}
148     
149     /**
150      * Returns true if the action requires approvals.
151      * @param action, on of the CAInfo.REQ_APPROVAL_ constants
152      */

153     public boolean isApprovalRequired(int action){
154         return approvalSettings.contains(new Integer JavaDoc(action));
155     }
156     
157     
158     /**
159      * Returns the number of different administrators that needs to approve
160      * an action, default 1.
161      */

162     public int getNumOfReqApprovals() {return numOfReqApprovals;}
163     /**
164      * The number of different administrators that needs to approve
165      */

166     public void setNumOfReqApprovals(int numOfReqApprovals) {this.numOfReqApprovals = numOfReqApprovals;}
167     
168 }
Popular Tags