KickJava   Java API By Example, From Geeks To Geeks.

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


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 java.util.HashMap JavaDoc;
17
18 import javax.ejb.CreateException JavaDoc;
19
20 import org.apache.log4j.Logger;
21 import org.ejbca.core.ejb.BaseEntityBean;
22 import org.ejbca.core.model.hardtoken.HardTokenIssuer;
23
24
25
26 /** Entity bean should not be used directly, use though Session beans.
27  *
28  * Entity Bean representing a hard token issuer in the ra.
29  * Information stored:
30  * <pre>
31  * id (Primary key)
32  * alias (of the hard token issuer)
33  * admingroupid (Integer pointing to administrator group associated to this issuer)
34  * hardtokenissuer (Data saved concerning the hard token issuer)
35  * </pre>
36  *
37  * @ejb.bean
38  * xxxgenerate="false"
39  * description="This enterprise bean entity represents a hard token issuer with accompanying data"
40  * display-name="HardTokenIssuerDataEB"
41  * name="HardTokenIssuerData"
42  * jndi-name="HardTokenIssuerData"
43  * local-jndi-name="HardTokenIssuerDataLocal"
44  * view-type="local"
45  * type="CMP"
46  * reentrant="False"
47  * cmp-version="2.x"
48  * transaction-type="Container"
49  * schema="HardTokenIssuerDataBean"
50  * primkey-field="id"
51  *
52  * @ejb.pk generate="false"
53  * class="java.lang.Integer"
54  *
55  * @ejb.persistence table-name = "HardTokenIssuerData"
56  *
57  * @ejb.home
58  * generate="local"
59  * local-extends="javax.ejb.EJBLocalHome"
60  * local-class="org.ejbca.core.ejb.hardtoken.HardTokenIssuerDataLocalHome"
61  *
62  * @ejb.interface
63  * generate="local"
64  * local-extends="javax.ejb.EJBLocalObject"
65  * local-class="org.ejbca.core.ejb.hardtoken.HardTokenIssuerDataLocal"
66  *
67  * @ejb.finder
68  * description="findByAlias"
69  * signature="org.ejbca.core.ejb.hardtoken.HardTokenIssuerDataLocal findByAlias(java.lang.String alias)"
70  * query="SELECT OBJECT(a) from HardTokenIssuerDataBean a WHERE a.alias=?1"
71  *
72  * @ejb.finder
73  * description="findAll"
74  * signature="java.util.Collection findAll()"
75  * query="SELECT OBJECT(a) from HardTokenIssuerDataBean AS a"
76  *
77  * @ejb.transaction type="Required"
78  *
79  * @jonas.jdbc-mapping
80  * jndi-name="${datasource.jndi-name}"
81  *
82  */

83 public abstract class HardTokenIssuerDataBean extends BaseEntityBean {
84
85     private static final Logger log = Logger.getLogger(HardTokenIssuerDataBean.class);
86
87     /**
88      * @ejb.pk-field
89      * @ejb.persistence column-name="id"
90      * @ejb.interface-method view-type="local"
91      */

92     public abstract Integer JavaDoc getId();
93
94     /**
95      */

96     public abstract void setId(Integer JavaDoc id);
97
98     /**
99      * @ejb.persistence column-name="alias"
100      * @ejb.interface-method view-type="local"
101      */

102     public abstract String JavaDoc getAlias();
103
104     /**
105      * @ejb.interface-method view-type="local"
106      */

107     public abstract void setAlias(String JavaDoc alias);
108
109     /**
110      * @ejb.persistence column-name="adminGroupId"
111      * @ejb.interface-method view-type="local"
112      */

113     public abstract int getAdminGroupId();
114
115     /**
116      * @ejb.interface-method view-type="local"
117      */

118     public abstract void setAdminGroupId(int groupid);
119
120     /**
121      * @ejb.persistence column-name="data"
122      * @weblogic.ora.columntyp@
123      */

124     public abstract HashMap JavaDoc getData();
125
126     /**
127      */

128     public abstract void setData(HashMap JavaDoc data);
129
130
131     /**
132      * Method that returns the hard token issuer data and updates it if nessesary.
133      * @ejb.interface-method view-type="local"
134      */

135     public HardTokenIssuer getHardTokenIssuer(){
136       HardTokenIssuer returnval = new HardTokenIssuer();
137       returnval.loadData(getData());
138       return returnval;
139     }
140
141     /**
142      * Method that saves the hard token issuer data to database.
143      * @ejb.interface-method view-type="local"
144      */

145     public void setHardTokenIssuer(HardTokenIssuer hardtokenissuer){
146        setData((HashMap JavaDoc) hardtokenissuer.saveData());
147     }
148
149
150     //
151
// Fields required by Container
152
//
153

154     /**
155      * Entity Bean holding data of a ahrd token issuer.
156      *
157      * @return null
158      * @ejb.create-method view-type="local"
159      */

160     public Integer JavaDoc ejbCreate(Integer JavaDoc id, String JavaDoc alias, int admingroupid, HardTokenIssuer issuerdata) throws CreateException JavaDoc {
161         setId(id);
162         setAlias(alias);
163         setAdminGroupId(admingroupid);
164         setHardTokenIssuer(issuerdata);
165
166         log.debug("Created Hard Token Issuer "+ alias );
167         return id;
168     }
169
170     public void ejbPostCreate(Integer JavaDoc id, String JavaDoc alias, int admingroupid, HardTokenIssuer issuerdata) {
171         // Do nothing. Required.
172
}
173 }
174
Popular Tags