stomp.jdo.kodo
Class KodoPMWrapper

java.lang.Object
  |
  +--com.solarmetric.kodo.runtime.PersistenceManagerImpl
        |
        +--stomp.jdo.kodo.KodoPMWrapper
All Implemented Interfaces:
javax.jdo.PersistenceManager, PMWrapper, javax.jdo.Transaction

public class KodoPMWrapper
extends com.solarmetric.kodo.runtime.PersistenceManagerImpl
implements PMWrapper

wraps the JDO implementation provided by a third party, but removes some transactional options from consideration. This is because we are going to manage transactions and cache synchronization transparently, and we don't want the developer getting in there and screwing it up.

Author:
Eric Lindauer

Field Summary
 
Fields inherited from class com.solarmetric.kodo.runtime.PersistenceManagerImpl
store
 
Constructor Summary
KodoPMWrapper()
           
 
Method Summary
 void close()
          does nothing.
 javax.jdo.Transaction currentTransaction()
          returns an TransactionWrapper wrapper of the currentTransaction in the pm in this.
 boolean equals(java.lang.Object object)
           
 void evict(java.lang.Object pc)
           
 void evictAll()
           
 void evictAll(java.util.Collection pcs)
           
 void evictAll(java.lang.Object[] pcs)
           
 java.lang.Object getLock()
          returns the object that should be used to synchronized on this PM.
 boolean isNonTransactional()
          returns true if the PM allows writes outside of a transaction, false otherwise.
 boolean isTransactional()
          returns true if setTransactional () was called on this PMWrapper, false otherwise.
 void makePersistent(java.lang.Object pc)
           
 void makePersistentAll(java.util.Collection pcs)
           
 void makePersistentAll(java.lang.Object[] pcs)
           
 void reallyBegin()
          convenience method for package members really start a transaction.
 javax.jdo.Transaction reallyCurrentTransaction()
          provides the only available access to the real JDO transaction, which is why this method is only available to package members.
 void refresh(java.lang.Object pc)
           
 void refreshAll()
           
 void refreshAll(java.util.Collection pcs)
           
 void refreshAll(java.lang.Object[] pcs)
           
 void setNonTransactional()
          indicates that this PM should return true for 'isNonTransactional'
 void setShouldClose()
          indicates that this PMWrapper should respond to 'close' method calls by actually closing the underlying PM.
 void setTransactional()
          indicates that this PM should consider itself "transactional" and should start a transaction immediately.
 
Methods inherited from class com.solarmetric.kodo.runtime.PersistenceManagerImpl
begin, checkActiveTransaction, checkClosed, checkNontransactionalRead, checkValid, closeQueries, commit, deletePersistent, deletePersistentAll, deletePersistentAll, deletePersistentFilter, endTransaction, evictFilter, flush, getCachedObjectById, getClassLoader, getConfiguration, getConnectionPassword, getConnectionUserName, getExtent, getIgnoreCache, getManagedObjects, getMultithreaded, getNontransactionalRead, getNontransactionalWrite, getObjectById, getObjectById, getObjectByIdFilter, getObjectId, getObjectIdClass, getOptimistic, getPersistenceManager, getPersistenceManagerFactory, getRestoreValues, getRetainValues, getState, getState, getStoreManager, getSynchronization, getTransactionalObjectId, getTransactionalObjects, getUserObject, initialize, isActive, isClosed, lock, makeNontransactional, makeNontransactionalAll, makeNontransactionalAll, makeNontransactionalFilter, makePersistentFilter, makeTransactional, makeTransactionalAll, makeTransactionalAll, makeTransactionalFilter, makeTransient, makeTransientAll, makeTransientAll, makeTransientFilter, markTransactionalObjectDirty, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, refreshFilter, retrieve, retrieveAll, retrieveAll, retrieveFilter, rollback, setIgnoreCache, setMultithreaded, setNontransactionalRead, setNontransactionalWrite, setOptimistic, setRestoreValues, setRetainValues, setSynchronization, setUserObject, unlock
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface stomp.jdo.PMWrapper
getManagedObjects
 
Methods inherited from interface javax.jdo.PersistenceManager
deletePersistent, deletePersistentAll, deletePersistentAll, getExtent, getIgnoreCache, getMultithreaded, getObjectById, getObjectId, getObjectIdClass, getPersistenceManagerFactory, getTransactionalObjectId, getUserObject, isClosed, makeNontransactional, makeNontransactionalAll, makeNontransactionalAll, makeTransactional, makeTransactionalAll, makeTransactionalAll, makeTransient, makeTransientAll, makeTransientAll, newObjectIdInstance, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, newQuery, retrieve, retrieveAll, retrieveAll, setIgnoreCache, setMultithreaded, setUserObject
 

