KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > versant > core > jdo > UnsynchronizedPMProxy


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.jdo;
13
14 import com.versant.core.server.QueryResultWrapper;
15 import com.versant.core.server.CompiledQuery;
16
17 import javax.jdo.Transaction;
18 import javax.jdo.PersistenceManager;
19 import javax.jdo.Query;
20 import javax.jdo.PersistenceManagerFactory;
21 import javax.jdo.Extent;
22 import javax.jdo.spi.PersistenceCapable;
23
24 import javax.transaction.Synchronization JavaDoc;
25 import javax.transaction.xa.XAException JavaDoc;
26 import javax.transaction.xa.XAResource JavaDoc;
27 import javax.transaction.xa.Xid JavaDoc;
28  
29 import java.sql.Connection JavaDoc;
30 import java.util.Collection JavaDoc;
31 import java.util.List JavaDoc;
32
33
34
35 import com.versant.core.common.BindingSupportImpl;
36 import com.versant.core.common.OID;
37 import com.versant.core.common.State;
38 import com.versant.core.common.*;
39 import com.versant.core.storagemanager.ExecuteQueryReturn;
40
41 /**
42  * This is a unsynchronized proxy to VersantPersistenceManagerImp.
43  *
44  * @see PMProxy
45  * @see SynchronizedPMProxy
46  */

