KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > hardtoken > HardTokenCertificateMapBean


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.ejb.hardtoken;
15
16 import javax.ejb.CreateException JavaDoc;
17
18 import org.apache.log4j.Logger;
19 import org.ejbca.core.ejb.BaseEntityBean;
20
21 /** Entity bean should not be used directly, use though Session beans.
22  *
23  * Entity Bean representing certificates placed on a token.
24  * Information stored:
25  * <pre>
26  * certificatefingerprint
27  * tokensn
28  * </pre>
29  *
30  *
31  * @ejb.bean
32  * xxxgenerate="false"
33  * description="This enterprise bean entity represents a hard token to certificate mappings"
34  * display-name="HardTokenCertificateMapEB"
35  * name="HardTokenCertificateMap"
36  * jndi-name="HardTokenCertificateMap"
37  * local-jndi-name="HardTokenCertificateMapLocal"
38  * view-type="local"
39  * type="CMP"
40  * reentrant="False"
41  * cmp-version="2.x"
42  * transaction-type="Container"
43  * schema="HardTokenCertificateMapBean"
44  * primkey-field="certificateFingerprint"
45  *
46  * @ejb.pk generate="false"
47  * class="java.lang.String"
48  *
49  * @ejb.persistence table-name = "HardTokenCertificateMap"
50  *
51  * @ejb.home
52  * generate="local"
53  * local-extends="javax.ejb.EJBLocalHome"
54  * local-class="org.ejbca.core.ejb.hardtoken.HardTokenCertificateMapLocalHome"
55  *
56  * @ejb.interface
57  * generate="local"
58  * local-extends="javax.ejb.EJBLocalObject"
59  * local-class="org.ejbca.core.ejb.hardtoken.HardTokenCertificateMapLocal"
60  *
61  * @ejb.finder
62  * description="findByTokenSN"
63  * signature="Collection findByTokenSN(java.lang.String sn)"
64  * query="SELECT OBJECT(a) from HardTokenCertificateMapBean a WHERE a.tokenSN=?1"
65  *
66  * @ejb.transaction type="Required"
67  *
68  * @jonas.jdbc-mapping
69  * jndi-name="${datasource.jndi-name}"
70  *
71  */

72 public abstract class HardTokenCertificateMapBean extends BaseEntityBean {
73
74     private static final Logger log = Logger.getLogger(HardTokenCertificateMapBean.class);
75
76     /**
77      * @ejb.pk-field
78      * @ejb.persistence column-name="certificateFingerprint"
79      * @ejb.interface-method view-type="local"
80      */

81     public abstract String JavaDoc getCertificateFingerprint();
82
83     /**
84      */

85     public abstract void setCertificateFingerprint(String JavaDoc certificateFingerprint);
86
87     /**
88      * @ejb.persistence column-name="tokenSN"
89      * @ejb.interface-method view-type="local"
90      */

91     public abstract String JavaDoc getTokenSN();
92
93     /**
94      * @ejb.interface-method view-type="local"
95      */

96     public abstract void setTokenSN(String JavaDoc tokenSN);
97
98
99     //
100
// Fields required by Container
101
//
102

103     /**
104      * Entity Bean holding data of a certificate to hard token relation.
105      *
106      * @return null
107      *
108      * @ejb.create-method view-type="local"
109      */

110     public String JavaDoc ejbCreate(String JavaDoc certificateFingerprint, String JavaDoc tokenSN) throws CreateException JavaDoc {
111         setCertificateFingerprint(certificateFingerprint);
112         setTokenSN(tokenSN);
113         log.debug("Created HardTokenCertificateMap for token SN: "+ tokenSN );
114         return certificateFingerprint;
115     }
116
117     public void ejbPostCreate(String JavaDoc certificateFingerprint, String JavaDoc tokenSN) {
118         // Do nothing. Required.
119
}
120 }
121
Popular Tags