1 2 12 package com.versant.core.jdo; 13 14 import com.versant.core.common.Utils; 15 16 import javax.jdo.Transaction; 17 import javax.jdo.PersistenceManager; 18 import javax.jdo.Query; 19 import javax.jdo.PersistenceManagerFactory; 20 import javax.jdo.Extent; 21 import javax.jdo.spi.PersistenceCapable; 22 23 import javax.transaction.Synchronization ; 24 import javax.transaction.xa.XAException ; 25 import javax.transaction.xa.XAResource ; 26 import javax.transaction.xa.Xid ; 27 28 import java.sql.Connection ; 29 import java.util.Collection ; 30 import java.util.List ; 31 32 33 34 import com.versant.core.common.OID; 35 import com.versant.core.common.*; 36 37 49 public abstract class PMProxy implements VersantPersistenceManager, Transaction, VersantPMInternal 50 51 , XAResource , Synchronization 52 53 { 54 55 public abstract void setPmCacheRefType(Object pc, int type); 56 57 public abstract void setPmCacheRefType(Object [] pcs, int type); 58 59 public abstract void setPmCacheRefType(Collection col, int type); 60 61 public abstract void setPmCacheRefType(int type); 62 63 public abstract int getPmCacheRefType(); 64 65 public abstract boolean isInterceptDfgFieldAccess(); 66 67 public abstract void setInterceptDfgFieldAccess(boolean interceptDfgFieldAccess); 68 69 public abstract VersantPersistenceManagerImp getRealPM(); 70 71 74 abstract VersantPersistenceManagerImp getRealPMNoCheck(); 75 76 public abstract void resetPM(); 77 78 public abstract List versantAllDirtyInstances(); 79 80 public abstract boolean isDirty(); 81 82 public abstract void cancelQueryExecution(); 83 84 public abstract Object getObjectByIDString(String value, boolean toValidate); 85 86 public abstract void loadFetchGroup(Object pc, String name); 87 88 public abstract void flush(); 89 90 public abstract void flush(boolean retainState); 91 92 public abstract void makeTransientRecursive(Object pc); 93 94 public abstract Connection getJdbcConnection(String datastore); 95 96 public abstract String getConnectionURL(String dataStore); 97 98 public abstract String getConnectionDriverName(String dataStore); 99 100 public abstract boolean isClosed(); 101 102 public abstract void close(); 103 104 public abstract Transaction currentTransaction(); 105 106 public abstract void evict(Object o); 107 108 public abstract void evictAll(Object [] objects); 109 110 public abstract void evictAll(Collection collection); 111 112 public abstract void evictAll(); 113 114 public abstract void refresh(Object o); 115 116 public abstract void refreshAll(Object [] objects); 117 118 public abstract void refreshAll(Collection collection); 119 120 public abstract void refreshAll(); 121 122 public abstract Query newQuery(); 123 124 public abstract Query newQuery(Object o); 125 126 public abstract Query newQuery(String s, Object o); 127 128 public abstract Query newQuery(Class aClass); 129 130 public abstract Query newQuery(Extent extent); 131 132 public abstract Query newQuery(Class aClass, Collection collection); 133 134 public abstract Query newQuery(Class aClass, String s); 135 136 public abstract Query newQuery(Class aClass, Collection collection, String s); 137 138 public abstract Query newQuery(Extent extent, String s); 139 140 public abstract Extent getExtent(Class aClass, boolean b); 141 142 public abstract Object getObjectById(Object o, boolean b); 143 144 public abstract Object getObjectId(Object o); 145 146 public abstract Object getTransactionalObjectId(Object o); 147 148 public abstract Object newObjectIdInstance(Class aClass, String s); 149 150 public abstract void makePersistent(Object o); 151 152 public abstract void makePersistentAll(Object [] objects); 153 154 public abstract void makePersistentAll(Collection collection); 155 156 public abstract void deletePersistent(Object o); 157 158 public abstract void deletePersistentAll(Object [] objects); 159 160 public abstract void deletePersistentAll(Collection collection); 161 162 public abstract void makeTransient(Object o); 163 164 public abstract void makeTransientAll(Object [] objects); 165 166 public abstract void makeTransientAll(Collection collection); 167 168 public abstract void makeTransactional(Object o); 169 170 public abstract void makeTransactionalAll(Object [] objects); 171 172 public abstract void makeTransactionalAll(Collection collection); 173 174 public abstract void makeNontransactional(Object o); 175 176 public abstract void makeNontransactionalAll(Object [] objects); 177 178 public abstract void makeNontransactionalAll(Collection collection); 179 180 public abstract void retrieve(Object o); 181 182 public abstract void retrieveAll(Collection pcs, boolean DFGOnly); 183 184 public abstract void retrieveAll(Object [] pcs, boolean DFGOnly); 185 186 public abstract void retrieveAll(Collection collection); 187 188 public abstract void retrieveAll(Object [] objects); 189 190 public abstract void setUserObject(Object o); 191 192 public abstract Object getUserObject(); 193 194 public abstract PersistenceManagerFactory getPersistenceManagerFactory(); 195 196 public abstract Class getObjectIdClass(Class aClass); 197 198 public abstract void setMultithreaded(boolean b); 199 200 public abstract boolean getMultithreaded(); 201 202 public abstract void setIgnoreCache(boolean b); 203 204 public abstract boolean getIgnoreCache(); 205 206 207 public abstract void commit(Xid xid, boolean b) throws XAException ; 208 209 public abstract void end(Xid xid, int i) throws XAException ; 210 211 public abstract void forget(Xid xid) throws XAException ; 212 213 public abstract int getTransactionTimeout() throws XAException ; 214 215 public abstract boolean isSameRM(XAResource xaResource) throws XAException ; 216 217 public abstract int prepare(Xid xid) throws XAException ; 218 219 public abstract Xid [] recover(int i) throws XAException ; 220 221 public abstract void rollback(Xid xid) throws XAException ; 222 223 public abstract boolean setTransactionTimeout(int i) throws XAException ; 224 225 public abstract void start(Xid xid, int i) throws XAException ; 226 227 public abstract void afterCompletion(int i); 228 229 public abstract void beforeCompletion(); 230 231 232 public abstract OID getInternalOID(final PersistenceCapable pc); 233 234 public abstract PCStateMan getInternalSM(final PersistenceCapable pc); 235 236 public abstract boolean isActive(); 237 238 public abstract void begin(); 239 240 public abstract void commit(); 241 242 public abstract boolean getNontransactionalRead(); 243 244 public abstract boolean getNontransactionalWrite(); 245 246 public abstract boolean getOptimistic(); 247 248 public abstract PersistenceManager getPersistenceManager(); 249 250 public abstract boolean getRestoreValues(); 251 252 public abstract boolean getRetainValues(); 253 254 255 public abstract Synchronization getSynchronization(); 256 257 258 public abstract void rollback(); 259 260 public abstract void setNontransactionalRead(boolean b); 261 262 public abstract void setNontransactionalWrite(boolean b); 263 264 public abstract void setOptimistic(boolean b); 265 266 public abstract void setRestoreValues(boolean b); 267 268 public abstract void setRetainValues(boolean b); 269 270 271 public abstract void setSynchronization(Synchronization synchronization); 272 273 274 public abstract void setDatastoreTxLocking(int mode); 275 276 public abstract int getDatastoreTxLocking(); 277 278 public abstract void setRetainConnectionInOptTx(boolean on); 279 280 public abstract Object getObjectByIdFromCache(Object oid); 281 282 public abstract boolean isHollow(Object pc); 283 284 public abstract boolean hasIdentity(Object pc); 285 286 public abstract Object newObjectIdInstance(Class pcClass, String str, 287 boolean resolved); 288 289 public abstract Object getObjectByIDString(String value, boolean toValidate, 290 boolean resolved); 291 292 public abstract void logEvent(int level, String description, int ms); 293 294 public abstract Query versantNewNamedQuery(Class cls, String queryName); 295 296 public abstract boolean isCheckModelConsistencyOnCommit(); 297 298 public abstract void setCheckModelConsistencyOnCommit(boolean on); 299 300 public abstract void checkModelConsistency(); 301 302 306 public String toMsgString() { 307 StringBuffer s = new StringBuffer (); 308 s.append("0x"); 309 s.append(Integer.toHexString(System.identityHashCode(this))); 310 VersantPersistenceManagerImp realPM = getRealPMNoCheck(); 311 if (realPM == null) { 312 s.append(" CLOSED"); 313 } else { 314 Object userObject = realPM.getUserObject(); 315 if (userObject != null) { 316 s.append(' '); 317 s.append(Utils.toString(userObject)); 318 } 319 } 320 return s.toString(); 321 } 322 323 327 public String toString() { 328 return "PM " + toMsgString(); 329 } 330 331 public abstract int getObjectsById(Object [] oids, int length, Object [] data, 332 int stateFieldNo, int classMetaDataIndex); 333 334 public abstract Collection versantDetachCopy(Collection pcs, String fetchGroup); 335 336 public abstract Collection versantAttachCopy(Collection detached, 337 boolean makeTransactional); 338 339 public abstract Collection versantAttachCopy(Collection detached, 340 boolean makeTransactional, boolean shallow); 341 342 public abstract void evictFromL2CacheAfterCommit(Object o); 343 344 public abstract void evictAllFromL2CacheAfterCommit(Object [] a); 345 346 public abstract void evictAllFromL2CacheAfterCommit(Collection c); 347 348 public abstract void evictAllFromL2CacheAfterCommit(Class cls, 349 boolean includeSubclasses); 350 351 public abstract void evictAllFromL2CacheAfterCommit(); 352 353 public final PersistenceCapable cast2persistent(Object o) 354 { try { 356 return (PersistenceCapable)o; 357 } catch (ClassCastException e) { 358 throw BindingSupportImpl.getInstance().invalidOperation("The supplied instance is not of type " + 359 PersistenceCapable.class.getName() + 360 " (" + o.getClass().getName() + ")"); 361 } 362 } 363 364 365 } 366 | Popular Tags |