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.xmlstore
Class XMLStoreManager

    java.lang.Object
      |
      +--kodo.abstractstore.AbstractStoreManager
            |
            +--kodo.xmlstore.XMLStoreManager

All Implemented Interfaces:
  com.solarmetric.util.Closeable, StoreManager

public class XMLStoreManager
extends AbstractStoreManager

Store manager to a back-end consisting of XML files. This implementation accesses data through the `XMLStore` associated with its `XMLConfiguration`. Configuration instances are shared by all store managers owned by all persistence managers created with the same persistence manager factory.

See Also:
  `AbstractStoreManager`

Inner Class Summary
`protected class` | `XMLStoreManager.XMLExtent` Extent implementation for the XMLStoreManager.

Fields inherited from interface kodo.runtime.StoreManager
`FORCE_LOAD_ALL, FORCE_LOAD_DFG, FORCE_LOAD_NONE, FORCE_LOAD_REFRESH, VERSION_DIFFERENT, VERSION_EARLIER, VERSION_LATER, VERSION_SAME`

Constructor Summary
`XMLStoreManager()`

Method Summary
`void` | `begin()` Kodo assumes that after this method is invoked, all data accesses through this store manager will be part of a single unit of work that can be rolled back.
`void` | `commit()` This is a no-op implementation.
`boolean` | `exists(KodoStateManager sm, Object connection)` Verify that the given instance exists in the data store; return false if it does not.
`protected Collection` | `flush(Collection pNew, Collection pNewUpdated, Collection pNewFlushedDeleted, Collection pDirty, Collection pDeleted)` Responsible for writing modifications happened back to the data store.
`SequenceGenerator` | `getSequenceGenerator(ClassMetaData forClass)` Throws a `javax.jdo.JDOUnsupportedOptionException`.
`protected Collection` | `getUnsupportedOptions()` Returns a set of JDO option names that this store manager does not support.
`boolean` | `initialize(KodoStateManager sm, JDOState state, FetchConfiguration fetch, Object connection)` This method is invoked when Kodo needs to load an object whose identity is known but which has not yet been loaded from the data store.
`boolean` | `load(KodoStateManager sm, BitSet fields, FetchConfiguration fetch, int lockLevel, Object connection)` This method is invoked when Kodo needs to load additional data into an object that has already been at least partially loaded by a previous `initialize(kodo.runtime.KodoStateManager, kodo.runtime.JDOState, kodo.runtime.FetchConfiguration, java.lang.Object)` invocation.
`protected JDOConfiguration` | `newConfiguration()` Return a new configuration instance for this runtime.
`KodoExtent` | `newExtent(Class type, boolean subclasses)` Create an `KodoExtent` capable of loading all instances of `type`, optionally including subclasses as defined by `subclasses`.
`protected void` | `open()` No-op implementation.
`void` | `rollback()` This is a no-op implementation.
`boolean` | `synchVersion(KodoStateManager sm, Object connection)` Since this store manager does not provide optimistic locking support, this method always returns `true`.

Methods inherited from class kodo.abstractstore.AbstractStoreManager
`attachVersion, beginOptimistic, cancelAll, changeJDOState, close, compareVersion, copyDataStoreId, detachVersion, flush, getConnection, getDataStoreIdClass, getPersistenceCapableClass, getPersistenceManager, getPlatform, hasConnection, loadAll, newDataStoreId, newDataStoreId, newFetchConfiguration, newQuery, rollbackOptimistic, setPersistenceManager`

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

Constructor Detail

### XMLStoreManager

    public XMLStoreManager()

Method Detail

### getUnsupportedOptions

    protected Collection getUnsupportedOptions()

  Description copied from class: `AbstractStoreManager`

  Returns a set of JDO option names that this store manager does not support.

  This returns `[ "javax.jdo.option.Optimistic", "javax.jdo.option.DatastoreIdentity", "kodo.option.IncrementalFlush" ]`

  Overrides:
    `getUnsupportedOptions` in class `AbstractStoreManager`

### newConfiguration

    protected JDOConfiguration newConfiguration()

  Description copied from class: `AbstractStoreManager`
  Return a new configuration instance for this runtime. Configuration data is maintained at the persistence manager factory level and is available to all Kodo components; therefore it is a good place to maintain shared resources such as connection pools, etc.
  Overrides:
    `newConfiguration` in class `AbstractStoreManager`

