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.jdo;
012:
013: import com.versant.core.common.OID;
014: import com.versant.core.common.State;
015: import com.versant.core.metadata.ClassMetaData;
016: import com.versant.core.metadata.FetchGroup;
017: import com.versant.core.metadata.ModelMetaData;
018: import com.versant.core.server.OIDGraph;
019:
020: import javax.jdo.spi.PersistenceCapable;
021: import java.io.IOException;
022: import java.io.ObjectInput;
023: import java.io.ObjectOutput;
024: import java.util.Date;
025:
026: import com.versant.core.common.BindingSupportImpl;
027: import com.versant.core.common.PersistenceContext;
028: import com.versant.core.util.IntArray;
029: import com.versant.core.util.OIDObjectOutput;
030: import com.versant.core.util.OIDObjectInput;
031:
032: /**
033: * This is a nonmutable state that is used to obtain the default values for fields.
034: */
035: public class InitState extends State {
036:
037: public boolean isCacheble() {
038: return false;
039: }
040:
041: public boolean isFieldNullorZero(int stateFieldNo) {
042: return false; //To change body of implemented methods use File | Settings | File Templates.
043: }
044:
045: public boolean checkKeyFields(OID oid) {
046: throw createBadMethodException();
047: }
048:
049: public void setInternalBooleanFieldAbs(int field, boolean newValue) {
050: throw createBadMethodException();
051: }
052:
053: public void findDirectEdges(OIDGraph graph, IntArray edges) {
054: throw createBadMethodException();
055: }
056:
057: public void setInternalIntField(int field, int newValue) {
058: throw createBadMethodException();
059: }
060:
061: public int getClassIndex() {
062: throw createBadMethodException();
063: }
064:
065: public void makeDirtyAbs(int fieldNo) {
066: throw createBadMethodException();
067: }
068:
069: public void setDoubleField(int stateFieldNo, double newValue) {
070: throw createBadMethodException();
071: }
072:
073: public int replaceSCOFields(PersistenceCapable owner,
074: VersantPersistenceManagerImp sm, int[] absFieldNos) {
075: throw createBadMethodException();
076: }
077:
078: public void setCharField(int stateFieldNo, char newValue) {
079: throw createBadMethodException();
080: }
081:
082: public void copyOptimisticLockingField(State state) {
083: throw createBadMethodException();
084: }
085:
086: public void clear() {
087: }
088:
089: public void setStringField(int stateFieldNo, String newValue) {
090: throw createBadMethodException();
091: }
092:
093: public void setBooleanFieldAbs(int absFieldNo, boolean newValue) {
094: throw createBadMethodException();
095: }
096:
097: public void updateNonFilled(State state) {
098: throw createBadMethodException();
099: }
100:
101: public boolean isHollow() {
102: throw createBadMethodException();
103: }
104:
105: public void setInternalDoubleFieldAbs(int field, double newValue) {
106: throw createBadMethodException();
107: }
108:
109: public byte getByteField(int stateFieldNo) {
110: return 0;
111: }
112:
113: public void clearCollectionFields() {
114: throw createBadMethodException();
115: }
116:
117: public void setInternalShortFieldAbs(int field, short newValue) {
118: throw createBadMethodException();
119: }
120:
121: public void clearDirtyFields() {
122: throw createBadMethodException();
123: }
124:
125: public int compareToPass1(State state) {
126: throw createBadMethodException();
127: }
128:
129: public boolean fillToStoreState(State stateToStore,
130: PersistenceContext sm, VersantStateManager pcStateMan) {
131: throw createBadMethodException();
132: }
133:
134: public void updateAutoSetFieldsCreated(Date now) {
135: throw createBadMethodException();
136: }
137:
138: public boolean getBooleanFieldAbs(int absFieldNo) {
139: return false;
140: }
141:
142: public void copyFieldsForOptimisticLocking(State state,
143: VersantPersistenceManagerImp sm) {
144: throw createBadMethodException();
145: }
146:
147: public void setByteFieldAbs(int absFieldNo, byte newValue) {
148: throw createBadMethodException();
149: }
150:
151: public char getCharField(int stateFieldNo) {
152: return 0;
153: }
154:
155: public void setInternalBooleanField(int field, boolean newValue) {
156: throw createBadMethodException();
157: }
158:
159: public boolean containFieldsAbs(int[] absFieldNos) {
160: throw createBadMethodException();
161: }
162:
163: public int getPass1FieldRefFieldNosWithNewOids(int[] stateFieldNoBuf) {
164: throw createBadMethodException();
165: }
166:
167: public void setBooleanField(int stateFieldNo, boolean newValue) {
168: throw createBadMethodException();
169: }
170:
171: public void setStringFieldAbs(int absFieldNo, String newValue) {
172: throw createBadMethodException();
173: }
174:
175: public long getLongFieldAbs(int absFieldNo) {
176: return 0;
177: }
178:
179: public void setCharFieldAbs(int absFieldNo, char newValue) {
180: throw createBadMethodException();
181: }
182:
183: public void setInternalByteFieldAbs(int field, byte newValue) {
184: throw createBadMethodException();
185: }
186:
187: public void makeClean() {
188: throw createBadMethodException();
189: }
190:
191: public boolean containsFieldAbs(int absFieldNo) {
192: return true;
193: }
194:
195: public void setClassMetaData(ClassMetaData cmd) {
196: throw createBadMethodException();
197: }
198:
199: public void clearNonFilled(State state) {
200: throw createBadMethodException();
201: }
202:
203: public void setInternalFloatFieldAbs(int field, float newValue) {
204: throw createBadMethodException();
205: }
206:
207: public void setInternalObjectFieldAbs(int field, Object newValue) {
208: throw createBadMethodException();
209: }
210:
211: public void clearNonAutoSetFields() {
212: throw createBadMethodException();
213: }
214:
215: public String getStringFieldAbs(int absFieldNo) {
216: return null;
217: }
218:
219: public void setIntFieldAbs(int absFieldNo, int newValue) {
220: throw createBadMethodException();
221: }
222:
223: public int getFieldNos(int[] buf) {
224: throw createBadMethodException();
225: }
226:
227: public void updateAutoSetFieldsModified(Date now, State oldState) {
228: throw createBadMethodException();
229: }
230:
231: public void setInternalStringFieldAbs(int field, String newValue) {
232: throw createBadMethodException();
233: }
234:
235: public double getDoubleFieldAbs(int absFieldNo) {
236: return 0;
237: }
238:
239: public void setDoubleFieldAbs(int absFieldNo, double newValue) {
240: throw createBadMethodException();
241: }
242:
243: public void clearSCOFields() {
244: throw createBadMethodException();
245: }
246:
247: public boolean hasSameFields(State state) {
248: throw createBadMethodException();
249: }
250:
251: public short getShortFieldAbs(int absFieldNo) {
252: return 0;
253: }
254:
255: public void setShortField(int stateFieldNo, short newValue) {
256: throw createBadMethodException();
257: }
258:
259: public String getStringField(int stateFieldNo) {
260: return null;
261: }
262:
263: public void copyKeyFields(OID oid) {
264: throw createBadMethodException();
265: }
266:
267: public byte getByteFieldAbs(int absFieldNo) {
268: return 0;
269: }
270:
271: public void setFloatFieldAbs(int absFieldNo, float newValue) {
272: throw createBadMethodException();
273: }
274:
275: public void setInternalShortField(int field, short newValue) {
276: throw createBadMethodException();
277: }
278:
279: public boolean containsValidAppIdFields() {
280: throw createBadMethodException();
281: }
282:
283: public void addRefs(VersantPersistenceManagerImp sm,
284: PCStateMan pcStateMan) {
285: }
286:
287: public Object getObjectField(int stateFieldNo,
288: PersistenceCapable owningPC, PersistenceContext sm, OID oid) {
289: return null;
290: }
291:
292: public Object getInternalObjectField(int field) {
293: return null;
294: }
295:
296: public void copyKeyFieldsUpdate(OID oid) {
297: throw createBadMethodException();
298: }
299:
300: public void setInternalCharField(int field, char newValue) {
301: throw createBadMethodException();
302: }
303:
304: public void setInternalFloatField(int field, float newValue) {
305: throw createBadMethodException();
306: }
307:
308: public void setInternalIntFieldAbs(int field, int newValue) {
309: throw createBadMethodException();
310: }
311:
312: public void setInternalCharFieldAbs(int field, char newValue) {
313: throw createBadMethodException();
314: }
315:
316: public double getDoubleField(int stateFieldNo) {
317: return 0;
318: }
319:
320: public float getFloatFieldAbs(int absFieldNo) {
321: return 0;
322: }
323:
324: public int getPass1FieldNos(int[] buf) {
325: throw createBadMethodException();
326: }
327:
328: public ClassMetaData getClassMetaData(ModelMetaData jmd) {
329: throw createBadMethodException();
330: }
331:
332: public ClassMetaData getClassMetaData() {
333: throw createBadMethodException();
334: }
335:
336: public char getCharFieldAbs(int absFieldNo) {
337: return 0;
338: }
339:
340: public State getCopy() {
341: throw createBadMethodException();
342: }
343:
344: public void setInternalDoubleField(int field, double newValue) {
345: throw createBadMethodException();
346: }
347:
348: public void setInternalLongFieldAbs(int field, long newValue) {
349: throw createBadMethodException();
350: }
351:
352: public void clearApplicationIdentityFields() {
353: throw createBadMethodException();
354: }
355:
356: public boolean isEmpty() {
357: throw createBadMethodException();
358: }
359:
360: public float getFloatField(int stateFieldNo) {
361: return 0;
362: }
363:
364: public void setInternalLongField(int field, long newValue) {
365: throw createBadMethodException();
366: }
367:
368: public void setLongFieldAbs(int absFieldNo, long newValue) {
369: throw createBadMethodException();
370: }
371:
372: public void setObjectField(int stateFieldNo, Object newValue) {
373: throw createBadMethodException();
374: }
375:
376: public void setInternalStringField(int field, String newValue) {
377: throw createBadMethodException();
378: }
379:
380: public boolean containsPass2Fields() {
381: throw createBadMethodException();
382: }
383:
384: public boolean isDirty() {
385: throw createBadMethodException();
386: }
387:
388: public boolean isDirty(int fieldNo) {
389: throw createBadMethodException();
390: }
391:
392: public void retrieve(VersantPersistenceManagerImp sm) {
393: throw createBadMethodException();
394: }
395:
396: public void clearTransactionNonPersistentFields() {
397: throw createBadMethodException();
398: }
399:
400: public void setObjectFieldAbs(int absFieldNo, Object newValue) {
401: throw createBadMethodException();
402: }
403:
404: public void setObjectFieldUnresolved(int field, Object newValue) {
405: throw createBadMethodException();
406: }
407:
408: public void setObjectFieldUnresolvedAbs(int field, Object newValue) {
409: throw createBadMethodException();
410: }
411:
412: public void setInternalObjectField(int field, Object newValue) {
413: throw createBadMethodException();
414: }
415:
416: public void setShortFieldAbs(int absFieldNo, short newValue) {
417: throw createBadMethodException();
418: }
419:
420: public boolean containsApplicationIdentityFields() {
421: throw createBadMethodException();
422: }
423:
424: public Object getInternalObjectFieldAbs(int field) {
425: return null;
426: }
427:
428: public State newInstance() {
429: throw createBadMethodException();
430: }
431:
432: public short getShortField(int stateFieldNo) {
433: return 0;
434: }
435:
436: public boolean containsFetchGroup(FetchGroup fetchGroup) {
437: throw createBadMethodException();
438: }
439:
440: public Object getObjectFieldAbs(int absFieldNo,
441: PersistenceCapable owningPC, PersistenceContext sm, OID oid) {
442: return null;
443: }
444:
445: public void setFloatField(int stateFieldNo, float newValue) {
446: throw createBadMethodException();
447: }
448:
449: public void updateFrom(State state) {
450: throw createBadMethodException();
451: }
452:
453: public int getPass2FieldNos(int[] buf) {
454: throw createBadMethodException();
455: }
456:
457: public boolean containsPass1Fields() {
458: throw createBadMethodException();
459: }
460:
461: public void setIntField(int stateFieldNo, int newValue) {
462: throw createBadMethodException();
463: }
464:
465: public boolean replaceNewObjectOIDs(int[] fieldNos,
466: int fieldNosLength) {
467: throw createBadMethodException();
468: }
469:
470: public boolean hasSameNullFields(State state, State mask) {
471: throw createBadMethodException();
472: }
473:
474: public void unmanageSCOFields() {
475: throw createBadMethodException();
476: }
477:
478: public int getIntField(int stateFieldNo) {
479: return 0;
480: }
481:
482: public int getIntFieldAbs(int absFieldNo) {
483: return 0;
484: }
485:
486: public void setInternalByteField(int field, byte newValue) {
487: throw createBadMethodException();
488: }
489:
490: public String getVersion() {
491: throw createBadMethodException();
492: }
493:
494: public long getLongField(int stateFieldNo) {
495: return 0;
496: }
497:
498: public long getLongFieldInternal(int stateFieldNo) {
499: return 0;
500: }
501:
502: public void copyFields(OID oid) {
503: throw createBadMethodException();
504: }
505:
506: public boolean isNull(int stateFieldNo) {
507: throw createBadMethodException();
508: }
509:
510: public boolean getBooleanField(int stateFieldNo) {
511: return false;
512: }
513:
514: public void setLongField(int stateFieldNo, long newValue) {
515: throw createBadMethodException();
516: }
517:
518: public boolean containFields(int[] stateFieldNos) {
519: throw createBadMethodException();
520: }
521:
522: public boolean containsField(int stateFieldNo) {
523: return true;
524: }
525:
526: public void setByteField(int stateFieldNo, byte newValue) {
527: throw createBadMethodException();
528: }
529:
530: public void readExternal(ObjectInput in) throws IOException,
531: ClassNotFoundException {
532: //To change body of implemented methods use Options | File Templates.
533: }
534:
535: public void writeExternal(ObjectOutput out) throws IOException {
536: //To change body of implemented methods use Options | File Templates.
537: }
538:
539: /**
540: * Add all states referenced by fields in fg to the dcs.
541: */
542: public void addFetchGroupStatesToDCS(FetchGroup fg,
543: DetachStateContainer dcs, VersantPersistenceManagerImp pm,
544: OID oid) {
545: throw createBadMethodException();
546: }
547:
548: /**
549: * Is this state field nummber resolved for the Client
550: */
551: public boolean isResolvedForClient(int stateFieldNo) {
552: throw createBadMethodException();
553: }
554:
555: /**
556: * The value of the version field on the pc.
557: * This will return null if there are no version fields.
558: */
559: public Object getOptimisticLockingValue() {
560: throw createBadMethodException();
561: }
562:
563: private RuntimeException createBadMethodException() {
564: return BindingSupportImpl.getInstance().internal(
565: "This method should not be called");
566: }
567:
568: public void setFilled(int field) {
569: throw createBadMethodException();
570: }
571:
572: public void fillForRead(State dest, VersantPersistenceManagerImp sm) {
573: throw createBadMethodException();
574: }
575:
576: public void clearFilledFlags() {
577: throw createBadMethodException();
578: }
579:
580: public void addOneToManyInverseFieldsForL2Evict(
581: VersantPersistenceManagerImp pm) {
582: throw createBadMethodException();
583: }
584:
585: public void writeExternal(OIDObjectOutput os) throws IOException {
586: throw createBadMethodException();
587: }
588:
589: public void readExternal(OIDObjectInput is) throws IOException,
590: ClassNotFoundException {
591: throw createBadMethodException();
592: }
593:
594: }
|