KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > model > ca > publisher > BasePublisher


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.publisher;
15
16 import java.io.Serializable JavaDoc;
17 import java.security.cert.Certificate JavaDoc;
18
19 import org.ejbca.core.model.UpgradeableDataHashMap;
20 import org.ejbca.core.model.log.Admin;
21 import org.ejbca.core.model.ra.ExtendedInformation;
22
23
24
25 /**
26  * BasePublisher is a basic class that should be inherited by all types
27  * of publishers in the system.
28  *
29  *
30  * @version $Id: BasePublisher.java,v 1.4 2007/01/09 15:42:52 anatom Exp $
31  */

32 public abstract class BasePublisher extends UpgradeableDataHashMap implements Serializable JavaDoc, Cloneable JavaDoc {
33     // Default Values
34

35
36     public static final String JavaDoc TRUE = "true";
37     public static final String JavaDoc FALSE = "false";
38
39     // Protected Constants.
40
public static final String JavaDoc TYPE = "type";
41     
42     protected static final String JavaDoc DESCRIPTION = "description";
43         
44     // Public Methods
45

46     /**
47      * Creates a new instance of CertificateProfile
48      */

49     public BasePublisher() {
50       setDescription("");
51   
52     }
53
54     // Public Methods mostly used by PrimeCard
55
/**
56      * Returns the description of publisher
57      */

58     public String JavaDoc getDescription() { return (String JavaDoc) data.get(DESCRIPTION);}
59
60     /**
61      * Sets the description.
62      */

63     public void setDescription(String JavaDoc description){ data.put(DESCRIPTION, description); }
64
65   
66     
67     // Abstact methods.
68

69     /**
70      * Publishes a certificate to a certificate store. If status is not active for the certificate, the publisher may choose
71      * to not publish the certificate, for instance if revoke removes a certificate from LDAP,
72      * re-publishing the certificate should not add it again if the status is revoked.
73      *
74      * @param incert The certificate to be stored.
75      * @param chainfp Fingerprint (hex) of the CAs certificate.
76      * @param username Username of end entity owning the certificate.
77      * @param password Password given to the user, may be null if no password exists for the user.
78      * @param status Status of the certificate (from CertificateData).
79      * @param type Type of certificate (from CertificateDataBean).
80      * @param revocationDate Date for revocation (of revoked), like System.currentTimeMillis(), or -1 if not revoked.
81      * @param revocationReason reason for revocation from RevokedCertInfo, RevokedCertInfo.NOT_REVOKED if not revoked.
82      * @param extendedinformation contains extended information about the user, like picture, is null if no extendedinformation exists about the user.
83      *
84      * @return true if storage was successful.
85      *
86      * @throws EJBException if a communication or other error occurs.
87      */

88     public abstract boolean storeCertificate(Admin admin, Certificate JavaDoc incert, String JavaDoc username, String JavaDoc password, String JavaDoc cafp, int status, int type, long revocationDate, int revocationReason, ExtendedInformation extendedinformation) throws PublisherException;
89     
90     /**
91      * Published a CRL to a CRL store.
92      *
93      * @param incrl The DER coded CRL to be stored.
94      * @param chainfp Fingerprint (hex) of the CAs certificate.
95      * @param number CRL number.
96      *
97      * @return true if storage was successful.
98      *
99      * @throws EJBException if a communication or other error occurs.
100      */

101     public abstract boolean storeCRL(Admin admin, byte[] incrl, String JavaDoc cafp, int number) throws PublisherException;
102     
103     /**
104      * Revokes a certificate (already revoked by the CA), the Publisher decides what to do, if
105      * anything.
106      *
107      * @param cert The DER coded Certificate that has been revoked.
108      *
109      * @throws EJBException if a communication or other error occurs.
110      */

111     public abstract void revokeCertificate(Admin admin, Certificate JavaDoc cert, int reason) throws PublisherException;
112     
113     /**
114      * Method used to test the connection to a publisher.
115      *
116      * @param admin the administrator perfoming the test
117      * @throws PublisherConnectionException when couldn't be set up correctly in any way.
118      */

119     public abstract void testConnection(Admin admin) throws PublisherConnectionException;
120     
121
122     public abstract Object JavaDoc clone() throws CloneNotSupportedException JavaDoc;
123
124     
125     public abstract float getLatestVersion();
126
127     
128     public void upgrade(){
129         // Performing upgrade rutines
130
}
131     
132     
133
134 }
135
Popular Tags