### open

    protected void open()

  Description copied from class: `AbstractStoreManager`
  No-op implementation. Ready this store manager for persistent operations.
  Overrides:
    `open` in class `AbstractStoreManager`

### exists

    public boolean exists(KodoStateManager sm,
                          Object connection)

  Description copied from interface: `StoreManager`
  Verify that the given instance exists in the data store; return false if it does not.

### initialize

    public boolean initialize(KodoStateManager sm,
                              JDOState state,
                              FetchConfiguration fetch,
                              Object connection)

  Description copied from class: `AbstractStoreManager`

  This method is invoked when Kodo needs to load an object whose identity is known but which has not yet been loaded from the data store. `sm` is a partially-set-up state manager for this object. The ID and least-derived type information for the instance to load can be obtained by invoking `sm.getObjectId(false,true)` and `sm.getMetaData()`.

  When implementing this method, load the data for this object from the data store, determine the most-derived subclass of the newly-loaded data, and then use the `#newInstance` method to populate `sm` with a new instance of the appropriate type. Once `#newInstance` has been invoked, proceed to load field data into `sm` as in the `AbstractStoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, java.lang.Object)` method, by using `KodoStateManager.store(int, java.lang.Object)` (or the appropriate `KodoStateManager.storetype` method) to put the data into the object.

  Overrides:
    `initialize` in class `AbstractStoreManager`
  Following copied from interface: `kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to initialize
    `state` - the lifecycle state to initialize the state manager with
    `fetch` - configuration for how to load the instance
    `connection` - the current connection information, or null if not given to the calling method of the persistence manager
  Returns:
    true if the matching instance exists in the data store, false otherwise

### load

    public boolean load(KodoStateManager sm,
                        BitSet fields,
                        FetchConfiguration fetch,
                        int lockLevel,
                        Object connection)

  Description copied from class: `AbstractStoreManager`

  This method is invoked when Kodo needs to load additional data into an object that has already been at least partially loaded by a previous `AbstractStoreManager.initialize(kodo.runtime.KodoStateManager, kodo.runtime.JDOState, kodo.runtime.FetchConfiguration, java.lang.Object)` invocation.

  Load data into `sm` by using `KodoStateManager.store(int, java.lang.Object)` (or the appropriate `KodoStateManager.storetype` method) to put the data into the object.

  Overrides:
    `load` in class `AbstractStoreManager`
  Following copied from interface: `kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to load
    `fields` - set of fields to load; all field indexes in this set must be loaded; this set is mutable
    `fetch` - the fetch configuration to use when loading related objects
    `lockLevel` - attempt to load simple fields at this lock level; relations should be loaded at the read lock level of the fetch configuration
    `connection` - the current connection information, or null if not given to the calling method of the persistence manager
  Returns:
    false if the object no longer exists in the database, true otherwise

### synchVersion

    public boolean synchVersion(KodoStateManager sm,
                                Object connection)

  Description copied from class: `AbstractStoreManager`
  Since this store manager does not provide optimistic locking support, this method always returns `true`.
  Overrides:
    `synchVersion` in class `AbstractStoreManager`
  Following copied from interface: `kodo.runtime.StoreManager`
  Parameters:
    `sm` - the instance to check
    `connection` - the current connection information, or null if not given to the calling method of the persistence manager
  Returns:
    true if the instance still exists in the datastore and is up-to-date, false otherwise

### begin

    public void begin()

  Description copied from class: `AbstractStoreManager`

  Kodo assumes that after this method is invoked, all data accesses through this store manager will be part of a single unit of work that can be rolled back.

  This is a no-op implementation. If your data store does not support any concept of locking or transactions, you need not override this method.

  Overrides:
    `begin` in class `AbstractStoreManager`

### commit

    public void commit()

  Description copied from class: `AbstractStoreManager`
  This is a no-op implementation. If your data store does not have a concept of transactions or a unit of work, you need not override this method. If it does, then override this method to notify the data store that the current transaction should be committed.
  Overrides:
    `commit` in class `AbstractStoreManager`

### rollback

    public void rollback()

  Description copied from class: `AbstractStoreManager`
  This is a no-op implementation. If your data store does not have a concept of transactions or a unit of work, you need not override this method. If it does, then override this method to notify the data store that the current transaction should be rolled back.
  Overrides:
    `rollback` in class `AbstractStoreManager`

