KickJava   Java API By Example, From Geeks To Geeks.

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


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.security.cert.Certificate JavaDoc;
17 import java.util.Properties JavaDoc;
18
19 import org.apache.log4j.Logger;
20 import org.ejbca.core.ejb.ca.store.CertificateDataBean;
21 import org.ejbca.core.model.log.Admin;
22 import org.ejbca.core.model.ra.ExtendedInformation;
23
24
25 /**
26  * This is an class used for testing and example purposes.
27  * I supposed to illustrat how to implement a custom publisher to EJBCA 3.
28  *
29  *
30  * @version $Id: DummyCustomPublisher.java,v 1.3 2006/07/23 10:31:22 anatom Exp $
31  */

32 public class DummyCustomPublisher implements ICustomPublisher{
33             
34     private static Logger log = Logger.getLogger(DummyCustomPublisher.class);
35
36     /**
37      * Creates a new instance of DummyCustomPublisher
38      */

39     public DummyCustomPublisher() {}
40
41     /**
42      * @see org.ejbca.core.model.ca.publisher.ICustomPublisher#init(java.util.Properties)
43      */

44     public void init(Properties JavaDoc properties) {
45       // This method sets up the communication with the publisher
46

47       log.debug("Initializing DummyCustomPublisher");
48     }
49
50     /**
51      * @see org.ejbca.core.model.ca.publisher.ICustomPublisher#storeCertificate(org.ejbca.core.model.log.Admin, java.security.cert.Certificate, java.lang.String, java.lang.String, int, int)
52      */

53     public 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 {
54         log.debug("DummyCustomPublisher, Storing Certificate for user: " + username);
55         // Don't publish non-active certificates
56
if (status != CertificateDataBean.CERT_ACTIVE) {
57             return true;
58         }
59         return true;
60     }
61
62     /**
63      * @see org.ejbca.core.model.ca.publisher.ICustomPublisher#storeCRL(org.ejbca.core.model.log.Admin, byte[], java.lang.String, int)
64      */

65     public boolean storeCRL(Admin admin, byte[] incrl, String JavaDoc cafp, int number) throws PublisherException {
66         log.debug("DummyCustomPublisher, Storing CRL");
67         return true;
68     }
69
70     /**
71      * @see org.ejbca.core.model.ca.publisher.ICustomPublisher#revokeCertificate(org.ejbca.core.model.log.Admin, java.security.cert.Certificate, int)
72      */

73     public void revokeCertificate(Admin admin, Certificate JavaDoc cert, int reason) throws PublisherException {
74         log.debug("DummyCustomPublisher, Rekoving Certificate");
75         
76     }
77
78     /**
79      * @see org.ejbca.core.model.ca.publisher.ICustomPublisher#testConnection(org.ejbca.core.model.log.Admin)
80      */

81     public void testConnection(Admin admin) throws PublisherConnectionException {
82         log.debug("DummyCustomPublisher, Testing connection");
83     }
84
85     
86     protected void finalize() throws Throwable JavaDoc {
87         log.debug("DummyCustomPublisher, closing connection");
88         // This method closes the communication with the publisher.
89

90         super.finalize();
91     }
92     
93 }
94
Popular Tags