001: /*
002: * Copyright (c) 1998 - 2005 Versant Corporation
003: * All rights reserved. This program and the accompanying materials
004: * are made available under the terms of the Eclipse Public License v1.0
005: * which accompanies this distribution, and is available at
006: * http://www.eclipse.org/legal/epl-v10.html
007: *
008: * Contributors:
009: * Versant Corporation - initial API and implementation
010: */
011: package com.versant.core.ejb;
012:
013: import com.versant.core.common.OID;
014:
015: import javax.jdo.PersistenceManager;
016: import javax.jdo.spi.PersistenceCapable;
017: import javax.jdo.spi.StateManager;
018:
019: import com.versant.core.jdo.VersantStateManager;
020: import com.versant.core.jdo.VersantDetachable;
021: import com.versant.core.ejb.common.EntrySet;
022: import com.versant.core.metadata.FieldMetaData;
023:
024: /**
025: * StateManager that is used for merging detached instances.
026: */
027: public class AttachStateManager implements VersantStateManager {
028:
029: private StateManagerImp sm;
030: private EntrySet mergeSet;
031:
032: public AttachStateManager() {
033: }
034:
035: public StateManagerImp getSm() {
036: return sm;
037: }
038:
039: public void setSm(StateManagerImp sm) {
040: this .sm = sm;
041: }
042:
043: public byte replacingFlags(PersistenceCapable persistenceCapable) {
044: return 0;
045: }
046:
047: public StateManager replacingStateManager(
048: PersistenceCapable persistenceCapable,
049: StateManager stateManager) {
050: return stateManager;
051: }
052:
053: public boolean isDirty(PersistenceCapable persistenceCapable) {
054: return ((VersantDetachable) persistenceCapable)
055: .versantIsDirty();
056: }
057:
058: public boolean isTransactional(PersistenceCapable persistenceCapable) {
059: return false;
060: }
061:
062: public boolean isPersistent(PersistenceCapable persistenceCapable) {
063: return false;
064: }
065:
066: public boolean isNew(PersistenceCapable persistenceCapable) {
067: return false;
068: }
069:
070: public boolean isDeleted(PersistenceCapable persistenceCapable) {
071: return false;
072: }
073:
074: public PersistenceManager getPersistenceManager(
075: PersistenceCapable persistenceCapable) {
076: return null;
077: }
078:
079: public void makeDirty(PersistenceCapable persistenceCapable,
080: String s) {
081: ((VersantDetachable) persistenceCapable).versantMakeDirty(s);
082: }
083:
084: public Object getObjectId(PersistenceCapable persistenceCapable) {
085: return null;
086: }
087:
088: public Object getTransactionalObjectId(
089: PersistenceCapable persistenceCapable) {
090: return null;
091: }
092:
093: public boolean isLoaded(PersistenceCapable persistenceCapable, int i) {
094: return ((VersantDetachable) persistenceCapable)
095: .versantIsLoaded(i);
096: }
097:
098: public void preSerialize(PersistenceCapable persistenceCapable) {
099:
100: }
101:
102: public boolean getBooleanField(
103: PersistenceCapable persistenceCapable, int i, boolean b) {
104: return b;
105: }
106:
107: public char getCharField(PersistenceCapable persistenceCapable,
108: int i, char c) {
109: return c;
110: }
111:
112: public byte getByteField(PersistenceCapable persistenceCapable,
113: int i, byte b) {
114: return b;
115: }
116:
117: public short getShortField(PersistenceCapable persistenceCapable,
118: int i, short i1) {
119: return i1;
120: }
121:
122: public int getIntField(PersistenceCapable persistenceCapable,
123: int i, int i1) {
124: return i1;
125: }
126:
127: public long getLongField(PersistenceCapable persistenceCapable,
128: int i, long l) {
129: return l;
130: }
131:
132: public float getFloatField(PersistenceCapable persistenceCapable,
133: int i, float v) {
134: return v;
135: }
136:
137: public double getDoubleField(PersistenceCapable persistenceCapable,
138: int i, double v) {
139: return v;
140: }
141:
142: public String getStringField(PersistenceCapable persistenceCapable,
143: int i, String s) {
144: return s;
145: }
146:
147: public Object getObjectField(PersistenceCapable persistenceCapable,
148: int i, Object o) {
149: return o;
150: }
151:
152: public void setBooleanField(PersistenceCapable persistenceCapable,
153: int i, boolean b, boolean b1) {
154: }
155:
156: public void setCharField(PersistenceCapable persistenceCapable,
157: int i, char c, char c1) {
158: }
159:
160: public void setByteField(PersistenceCapable persistenceCapable,
161: int i, byte b, byte b1) {
162: }
163:
164: public void setShortField(PersistenceCapable persistenceCapable,
165: int i, short i1, short i2) {
166: }
167:
168: public void setIntField(PersistenceCapable persistenceCapable,
169: int i, int i1, int i2) {
170: }
171:
172: public void setLongField(PersistenceCapable persistenceCapable,
173: int i, long l, long l1) {
174: }
175:
176: public void setFloatField(PersistenceCapable persistenceCapable,
177: int i, float v, float v1) {
178: }
179:
180: public void setDoubleField(PersistenceCapable persistenceCapable,
181: int i, double v, double v1) {
182: }
183:
184: public void setStringField(PersistenceCapable persistenceCapable,
185: int i, String s, String s1) {
186: }
187:
188: public void setObjectField(PersistenceCapable persistenceCapable,
189: int i, Object o, Object val) {
190: }
191:
192: public void providedBooleanField(
193: PersistenceCapable persistenceCapable, int fieldNo,
194: boolean newVal) {
195: sm.setBooleanField(null, fieldNo, newVal, newVal);
196: }
197:
198: public void providedCharField(
199: PersistenceCapable persistenceCapable, int fieldNo,
200: char newVal) {
201: sm.setCharField(null, fieldNo, newVal, newVal);
202: }
203:
204: public void providedByteField(
205: PersistenceCapable persistenceCapable, int fieldNo,
206: byte newVal) {
207: sm.setByteField(null, fieldNo, newVal, newVal);
208: }
209:
210: public void providedShortField(
211: PersistenceCapable persistenceCapable, int fieldNo,
212: short newVal) {
213: sm.setShortField(null, fieldNo, newVal, newVal);
214: }
215:
216: public void providedIntField(PersistenceCapable persistenceCapable,
217: int fieldNo, int newVal) {
218: sm.setIntField(null, fieldNo, newVal, newVal);
219: }
220:
221: public void providedLongField(
222: PersistenceCapable persistenceCapable, int fieldNo,
223: long newVal) {
224: sm.setLongField(null, fieldNo, newVal, newVal);
225: }
226:
227: public void providedFloatField(
228: PersistenceCapable persistenceCapable, int fieldNo,
229: float newVal) {
230: sm.setFloatField(null, fieldNo, newVal, newVal);
231: }
232:
233: public void providedDoubleField(
234: PersistenceCapable persistenceCapable, int fieldNo,
235: double newVal) {
236: sm.setDoubleField(null, fieldNo, newVal, newVal);
237: }
238:
239: public void providedStringField(
240: PersistenceCapable persistenceCapable, int fieldNo,
241: String newVal) {
242: sm.setStringField(null, fieldNo, newVal, newVal);
243: }
244:
245: public void providedObjectField(
246: PersistenceCapable persistenceCapable, int fieldNo,
247: Object newVal) {
248: // FieldMetaData fmd = sm.getFmd(fieldNo);
249: //
250: sm.setObjectField(persistenceCapable, fieldNo, newVal, newVal);
251: }
252:
253: public boolean replacingBooleanField(
254: PersistenceCapable persistenceCapable, int i) {
255: return false;
256: }
257:
258: public char replacingCharField(
259: PersistenceCapable persistenceCapable, int i) {
260: return 0;
261: }
262:
263: public byte replacingByteField(
264: PersistenceCapable persistenceCapable, int i) {
265: return 0;
266: }
267:
268: public short replacingShortField(
269: PersistenceCapable persistenceCapable, int i) {
270: return 0;
271: }
272:
273: public int replacingIntField(PersistenceCapable persistenceCapable,
274: int i) {
275: return 0;
276: }
277:
278: public long replacingLongField(
279: PersistenceCapable persistenceCapable, int i) {
280: return 0;
281: }
282:
283: public float replacingFloatField(
284: PersistenceCapable persistenceCapable, int i) {
285: return 0;
286: }
287:
288: public double replacingDoubleField(
289: PersistenceCapable persistenceCapable, int i) {
290: return 0;
291: }
292:
293: public String replacingStringField(
294: PersistenceCapable persistenceCapable, int i) {
295: return null;
296: }
297:
298: public Object replacingObjectField(
299: PersistenceCapable persistenceCapable, int i) {
300: return null;
301: }
302:
303: public void fillNewAppPKField(int fieldNo) {
304: }
305:
306: public void makeDirty(PersistenceCapable pc, int managedFieldNo) {
307: ((VersantDetachable) pc).versantMakeDirty(managedFieldNo);
308: }
309:
310: public OID getOID() {
311: return null;
312: }
313:
314: public PersistenceCapable getPersistenceCapable() {
315: return null;
316: }
317:
318: }
|