KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > sampleCluster2 > ejb > MyEntitySLR


1 /**
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 2005 Bull S.A.
4  * Contact: jonas-team@objectweb.org
5  *
6  * This library is free software; you can redistribute it and/or
7  * modify it under the terms of the GNU Lesser General Public
8  * License as published by the Free Software Foundation; either
9  * version 2.1 of the License, or any later version.
10  *
11  * This library is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14  * Lesser General Public License for more details.
15  *
16  * You should have received a copy of the GNU Lesser General Public
17  * License along with this library; if not, write to the Free Software
18  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19  * USA
20  *
21  * Initial developer(s):
22  * --------------------------------------------------------------------------
23  * $Id: MyEntitySLR.java,v 1.5 2005/04/28 14:17:34 goebelg Exp $
24  * --------------------------------------------------------------------------
25  */

26 package org.objectweb.sampleCluster2.ejb;
27
28 import javax.ejb.CreateException JavaDoc;
29 import javax.ejb.EntityContext JavaDoc;
30
31 import org.objectweb.jonas.common.JProp;
32
33 /**
34  * Implementation of the entity bean
35  * @author goebelg
36  */

37 public abstract class MyEntitySLR implements javax.ejb.EntityBean JavaDoc {
38
39     /**
40      * The JOnAS instance name where the bean is executed
41      */

42     private String JavaDoc jonasInstanceName = "unknown";
43
44     /**
45      * Creation of the entity bean
46      * @param number the primary key -> date.getTime() as string of creation
47      * @return the entity bean
48      */

49     public Object JavaDoc ejbCreate(String JavaDoc number) throws CreateException JavaDoc{
50
51         jonasInstanceName = "unknown";
52
53         try {
54             JProp jp = JProp.getInstance();
55             jonasInstanceName = jp.getValue("jonas.name");
56         } catch (Exception JavaDoc e) {
57             System.out.println("Error while creating ejb : " + e.getMessage());
58         }
59
60         setNumber(number);
61         setJOnASName(jonasInstanceName);
62
63         return null;
64     }
65
66     /**
67      * Post create methode invoked after create methode
68      * @param number the pk of the entity bean
69      */

70     public void ejbPostCreate(String JavaDoc number) {
71     }
72
73     /**
74      * ejbLoad
75      */

76     public void ejbLoad() {
77     }
78
79     /**
80      * ejbStore
81      */

82     public void ejbStore() {
83     }
84
85     /**
86      * Activation of the ejb
87      */

88     public void ejbActivate() {
89     }
90
91     /**
92      * Passivate the ejb
93      */

94     public void ejbPassivate() {
95     }
96
97     /**
98      * Removes the ejb
99      */

100     public void ejbRemove() {
101     }
102
103     /**
104      * Set the EntityContext
105      */

106     public void setEntityContext(EntityContext JavaDoc ec) {
107     }
108
109     /**
110      * Unsets the EntityContext
111      */

112     public void unsetEntityContext() {
113     }
114
115     /**
116      * Returns the time when the bean was created
117      * @return The time when the bean was created
118      */

119     public abstract String JavaDoc getNumber();
120
121     /**
122      * Sets the time when the bean was created
123      * @param number The time when the bean was created
124      */

125     public abstract void setNumber(String JavaDoc number);
126
127     /**
128      * Returns the name of the JOnAS instance
129      * @return Name of the JOnAS instance where the entity bean was created
130      */

131     public abstract String JavaDoc getJOnASName();
132
133     /**
134      * sets the name of the JOnAS instance
135      * @param name Name of the JOnAS instance where the entity bean was created
136      */

137     public abstract void setJOnASName(String JavaDoc name);
138
139 }
Popular Tags