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