com.nurelm.util.jdo
Class JdoUtil

java.lang.Object
  extended bycom.nurelm.util.jdo.JdoUtil

public class JdoUtil
extends java.lang.Object

Provides static class functions to access JDO persistence manager.


Constructor Summary
JdoUtil()
           
 
Method Summary
static void commitLocalTransaction(javax.jdo.PersistenceManager pm, boolean startedLocalTransaction)
          Commit's a local transaction if one was started.
static javax.jdo.PersistenceManager getPM()
          Utility function to help get current JDO PersistenceManager.
static javax.jdo.PersistenceManager getPM(java.lang.Object object)
          Util function to get a persistence manager from an object with an existing persistence manager.
static javax.jdo.PersistenceManagerFactory getPMF()
          Get's JDO PersistenceManagerFactory based on kodo.properties settings.
static java.util.Properties getProperties()
          Returns properties contained in kodo.properties.
static boolean startLocalTransaction(javax.jdo.PersistenceManager pm)
          Starts a local transaction if one is not already started.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

JdoUtil

public JdoUtil()
Method Detail

startLocalTransaction

public static boolean startLocalTransaction(javax.jdo.PersistenceManager pm)
Starts a local transaction if one is not already started.

Parameters:
pm - The caller's current JDO PersistenceManager.

commitLocalTransaction

public static void commitLocalTransaction(javax.jdo.PersistenceManager pm,
                                          boolean startedLocalTransaction)
Commit's a local transaction if one was started.

Parameters:
pm - The caller's current JDO PersistenceManager.

getProperties

public static java.util.Properties getProperties()
Returns properties contained in kodo.properties. Note that kodo.properties must exist in the current classpath in order to be found.

Returns:
Properties contained in current classpath's kodo.properties file.

getPMF

public static javax.jdo.PersistenceManagerFactory getPMF()
Get's JDO PersistenceManagerFactory based on kodo.properties settings.

Returns:
The current PersistenceManagerFactory.

getPM

public static javax.jdo.PersistenceManager getPM()
Utility function to help get current JDO PersistenceManager. We need to be able to get PM from static context, hence this class.

Returns:
Current PM based on classpath's kodo.properties settings.

getPM

public static javax.jdo.PersistenceManager getPM(java.lang.Object object)
Util function to get a persistence manager from an object with an existing persistence manager.

Returns:
Current PM from either the object passed in, or from the kodo.properties settings.