Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.1.6 generated on August 25 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## kodo.runtime
Class KodoHelper

    java.lang.Object
      |
      +--kodo.runtime.KodoHelper

public class KodoHelper
extends Object

Helper methods for acquiring `PersistenceManagerFactory` objects and obtaining information about persistence capable instances. These methods build on the methods in `JDOHelper`.

Constructor Summary
`KodoHelper()`

Method Summary
`static void` | `close(Object o)` Close the given resource.
`static DataCache` | `getDataCache(Object o)` Returns the `DataCache` for the specified instance.
`static DataCache` | `getDataCache(PersistenceManager pm, Class forClass)` Returns the `DataCache` for the specified class in the context of the given persistence manager.
`static DataCache` | `getDataCache(PersistenceManagerFactory pmf, Class forClass)` Returns the `DataCache` for the specified class in the context of the given persistence manager factory.
`static String` | `getDetachedObjectId(Object pc)` Returns the object id from a detached instance that uses datastore identity.
`static Object` | `getDetachedState(Object pc)` Returns an opaque object containg state information for detached instances.
`static int` | `getLockLevel(Object o)` Return the lock level of the specified object.
`static ClassMetaData` | `getMetaData(Object o)` Returns the `ClassMetaData` associated with the persistent type `type`.
`static ClassMetaData` | `getMetaData(PersistenceManager pm, Class cls)` Returns the `ClassMetaData` associated with the persistent type `cls`.
`static ClassMetaData` | `getMetaData(PersistenceManagerFactory factory, Class cls)` Returns the `ClassMetaData` associated with the persistent type `cls`.
`static Object` | `getObjectId(Object o)`
`static KodoPersistenceManager` | `getPersistenceManager(Object o)`
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory()` Returns a `KodoPersistenceManagerFactory` configured based on the properties resource named by the system property `kodo.properties`, or the resource `kodo.properties` if no system property is set.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(File propsFile)` JDO 2.0 Preview.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(File propsFile, ClassLoader loader)` JDO 2.0 Preview.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(Properties props)`
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(Properties props, ClassLoader loader)`
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(String propsResource)` JDO 2.0 Preview.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(String propsResource, ClassLoader loader)` JDO 2.0 Preview.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(String jndiLocation, Context context)` JDO 2.0 Preview.
`static KodoPersistenceManagerFactory` | `getPersistenceManagerFactory(String jndiLocation, Context context, ClassLoader loader)` JDO 2.0 Preview.
`static SequenceGenerator` | `getSequenceGenerator(Object o)` Returns a `SequenceGenerator` for the specified instance.
`static SequenceGenerator` | `getSequenceGenerator(PersistenceManager pm, Class forClass)` Returns a `SequenceGenerator` for the specified persistet class.
`static Object` | `getTransactionalObjectId(Object o)`
`static Object` | `getVersion(Object o)` Returns the current version indicator for `o`.
`static boolean` | `isDeleted(Object o)`
`static boolean` | `isDetached(Object pc)` Returns `true` if `pc` is a detached object (one that can be reattached to a `PersistenceManager` via a call to `KodoPersistenceManager.attach(java.lang.Object)`); otherwise returns `false`.
`static boolean` | `isDirty(Object o)`
`static boolean` | `isNew(Object o)`
`static boolean` | `isPersistent(Object o)`
`static boolean` | `isTransactional(Object o)`
`static void` | `makeDirty(Object o, String field)`
`static void` | `setDetachedObjectId(Object pc, String id)` Set the stringified object id into the detached persistent instance.
`static void` | `setDetachedState(Object pc, Object state)` Set the state for a detached instance.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### KodoHelper

    public KodoHelper()

