KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > se > anatom > ejbca > log > OldLogConfigurationDataBean


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 se.anatom.ejbca.log;
15
16 import javax.ejb.CreateException JavaDoc;
17
18 import org.ejbca.core.ejb.BaseEntityBean;
19 import org.ejbca.core.model.log.LogEntry;
20
21
22
23
24 /**
25  * TODO: remove this whole class method for EJBCA 3.3.
26  *
27  * Entity bean should not be used directly, use though Session beans. Entity Bean representing the
28  * log configuration data. Information stored:
29  * <pre>
30  * Id (Should always be 0)
31  * logConfiguration is the actual log configuration
32  * logentryrownumber is the number of the last row number in the log entry database.
33  * </pre>
34  *
35  * @version $Id: OldLogConfigurationDataBean.java,v 1.4 2006/11/10 09:29:35 anatom Exp $
36  *
37  * @ejb.bean
38  * description="This enterprise bean entity represents a Log Entry with accompanying data"
39  * display-name="OldLogConfigurationDataEB"
40  * name="OldLogConfigurationData"
41  * jndi-name="OldLogConfigurationData"
42  * view-type="local"
43  * type="CMP"
44  * reentrant="False"
45  * cmp-version="2.x"
46  * transaction-type="Container"
47  * schema="OldLogConfigurationDataBean"
48  * primkey-field="id"
49  *
50  * @ejb.pk
51  * generate="false"
52  * class="java.lang.Integer"
53  *
54  * @ejb.persistence table-name = "LogConfigurationData"
55  *
56  * @ejb.home
57  * generate="local"
58  * local-extends="javax.ejb.EJBLocalHome"
59  * local-class="se.anatom.ejbca.log.OldLogConfigurationDataLocalHome"
60  *
61  * @ejb.interface
62  * generate="local"
63  * local-extends="javax.ejb.EJBLocalObject"
64  * local-class="se.anatom.ejbca.log.OldLogConfigurationDataLocal"
65  *
66  * @ejb.finder
67  * description="findAll"
68  * signature="java.util.Collection findAll()"
69  * query="SELECT OBJECT(a) from OldLogConfigurationDataBean a"
70  *
71  * @ejb.transaction type="Required"
72  *
73  * @jonas.jdbc-mapping
74  * jndi-name="${datasource.jndi-name}"
75  */

76 public abstract class OldLogConfigurationDataBean extends BaseEntityBean {
77
78     /**
79      * @ejb.pk-field
80      * @ejb.persistence column-name="id"
81      * @ejb.interface-method view-type="local"
82      */

83     public abstract Integer JavaDoc getId();
84
85     /**
86      */

87     public abstract void setId(Integer JavaDoc id);
88
89     /**
90      * @ejb.persistence column-name="logConfiguration"
91      * @ejb.interface-method view-type="local"
92      * @weblogic.ora.columntyp@
93      */

94     public abstract LogConfiguration getLogConfiguration();
95
96     /**
97      */

98     public abstract void setLogConfiguration(LogConfiguration logConfiguration);
99
100     /**
101      * @ejb.persistence column-name="logEntryRowNumber"
102      * @ejb.interface-method view-type="local"
103      */

104     public abstract int getLogEntryRowNumber();
105
106     /**
107      */

108     public abstract void setLogEntryRowNumber(int logEntryRowNumber);
109
110     /**
111      * DOCUMENT ME!
112      *
113      * @ejb.interface-method view-type="local"
114      */

115     public LogConfiguration loadLogConfiguration() {
116         LogConfiguration logconfiguration = getLogConfiguration();
117
118         // Fill in new information from LogEntry constants.
119
for (int i = 0; i < LogEntry.EVENTNAMES_INFO.length; i++) {
120             if (logconfiguration.getLogEvent(i) == null) {
121                 logconfiguration.setLogEvent(i, true);
122             }
123         }
124
125         for (int i = 0; i < LogEntry.EVENTNAMES_ERROR.length; i++) {
126             int index = i + LogEntry.EVENT_ERROR_BOUNDRARY;
127
128             if (logconfiguration.getLogEvent(index) == null) {
129                 logconfiguration.setLogEvent(index, true);
130             }
131         }
132
133         return logconfiguration;
134     }
135
136     /**
137      * DOCUMENT ME!
138      *
139      * @ejb.interface-method view-type="local"
140      */

141     public void saveLogConfiguration(LogConfiguration logConfiguration) {
142         setLogConfiguration(logConfiguration);
143     }
144
145     /**
146      * DOCUMENT ME!
147      *
148      * @ejb.interface-method view-type="local"
149      */

150     public Integer JavaDoc getAndIncrementRowCount() {
151         int returnval = getLogEntryRowNumber();
152         setLogEntryRowNumber(returnval + 1);
153
154         return new Integer JavaDoc(returnval);
155     }
156
157     //
158
// Fields required by Container
159
//
160

161     /**
162      * Entity Bean holding data of log configuration. Create by sending in the id.
163      *
164      * @param id the unique id of logconfiguration (should always be 0).
165      * @param logConfiguration is the serialized representation of the log configuration.
166      *
167      * @return the given id
168      *
169      * @ejb.create-method view-type="local"
170      */

171     public Integer JavaDoc ejbCreate(Integer JavaDoc id, LogConfiguration logConfiguration)
172             throws CreateException JavaDoc {
173         setId(id);
174         setLogConfiguration(logConfiguration);
175         setLogEntryRowNumber(0);
176
177         return null;
178     }
179
180     /**
181      * DOCUMENT ME!
182      *
183      * @param id DOCUMENT ME!
184      * @param logConfiguration DOCUMENT ME!
185      */

186     public void ejbPostCreate(Integer JavaDoc id, LogConfiguration logConfiguration) {
187         // Do nothing. Required.
188
}
189 }
190
Popular Tags