Constructor Detail

KodoPMWrapper

public KodoPMWrapper()
Method Detail

setShouldClose

public void setShouldClose()
Description copied from interface: PMWrapper
indicates that this PMWrapper should respond to 'close' method calls by actually closing the underlying PM.

Specified by:
setShouldClose in interface PMWrapper

setNonTransactional

public void setNonTransactional()
Description copied from interface: PMWrapper
indicates that this PM should return true for 'isNonTransactional'

Specified by:
setNonTransactional in interface PMWrapper

setTransactional

public void setTransactional()
Description copied from interface: PMWrapper
indicates that this PM should consider itself "transactional" and should start a transaction immediately.

Specified by:
setTransactional in interface PMWrapper

isNonTransactional

public boolean isNonTransactional()
Description copied from interface: PMWrapper
returns true if the PM allows writes outside of a transaction, false otherwise.

Specified by:
isNonTransactional in interface PMWrapper

isTransactional

public boolean isTransactional()
Description copied from interface: PMWrapper
returns true if setTransactional () was called on this PMWrapper, false otherwise.

Specified by:
isTransactional in interface PMWrapper

getLock

public java.lang.Object getLock()
Description copied from interface: PMWrapper
returns the object that should be used to synchronized on this PM.

Specified by:
getLock in interface PMWrapper

reallyCurrentTransaction

public javax.jdo.Transaction reallyCurrentTransaction()
provides the only available access to the real JDO transaction, which is why this method is only available to package members. Client code should never see this object.

Specified by:
reallyCurrentTransaction in interface PMWrapper

reallyBegin

public void reallyBegin()
convenience method for package members really start a transaction.

Specified by:
reallyBegin in interface PMWrapper

currentTransaction

public javax.jdo.Transaction currentTransaction()
returns an TransactionWrapper wrapper of the currentTransaction in the pm in this. This wrapper throws an exception in the event that anyone tries to start or commit the wrapped transaction. this allows us to manage the transaction transparently to the developer and prevents people from screwing it up.

Specified by:
currentTransaction in interface javax.jdo.PersistenceManager
Overrides:
currentTransaction in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

close

public void close()
does nothing. Since we are wrapping a read-only PM, we don't ever want to close the PM. This method is synchronized on this object, so code that is concerned about the PM getting closed in another thread can synchronize on this PM, check if the PM isClosed (), then take whatever action is needed without fear of JDOUserExceptions.

Specified by:
close in interface javax.jdo.PersistenceManager
Overrides:
close in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

makePersistent

public void makePersistent(java.lang.Object pc)
Specified by:
makePersistent in interface javax.jdo.PersistenceManager
Overrides:
makePersistent in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

makePersistentAll

public void makePersistentAll(java.util.Collection pcs)
Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Overrides:
makePersistentAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

makePersistentAll

public void makePersistentAll(java.lang.Object[] pcs)
Specified by:
makePersistentAll in interface javax.jdo.PersistenceManager
Overrides:
makePersistentAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

refresh

public void refresh(java.lang.Object pc)
Specified by:
refresh in interface javax.jdo.PersistenceManager
Overrides:
refresh in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

refreshAll

public void refreshAll()
Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Overrides:
refreshAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

refreshAll

public void refreshAll(java.util.Collection pcs)
Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Overrides:
refreshAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

refreshAll

public void refreshAll(java.lang.Object[] pcs)
Specified by:
refreshAll in interface javax.jdo.PersistenceManager
Overrides:
refreshAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

evict

public void evict(java.lang.Object pc)
Specified by:
evict in interface javax.jdo.PersistenceManager
Overrides:
evict in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

evictAll

public void evictAll()
Specified by:
evictAll in interface javax.jdo.PersistenceManager
Overrides:
evictAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

evictAll

public void evictAll(java.util.Collection pcs)
Specified by:
evictAll in interface javax.jdo.PersistenceManager
Overrides:
evictAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

evictAll

public void evictAll(java.lang.Object[] pcs)
Specified by:
evictAll in interface javax.jdo.PersistenceManager
Overrides:
evictAll in class com.solarmetric.kodo.runtime.PersistenceManagerImpl

equals

public boolean equals(java.lang.Object object)
Overrides:
equals in class java.lang.Object