KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > ejbca > core > ejb > ra > raadmin > GlobalConfigurationDataBean


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.ra.raadmin;
15
16 import javax.ejb.CreateException JavaDoc;
17 import java.util.HashMap JavaDoc;
18 import org.apache.log4j.Logger;
19 import org.ejbca.core.ejb.BaseEntityBean;
20 import org.ejbca.core.model.ra.raadmin.GlobalConfiguration;
21
22
23
24 /** Entity bean should not be used directly, use though Session beans.
25  *
26  * Entity Bean representing ra admin web interface global configuration.
27  * Information stored:
28  * <pre>
29  * ConfigurationId (Should always be 0)
30  * GlobalConfiguration
31  * </pre>
32  *
33  * @version $Id: GlobalConfigurationDataBean.java,v 1.5 2006/11/10 09:29:34 anatom Exp $
34  *
35  * @ejb.bean description="This enterprise bean entity represents global configuration of ra administration"
36  * display-name="GlobalConfigurationDataEB"
37  * name="GlobalConfigurationData"
38  * jndi-name="GlobalConfigurationData"
39  * view-type="local"
40  * type="CMP"
41  * reentrant="False"
42  * cmp-version="2.x"
43  * transaction-type="Container"
44  * schema="GlobalConfigurationDataBean"
45  * primkey-field="configurationId"
46  *
47  * @ejb.pk class="java.lang.String"
48  * generate="false"
49  *
50  * @ejb.persistence table-name = "GlobalConfigurationData"
51  *
52  * @ejb.transaction type="Required"
53  *
54  * @ejb.home
55  * local-extends="javax.ejb.EJBLocalHome"
56  * local-class="org.ejbca.core.ejb.ra.raadmin.GlobalConfigurationDataLocalHome"
57  *
58  * @ejb.interface
59  * local-extends="javax.ejb.EJBLocalObject"
60  * local-class="org.ejbca.core.ejb.ra.raadmin.GlobalConfigurationDataLocal"
61  *
62  * TODO How is this different from findByPrimaryKey ?
63  * @ejb.finder
64  * description="findByConfigurationId"
65  * signature="org.ejbca.core.ejb.ra.raadmin.GlobalConfigurationDataLocal findByConfigurationId(java.lang.String id)"
66  * query="SELECT OBJECT(a) from GlobalConfigurationDataBean a WHERE a.configurationId=?1"
67  *
68  */

69 public abstract class GlobalConfigurationDataBean extends BaseEntityBean {
70
71     private static final Logger log = Logger.getLogger(GlobalConfigurationDataBean.class);
72
73     /**
74      * @ejb.pk-field
75      * @ejb.persistence column-name="configurationId"
76      * @ejb.interface-method
77      */

78     public abstract String JavaDoc getConfigurationId();
79
80     /**
81      */

82     public abstract void setConfigurationId(String JavaDoc id);
83
84     /**
85      * @ejb.persistence column-name="data"
86      * @weblogic.ora.columntyp@
87      */

88     public abstract HashMap JavaDoc getData();
89
90     /**
91      */

92     public abstract void setData(HashMap JavaDoc data);
93
94     /**
95      * Method that returns the globalconfigurtation and updates it if nessesary.
96      * @ejb.interface-method
97      */

98     public GlobalConfiguration getGlobalConfiguration(){
99       GlobalConfiguration returnval = new GlobalConfiguration();
100       returnval.loadData(getData());
101       return returnval;
102     }
103     
104     /**
105      * Method that saves the global configuration to database.
106      * @ejb.interface-method
107      */

108     public void setGlobalConfiguration(GlobalConfiguration globalconfiguration){
109       setData((HashMap JavaDoc) globalconfiguration.saveData());
110     }
111     //
112
// Fields required by Container
113
//
114

115
116     /**
117      * Entity Bean holding data of raadmin configuration.
118      * Create by sending in the id and string representation of globalconfiguration
119      * @param id the unique id of globalconfiguration.
120      * @param globalconfiguration is the serialized string representation of the global configuration.
121      * @return GlobalConfigurationDataPK primary key
122      * @ejb.create-method
123      */

124     public String JavaDoc ejbCreate(String JavaDoc configurationId, GlobalConfiguration globalConfiguration) throws CreateException JavaDoc {
125
126         setConfigurationId(configurationId);
127         setGlobalConfiguration(globalConfiguration);
128
129         log.debug("Created global configuration "+configurationId);
130         return configurationId;
131     }
132
133     public void ejbPostCreate(String JavaDoc id, GlobalConfiguration globalconfiguration) {
134         // Do nothing. Required.
135
}
136 }
137
Popular Tags