KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > protect > TableProtectDataBean


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.protect;
15
16
17 import java.util.Date JavaDoc;
18
19 import javax.ejb.CreateException JavaDoc;
20
21 import org.ejbca.core.ejb.BaseEntityBean;
22
23 /** Entity bean should not be used directly, use though Session beans.
24  *
25  * Entity Bean representing a table protection entry in the log database.
26  * Information stored:
27  * <pre>
28  * id (Primary Key)
29  * version versioning of the protection rows (this row), so that the underlying database table can be upgraded and still verified.
30  * protectAlg hmac, rsaWithSHA1 etc. Also used to implicitly define the key type of the protection key.
31  * hashVersion versioning of the protected row, so the underlying database table can be extended and still verified
32  * hash hash of the row data from the underlying table to be protected.
33  * signature actual signature.
34  * dbKey database key of the underlying row that is protected, used to find the row for verification.
35  * dbType type of object protected, determined by the OBJECT, for example LOGENTRY
36  * keyRef reference to key used for protection.
37  * keyType type of key which the reference refers to
38  * </pre>
39  *
40  * @ejb.bean
41  * description="This enterprise bean entity represents a Table Protection entry with accompanying data"
42  * display-name="TableProtectDataEB"
43  * name="TableProtectData"
44  * jndi-name="TableProtectData"
45  * view-type="local"
46  * type="CMP"
47  * reentrant="False"
48  * cmp-version="2.x"
49  * transaction-type="Container"
50  * schema="TableProtectDataBean"
51  * primkey-field="id"
52  *
53  * @ejb.pk
54  * generate="false"
55  * class="java.lang.String"
56  *
57  * @ejb.persistence table-name = "TableProtectData"
58  *
59  * @ejb.home
60  * generate="local"
61  * local-extends="javax.ejb.EJBLocalHome"
62  * local-class="org.ejbca.core.ejb.protect.TableProtectDataLocalHome"
63  *
64  * @ejb.interface
65  * generate="local"
66  * local-extends="javax.ejb.EJBLocalObject"
67  * local-class="org.ejbca.core.ejb.protect.TableProtectDataLocal"
68  *
69  * @ejb.transaction type="Required"
70  *
71  * @ejb.finder description="findByDbTypeAndKey"
72  * signature="org.ejbca.core.ejb.protect.TableProtectDataLocal findByDbTypeAndKey(java.lang.String dbType, java.lang.String dbKey)"
73  * query="SELECT OBJECT(a) from TableProtectDataBean a WHERE a.dbType=?1 AND a.dbKey=?2"
74  *
75
76  * @version $Id: TableProtectDataBean.java,v 1.5 2006/11/10 09:29:11 anatom Exp $
77  */

78 public abstract class TableProtectDataBean extends BaseEntityBean {
79
80     public static final String JavaDoc KEYTYPE_HMAC = "HMAC";
81     
82     public static final int CURRENT_VERSION = 1;
83     
84     /**
85      * @ejb.pk-field
86      * @ejb.persistence column-name="id"
87      * @ejb.interface-method view-type="local"
88      */

89     public abstract String JavaDoc getId();
90
91     /**
92      */

93     public abstract void setId(String JavaDoc id);
94
95     /**
96      * @ejb.persistence column-name="version"
97      * @ejb.interface-method view-type="local"
98      */

99     public abstract int getVersion();
100
101     /**
102      * @ejb.interface-method view-type="local"
103      */

104     public abstract void setVersion(int version);
105
106     /**
107      * @ejb.persistence column-name="hashVersion"
108      * @ejb.interface-method view-type="local"
109      */

110     public abstract int getHashVersion();
111
112     /**
113      * @ejb.interface-method view-type="local"
114      */

115     public abstract void setHashVersion(int version);
116     
117     /**
118      * @ejb.persistence column-name="protectionAlg"
119      * @ejb.interface-method view-type="local"
120      */

121     public abstract String JavaDoc getProtectionAlg();
122
123     /**
124      * @ejb.interface-method view-type="local"
125      */

126     public abstract void setProtectionAlg(String JavaDoc alg);
127
128     /**
129      * @ejb.persistence column-name="hash"
130      * @ejb.interface-method view-type="local"
131      */

132     public abstract String JavaDoc getHash();
133
134     /**
135      * @ejb.interface-method view-type="local"
136      */

137     public abstract void setHash(String JavaDoc hash);
138
139     /**
140      * @ejb.persistence column-name="signature"
141      * @ejb.interface-method view-type="local"
142      */

143     public abstract String JavaDoc getSignature();
144
145     /**
146      * @ejb.interface-method view-type="local"
147      */

148     public abstract void setSignature(String JavaDoc signature);
149
150     /**
151      * @ejb.persistence column-name="time"
152      */

153     public abstract long getTime();
154
155     /**
156      * @ejb.interface-method view-type="local"
157      */

158     public abstract void setTime(long time);
159
160     /**
161      * @ejb.persistence column-name="dbKey"
162      * @ejb.interface-method view-type="local"
163      */

164     public abstract String JavaDoc getDbKey();
165
166     /**
167      * @ejb.interface-method view-type="local"
168      */

169     public abstract void setDbKey(String JavaDoc dbKey);
170
171     /**
172      * @ejb.persistence column-name="dbType"
173      * @ejb.interface-method view-type="local"
174      */

175     public abstract String JavaDoc getDbType();
176
177     /**
178      * @ejb.interface-method view-type="local"
179      */

180     public abstract void setDbType(String JavaDoc dbType);
181
182     /**
183      * @ejb.persistence column-name="keyRef"
184      * @ejb.interface-method view-type="local"
185      */

186     public abstract String JavaDoc getKeyRef();
187
188     /**
189      * @ejb.interface-method view-type="local"
190      */

191     public abstract void setKeyRef(String JavaDoc keyRef);
192
193     /**
194      * @ejb.persistence column-name="keyType"
195      * @ejb.interface-method view-type="local"
196      */

197     public abstract String JavaDoc getKeyType();
198
199     /**
200      * @ejb.interface-method view-type="local"
201      */

202     public abstract void setKeyType(String JavaDoc keyType);
203
204     /**
205      * @ejb.interface-method view-type="local"
206      */

207     public Date JavaDoc getTimeAsDate() {
208         return new Date JavaDoc(getTime());
209     }
210
211     /**
212      *
213      * @ejb.create-method view-type="local"
214      */

215     public String JavaDoc ejbCreate(String JavaDoc id, int hashVersion, String JavaDoc alg, String JavaDoc hash, String JavaDoc signature, Date JavaDoc time, String JavaDoc dbKey, String JavaDoc dbType, String JavaDoc keyRef, String JavaDoc keyType) throws CreateException JavaDoc {
216         setId(id);
217         setVersion(CURRENT_VERSION);
218         setHashVersion(hashVersion);
219         setProtectionAlg(alg);
220         setHash(hash);
221         setSignature(signature);
222         setTime(time.getTime());
223         setDbKey(dbKey);
224         setDbType(dbType);
225         setKeyRef(keyRef);
226         setKeyType(keyType);
227         return null;
228     }
229
230     /**
231      */

232     public void ejbPostCreate(String JavaDoc id, int hashVersion, String JavaDoc alg, String JavaDoc hash, String JavaDoc signature, Date JavaDoc time, String JavaDoc dbKey, String JavaDoc dbType, String JavaDoc keyRef, String JavaDoc keyType) {
233         // Do nothing. Required.
234
}
235 }
236
237
Popular Tags