KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > objectweb > jonas_ejb > container > jorm > GenClassElement


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  * Initial developer(s): Sebastien Chassande
22  * Contributor(s):
23  *
24  * --------------------------------------------------------------------------
25  * $Id: GenClassElement.java,v 1.12 2005/04/28 16:52:59 benoitf Exp $
26  * --------------------------------------------------------------------------
27  */

28 package org.objectweb.jonas_ejb.container.jorm;
29
30 import org.objectweb.jorm.api.PIndexedElem;
31 import org.objectweb.jorm.api.PException;
32 import org.objectweb.jorm.naming.api.PName;
33 import org.objectweb.jorm.type.api.PExceptionTyping;
34 import org.objectweb.jonas_ejb.container.TraceEjb;
35 import org.objectweb.util.monolog.api.BasicLevel;
36
37 import java.util.Date JavaDoc;
38 import java.io.Serializable JavaDoc;
39 import java.math.BigDecimal JavaDoc;
40
41 /**
42  * This class is a basic implementation of the PIndexedElem interface used by
43  * the GenClassImpl class. This implementation manages only references (no
44  * primitive elements).
45  *
46  * @author S.Chassande-Barrioz
47  */

48 public class GenClassElement implements PIndexedElem {
49
50     /**
51      * This field describes the status of the PIndexedElem in according to the
52      * constant defined in the PIndexedElem interface.
53      */

54     public byte status = PIndexedElem.ELEM_UNMODIFIED;
55
56     public boolean hasBeenCreated = false;
57
58     /**
59      * This field references the associated pname. This field is never null
60      * after data has been loaded.
61      */

62     public PName pname = null;
63
64     /**
65      * This field references the user object. This is a PObject which permits
66      * to reach its PName.
67      */

68     public PObject value = null;
69
70     /**
71      * This field references the GenClass inside which the PIndexedElem is
72      * store.
73      */

74     public GenClassImpl gc = null;
75
76
77     public GenClassElement(GenClassImpl gc) {
78         this.gc = gc;
79     }
80
81     // IMPLEMENTATION OF THE PIndexedElem INTERFACE //
82
//----------------------------------------------//
83

84     public byte getElemStatus() {
85         return status;
86     }
87
88     public PName pieGetRefElem() throws PException {
89         if (pname == null) {
90             pname = gc.gcObject2ref(value);
91         }
92         if (TraceEjb.genclass.isLoggable(BasicLevel.DEBUG)) {
93             TraceEjb.genclass.log(BasicLevel.DEBUG, "pn=" + pname);
94         }
95         return pname;
96     }
97     /**
98      * The jorm assignes the PName of the referenced object
99      */

100     public void pieSetRefElem(PName pn) throws PException {
101         pname = pn;
102         value = null;
103         if (TraceEjb.genclass.isLoggable(BasicLevel.DEBUG)) {
104             TraceEjb.genclass.log(BasicLevel.DEBUG, "pn=" + pname);
105         }
106     }
107
108     public boolean pieGetBooleanElem() throws PException {
109         throw new PExceptionTyping("Bad elem type: asked: boolean, been: object");
110     }
111     public Boolean JavaDoc pieGetObooleanElem() throws PException {
112         throw new PExceptionTyping("Bad elem type: asked: Boolean, been: object");
113     }
114     public byte pieGetByteElem() throws PException {
115         throw new PExceptionTyping("Bad elem type: asked: byte, been: object");
116     }
117     public Byte JavaDoc pieGetObyteElem() throws PException {
118         throw new PExceptionTyping("Bad elem type: asked: Byte, been: object");
119     }
120     public byte pieGetByteIndexField(String JavaDoc fn) throws PException {
121         throw new PExceptionTyping("No index");
122     }
123     public Byte JavaDoc pieGetObyteIndexField(String JavaDoc fn) throws PException {
124         throw new PExceptionTyping("No index");
125     }
126     public char pieGetCharElem() throws PException {
127         throw new PExceptionTyping("Bad elem type: asked: char, been: object");
128     }
129     public Character JavaDoc pieGetOcharElem() throws PException {
130         throw new PExceptionTyping("Bad elem type: asked: Char, been: object");
131     }
132     public char pieGetCharIndexField(String JavaDoc fn) throws PException {
133         throw new PExceptionTyping("No index");
134     }
135     public Character JavaDoc pieGetOcharIndexField(String JavaDoc fn) throws PException {
136         throw new PExceptionTyping("No index");
137     }
138     public short pieGetShortElem() throws PException {
139         throw new PExceptionTyping("Bad elem type: asked: short, been: object");
140     }
141     public Short JavaDoc pieGetOshortElem() throws PException {
142         throw new PExceptionTyping("Bad elem type: asked: Short, been: object");
143     }
144     public short pieGetShortIndexField(String JavaDoc fn) throws PException {
145         throw new PExceptionTyping("No index");
146     }
147     public Short JavaDoc pieGetOshortIndexField(String JavaDoc fn) throws PException {
148         throw new PExceptionTyping("No index");
149     }
150     public int pieGetIntElem() throws PException {
151         throw new PExceptionTyping("Bad elem type: asked: int, been: object");
152     }
153     public Integer JavaDoc pieGetOintElem() throws PException {
154         throw new PExceptionTyping("Bad elem type: asked: Int, been: object");
155     }
156     public int pieGetIntIndexField(String JavaDoc fn) throws PException {
157         throw new PExceptionTyping("No index");
158     }
159     public Integer JavaDoc pieGetOintIndexField(String JavaDoc fn) throws PException {
160         throw new PExceptionTyping("No index");
161     }
162     public long pieGetLongElem() throws PException {
163         throw new PExceptionTyping("Bad elem type: asked: long, been: object");
164     }
165     public Long JavaDoc pieGetOlongElem() throws PException {
166         throw new PExceptionTyping("Bad elem type: asked: Long, been: object");
167     }
168     public long pieGetLongIndexField(String JavaDoc fn) throws PException {
169         throw new PExceptionTyping("No index");
170     }
171     public Long JavaDoc pieGetOlongIndexField(String JavaDoc fn) throws PException {
172         throw new PExceptionTyping("No index");
173     }
174     public float pieGetFloatElem() throws PException {
175         throw new PExceptionTyping("Bad elem type: asked: float, been: object");
176     }
177     public Float JavaDoc pieGetOfloatElem() throws PException {
178         throw new PExceptionTyping("Bad elem type: asked: Float, been: object");
179     }
180     public double pieGetDoubleElem() throws PException {
181         throw new PExceptionTyping("Bad elem type: asked: double, been: object");
182     }
183     public Double JavaDoc pieGetOdoubleElem() throws PException {
184         throw new PExceptionTyping("Bad elem type: asked: Double, been: object");
185     }
186     public String JavaDoc pieGetStringElem() throws PException {
187         throw new PExceptionTyping("Bad elem type: asked: String, been: object");
188     }
189     public String JavaDoc pieGetStringIndexField(String JavaDoc fn) throws PException {
190         return null;
191     }
192     public Date JavaDoc pieGetDateElem() throws PException {
193         throw new PExceptionTyping("Bad elem type: asked: java.util.Date, been: object");
194     }
195     public Date JavaDoc pieGetDateIndexField(String JavaDoc fn) throws PException {
196         throw new PExceptionTyping("No index");
197     }
198     public char[] pieGetCharArrayElem() throws PException {
199         throw new PExceptionTyping("Bad elem type: asked: char[], been: object");
200     }
201     public byte[] pieGetByteArrayElem() throws PException {
202         throw new PExceptionTyping("Bad elem type: asked: byte[], been: object");
203     }
204     public Serializable JavaDoc pieGetSerializedElem() throws PException {
205         throw new PExceptionTyping("Bad elem type: asked: Serializable, been: object");
206     }
207     public void pieSetBooleanElem(boolean value) throws PException {
208         throw new PExceptionTyping("Bad elem type: asked: boolean, been: object");
209     }
210     public void pieSetObooleanElem(Boolean JavaDoc value) throws PException {
211         throw new PExceptionTyping("Bad elem type: asked: boolean, been: object");
212     }
213     public void pieSetByteElem(byte value) throws PException {
214         throw new PExceptionTyping("Bad elem type: asked: byte, been: object");
215     }
216     public void pieSetObyteElem(Byte JavaDoc value) throws PException {
217         throw new PExceptionTyping("Bad elem type: asked: Byte, been: object");
218     }
219     public void pieSetByteIndexField(String JavaDoc fn, byte value) throws PException {
220         throw new PExceptionTyping("No index");
221     }
222     public void pieSetObyteIndexField(String JavaDoc fn, Byte JavaDoc value) throws PException {
223         throw new PExceptionTyping("No index");
224     }
225     public void pieSetCharElem(char value) throws PException {
226         throw new PExceptionTyping("Bad elem type: asked: char, been: object");
227     }
228     public void pieSetOcharElem(Character JavaDoc value) throws PException {
229         throw new PExceptionTyping("Bad elem type: asked: Char, been: object");
230     }
231     public void pieSetCharIndexField(String JavaDoc fn, char value) throws PException {
232         throw new PExceptionTyping("No index");
233     }
234     public void pieSetOcharIndexField(String JavaDoc fn, Character JavaDoc value) throws PException {
235         throw new PExceptionTyping("No index");
236     }
237     public void pieSetShortElem(short value) throws PException {
238         throw new PExceptionTyping("Bad elem type: asked: short, been: object");
239     }
240     public void pieSetOshortElem(Short JavaDoc value) throws PException {
241         throw new PExceptionTyping("Bad elem type: asked: Short, been: object");
242     }
243     public void pieSetShortIndexField(String JavaDoc fn, short value) throws PException {
244         throw new PExceptionTyping("No index");
245     }
246     public void pieSetOshortIndexField(String JavaDoc fn, Short JavaDoc value) throws PException {
247         throw new PExceptionTyping("No index");
248     }
249     public void pieSetIntElem(int value) throws PException {
250         throw new PExceptionTyping("Bad elem type: asked: int, been: object");
251     }
252     public void pieSetOintElem(Integer JavaDoc value) throws PException {
253         throw new PExceptionTyping("Bad elem type: asked: Int, been: object");
254     }
255     public void pieSetIntIndexField(String JavaDoc fn, int value) throws PException {
256         throw new PExceptionTyping("No index");
257     }
258     public void pieSetOintIndexField(String JavaDoc fn, Integer JavaDoc value) throws PException {
259         throw new PExceptionTyping("No index");
260     }
261     public void pieSetLongElem(long value) throws PException {
262         throw new PExceptionTyping("Bad elem type: asked: long, been: object");
263     }
264     public void pieSetOlongElem(Long JavaDoc value) throws PException {
265         throw new PExceptionTyping("Bad elem type: asked: Long, been: object");
266     }
267     public void pieSetLongIndexField(String JavaDoc fn, long value) throws PException {
268         throw new PExceptionTyping("No index");
269     }
270     public void pieSetOlongIndexField(String JavaDoc fn, Long JavaDoc value) throws PException {
271         throw new PExceptionTyping("No index");
272     }
273     public void pieSetFloatElem(float value) throws PException {
274         throw new PExceptionTyping("Bad elem type: asked: float, been: object");
275     }
276     public void pieSetOfloatElem(Float JavaDoc value) throws PException {
277         throw new PExceptionTyping("Bad elem type: asked: Float, been: object");
278     }
279     public void pieSetDoubleElem(double value) throws PException {
280         throw new PExceptionTyping("Bad elem type: asked: double, been: object");
281     }
282     public void pieSetOdoubleElem(Double JavaDoc value) throws PException {
283         throw new PExceptionTyping("Bad elem type: asked: Double, been: object");
284     }
285     public void pieSetStringElem(String JavaDoc value) throws PException {
286         throw new PExceptionTyping("Bad elem type: asked: String, been: object");
287     }
288     public void pieSetStringIndexField(String JavaDoc fn, String JavaDoc value) throws PException {
289         throw new PExceptionTyping("No index");
290     }
291     public void pieSetDateElem(Date JavaDoc value) throws PException {
292         throw new PExceptionTyping("Bad elem type: asked: java.util.Date, been: object");
293     }
294     public void pieSetDateIndexField(String JavaDoc fn, Date JavaDoc value) throws PException {
295         throw new PExceptionTyping("No index");
296     }
297     public void pieSetCharArrayElem(char[] value) throws PException {
298         throw new PExceptionTyping("Bad elem type: asked: char[], been: object");
299     }
300     public void pieSetByteArrayElem(byte[] value) throws PException {
301         throw new PExceptionTyping("Bad elem type: asked: byte[], been: object");
302     }
303     public void pieSetSerializedElem(Serializable JavaDoc value) throws PException {
304         throw new PExceptionTyping("Bad elem type: asked: Serializable, been: object");
305     }
306     public BigDecimal JavaDoc pieGetBigDecimalElem() throws PException {
307         throw new PExceptionTyping("Bad elem type: asked: BigDecimal, been: object");
308     }
309     public void pieSetBigDecimalElem(BigDecimal JavaDoc value) throws PException {
310         throw new PExceptionTyping("Bad elem type: asked: BigDecimal, been: object");
311     }
312     public java.math.BigInteger JavaDoc pieGetBigIntegerElem() throws PException {
313         throw new PExceptionTyping("Bad elem type: asked: BigInteger, been: object");
314     }
315     public void pieSetBigIntegerElem(java.math.BigInteger JavaDoc value) throws PException {
316         throw new PExceptionTyping("Bad elem type: asked: BigInteger, been: object");
317     }
318 }
319
Popular Tags