### flush

    protected Collection flush(Collection pNew,
                               Collection pNewUpdated,
                               Collection pNewFlushedDeleted,
                               Collection pDirty,
                               Collection pDeleted)

  Description copied from class: `AbstractStoreManager`

  Responsible for writing modifications happened back to the data store. If you do not remove the `JDOConfiguration.OPTION_INC_FLUSH` option in `AbstractStoreManager.getUnsupportedOptions()`, this will be called only once at the end of a transaction. Otherwise, it may be called periodically throughout the course of a transaction.

  If this store manager supports optimistic transactions, datastore version information should be updated during flush, and the state manager's version indicator should be updated through the `KodoStateManager.setNextVersion(java.lang.Object)` method.

  This method will only be invoked if there are meaningful changes to store. This differs from the behavior of `StoreManager.flush(java.util.Collection)`, which may be invoked with a collection of objects in JDO states that do not require any datastore action (for example, objects in the transient-transactional state).

  Overrides:
    `flush` in class `AbstractStoreManager`
  Following copied from class: `kodo.abstractstore.AbstractStoreManager`
  Parameters:
    `pNew` - Objects that should be added to the store, and that have not previously been flushed.
    `pNewUpdated` - New objects that have been modified since they were initially flushed. These were in `persistentNew` in an earlier flush invocation.
    `pNewFlushedDeleted` - New objects that have been deleted since they were initially flushed. These were in `persistentNew` in an earlier flush invocation.
    `pDirty` - Objects that were loaded from the data store and have since been modified.
    `pDeleted` - Objects that were loaded from the data store and have since been deleted. These may have been in a previous flush invocation's persistentDirty list.
  Returns:
    a collection of `OptimisticVerificationException`s encountered during flushing.

### newExtent

    public KodoExtent newExtent(Class type,
                                boolean subclasses)

  Description copied from class: `AbstractStoreManager`

  Create an `KodoExtent` capable of loading all instances of `type`, optionally including subclasses as defined by `subclasses`.

  This will typically return an instance of a class that extends `ExtentImpl`, defining `ExtentImpl.getResultObjectProvider(kodo.meta.ClassMetaData)` to return a `ResultObjectProvider` capable of iterating through all the desired objects for a given `ClassMetaData`. Note that there might be multiple calls to that method if `type` identifies an interface or abstract class with multiple persistence-capable implementations.

  The implementation of the `ExtentImpl.getResultObjectProvider(kodo.meta.ClassMetaData)` method will typically execute some sort of data store query to find all the applicable objects, loop through the returned data, extracting object IDs from the data, and invoking `#getObjectById(Object,FetchConfiguration,Object)` on each OID. When invoking this method, the first argument is the OID. The second is the current fetch configuration (this can be null). The last argument is an object that will be passed through to `AbstractStoreManager.initialize(kodo.runtime.KodoStateManager, kodo.runtime.JDOState, kodo.runtime.FetchConfiguration, java.lang.Object)` or `AbstractStoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, java.lang.Object)`, and typically will contain the actual data to load. For example, for a JDBC-based store manager, this might be the result set that is being iterated over. If this argument is `null`, then the `AbstractStoreManager.initialize(kodo.runtime.KodoStateManager, kodo.runtime.JDOState, kodo.runtime.FetchConfiguration, java.lang.Object)` or `AbstractStoreManager.load(kodo.runtime.KodoStateManager, java.util.BitSet, kodo.runtime.FetchConfiguration, int, java.lang.Object)` method will have to issue another command to the data store in order to fetch the data to be loaded.

  Overrides:
    `newExtent` in class `AbstractStoreManager`

### getSequenceGenerator

    public SequenceGenerator getSequenceGenerator(ClassMetaData forClass)

  Description copied from class: `AbstractStoreManager`
  Throws a `javax.jdo.JDOUnsupportedOptionException`. Override this method to provide datastore identity by using Kodo's `Id` class, which uses a long as the per-class identifier. To use some other sort of datastore identifier (a GUID, string, or someting of that nature), override `AbstractStoreManager.getPersistenceCapableClass(java.lang.Object)`, `AbstractStoreManager.getDataStoreIdClass(kodo.meta.ClassMetaData)`, .
  Overrides:
    `getSequenceGenerator` in class `AbstractStoreManager`

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.