0001: /*
0002: * Licensed to the Apache Software Foundation (ASF) under one
0003: * or more contributor license agreements. See the NOTICE file
0004: * distributed with this work for additional information
0005: * regarding copyright ownership. The ASF licenses this file
0006: * to you under the Apache License, Version 2.0 (the
0007: * "License"); you may not use this file except in compliance
0008: * with the License. You may obtain a copy of the License at
0009: *
0010: * http://www.apache.org/licenses/LICENSE-2.0
0011: *
0012: * Unless required by applicable law or agreed to in writing,
0013: * software distributed under the License is distributed on an
0014: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0015: * KIND, either express or implied. See the License for the
0016: * specific language governing permissions and limitations
0017: * under the License.
0018: */
0019: package org.apache.openjpa.kernel;
0020:
0021: import java.util.BitSet;
0022: import java.util.Collection;
0023: import java.util.Iterator;
0024:
0025: import org.apache.openjpa.conf.OpenJPAConfiguration;
0026: import org.apache.openjpa.ee.ManagedRuntime;
0027: import org.apache.openjpa.event.LifecycleEventManager;
0028: import org.apache.openjpa.meta.ClassMetaData;
0029: import org.apache.openjpa.meta.FieldMetaData;
0030: import org.apache.openjpa.meta.ValueMetaData;
0031: import org.apache.openjpa.util.RuntimeExceptionTranslator;
0032:
0033: ///////////////////////////////////////////////////////////////
0034: // NOTE: when adding a public API method, be sure to add it to
0035: // JDO and JPA facades!
0036: ///////////////////////////////////////////////////////////////
0037:
0038: /**
0039: * Delegating broker that can also perform exception translation
0040: * for use in facades.
0041: *
0042: * @since 0.4.0
0043: * @author Abe White
0044: * @nojavadoc
0045: */
0046: public class DelegatingBroker implements Broker {
0047:
0048: private final Broker _broker;
0049: private final DelegatingBroker _del;
0050: private final RuntimeExceptionTranslator _trans;
0051:
0052: /**
0053: * Constructor; supply delegate.
0054: */
0055: public DelegatingBroker(Broker broker) {
0056: this (broker, null);
0057: }
0058:
0059: /**
0060: * Constructor; supply delegate and exception translator.
0061: */
0062: public DelegatingBroker(Broker broker,
0063: RuntimeExceptionTranslator trans) {
0064: _broker = broker;
0065: if (broker instanceof DelegatingBroker)
0066: _del = (DelegatingBroker) broker;
0067: else
0068: _del = null;
0069: _trans = trans;
0070: }
0071:
0072: /**
0073: * Return the direct delegate.
0074: */
0075: public Broker getDelegate() {
0076: return _broker;
0077: }
0078:
0079: /**
0080: * Return the native delegate.
0081: */
0082: public Broker getInnermostDelegate() {
0083: return (_del == null) ? _broker : _del.getInnermostDelegate();
0084: }
0085:
0086: public int hashCode() {
0087: return getInnermostDelegate().hashCode();
0088: }
0089:
0090: public boolean equals(Object other) {
0091: if (other == this )
0092: return true;
0093: if (other instanceof DelegatingBroker)
0094: other = ((DelegatingBroker) other).getInnermostDelegate();
0095: return getInnermostDelegate().equals(other);
0096: }
0097:
0098: /**
0099: * Translate the OpenJPA exception.
0100: */
0101: protected RuntimeException translate(RuntimeException re) {
0102: return (_trans == null) ? re : _trans.translate(re);
0103: }
0104:
0105: public Broker getBroker() {
0106: return this ;
0107: }
0108:
0109: public OpenJPAConfiguration getConfiguration() {
0110: try {
0111: return _broker.getConfiguration();
0112: } catch (RuntimeException re) {
0113: throw translate(re);
0114: }
0115: }
0116:
0117: public FetchConfiguration getFetchConfiguration() {
0118: try {
0119: return _broker.getFetchConfiguration();
0120: } catch (RuntimeException re) {
0121: throw translate(re);
0122: }
0123: }
0124:
0125: public ClassLoader getClassLoader() {
0126: try {
0127: return _broker.getClassLoader();
0128: } catch (RuntimeException re) {
0129: throw translate(re);
0130: }
0131: }
0132:
0133: public LockManager getLockManager() {
0134: try {
0135: return _broker.getLockManager();
0136: } catch (RuntimeException re) {
0137: throw translate(re);
0138: }
0139: }
0140:
0141: public DelegatingStoreManager getStoreManager() {
0142: try {
0143: return _broker.getStoreManager();
0144: } catch (RuntimeException re) {
0145: throw translate(re);
0146: }
0147: }
0148:
0149: public String getConnectionUserName() {
0150: try {
0151: return _broker.getConnectionUserName();
0152: } catch (RuntimeException re) {
0153: throw translate(re);
0154: }
0155: }
0156:
0157: public String getConnectionPassword() {
0158: try {
0159: return _broker.getConnectionPassword();
0160: } catch (RuntimeException re) {
0161: throw translate(re);
0162: }
0163: }
0164:
0165: public Object find(Object oid, boolean validate, FindCallbacks call) {
0166: try {
0167: return _broker.find(oid, validate, call);
0168: } catch (RuntimeException re) {
0169: throw translate(re);
0170: }
0171: }
0172:
0173: public Object[] findAll(Collection oids, boolean validate,
0174: FindCallbacks call) {
0175: try {
0176: return _broker.findAll(oids, validate, call);
0177: } catch (RuntimeException re) {
0178: throw translate(re);
0179: }
0180: }
0181:
0182: public Object findCached(Object oid, FindCallbacks call) {
0183: try {
0184: return _broker.findCached(oid, call);
0185: } catch (RuntimeException re) {
0186: throw translate(re);
0187: }
0188: }
0189:
0190: public Object find(Object oid, FetchConfiguration fetch,
0191: BitSet exclude, Object edata, int flags) {
0192: try {
0193: return _broker.find(oid, fetch, exclude, edata, flags);
0194: } catch (RuntimeException re) {
0195: throw translate(re);
0196: }
0197: }
0198:
0199: public Object[] findAll(Collection oids, FetchConfiguration fetch,
0200: BitSet exclude, Object edata, int flags) {
0201: try {
0202: return _broker.findAll(oids, fetch, exclude, edata, flags);
0203: } catch (RuntimeException re) {
0204: throw translate(re);
0205: }
0206: }
0207:
0208: public Iterator extentIterator(Class cls, boolean subs,
0209: FetchConfiguration fetch, boolean ignoreChanges) {
0210: try {
0211: return _broker.extentIterator(cls, subs, fetch,
0212: ignoreChanges);
0213: } catch (RuntimeException re) {
0214: throw translate(re);
0215: }
0216: }
0217:
0218: public void retrieve(Object obj, boolean fgOnly, OpCallbacks call) {
0219: try {
0220: _broker.retrieve(obj, fgOnly, call);
0221: } catch (RuntimeException re) {
0222: throw translate(re);
0223: }
0224: }
0225:
0226: public void retrieveAll(Collection objs, boolean fgOnly,
0227: OpCallbacks call) {
0228: try {
0229: _broker.retrieveAll(objs, fgOnly, call);
0230: } catch (RuntimeException re) {
0231: throw translate(re);
0232: }
0233: }
0234:
0235: public OpenJPAStateManager embed(Object obj, Object id,
0236: OpenJPAStateManager owner, ValueMetaData ownerMeta) {
0237: try {
0238: return _broker.embed(obj, id, owner, ownerMeta);
0239: } catch (RuntimeException re) {
0240: throw translate(re);
0241: }
0242: }
0243:
0244: public Class getObjectIdType(Class cls) {
0245: try {
0246: return _broker.getObjectIdType(cls);
0247: } catch (RuntimeException re) {
0248: throw translate(re);
0249: }
0250: }
0251:
0252: public Object newObjectId(Class cls, Object val) {
0253: try {
0254: return _broker.newObjectId(cls, val);
0255: } catch (RuntimeException re) {
0256: throw translate(re);
0257: }
0258: }
0259:
0260: public Collection getManagedObjects() {
0261: try {
0262: return _broker.getManagedObjects();
0263: } catch (RuntimeException re) {
0264: throw translate(re);
0265: }
0266: }
0267:
0268: public Collection getTransactionalObjects() {
0269: try {
0270: return _broker.getTransactionalObjects();
0271: } catch (RuntimeException re) {
0272: throw translate(re);
0273: }
0274: }
0275:
0276: public Collection getPendingTransactionalObjects() {
0277: try {
0278: return _broker.getPendingTransactionalObjects();
0279: } catch (RuntimeException re) {
0280: throw translate(re);
0281: }
0282: }
0283:
0284: public Collection getDirtyObjects() {
0285: try {
0286: return _broker.getDirtyObjects();
0287: } catch (RuntimeException re) {
0288: throw translate(re);
0289: }
0290: }
0291:
0292: public boolean getOrderDirtyObjects() {
0293: try {
0294: return _broker.getOrderDirtyObjects();
0295: } catch (RuntimeException re) {
0296: throw translate(re);
0297: }
0298: }
0299:
0300: public void setOrderDirtyObjects(boolean order) {
0301: try {
0302: _broker.setOrderDirtyObjects(order);
0303: } catch (RuntimeException re) {
0304: throw translate(re);
0305: }
0306: }
0307:
0308: public Collection getPersistedTypes() {
0309: try {
0310: return _broker.getPersistedTypes();
0311: } catch (RuntimeException re) {
0312: throw translate(re);
0313: }
0314: }
0315:
0316: public Collection getUpdatedTypes() {
0317: try {
0318: return _broker.getUpdatedTypes();
0319: } catch (RuntimeException re) {
0320: throw translate(re);
0321: }
0322: }
0323:
0324: public Collection getDeletedTypes() {
0325: try {
0326: return _broker.getDeletedTypes();
0327: } catch (RuntimeException re) {
0328: throw translate(re);
0329: }
0330: }
0331:
0332: public OpenJPAStateManager getStateManager(Object obj) {
0333: try {
0334: return _broker.getStateManager(obj);
0335: } catch (RuntimeException re) {
0336: throw translate(re);
0337: }
0338: }
0339:
0340: public int getLockLevel(Object obj) {
0341: try {
0342: return _broker.getLockLevel(obj);
0343: } catch (RuntimeException re) {
0344: throw translate(re);
0345: }
0346: }
0347:
0348: public Object getVersion(Object obj) {
0349: try {
0350: return _broker.getVersion(obj);
0351: } catch (RuntimeException re) {
0352: throw translate(re);
0353: }
0354: }
0355:
0356: public boolean isDirty(Object obj) {
0357: try {
0358: return _broker.isDirty(obj);
0359: } catch (RuntimeException re) {
0360: throw translate(re);
0361: }
0362: }
0363:
0364: public boolean isTransactional(Object obj) {
0365: try {
0366: return _broker.isTransactional(obj);
0367: } catch (RuntimeException re) {
0368: throw translate(re);
0369: }
0370: }
0371:
0372: public boolean isPersistent(Object obj) {
0373: try {
0374: return _broker.isPersistent(obj);
0375: } catch (RuntimeException re) {
0376: throw translate(re);
0377: }
0378: }
0379:
0380: public boolean isNew(Object obj) {
0381: try {
0382: return _broker.isNew(obj);
0383: } catch (RuntimeException re) {
0384: throw translate(re);
0385: }
0386: }
0387:
0388: public boolean isDeleted(Object obj) {
0389: try {
0390: return _broker.isDeleted(obj);
0391: } catch (RuntimeException re) {
0392: throw translate(re);
0393: }
0394: }
0395:
0396: public Object getObjectId(Object obj) {
0397: try {
0398: return _broker.getObjectId(obj);
0399: } catch (RuntimeException re) {
0400: throw translate(re);
0401: }
0402: }
0403:
0404: public boolean isManaged() {
0405: try {
0406: return _broker.isManaged();
0407: } catch (RuntimeException re) {
0408: throw translate(re);
0409: }
0410: }
0411:
0412: public boolean isActive() {
0413: try {
0414: return _broker.isActive();
0415: } catch (RuntimeException re) {
0416: throw translate(re);
0417: }
0418: }
0419:
0420: public boolean isStoreActive() {
0421: try {
0422: return _broker.isStoreActive();
0423: } catch (RuntimeException re) {
0424: throw translate(re);
0425: }
0426: }
0427:
0428: public boolean hasConnection() {
0429: try {
0430: return _broker.hasConnection();
0431: } catch (RuntimeException re) {
0432: throw translate(re);
0433: }
0434: }
0435:
0436: public Object getConnection() {
0437: try {
0438: return _broker.getConnection();
0439: } catch (RuntimeException re) {
0440: throw translate(re);
0441: }
0442: }
0443:
0444: public void lock() {
0445: try {
0446: _broker.lock();
0447: } catch (RuntimeException re) {
0448: throw translate(re);
0449: }
0450: }
0451:
0452: public void unlock() {
0453: try {
0454: _broker.unlock();
0455: } catch (RuntimeException re) {
0456: throw translate(re);
0457: }
0458: }
0459:
0460: public boolean beginOperation(boolean read) {
0461: try {
0462: return _broker.beginOperation(read);
0463: } catch (RuntimeException re) {
0464: throw translate(re);
0465: }
0466: }
0467:
0468: public boolean endOperation() {
0469: try {
0470: return _broker.endOperation();
0471: } catch (RuntimeException re) {
0472: throw translate(re);
0473: }
0474: }
0475:
0476: public void setImplicitBehavior(OpCallbacks call,
0477: RuntimeExceptionTranslator ex) {
0478: try {
0479: _broker.setImplicitBehavior(call, ex);
0480: } catch (RuntimeException re) {
0481: throw translate(re);
0482: }
0483: }
0484:
0485: public BrokerFactory getBrokerFactory() {
0486: try {
0487: return _broker.getBrokerFactory();
0488: } catch (RuntimeException re) {
0489: throw translate(re);
0490: }
0491: }
0492:
0493: public int getConnectionRetainMode() {
0494: try {
0495: return _broker.getConnectionRetainMode();
0496: } catch (RuntimeException re) {
0497: throw translate(re);
0498: }
0499: }
0500:
0501: public ManagedRuntime getManagedRuntime() {
0502: try {
0503: return _broker.getManagedRuntime();
0504: } catch (RuntimeException re) {
0505: throw translate(re);
0506: }
0507: }
0508:
0509: public InverseManager getInverseManager() {
0510: try {
0511: return _broker.getInverseManager();
0512: } catch (RuntimeException re) {
0513: throw translate(re);
0514: }
0515: }
0516:
0517: public boolean getMultithreaded() {
0518: try {
0519: return _broker.getMultithreaded();
0520: } catch (RuntimeException re) {
0521: throw translate(re);
0522: }
0523: }
0524:
0525: public void setMultithreaded(boolean multi) {
0526: try {
0527: _broker.setMultithreaded(multi);
0528: } catch (RuntimeException re) {
0529: throw translate(re);
0530: }
0531: }
0532:
0533: public boolean getIgnoreChanges() {
0534: try {
0535: return _broker.getIgnoreChanges();
0536: } catch (RuntimeException re) {
0537: throw translate(re);
0538: }
0539: }
0540:
0541: public void setIgnoreChanges(boolean ignore) {
0542: try {
0543: _broker.setIgnoreChanges(ignore);
0544: } catch (RuntimeException re) {
0545: throw translate(re);
0546: }
0547: }
0548:
0549: public boolean getNontransactionalRead() {
0550: try {
0551: return _broker.getNontransactionalRead();
0552: } catch (RuntimeException re) {
0553: throw translate(re);
0554: }
0555: }
0556:
0557: public void setNontransactionalRead(boolean read) {
0558: try {
0559: _broker.setNontransactionalRead(read);
0560: } catch (RuntimeException re) {
0561: throw translate(re);
0562: }
0563: }
0564:
0565: public boolean getNontransactionalWrite() {
0566: try {
0567: return _broker.getNontransactionalWrite();
0568: } catch (RuntimeException re) {
0569: throw translate(re);
0570: }
0571: }
0572:
0573: public void setNontransactionalWrite(boolean write) {
0574: try {
0575: _broker.setNontransactionalWrite(write);
0576: } catch (RuntimeException re) {
0577: throw translate(re);
0578: }
0579: }
0580:
0581: public int getRestoreState() {
0582: try {
0583: return _broker.getRestoreState();
0584: } catch (RuntimeException re) {
0585: throw translate(re);
0586: }
0587: }
0588:
0589: public void setRestoreState(int restore) {
0590: try {
0591: _broker.setRestoreState(restore);
0592: } catch (RuntimeException re) {
0593: throw translate(re);
0594: }
0595: }
0596:
0597: public boolean getOptimistic() {
0598: try {
0599: return _broker.getOptimistic();
0600: } catch (RuntimeException re) {
0601: throw translate(re);
0602: }
0603: }
0604:
0605: public void setOptimistic(boolean opt) {
0606: try {
0607: _broker.setOptimistic(opt);
0608: } catch (RuntimeException re) {
0609: throw translate(re);
0610: }
0611: }
0612:
0613: public boolean getRetainState() {
0614: try {
0615: return _broker.getRetainState();
0616: } catch (RuntimeException re) {
0617: throw translate(re);
0618: }
0619: }
0620:
0621: public void setRetainState(boolean retain) {
0622: try {
0623: _broker.setRetainState(retain);
0624: } catch (RuntimeException re) {
0625: throw translate(re);
0626: }
0627: }
0628:
0629: public int getAutoClear() {
0630: try {
0631: return _broker.getAutoClear();
0632: } catch (RuntimeException re) {
0633: throw translate(re);
0634: }
0635: }
0636:
0637: public void setAutoClear(int clear) {
0638: try {
0639: _broker.setAutoClear(clear);
0640: } catch (RuntimeException re) {
0641: throw translate(re);
0642: }
0643: }
0644:
0645: public int getAutoDetach() {
0646: try {
0647: return _broker.getAutoDetach();
0648: } catch (RuntimeException re) {
0649: throw translate(re);
0650: }
0651: }
0652:
0653: public void setAutoDetach(int flags) {
0654: try {
0655: _broker.setAutoDetach(flags);
0656: } catch (RuntimeException re) {
0657: throw translate(re);
0658: }
0659: }
0660:
0661: public void setAutoDetach(int flag, boolean on) {
0662: try {
0663: _broker.setAutoDetach(flag, on);
0664: } catch (RuntimeException re) {
0665: throw translate(re);
0666: }
0667: }
0668:
0669: public int getDetachState() {
0670: try {
0671: return _broker.getDetachState();
0672: } catch (RuntimeException re) {
0673: throw translate(re);
0674: }
0675: }
0676:
0677: public void setDetachState(int mode) {
0678: try {
0679: _broker.setDetachState(mode);
0680: } catch (RuntimeException re) {
0681: throw translate(re);
0682: }
0683: }
0684:
0685: public boolean isDetachedNew() {
0686: try {
0687: return _broker.isDetachedNew();
0688: } catch (RuntimeException re) {
0689: throw translate(re);
0690: }
0691: }
0692:
0693: public void setDetachedNew(boolean isNew) {
0694: try {
0695: _broker.setDetachedNew(isNew);
0696: } catch (RuntimeException re) {
0697: throw translate(re);
0698: }
0699: }
0700:
0701: public boolean getSyncWithManagedTransactions() {
0702: try {
0703: return _broker.getSyncWithManagedTransactions();
0704: } catch (RuntimeException re) {
0705: throw translate(re);
0706: }
0707: }
0708:
0709: public void setSyncWithManagedTransactions(boolean sync) {
0710: try {
0711: _broker.setSyncWithManagedTransactions(sync);
0712: } catch (RuntimeException re) {
0713: throw translate(re);
0714: }
0715: }
0716:
0717: public boolean getEvictFromDataCache() {
0718: try {
0719: return _broker.getEvictFromDataCache();
0720: } catch (RuntimeException re) {
0721: throw translate(re);
0722: }
0723: }
0724:
0725: public void setEvictFromDataCache(boolean evict) {
0726: try {
0727: _broker.setEvictFromDataCache(evict);
0728: } catch (RuntimeException re) {
0729: throw translate(re);
0730: }
0731: }
0732:
0733: public boolean getPopulateDataCache() {
0734: try {
0735: return _broker.getPopulateDataCache();
0736: } catch (RuntimeException re) {
0737: throw translate(re);
0738: }
0739: }
0740:
0741: public void setPopulateDataCache(boolean cache) {
0742: try {
0743: _broker.setPopulateDataCache(cache);
0744: } catch (RuntimeException re) {
0745: throw translate(re);
0746: }
0747: }
0748:
0749: public boolean isTrackChangesByType() {
0750: try {
0751: return _broker.isTrackChangesByType();
0752: } catch (RuntimeException re) {
0753: throw translate(re);
0754: }
0755: }
0756:
0757: public void setTrackChangesByType(boolean largeTransaction) {
0758: try {
0759: _broker.setTrackChangesByType(largeTransaction);
0760: } catch (RuntimeException re) {
0761: throw translate(re);
0762: }
0763: }
0764:
0765: public Object putUserObject(Object key, Object val) {
0766: try {
0767: return _broker.putUserObject(key, val);
0768: } catch (RuntimeException re) {
0769: throw translate(re);
0770: }
0771: }
0772:
0773: public Object getUserObject(Object key) {
0774: try {
0775: return _broker.getUserObject(key);
0776: } catch (RuntimeException re) {
0777: throw translate(re);
0778: }
0779: }
0780:
0781: public void addTransactionListener(Object listener) {
0782: try {
0783: _broker.addTransactionListener(listener);
0784: } catch (RuntimeException re) {
0785: throw translate(re);
0786: }
0787: }
0788:
0789: public void removeTransactionListener(Object listener) {
0790: try {
0791: _broker.removeTransactionListener(listener);
0792: } catch (RuntimeException re) {
0793: throw translate(re);
0794: }
0795: }
0796:
0797: public int getTransactionListenerCallbackMode() {
0798: try {
0799: return _broker.getTransactionListenerCallbackMode();
0800: } catch (RuntimeException re) {
0801: throw translate(re);
0802: }
0803: }
0804:
0805: public void setTransactionListenerCallbackMode(int mode) {
0806: try {
0807: _broker.setTransactionListenerCallbackMode(mode);
0808: } catch (RuntimeException re) {
0809: throw translate(re);
0810: }
0811: }
0812:
0813: public void addLifecycleListener(Object listener, Class[] classes) {
0814: try {
0815: _broker.addLifecycleListener(listener, classes);
0816: } catch (RuntimeException re) {
0817: throw translate(re);
0818: }
0819: }
0820:
0821: public void removeLifecycleListener(Object listener) {
0822: try {
0823: _broker.removeLifecycleListener(listener);
0824: } catch (RuntimeException re) {
0825: throw translate(re);
0826: }
0827: }
0828:
0829: public int getLifecycleListenerCallbackMode() {
0830: try {
0831: return _broker.getLifecycleListenerCallbackMode();
0832: } catch (RuntimeException re) {
0833: throw translate(re);
0834: }
0835: }
0836:
0837: public void setLifecycleListenerCallbackMode(int mode) {
0838: try {
0839: _broker.setLifecycleListenerCallbackMode(mode);
0840: } catch (RuntimeException re) {
0841: throw translate(re);
0842: }
0843: }
0844:
0845: public LifecycleEventManager getLifecycleEventManager() {
0846: try {
0847: return _broker.getLifecycleEventManager();
0848: } catch (RuntimeException re) {
0849: throw translate(re);
0850: }
0851: }
0852:
0853: public void begin() {
0854: try {
0855: _broker.begin();
0856: } catch (RuntimeException re) {
0857: throw translate(re);
0858: }
0859: }
0860:
0861: public void commit() {
0862: try {
0863: _broker.commit();
0864: } catch (RuntimeException re) {
0865: throw translate(re);
0866: }
0867: }
0868:
0869: public void rollback() {
0870: try {
0871: _broker.rollback();
0872: } catch (RuntimeException re) {
0873: throw translate(re);
0874: }
0875: }
0876:
0877: public boolean syncWithManagedTransaction() {
0878: try {
0879: return _broker.syncWithManagedTransaction();
0880: } catch (RuntimeException re) {
0881: throw translate(re);
0882: }
0883: }
0884:
0885: public void commitAndResume() {
0886: try {
0887: _broker.commitAndResume();
0888: } catch (RuntimeException re) {
0889: throw translate(re);
0890: }
0891: }
0892:
0893: public void rollbackAndResume() {
0894: try {
0895: _broker.rollbackAndResume();
0896: } catch (RuntimeException re) {
0897: throw translate(re);
0898: }
0899: }
0900:
0901: public void setRollbackOnly() {
0902: try {
0903: _broker.setRollbackOnly();
0904: } catch (RuntimeException re) {
0905: throw translate(re);
0906: }
0907: }
0908:
0909: public void setRollbackOnly(Throwable cause) {
0910: try {
0911: _broker.setRollbackOnly(cause);
0912: } catch (RuntimeException re) {
0913: throw translate(re);
0914: }
0915: }
0916:
0917: public Throwable getRollbackCause() {
0918: try {
0919: return _broker.getRollbackCause();
0920: } catch (RuntimeException re) {
0921: throw translate(re);
0922: }
0923: }
0924:
0925: public boolean getRollbackOnly() {
0926: try {
0927: return _broker.getRollbackOnly();
0928: } catch (RuntimeException re) {
0929: throw translate(re);
0930: }
0931: }
0932:
0933: public void setSavepoint(String name) {
0934: try {
0935: _broker.setSavepoint(name);
0936: } catch (RuntimeException re) {
0937: throw translate(re);
0938: }
0939: }
0940:
0941: public void rollbackToSavepoint() {
0942: try {
0943: _broker.rollbackToSavepoint();
0944: } catch (RuntimeException re) {
0945: throw translate(re);
0946: }
0947: }
0948:
0949: public void rollbackToSavepoint(String name) {
0950: try {
0951: _broker.rollbackToSavepoint(name);
0952: } catch (RuntimeException re) {
0953: throw translate(re);
0954: }
0955: }
0956:
0957: public void releaseSavepoint() {
0958: try {
0959: _broker.releaseSavepoint();
0960: } catch (RuntimeException re) {
0961: throw translate(re);
0962: }
0963: }
0964:
0965: public void releaseSavepoint(String name) {
0966: try {
0967: _broker.releaseSavepoint(name);
0968: } catch (RuntimeException re) {
0969: throw translate(re);
0970: }
0971: }
0972:
0973: public void flush() {
0974: try {
0975: _broker.flush();
0976: } catch (RuntimeException re) {
0977: throw translate(re);
0978: }
0979: }
0980:
0981: public void preFlush() {
0982: try {
0983: _broker.preFlush();
0984: } catch (RuntimeException re) {
0985: throw translate(re);
0986: }
0987: }
0988:
0989: public void validateChanges() {
0990: try {
0991: _broker.validateChanges();
0992: } catch (RuntimeException re) {
0993: throw translate(re);
0994: }
0995: }
0996:
0997: public void beginStore() {
0998: try {
0999: _broker.beginStore();
1000: } catch (RuntimeException re) {
1001: throw translate(re);
1002: }
1003: }
1004:
1005: public void persist(Object obj, OpCallbacks call) {
1006: try {
1007: _broker.persist(obj, call);
1008: } catch (RuntimeException re) {
1009: throw translate(re);
1010: }
1011: }
1012:
1013: public void persistAll(Collection objs, OpCallbacks call) {
1014: try {
1015: _broker.persistAll(objs, call);
1016: } catch (RuntimeException re) {
1017: throw translate(re);
1018: }
1019: }
1020:
1021: public OpenJPAStateManager persist(Object obj, Object id,
1022: OpCallbacks call) {
1023: try {
1024: return _broker.persist(obj, id, call);
1025: } catch (RuntimeException re) {
1026: throw translate(re);
1027: }
1028: }
1029:
1030: public void delete(Object obj, OpCallbacks call) {
1031: try {
1032: _broker.delete(obj, call);
1033: } catch (RuntimeException re) {
1034: throw translate(re);
1035: }
1036: }
1037:
1038: public void deleteAll(Collection objs, OpCallbacks call) {
1039: try {
1040: _broker.deleteAll(objs, call);
1041: } catch (RuntimeException re) {
1042: throw translate(re);
1043: }
1044: }
1045:
1046: public void release(Object obj, OpCallbacks call) {
1047: try {
1048: _broker.release(obj, call);
1049: } catch (RuntimeException re) {
1050: throw translate(re);
1051: }
1052: }
1053:
1054: public void releaseAll(Collection objs, OpCallbacks call) {
1055: try {
1056: _broker.releaseAll(objs, call);
1057: } catch (RuntimeException re) {
1058: throw translate(re);
1059: }
1060: }
1061:
1062: public void refresh(Object obj, OpCallbacks call) {
1063: try {
1064: _broker.refresh(obj, call);
1065: } catch (RuntimeException re) {
1066: throw translate(re);
1067: }
1068: }
1069:
1070: public void refreshAll(Collection objs, OpCallbacks call) {
1071: try {
1072: _broker.refreshAll(objs, call);
1073: } catch (RuntimeException re) {
1074: throw translate(re);
1075: }
1076: }
1077:
1078: public void evict(Object obj, OpCallbacks call) {
1079: try {
1080: _broker.evict(obj, call);
1081: } catch (RuntimeException re) {
1082: throw translate(re);
1083: }
1084: }
1085:
1086: public void evictAll(Collection objs, OpCallbacks call) {
1087: try {
1088: _broker.evictAll(objs, call);
1089: } catch (RuntimeException re) {
1090: throw translate(re);
1091: }
1092: }
1093:
1094: public void evictAll(OpCallbacks call) {
1095: try {
1096: _broker.evictAll(call);
1097: } catch (RuntimeException re) {
1098: throw translate(re);
1099: }
1100: }
1101:
1102: public void evictAll(Extent extent, OpCallbacks call) {
1103: try {
1104: _broker.evictAll(extent, call);
1105: } catch (RuntimeException re) {
1106: throw translate(re);
1107: }
1108: }
1109:
1110: public Object detach(Object obj, OpCallbacks call) {
1111: try {
1112: return _broker.detach(obj, call);
1113: } catch (RuntimeException re) {
1114: throw translate(re);
1115: }
1116: }
1117:
1118: public Object[] detachAll(Collection objs, OpCallbacks call) {
1119: try {
1120: return _broker.detachAll(objs, call);
1121: } catch (RuntimeException re) {
1122: throw translate(re);
1123: }
1124: }
1125:
1126: public void detachAll(OpCallbacks call) {
1127: try {
1128: _broker.detachAll(call);
1129: } catch (RuntimeException re) {
1130: throw translate(re);
1131: }
1132: }
1133:
1134: public void detachAll(OpCallbacks call, boolean flush) {
1135: try {
1136: _broker.detachAll(call, flush);
1137: } catch (RuntimeException re) {
1138: throw translate(re);
1139: }
1140: }
1141:
1142: public Object attach(Object obj, boolean copyNew, OpCallbacks call) {
1143: try {
1144: return _broker.attach(obj, copyNew, call);
1145: } catch (RuntimeException re) {
1146: throw translate(re);
1147: }
1148: }
1149:
1150: public Object[] attachAll(Collection objs, boolean copyNew,
1151: OpCallbacks call) {
1152: try {
1153: return _broker.attachAll(objs, copyNew, call);
1154: } catch (RuntimeException re) {
1155: throw translate(re);
1156: }
1157: }
1158:
1159: public void transactional(Object pc, boolean updateVersion,
1160: OpCallbacks call) {
1161: try {
1162: _broker.transactional(pc, updateVersion, call);
1163: } catch (RuntimeException re) {
1164: throw translate(re);
1165: }
1166: }
1167:
1168: public void transactionalAll(Collection objs,
1169: boolean updateVersion, OpCallbacks call) {
1170: try {
1171: _broker.transactionalAll(objs, updateVersion, call);
1172: } catch (RuntimeException re) {
1173: throw translate(re);
1174: }
1175: }
1176:
1177: public void nontransactional(Object pc, OpCallbacks call) {
1178: try {
1179: _broker.nontransactional(pc, call);
1180: } catch (RuntimeException re) {
1181: throw translate(re);
1182: }
1183: }
1184:
1185: public void nontransactionalAll(Collection objs, OpCallbacks call) {
1186: try {
1187: _broker.nontransactionalAll(objs, call);
1188: } catch (RuntimeException re) {
1189: throw translate(re);
1190: }
1191: }
1192:
1193: public Extent newExtent(Class cls, boolean subs) {
1194: try {
1195: return _broker.newExtent(cls, subs);
1196: } catch (RuntimeException re) {
1197: throw translate(re);
1198: }
1199: }
1200:
1201: public Query newQuery(String language, Class cls, Object query) {
1202: try {
1203: return _broker.newQuery(language, cls, query);
1204: } catch (RuntimeException re) {
1205: throw translate(re);
1206: }
1207: }
1208:
1209: public Query newQuery(String language, Object query) {
1210: try {
1211: return _broker.newQuery(language, query);
1212: } catch (RuntimeException re) {
1213: throw translate(re);
1214: }
1215: }
1216:
1217: public Seq getIdentitySequence(ClassMetaData meta) {
1218: try {
1219: return _broker.getIdentitySequence(meta);
1220: } catch (RuntimeException re) {
1221: throw translate(re);
1222: }
1223: }
1224:
1225: public Seq getValueSequence(FieldMetaData fmd) {
1226: try {
1227: return _broker.getValueSequence(fmd);
1228: } catch (RuntimeException re) {
1229: throw translate(re);
1230: }
1231: }
1232:
1233: public void lock(Object obj, int level, int timeout,
1234: OpCallbacks call) {
1235: try {
1236: _broker.lock(obj, level, timeout, call);
1237: } catch (RuntimeException re) {
1238: throw translate(re);
1239: }
1240: }
1241:
1242: public void lock(Object obj, OpCallbacks call) {
1243: try {
1244: _broker.lock(obj, call);
1245: } catch (RuntimeException re) {
1246: throw translate(re);
1247: }
1248: }
1249:
1250: public void lockAll(Collection objs, int level, int timeout,
1251: OpCallbacks call) {
1252: try {
1253: _broker.lockAll(objs, level, timeout, call);
1254: } catch (RuntimeException re) {
1255: throw translate(re);
1256: }
1257: }
1258:
1259: public void lockAll(Collection objs, OpCallbacks call) {
1260: try {
1261: _broker.lockAll(objs, call);
1262: } catch (RuntimeException re) {
1263: throw translate(re);
1264: }
1265: }
1266:
1267: public boolean cancelAll() {
1268: try {
1269: return _broker.cancelAll();
1270: } catch (RuntimeException re) {
1271: throw translate(re);
1272: }
1273: }
1274:
1275: public void dirtyType(Class cls) {
1276: try {
1277: _broker.dirtyType(cls);
1278: } catch (RuntimeException re) {
1279: throw translate(re);
1280: }
1281: }
1282:
1283: public void close() {
1284: try {
1285: _broker.close();
1286: } catch (RuntimeException re) {
1287: throw translate(re);
1288: }
1289: }
1290:
1291: public boolean isClosed() {
1292: try {
1293: return _broker.isClosed();
1294: } catch (RuntimeException re) {
1295: throw translate(re);
1296: }
1297: }
1298:
1299: public boolean isCloseInvoked() {
1300: try {
1301: return _broker.isCloseInvoked();
1302: } catch (RuntimeException re) {
1303: throw translate(re);
1304: }
1305: }
1306:
1307: public void assertOpen() {
1308: try {
1309: _broker.assertOpen();
1310: } catch (RuntimeException re) {
1311: throw translate(re);
1312: }
1313: }
1314:
1315: public void assertActiveTransaction() {
1316: try {
1317: _broker.assertActiveTransaction();
1318: } catch (RuntimeException re) {
1319: throw translate(re);
1320: }
1321: }
1322:
1323: public void assertNontransactionalRead() {
1324: try {
1325: _broker.assertNontransactionalRead();
1326: } catch (RuntimeException re) {
1327: throw translate(re);
1328: }
1329: }
1330:
1331: public void assertWriteOperation() {
1332: try {
1333: _broker.assertWriteOperation();
1334: } catch (RuntimeException re) {
1335: throw translate(re);
1336: }
1337: }
1338:
1339: ///////////////////////////////////////////////
1340: // Implementation of Synchronization interface
1341: ///////////////////////////////////////////////
1342:
1343: public void beforeCompletion() {
1344: try {
1345: _broker.beforeCompletion();
1346: } catch (RuntimeException re) {
1347: throw translate(re);
1348: }
1349: }
1350:
1351: public void afterCompletion(int status) {
1352: try {
1353: _broker.afterCompletion(status);
1354: } catch (RuntimeException re) {
1355: throw translate(re);
1356: }
1357: }
1358:
1359: public Object newInstance(Class cls) {
1360: try {
1361: return _broker.newInstance(cls);
1362: } catch (RuntimeException re) {
1363: throw translate(re);
1364: }
1365: }
1366:
1367: public boolean isDetached(Object obj) {
1368: try {
1369: return _broker.isDetached(obj);
1370: } catch (RuntimeException re) {
1371: throw translate(re);
1372: }
1373: }
1374: }
|