Method Detail

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory()

  Returns a `KodoPersistenceManagerFactory` configured based on the properties resource named by the system property `kodo.properties`, or the resource `kodo.properties` if no system property is set. This method is equivalent to invoking `getPersistenceManagerFactory(String)` with the appropriate resource name.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(String propsResource)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` configured based on the properties stored in the resource at `propsResource`. This method is equivalent to invoking `getPersistenceManagerFactory(String,ClassLoader)` with `Thread.currentThread().getContextClassLoader()` as the `loader` argument.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(String propsResource,
                                                                             ClassLoader loader)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` configured based on the properties stored in the resource at `propsResource`. Loads the resource via `loader`, and creates a `KodoPersistenceManagerFactory` with `loader`. Any `IOException`s thrown during resource loading will be wrapped in a `JDOFatalUserException`.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(File propsFile)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` configured based on the properties stored in the file at `propsResource`. This method is equivalent to invoking `getPersistenceManagerFactory(File,ClassLoader)` with `Thread.currentThread().getContextClassLoader()` as the `loader` argument.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(File propsFile,
                                                                             ClassLoader loader)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` configured based on the properties stored in the file at `propsResource`. Creates a `KodoPersistenceManagerFactory` with `loader`. Any `IOException`s or `FileNotFouldException`s thrown during resource loading will be wrapped in a `JDOFatalUserException`.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(String jndiLocation,
                                                                             Context context)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` at the JNDI location specified by `jndiLocation` in the context `context`. If `context` is `null`, `new InitialContext()` will be used. This method is equivalent to invoking `getPersistenceManagerFactory(String,Context,ClassLoader)` with `Thread.currentThread().getContextClassLoader()` as the `loader` argument.

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(String jndiLocation,
                                                                             Context context,
                                                                             ClassLoader loader)

  JDO 2.0 Preview. Returns a `KodoPersistenceManagerFactory` at the JNDI location specified by `jndiLocation` in the context `context`. If `context` is `null`, `new InitialContext()` will be used. Creates a `KodoPersistenceManagerFactory` with `loader`. Any `NamingException`s thrown will be wrapped in a `JDOFatalUserException`.

### getMetaData

    public static ClassMetaData getMetaData(Object o)

  Returns the `ClassMetaData` associated with the persistent type `type`. Equivalent to `getMetaData(KodoHelper.getPersistenceManager(o), o.getClass())`. Returns null if `o` is `null`, or is not managed.

### getMetaData

    public static ClassMetaData getMetaData(PersistenceManager pm,
                                            Class cls)

  Returns the `ClassMetaData` associated with the persistent type `cls`. Throws an exception if either `pm` or `cls` are `null`.

### getMetaData

    public static ClassMetaData getMetaData(PersistenceManagerFactory factory,
                                            Class cls)

  Returns the `ClassMetaData` associated with the persistent type `cls`. Throws an exception if either `factory` or `cls` are `null`. If no metadata exists for the class, returns `null`.

### getVersion

    public static Object getVersion(Object o)

  Returns the current version indicator for `o`.

### getSequenceGenerator

    public static SequenceGenerator getSequenceGenerator(Object o)

  Returns a `SequenceGenerator` for the specified instance. The object must be managed by a persistence manager.

### getSequenceGenerator

    public static SequenceGenerator getSequenceGenerator(PersistenceManager pm,
                                                         Class forClass)

  Returns a `SequenceGenerator` for the specified persistet class.

### getDataCache

    public static DataCache getDataCache(Object o)

  Returns the `DataCache` for the specified instance. The object must be managed by a persistence manager.

### getDataCache

    public static DataCache getDataCache(PersistenceManager pm,
                                         Class forClass)

  Returns the `DataCache` for the specified class in the context of the given persistence manager.

### getDataCache

    public static DataCache getDataCache(PersistenceManagerFactory pmf,
                                         Class forClass)

  Returns the `DataCache` for the specified class in the context of the given persistence manager factory.

### getLockLevel

    public static int getLockLevel(Object o)

  Return the lock level of the specified object.
  See Also:
    `KodoPersistenceManager`

### close

    public static void close(Object o)

  Close the given resource. The resource can be an extent iterator, query result, or large result set relation.

### getPersistenceManager

    public static KodoPersistenceManager getPersistenceManager(Object o)

  See Also:
    `JDOHelper`

### makeDirty

    public static void makeDirty(Object o,
                                 String field)

  See Also:
    `JDOHelper`

### getObjectId

    public static Object getObjectId(Object o)

  See Also:
    `JDOHelper`

### getTransactionalObjectId

    public static Object getTransactionalObjectId(Object o)

  See Also:
    `JDOHelper`

### isDirty

    public static boolean isDirty(Object o)

  See Also:
    `JDOHelper`

### isTransactional

    public static boolean isTransactional(Object o)

  See Also:
    `JDOHelper`

### isPersistent

    public static boolean isPersistent(Object o)

  See Also:
    `JDOHelper`

### isNew

    public static boolean isNew(Object o)

  See Also:
    `JDOHelper`

### isDeleted

    public static boolean isDeleted(Object o)

  See Also:
    `JDOHelper`

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(Properties props)

  See Also:
    `JDOHelper`

### getPersistenceManagerFactory

    public static KodoPersistenceManagerFactory getPersistenceManagerFactory(Properties props,
                                                                             ClassLoader loader)

  See Also:
    `JDOHelper`

### isDetached

    public static boolean isDetached(Object pc)

  Returns `true` if `pc` is a detached object (one that can be reattached to a `PersistenceManager` via a call to `KodoPersistenceManager.attach(java.lang.Object)`); otherwise returns `false`.
  Since:
    3.1

### setDetachedState

    public static void setDetachedState(Object pc,
                                        Object state)

  Set the state for a detached instance.
  Parameters:
    `pc` - the detached persistent instance into which to set the state
    `state` - the state to set. the state is an opaque data structure that is implementation-specific, and should not be modified.
  See Also:
    `getDetachedState(java.lang.Object)`, `KodoPersistenceManager.attach(java.lang.Object)`, `KodoPersistenceManager.detach(java.lang.Object)`

### getDetachedState

    public static Object getDetachedState(Object pc)

  Returns an opaque object containg state information for detached instances.
  Parameters:
    `pc` - the detached persistent instance
  Returns:
    the opaque state of the detached instance
  See Also:
    `setDetachedState(java.lang.Object, java.lang.Object)`, `KodoPersistenceManager.attach(java.lang.Object)`, `KodoPersistenceManager.detach(java.lang.Object)`

### setDetachedObjectId

    public static void setDetachedObjectId(Object pc,
                                           String id)

  Set the stringified object id into the detached persistent instance.
  Parameters:
    `pc` - the detached persistent instance
    `id` - the stringified object id
  See Also:
    `getDetachedObjectId(java.lang.Object)`, `KodoPersistenceManager.attach(java.lang.Object)`, `KodoPersistenceManager.detach(java.lang.Object)`

### getDetachedObjectId

    public static String getDetachedObjectId(Object pc)

  Returns the object id from a detached instance that uses datastore identity.
  Parameters:
    `pc` - the detached persistent instance
  Returns:
    the stringified object id
  See Also:
    `setDetachedObjectId(java.lang.Object, java.lang.String)`, `KodoPersistenceManager.attach(java.lang.Object)`, `KodoPersistenceManager.detach(java.lang.Object)`

Overview | Package | Class | Tree | Deprecated | Index | Help
| SolarMetric Kodo JDO 3.1.6 generated on August 25 2004
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 2001,2002 SolarMetric, Inc. All Rights Reserved.