KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas > jtests > beans > sequence > SequenceEC2


1 /*
2  * JOnAS: Java(TM) Open Application Server
3  * Copyright (C) 1999 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  * --------------------------------------------------------------------------
22  * $Id: SequenceEC2.java,v 1.2 2005/04/22 07:43:55 durieuxp Exp $
23  * --------------------------------------------------------------------------
24  */

25
26 package org.objectweb.jonas.jtests.beans.sequence;
27
28 import javax.ejb.CreateException JavaDoc;
29 import javax.ejb.EntityBean JavaDoc;
30 import javax.ejb.EntityContext JavaDoc;
31 import javax.ejb.RemoveException JavaDoc;
32
33
34 /**
35  * SequenceEC2 controls the sequence block requests.
36  *
37  */

38 public abstract class SequenceEC2 implements EntityBean JavaDoc {
39
40     protected EntityContext JavaDoc entCtx;
41
42     /*
43      * Method ejbCreate
44      * @param id Sequence identifier
45      * @param firstNumber Starting number
46      * @return null
47      * @throws CreateException Create error
48      */

49     public String JavaDoc ejbCreate(String JavaDoc id, int firstNumber) throws CreateException JavaDoc {
50         setId(id);
51         setNextNumber(firstNumber);
52         return null;
53     }
54
55     /**
56      * Method ejbPostCreate
57      * @param id Sequence identifier
58      * @param firstNumber First number
59      */

60     public void ejbPostCreate(String JavaDoc id, int firstNumber) {
61     }
62
63     /**
64      * Method ejbRemove
65      * @throws RemoveException Remove error
66      */

67     public void ejbRemove() throws RemoveException JavaDoc {
68     }
69
70     /**
71      * Method getId
72      * @return The sequence identifier
73      */

74     public abstract String JavaDoc getId();
75
76     /**
77      * Method setId
78      * @param The sequence identifier
79      */

80     public abstract void setId(String JavaDoc id);
81
82     /**
83      * Method getNextNumber gets the next number
84      * @return The next sequence number.
85      */

86     public abstract int getNextNumber();
87
88     /**
89      * Method setNextNumber gets the next number
90      * @param The next sequence number.
91      */

92     public abstract void setNextNumber(int nextNumber);
93
94     /**
95      * Method ejbActivate
96      */

97     public void ejbActivate() {
98
99     }
100
101     /**
102      * Method ejbPassivate
103      */

104     public void ejbPassivate() {
105
106     }
107
108     /**
109      * Method ejbLoad
110      */

111     public void ejbLoad() {
112     }
113
114     /**
115      * Method ejbStore
116      */

117     public void ejbStore() {
118
119     }
120
121     /**
122      * Method setEntityContext
123      * @param entCtx The context of this entity bean.
124      */

125     public void setEntityContext(EntityContext JavaDoc entCtx) {
126         this.entCtx = entCtx;
127     }
128
129     /**
130      * Method unsetEntityContext
131      */

132     public void unsetEntityContext() {
133         this.entCtx = null;
134     }
135
136     /**
137      * Get a unique PK number, and increment the count for next call.
138      */

139     public int getUniqPk() {
140         int ret = getNextNumber();
141         setNextNumber(++ret);
142         return ret;
143     }
144
145 }
146
147
Popular Tags