47 public final class UnsynchronizedPMProxy extends PMProxy {
48
49     private VersantPersistenceManagerImp realPM;
50
51     public UnsynchronizedPMProxy(VersantPersistenceManagerImp realPM) {
52         this.realPM = realPM;
53     }
54
55     public void flushIfDepOn(int[] bits) {
56         realPM.flushIfDepOn(bits);
57     }
58
59     public void processLocalCacheReferenceQueue() {
60         realPM.processLocalCacheReferenceQueue();
61     }
62
63     public QueryResultWrapper executeQuery(CompiledQuery cq, Object JavaDoc[] params) {
64         return realPM.getStorageManager().executeQuery(realPM, null, cq, params);
65     }
66
67     public QueryResultContainer getNextQueryResult(QueryResultWrapper aQrs, int skipAmount) {
68         return realPM.getStorageManager().fetchNextQueryResult(realPM,
69                 ((ExecuteQueryReturn)aQrs).getRunningQuery(), skipAmount);
70     }
71
72     public void addToCache(StatesReturned container) {
73         realPM.addToCache(container);
74     }
75
76     public void closeQuery(QueryResultWrapper qrw) {
77         realPM.getStorageManager().closeQuery(((ExecuteQueryReturn)qrw).getRunningQuery());
78     }
79
80     public QueryResultContainer getAbsolute(QueryResultWrapper qrsIF, int index, int fetchAmount) {
81         return realPM.getStorageManager().fetchRandomAccessQueryResult(realPM,
82                 ((ExecuteQueryReturn)qrsIF).getRunningQuery(), index,
83                 fetchAmount);
84     }
85
86     public int getResultCount(QueryResultWrapper qrsIF) {
87         return realPM.getStorageManager().getRandomAccessQueryCount(realPM,
88                 ((ExecuteQueryReturn)qrsIF).getRunningQuery());
89     }
90
91     public QueryResultContainer getAllQueryResults(CompiledQuery cq,
92             Object JavaDoc[] params) {
93         return realPM.getStorageManager().executeQueryAll(realPM, null, cq, params);
94     }
95
96     public void setMasterOnDetail(PersistenceCapable detail, int managedFieldNo,
97             PersistenceCapable master, boolean removeFromCurrentMaster) {
98         realPM.setMasterOnDetail(detail, managedFieldNo, master, removeFromCurrentMaster);
99     }
100
101     public Object JavaDoc getObjectField(PersistenceCapable pc, int fieldNo) {
102         return realPM.getObjectField(pc, fieldNo);
103     }
104
105     public int getQueryRowCount(CompiledQuery cq, Object JavaDoc[] params) {
106         return realPM.getStorageManager().executeQueryCount(null, cq, params);
107     }
108
109     public Object JavaDoc getOptimisticLockingValue(Object JavaDoc o) {
110         checkClosed();
111         return realPM.getOptimisticLockingValue(o);
112     }
113
114     public void setPmCacheRefType(Object JavaDoc pc, int type) {
115         checkClosed();
116         realPM.setPmCacheRefType(pc, type);
117     }
118
119     public void setPmCacheRefType(Object JavaDoc[] pcs, int type) {
120         checkClosed();
121         realPM.setPmCacheRefType(pcs, type);
122     }
123
124     public void setPmCacheRefType(Collection JavaDoc col, int type) {
125         checkClosed();
126         realPM.setPmCacheRefType(col, type);
127     }
128
129     public void setPmCacheRefType(int type) {
130         checkClosed();
131         realPM.setPmCacheRefType(type);
132     }
133
134     public int getPmCacheRefType() {
135         checkClosed();
136         return realPM.getPmCacheRefType();
137     }
138
139     /**
140      * If default fetch group fields will be intercepted on a
141      * Persistent-Non-Transaction instance. If this is disabled then such a
142      * instance will not be 'refreshed' if accessed in a datastore transaction.
143      */

144     public boolean isInterceptDfgFieldAccess() {
145         return realPM.isInterceptDfgFieldAccess();
146     }
147
148     public void setInterceptDfgFieldAccess(boolean interceptDfgFieldAccess) {
149         realPM.setInterceptDfgFieldAccess(interceptDfgFieldAccess);
150     }
151
152     public VersantPersistenceManagerImp getRealPM() {
153         checkClosed();
154         return realPM;
155     }
156
157     VersantPersistenceManagerImp getRealPMNoCheck() {
158         return realPM;
159     }
160
161     public void resetPM() {
162         realPM = null;
163     }
164
165     public boolean isRealPMNull() {
166         return realPM == null;
167     }
168
169     public List JavaDoc versantAllDirtyInstances() {
170         checkClosed();
171         return realPM.versantAllDirtyInstances();
172     }
173
174     private void checkClosed() {
175         if (realPM == null) {
176             throw BindingSupportImpl.getInstance().invalidOperation(
177                     "The pm is closed");
178         }
179     }
180
181     public boolean isDirty() {
182         checkClosed();
183         return realPM.isDirty();
184     }
185
186     public void cancelQueryExecution() {
187         checkClosed();
188         realPM.cancelQueryExecution();
189     }
190
191     public Object JavaDoc getObjectByIDString(String JavaDoc value, boolean toValidate) {
192         checkClosed();
193         return realPM.getObjectByIDString(value, toValidate);
194     }
195
196     public void loadFetchGroup(Object JavaDoc pc, String JavaDoc name) {
197         checkClosed();
198         realPM.loadFetchGroup(pc, name);
199     }
200
201     public void flush() {
202         checkClosed();
203         realPM.flush();
204     }
205
206     public void flush(boolean retainState) {
207         checkClosed();
208         realPM.flush(retainState);
209     }
210
211     public void makeTransientRecursive(Object JavaDoc pc) {
212         checkClosed();
213         realPM.makeTransientRecursive(pc);
214     }
215
216     public Connection JavaDoc getJdbcConnection(String JavaDoc datastore) {
217         checkClosed();
218         return realPM.getJdbcConnection(datastore);
219     }
220
221     public String JavaDoc getConnectionURL(String JavaDoc dataStore) {
222         checkClosed();
223         return realPM.getConnectionURL(dataStore);
224     }
225
226     public String JavaDoc getConnectionDriverName(String JavaDoc dataStore) {
227         checkClosed();
228         return realPM.getConnectionDriverName(dataStore);
229     }
230
231     public boolean isClosed() {
232         return realPM == null;
233     }
234
235     public void close() {
236         if (realPM == null) {
237             return;
238         }
239         realPM.close();
240     }
241
242     public Transaction currentTransaction() {
243         checkClosed();
244         return this;
245     }
246
247     public void evict(Object JavaDoc o) {
248         checkClosed();
249         realPM.evict(o);
250     }
251
252     public void evictAll(Object JavaDoc[] objects) {
253         checkClosed();
254         realPM.evictAll(objects);
255     }
256
257     public void evictAll(Collection JavaDoc collection) {
258         checkClosed();
259         realPM.evictAll(collection);
260     }
261
262     public void evictAll() {
263         checkClosed();
264         realPM.evictAll();
265     }
266
267     public void refresh(Object JavaDoc o) {
268         checkClosed();
269         realPM.refresh(o);
270     }
271
272     public void refreshAll(Object JavaDoc[] objects) {
273         checkClosed();
274         realPM.refreshAll(objects);
275     }
276
277     public void refreshAll(Collection JavaDoc collection) {
278         checkClosed();
279         realPM.refreshAll(collection);
280     }
281
282     public void refreshAll() {
283         checkClosed();
284         realPM.refreshAll();
285     }
286
287     public Query newQuery() {
288         checkClosed();
289         return realPM.newQuery();
290     }
291
292     public Query newQuery(Object JavaDoc o) {
293         checkClosed();
294         return realPM.newQuery(o);
295     }
296
297     public Query newQuery(String JavaDoc s, Object JavaDoc o) {
298         checkClosed();
299         return realPM.newQuery(s, o);
300     }
301
302     public Query newQuery(Class JavaDoc aClass) {
303         checkClosed();
304         return realPM.newQuery(aClass);
305     }
306
307     public Query newQuery(Extent extent) {
308         checkClosed();
309         return realPM.newQuery(extent);
310     }
311
312     public Query newQuery(Class JavaDoc aClass, Collection JavaDoc collection) {
313         checkClosed();
314         return realPM.newQuery(aClass, collection);
315     }
316
317     public Query newQuery(Class JavaDoc aClass, String JavaDoc s) {
318         checkClosed();
319         return realPM.newQuery(aClass, s);
320     }
321
322     public Query newQuery(Class JavaDoc aClass, Collection JavaDoc collection, String JavaDoc s) {
323         checkClosed();
324         return realPM.newQuery(aClass, collection, s);
325     }
326
327     public Query newQuery(Extent extent, String JavaDoc s) {
328         checkClosed();
329         return realPM.newQuery(extent, s);
330     }
331
332     public Extent getExtent(Class JavaDoc aClass, boolean b) {
333         checkClosed();
334         return realPM.getExtent(aClass, b);
335     }
336
337     public Object JavaDoc getObjectById(Object JavaDoc o, boolean b) {
338         checkClosed();
339         return realPM.getObjectById(o, b);
340     }
341
342     public Object JavaDoc getObjectId(Object JavaDoc o) {
343         checkClosed();
344         return realPM.getObjectId(o);
345     }
346
347     public Object JavaDoc getTransactionalObjectId(Object JavaDoc o) {
348         checkClosed();
349         return realPM.getTransactionalObjectId(o);
350     }
351
352     public Object JavaDoc newObjectIdInstance(Class JavaDoc aClass, String JavaDoc s) {
353         checkClosed();
354         return realPM.newObjectIdInstance(aClass, s);
355     }
356
357     public void makePersistent(Object JavaDoc o) {
358         checkClosed();
359         realPM.makePersistent(o);
360     }
361
362     public void makePersistentAll(Object JavaDoc[] objects) {
363         checkClosed();
364         realPM.makePersistentAll(objects);
365     }
366
367     public void makePersistentAll(Collection JavaDoc collection) {
368         checkClosed();
369         realPM.makePersistentAll(collection);
370     }
371
372     public void deletePersistent(Object JavaDoc o) {
373         checkClosed();
374         realPM.deletePersistent(o);
375     }
376
377     public void deletePersistentAll(Object JavaDoc[] objects) {
378         checkClosed();
379         realPM.deletePersistentAll(objects);
380     }
381
382     public void deletePersistentAll(Collection JavaDoc collection) {
383         checkClosed();
384         realPM.deletePersistentAll(collection);
385     }
386
387     public void makeTransient(Object JavaDoc o) {
388         checkClosed();
389         realPM.makeTransient(o);
390     }
391
392     public void makeTransientAll(Object JavaDoc[] objects) {
393         checkClosed();
394         realPM.makeTransientAll(objects);
395     }
396
397     public void makeTransientAll(Collection JavaDoc collection) {
398         checkClosed();
399         realPM.makeTransientAll(collection);
400     }
401
402     public void makeTransactional(Object JavaDoc o) {
403         checkClosed();
404         realPM.makeTransactional(o);
405     }
406
407     public void makeTransactionalAll(Object JavaDoc[] objects) {
408         checkClosed();
409         realPM.makeTransactionalAll(objects);
410     }
411
412     public void makeTransactionalAll(Collection JavaDoc collection) {
413         checkClosed();
414         realPM.makeTransactionalAll(collection);
415     }
416
417     public void makeNontransactional(Object JavaDoc o) {
418         checkClosed();
419         realPM.makeNontransactional(o);
420     }
421
422     public void makeNontransactionalAll(Object JavaDoc[] objects) {
423         checkClosed();
424         realPM.makeNontransactionalAll(objects);
425     }
426
427     public void makeNontransactionalAll(Collection JavaDoc collection) {
428         checkClosed();
429         realPM.makeNontransactionalAll(collection);
430     }
431
432     public void retrieve(Object JavaDoc o) {
433         checkClosed();
434         realPM.retrieve(o);
435     }
436
437     public void retrieveAll(Collection JavaDoc pcs, boolean DFGOnly) {
438         checkClosed();
439         realPM.retrieveAll(pcs, DFGOnly);
440     }
441
442     public void retrieveAll(Object JavaDoc[] pcs, boolean DFGOnly) {
443         checkClosed();
444         realPM.retrieveAll(pcs, DFGOnly);
445     }
446
447     public void retrieveAll(Collection JavaDoc collection) {
448         checkClosed();
449         realPM.retrieveAll(collection);
450     }
451
452     public void retrieveAll(Object JavaDoc[] objects) {
453         checkClosed();
454         realPM.retrieveAll(objects);
455     }
456
457     public void setUserObject(Object JavaDoc o) {
458         checkClosed();
459         realPM.setUserObject(o);
460     }
461
462     public Object JavaDoc getUserObject() {
463         checkClosed();
464         return realPM.getUserObject();
465     }
466
467     public PersistenceManagerFactory getPersistenceManagerFactory() {
468         checkClosed();
469         return realPM.getPersistenceManagerFactory();
470     }
471
472     public Class JavaDoc getObjectIdClass(Class JavaDoc aClass) {
473         checkClosed();
474         return realPM.getObjectIdClass(aClass);
475     }
476
477     public void setMultithreaded(boolean b) {
478         checkClosed();
479         realPM.setMultithreaded(b);
480     }
481
482     public boolean getMultithreaded() {
483         checkClosed();
484         return realPM.getMultithreaded();
485     }
486
487     public void setIgnoreCache(boolean b) {
488         checkClosed();
489         realPM.setIgnoreCache(b);
490     }
491
492     public boolean getIgnoreCache() {
493         checkClosed();
494         return realPM.getIgnoreCache();
495     }
496
497
498     public void commit(Xid JavaDoc xid, boolean b) throws XAException JavaDoc {
499         checkClosed();
500         realPM.commit(xid, b);
501     }
502
503     public void end(Xid JavaDoc xid, int i) throws XAException JavaDoc {
504         checkClosed();
505         realPM.end(xid, i);
506     }
507
508     public void forget(Xid JavaDoc xid) throws XAException JavaDoc {
509         checkClosed();
510         realPM.forget(xid);
511     }
512
513     public int getTransactionTimeout() throws XAException JavaDoc {
514         checkClosed();
515         return realPM.getTransactionTimeout();
516     }
517
518     public boolean isSameRM(XAResource JavaDoc xaResource) throws XAException JavaDoc {
519         if (realPM == null) return false;
520         return realPM.isSameRM(xaResource);
521     }
522
523     public int prepare(Xid JavaDoc xid) throws XAException JavaDoc {
524         checkClosed();
525         return realPM.prepare(xid);
526     }
527
528     public Xid JavaDoc[] recover(int i) throws XAException JavaDoc {
529         checkClosed();
530         return realPM.recover(i);
531     }
532
533     public void rollback(Xid JavaDoc xid) throws XAException JavaDoc {
534         checkClosed();
535         realPM.rollback(xid);
536     }
537
538     public boolean setTransactionTimeout(int i) throws XAException JavaDoc {
539         checkClosed();
540         return realPM.setTransactionTimeout(i);
541     }
542
543     public void start(Xid JavaDoc xid, int i) throws XAException JavaDoc {
544         checkClosed();
545         realPM.start(xid, i);
546     }
547
548     public void afterCompletion(int i) {
549         checkClosed();
550         realPM.afterCompletion(i);
551     }
552
553     public void beforeCompletion() {
554         checkClosed();
555         realPM.beforeCompletion();
556     }
557
558
559     public OID getInternalOID(final PersistenceCapable pc) {
560         checkClosed();
561         return realPM.getInternalOID(pc);
562     }
563
564     public PCStateMan getInternalSM(final PersistenceCapable pc) {
565         checkClosed();
566         return realPM.getInternalSM(pc);
567     }
568
569     public PCStateMan getInternalSM(OID oid) {
570         checkClosed();
571         return realPM.getInternalSM(oid);
572     }
573
574     public State getInternaleState(PersistenceCapable pc) {
575         checkClosed();
576         return realPM.getInternaleState(pc);
577     }
578
579     public void addTxStateObject(PCStateMan stateObject) {
580         checkClosed();
581         realPM.addTxStateObject(stateObject);
582     }
583
584     public void removeTxStateObject(PCStateMan stateObject) {
585         checkClosed();
586         realPM.removeTxStateObject(stateObject);
587     }
588
589     public boolean isOptimistic() {
590         checkClosed();
591         return realPM.getOptimistic();
592     }
593
594     public boolean isRetainValues() {
595         checkClosed();
596         return realPM.getRetainValues();
597     }
598
599     public boolean isRestoreValues() {
600         checkClosed();
601         return realPM.getRestoreValues();
602     }
603
604     public boolean isActive() {
605         checkClosed();
606         return realPM.isActive();
607     }
608
609     public void begin() {
610         checkClosed();
611         realPM.begin();
612     }
613
614     public void commit() {
615         checkClosed();
616         realPM.commit();
617     }
618
619     public boolean getNontransactionalRead() {
620         checkClosed();
621         return realPM.getNontransactionalRead();
622     }
623
624     public boolean getNontransactionalWrite() {
625         checkClosed();
626         return realPM.getNontransactionalWrite();
627     }
628
629     public boolean getOptimistic() {
630         checkClosed();
631         return realPM.getOptimistic();
632     }
633
634     public PersistenceManager getPersistenceManager() {
635         checkClosed();
636         return this;
637     }
638
639     public boolean getRestoreValues() {
640         checkClosed();
641         return realPM.getRestoreValues();
642     }
643
644     public boolean getRetainValues() {
645         checkClosed();
646         return realPM.getRetainValues();
647     }
648
649
650     public Synchronization JavaDoc getSynchronization() {
651         checkClosed();
652         return realPM.getSynchronization();
653     }
654
655
656     public void rollback() {
657         checkClosed();
658         realPM.rollback();
659     }
660
661     public void setNontransactionalRead(boolean b) {
662         checkClosed();
663         realPM.setNontransactionalRead(b);
664     }
665
666     public void setNontransactionalWrite(boolean b) {
667         checkClosed();
668         realPM.setNontransactionalWrite(b);
669     }
670
671     public void setOptimistic(boolean b) {
672         checkClosed();
673         realPM.setOptimistic(b);
674     }
675
676     public void setRestoreValues(boolean b) {
677         checkClosed();
678         realPM.setRestoreValues(b);
679     }
680
681     public void setRetainValues(boolean b) {
682         checkClosed();
683         realPM.setRetainValues(b);
684     }
685
686
687     public void setSynchronization(Synchronization JavaDoc synchronization) {
688         checkClosed();
689         realPM.setSynchronization(synchronization);
690     }
691
692
693     public void setDatastoreTxLocking(int mode) {
694         checkClosed();
695         realPM.setDatastoreTxLocking(mode);
696     }
697
698     public int getDatastoreTxLocking() {
699         checkClosed();
700         return realPM.getDatastoreTxLocking();
701     }
702
703     public void setRetainConnectionInOptTx(boolean on) {
704         checkClosed();
705         realPM.setRetainConnectionInOptTx(on);
706     }
707
708     public Object JavaDoc getObjectByIdFromCache(Object JavaDoc oid) {
709         checkClosed();
710         return realPM.getObjectByIdFromCache(oid);
711     }
712
713     public boolean isHollow(Object JavaDoc pc) {
714         checkClosed();
715         return realPM.isHollow(pc);
716     }
717
718     public boolean hasIdentity(Object JavaDoc pc) {
719         checkClosed();
720         return realPM.hasIdentity(pc);
721     }
722
723     public Object JavaDoc newObjectIdInstance(Class JavaDoc pcClass, String JavaDoc str,
724             boolean resolved) {
725         checkClosed();
726         return realPM.newObjectIdInstance(pcClass, str, resolved);
727     }
728
729     public Object JavaDoc getObjectByIDString(String JavaDoc value, boolean toValidate,
730             boolean resolved) {
731         checkClosed();
732         return realPM.getObjectByIDString(value, toValidate, resolved);
733     }
734
735     public void logEvent(int level, String JavaDoc description, int ms) {
736         checkClosed();
737         realPM.logEvent(level, description, ms);
738     }
739
740     public Query versantNewNamedQuery(Class JavaDoc cls, String JavaDoc queryName) {
741         checkClosed();
742         return realPM.versantNewNamedQuery(cls, queryName);
743     }
744
745     public boolean isCheckModelConsistencyOnCommit() {
746         checkClosed();
747         return realPM.isCheckModelConsistencyOnCommit();
748     }
749
750     public void setCheckModelConsistencyOnCommit(boolean on) {
751         checkClosed();
752         realPM.setCheckModelConsistencyOnCommit(on);
753     }
754
755     public void checkModelConsistency() {
756         checkClosed();
757         realPM.checkModelConsistency();
758     }
759
760     public int getObjectsById(Object JavaDoc[] oids, int length, Object JavaDoc[] data,
761             int stateFieldNo, int classMetaDataIndex) {
762         checkClosed();
763         return realPM.getObjectsById(oids, length, data, stateFieldNo,
764                 classMetaDataIndex);
765     }
766
767     public Collection JavaDoc versantDetachCopy(Collection JavaDoc pcs, String JavaDoc fetchGroup) {
768         checkClosed();
769         return realPM.versantDetachCopy(pcs, fetchGroup);
770     }
771
772     public Collection JavaDoc versantAttachCopy(Collection JavaDoc detached,
773             boolean makeTransactional) {
774         checkClosed();
775         return realPM.versantAttachCopy(detached, makeTransactional);
776     }
777
778     public Collection JavaDoc versantAttachCopy(Collection JavaDoc detached,
779             boolean makeTransactional, boolean shallow) {
780         return realPM.versantAttachCopy(detached, makeTransactional, shallow);
781     }
782
783     public void evictFromL2CacheAfterCommit(Object JavaDoc o) {
784         checkClosed();
785         realPM.evictFromL2CacheAfterCommit(o);
786     }
787
788     public void evictAllFromL2CacheAfterCommit(Object JavaDoc[] a) {
789         checkClosed();
790         realPM.evictAllFromL2CacheAfterCommit(a);
791     }
792
793     public void evictAllFromL2CacheAfterCommit(Collection JavaDoc c) {
794         checkClosed();
795         realPM.evictAllFromL2CacheAfterCommit(c);
796     }
797
798     public void evictAllFromL2CacheAfterCommit(Class JavaDoc cls,
799             boolean includeSubclasses) {
800         checkClosed();
801         realPM.evictAllFromL2CacheAfterCommit(cls, includeSubclasses);
802     }
803
804     public void evictAllFromL2CacheAfterCommit() {
805         checkClosed();
806         realPM.evictAllFromL2CacheAfterCommit();
807     }
808
809     public void addLifecycleListener(LifecycleListener listener,
810             Class JavaDoc[] classes) {
811         checkClosed();
812         realPM.addLifecycleListener(listener, classes);
813     }
814
815     public void removeLifecycleListener(LifecycleListener listener) {
816         checkClosed();
817         realPM.removeLifecycleListener(listener);
818     }
819
820     
821
822 }
823
Popular Tags