1 2 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 ; 25 import javax.transaction.xa.XAException ; 26 import javax.transaction.xa.XAResource ; 27 import javax.transaction.xa.Xid ; 28 29 import java.sql.Connection ; 30 import java.util.Collection ; 31 import java.util.List ; 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 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 [] 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 [] 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 getObjectField(PersistenceCapable pc, int fieldNo) { 102 return realPM.getObjectField(pc, fieldNo); 103 } 104 105 public int getQueryRowCount(CompiledQuery cq, Object [] params) { 106 return realPM.getStorageManager().executeQueryCount(null, cq, params); 107 } 108 109 public Object getOptimisticLockingValue(Object o) { 110 checkClosed(); 111 return realPM.getOptimisticLockingValue(o); 112 } 113 114 public void setPmCacheRefType(Object pc, int type) { 115 checkClosed(); 116 realPM.setPmCacheRefType(pc, type); 117 } 118 119 public void setPmCacheRefType(Object [] pcs, int type) { 120 checkClosed(); 121 realPM.setPmCacheRefType(pcs, type); 122 } 123 124 public void setPmCacheRefType(Collection 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 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 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 getObjectByIDString(String value, boolean toValidate) { 192 checkClosed(); 193 return realPM.getObjectByIDString(value, toValidate); 194 } 195 196 public void loadFetchGroup(Object pc, String 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 pc) { 212 checkClosed(); 213 realPM.makeTransientRecursive(pc); 214 } 215 216 public Connection getJdbcConnection(String datastore) { 217 checkClosed(); 218 return realPM.getJdbcConnection(datastore); 219 } 220 221 public String getConnectionURL(String dataStore) { 222 checkClosed(); 223 return realPM.getConnectionURL(dataStore); 224 } 225 226 public String getConnectionDriverName(String 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 o) { 248 checkClosed(); 249 realPM.evict(o); 250 } 251 252 public void evictAll(Object [] objects) { 253 checkClosed(); 254 realPM.evictAll(objects); 255 } 256 257 public void evictAll(Collection 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 o) { 268 checkClosed(); 269 realPM.refresh(o); 270 } 271 272 public void refreshAll(Object [] objects) { 273 checkClosed(); 274 realPM.refreshAll(objects); 275 } 276 277 public void refreshAll(Collection 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 o) { 293 checkClosed(); 294 return realPM.newQuery(o); 295 } 296 297 public Query newQuery(String s, Object o) { 298 checkClosed(); 299 return realPM.newQuery(s, o); 300 } 301 302 public Query newQuery(Class 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 aClass, Collection collection) { 313 checkClosed(); 314 return realPM.newQuery(aClass, collection); 315 } 316 317 public Query newQuery(Class aClass, String s) { 318 checkClosed(); 319 return realPM.newQuery(aClass, s); 320 } 321 322 public Query newQuery(Class aClass, Collection collection, String s) { 323 checkClosed(); 324 return realPM.newQuery(aClass, collection, s); 325 } 326 327 public Query newQuery(Extent extent, String s) { 328 checkClosed(); 329 return realPM.newQuery(extent, s); 330 } 331 332 public Extent getExtent(Class aClass, boolean b) { 333 checkClosed(); 334 return realPM.getExtent(aClass, b); 335 } 336 337 public Object getObjectById(Object o, boolean b) { 338 checkClosed(); 339 return realPM.getObjectById(o, b); 340 } 341 342 public Object getObjectId(Object o) { 343 checkClosed(); 344 return realPM.getObjectId(o); 345 } 346 347 public Object getTransactionalObjectId(Object o) { 348 checkClosed(); 349 return realPM.getTransactionalObjectId(o); 350 } 351 352 public Object newObjectIdInstance(Class aClass, String s) { 353 checkClosed(); 354 return realPM.newObjectIdInstance(aClass, s); 355 } 356 357 public void makePersistent(Object o) { 358 checkClosed(); 359 realPM.makePersistent(o); 360 } 361 362 public void makePersistentAll(Object [] objects) { 363 checkClosed(); 364 realPM.makePersistentAll(objects); 365 } 366 367 public void makePersistentAll(Collection collection) { 368 checkClosed(); 369 realPM.makePersistentAll(collection); 370 } 371 372 public void deletePersistent(Object o) { 373 checkClosed(); 374 realPM.deletePersistent(o); 375 } 376 377 public void deletePersistentAll(Object [] objects) { 378 checkClosed(); 379 realPM.deletePersistentAll(objects); 380 } 381 382 public void deletePersistentAll(Collection collection) { 383 checkClosed(); 384 realPM.deletePersistentAll(collection); 385 } 386 387 public void makeTransient(Object o) { 388 checkClosed(); 389 realPM.makeTransient(o); 390 } 391 392 public void makeTransientAll(Object [] objects) { 393 checkClosed(); 394 realPM.makeTransientAll(objects); 395 } 396 397 public void makeTransientAll(Collection collection) { 398 checkClosed(); 399 realPM.makeTransientAll(collection); 400 } 401 402 public void makeTransactional(Object o) { 403 checkClosed(); 404 realPM.makeTransactional(o); 405 } 406 407 public void makeTransactionalAll(Object [] objects) { 408 checkClosed(); 409 realPM.makeTransactionalAll(objects); 410 } 411 412 public void makeTransactionalAll(Collection collection) { 413 checkClosed(); 414 realPM.makeTransactionalAll(collection); 415 } 416 417 public void makeNontransactional(Object o) { 418 checkClosed(); 419 realPM.makeNontransactional(o); 420 } 421 422 public void makeNontransactionalAll(Object [] objects) { 423 checkClosed(); 424 realPM.makeNontransactionalAll(objects); 425 } 426 427 public void makeNontransactionalAll(Collection collection) { 428 checkClosed(); 429 realPM.makeNontransactionalAll(collection); 430 } 431 432 public void retrieve(Object o) { 433 checkClosed(); 434 realPM.retrieve(o); 435 } 436 437 public void retrieveAll(Collection pcs, boolean DFGOnly) { 438 checkClosed(); 439 realPM.retrieveAll(pcs, DFGOnly); 440 } 441 442 public void retrieveAll(Object [] pcs, boolean DFGOnly) { 443 checkClosed(); 444 realPM.retrieveAll(pcs, DFGOnly); 445 } 446 447 public void retrieveAll(Collection collection) { 448 checkClosed(); 449 realPM.retrieveAll(collection); 450 } 451 452 public void retrieveAll(Object [] objects) { 453 checkClosed(); 454 realPM.retrieveAll(objects); 455 } 456 457 public void setUserObject(Object o) { 458 checkClosed(); 459 realPM.setUserObject(o); 460 } 461 462 public Object getUserObject() { 463 checkClosed(); 464 return realPM.getUserObject(); 465 } 466 467 public PersistenceManagerFactory getPersistenceManagerFactory() { 468 checkClosed(); 469 return realPM.getPersistenceManagerFactory(); 470 } 471 472 public Class getObjectIdClass(Class 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 xid, boolean b) throws XAException { 499 checkClosed(); 500 realPM.commit(xid, b); 501 } 502 503 public void end(Xid xid, int i) throws XAException { 504 checkClosed(); 505 realPM.end(xid, i); 506 } 507 508 public void forget(Xid xid) throws XAException { 509 checkClosed(); 510 realPM.forget(xid); 511 } 512 513 public int getTransactionTimeout() throws XAException { 514 checkClosed(); 515 return realPM.getTransactionTimeout(); 516 } 517 518 public boolean isSameRM(XAResource xaResource) throws XAException { 519 if (realPM == null) return false; 520 return realPM.isSameRM(xaResource); 521 } 522 523 public int prepare(Xid xid) throws XAException { 524 checkClosed(); 525 return realPM.prepare(xid); 526 } 527 528 public Xid [] recover(int i) throws XAException { 529 checkClosed(); 530 return realPM.recover(i); 531 } 532 533 public void rollback(Xid xid) throws XAException { 534 checkClosed(); 535 realPM.rollback(xid); 536 } 537 538 public boolean setTransactionTimeout(int i) throws XAException { 539 checkClosed(); 540 return realPM.setTransactionTimeout(i); 541 } 542 543 public void start(Xid xid, int i) throws XAException { 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 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 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 getObjectByIdFromCache(Object oid) { 709 checkClosed(); 710 return realPM.getObjectByIdFromCache(oid); 711 } 712 713 public boolean isHollow(Object pc) { 714 checkClosed(); 715 return realPM.isHollow(pc); 716 } 717 718 public boolean hasIdentity(Object pc) { 719 checkClosed(); 720 return realPM.hasIdentity(pc); 721 } 722 723 public Object newObjectIdInstance(Class pcClass, String str, 724 boolean resolved) { 725 checkClosed(); 726 return realPM.newObjectIdInstance(pcClass, str, resolved); 727 } 728 729 public Object getObjectByIDString(String value, boolean toValidate, 730 boolean resolved) { 731 checkClosed(); 732 return realPM.getObjectByIDString(value, toValidate, resolved); 733 } 734 735 public void logEvent(int level, String description, int ms) { 736 checkClosed(); 737 realPM.logEvent(level, description, ms); 738 } 739 740 public Query versantNewNamedQuery(Class cls, String 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 [] oids, int length, Object [] data, 761 int stateFieldNo, int classMetaDataIndex) { 762 checkClosed(); 763 return realPM.getObjectsById(oids, length, data, stateFieldNo, 764 classMetaDataIndex); 765 } 766 767 public Collection versantDetachCopy(Collection pcs, String fetchGroup) { 768 checkClosed(); 769 return realPM.versantDetachCopy(pcs, fetchGroup); 770 } 771 772 public Collection versantAttachCopy(Collection detached, 773 boolean makeTransactional) { 774 checkClosed(); 775 return realPM.versantAttachCopy(detached, makeTransactional); 776 } 777 778 public Collection versantAttachCopy(Collection detached, 779 boolean makeTransactional, boolean shallow) { 780 return realPM.versantAttachCopy(detached, makeTransactional, shallow); 781 } 782 783 public void evictFromL2CacheAfterCommit(Object o) { 784 checkClosed(); 785 realPM.evictFromL2CacheAfterCommit(o); 786 } 787 788 public void evictAllFromL2CacheAfterCommit(Object [] a) { 789 checkClosed(); 790 realPM.evictAllFromL2CacheAfterCommit(a); 791 } 792 793 public void evictAllFromL2CacheAfterCommit(Collection c) { 794 checkClosed(); 795 realPM.evictAllFromL2CacheAfterCommit(c); 796 } 797 798 public void evictAllFromL2CacheAfterCommit(Class 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 [] 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 |