KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > ejb > AttachStateManager


1
2 /*
3  * Copyright (c) 1998 - 2005 Versant Corporation
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  * Versant Corporation - initial API and implementation
11  */

12 package com.versant.core.ejb;
13
14 import com.versant.core.common.OID;
15
16 import javax.jdo.PersistenceManager;
17 import javax.jdo.spi.PersistenceCapable;
18 import javax.jdo.spi.StateManager;
19
20 import com.versant.core.jdo.VersantStateManager;
21 import com.versant.core.jdo.VersantDetachable;
22 import com.versant.core.ejb.common.EntrySet;
23 import com.versant.core.metadata.FieldMetaData;
24
25 /**
26  * StateManager that is used for merging detached instances.
27  */

28 public class AttachStateManager implements VersantStateManager {
29
30     private StateManagerImp sm;
31     private EntrySet mergeSet;
32
33
34     public AttachStateManager() {
35     }
36
37     public StateManagerImp getSm() {
38         return sm;
39     }
40
41     public void setSm(StateManagerImp sm) {
42         this.sm = sm;
43     }
44
45     public byte replacingFlags(PersistenceCapable persistenceCapable) {
46         return 0;
47     }
48
49     public StateManager replacingStateManager(
50             PersistenceCapable persistenceCapable, StateManager stateManager) {
51         return stateManager;
52     }
53
54     public boolean isDirty(PersistenceCapable persistenceCapable) {
55         return ((VersantDetachable)persistenceCapable).versantIsDirty();
56     }
57
58     public boolean isTransactional(PersistenceCapable persistenceCapable) {
59         return false;
60     }
61
62     public boolean isPersistent(PersistenceCapable persistenceCapable) {
63         return false;
64     }
65
66     public boolean isNew(PersistenceCapable persistenceCapable) {
67         return false;
68     }
69
70     public boolean isDeleted(PersistenceCapable persistenceCapable) {
71         return false;
72     }
73
74     public PersistenceManager getPersistenceManager(
75             PersistenceCapable persistenceCapable) {
76         return null;
77     }
78
79     public void makeDirty(PersistenceCapable persistenceCapable, String JavaDoc s) {
80         ((VersantDetachable)persistenceCapable).versantMakeDirty(s);
81     }
82
83     public Object JavaDoc getObjectId(PersistenceCapable persistenceCapable) {
84         return null;
85     }
86
87     public Object JavaDoc getTransactionalObjectId(
88             PersistenceCapable persistenceCapable) {
89         return null;
90     }
91
92     public boolean isLoaded(PersistenceCapable persistenceCapable, int i) {
93         return ((VersantDetachable)persistenceCapable).versantIsLoaded(i);
94     }
95
96     public void preSerialize(PersistenceCapable persistenceCapable) {
97
98     }
99
100     public boolean getBooleanField(PersistenceCapable persistenceCapable,
101             int i, boolean b) {
102         return b;
103     }
104
105     public char getCharField(PersistenceCapable persistenceCapable, int i,
106             char c) {
107         return c;
108     }
109
110     public byte getByteField(PersistenceCapable persistenceCapable, int i,
111             byte b) {
112         return b;
113     }
114
115     public short getShortField(PersistenceCapable persistenceCapable, int i,
116             short i1) {
117         return i1;
118     }
119
120     public int getIntField(PersistenceCapable persistenceCapable, int i,
121             int i1) {
122         return i1;
123     }
124
125     public long getLongField(PersistenceCapable persistenceCapable, int i,
126             long l) {
127         return l;
128     }
129
130     public float getFloatField(PersistenceCapable persistenceCapable, int i,
131             float v) {
132         return v;
133     }
134
135     public double getDoubleField(PersistenceCapable persistenceCapable, int i,
136             double v) {
137         return v;
138     }
139
140     public String JavaDoc getStringField(PersistenceCapable persistenceCapable, int i,
141             String JavaDoc s) {
142         return s;
143     }
144
145     public Object JavaDoc getObjectField(PersistenceCapable persistenceCapable, int i,
146             Object JavaDoc o) {
147         return o;
148     }
149
150     public void setBooleanField(PersistenceCapable persistenceCapable, int i,
151             boolean b, boolean b1) {
152     }
153
154     public void setCharField(PersistenceCapable persistenceCapable, int i,
155             char c, char c1) {
156     }
157
158     public void setByteField(PersistenceCapable persistenceCapable, int i,
159             byte b, byte b1) {
160     }
161
162     public void setShortField(PersistenceCapable persistenceCapable, int i,
163             short i1, short i2) {
164     }
165
166     public void setIntField(PersistenceCapable persistenceCapable, int i,
167             int i1, int i2) {
168     }
169
170     public void setLongField(PersistenceCapable persistenceCapable, int i,
171             long l, long l1) {
172     }
173
174     public void setFloatField(PersistenceCapable persistenceCapable, int i,
175             float v, float v1) {
176     }
177
178     public void setDoubleField(PersistenceCapable persistenceCapable, int i,
179             double v, double v1) {
180     }
181
182     public void setStringField(PersistenceCapable persistenceCapable, int i,
183             String JavaDoc s, String JavaDoc s1) {
184     }
185
186     public void setObjectField(PersistenceCapable persistenceCapable, int i,
187             Object JavaDoc o, Object JavaDoc val) {
188     }
189
190     public void providedBooleanField(PersistenceCapable persistenceCapable,
191             int fieldNo, boolean newVal) {
192         sm.setBooleanField(null, fieldNo, newVal, newVal);
193     }
194
195     public void providedCharField(PersistenceCapable persistenceCapable, int fieldNo,
196             char newVal) {
197         sm.setCharField(null, fieldNo, newVal, newVal);
198     }
199
200     public void providedByteField(PersistenceCapable persistenceCapable, int fieldNo,
201             byte newVal) {
202         sm.setByteField(null, fieldNo, newVal, newVal);
203     }
204
205     public void providedShortField(PersistenceCapable persistenceCapable,
206             int fieldNo, short newVal) {
207         sm.setShortField(null, fieldNo, newVal, newVal);
208     }
209
210     public void providedIntField(PersistenceCapable persistenceCapable, int fieldNo,
211             int newVal) {
212         sm.setIntField(null, fieldNo, newVal, newVal);
213     }
214
215     public void providedLongField(PersistenceCapable persistenceCapable, int fieldNo,
216             long newVal) {
217         sm.setLongField(null, fieldNo, newVal, newVal);
218     }
219
220     public void providedFloatField(PersistenceCapable persistenceCapable,
221             int fieldNo, float newVal) {
222         sm.setFloatField(null, fieldNo, newVal, newVal);
223     }
224
225     public void providedDoubleField(PersistenceCapable persistenceCapable,
226             int fieldNo, double newVal) {
227         sm.setDoubleField(null, fieldNo, newVal, newVal);
228     }
229
230     public void providedStringField(PersistenceCapable persistenceCapable,
231             int fieldNo, String JavaDoc newVal) {
232         sm.setStringField(null, fieldNo, newVal, newVal);
233     }
234
235     public void providedObjectField(PersistenceCapable persistenceCapable,
236             int fieldNo, Object JavaDoc newVal) {
237 // FieldMetaData fmd = sm.getFmd(fieldNo);
238
//
239
sm.setObjectField(persistenceCapable, fieldNo, newVal, newVal);
240     }
241
242
243
244     public boolean replacingBooleanField(PersistenceCapable persistenceCapable,
245             int i) {
246         return false;
247     }
248
249     public char replacingCharField(PersistenceCapable persistenceCapable,
250             int i) {
251         return 0;
252     }
253
254     public byte replacingByteField(PersistenceCapable persistenceCapable,
255             int i) {
256         return 0;
257     }
258
259     public short replacingShortField(PersistenceCapable persistenceCapable,
260             int i) {
261         return 0;
262     }
263
264     public int replacingIntField(PersistenceCapable persistenceCapable, int i) {
265         return 0;
266     }
267
268     public long replacingLongField(PersistenceCapable persistenceCapable,
269             int i) {
270         return 0;
271     }
272
273     public float replacingFloatField(PersistenceCapable persistenceCapable,
274             int i) {
275         return 0;
276     }
277
278     public double replacingDoubleField(PersistenceCapable persistenceCapable,
279             int i) {
280         return 0;
281     }
282
283     public String JavaDoc replacingStringField(PersistenceCapable persistenceCapable,
284             int i) {
285         return null;
286     }
287
288     public Object JavaDoc replacingObjectField(PersistenceCapable persistenceCapable,
289             int i) {
290         return null;
291     }
292
293     public void fillNewAppPKField(int fieldNo) {}
294
295     public void makeDirty(PersistenceCapable pc,
296             int managedFieldNo) {
297         ((VersantDetachable)pc).versantMakeDirty(managedFieldNo);
298     }
299
300     public OID getOID() {
301         return null;
302     }
303
304     public PersistenceCapable getPersistenceCapable() {
305         return null;
306     }
307
308
309
310 }
311
Popular Tags