org.datanucleus.store
Interface StorePersistenceHandler

All Known Implementing Classes:
FederationPersistence

public interface StorePersistenceHandler

Interface defining persistence operations of a StoreManager.

Version:
$Revision$

Method Summary
 void close()
          Method to close the persistence handler, and release any resources.
 void deleteObject(StateManager sm)
          Deletes a persistent object from the datastore.
 void fetchObject(StateManager sm, int[] fieldNumbers)
          Fetches a persistent object from the database.
 java.lang.Object findObject(ObjectManager om, java.lang.Object id)
          Method to find a persistable object with the specified id from the datastore, if the StoreManager supports this operation (optional).
 void insertObject(StateManager sm)
          Inserts a persistent object into the database.
 void locateObject(StateManager sm)
          Locates this object in the datastore.
 void updateObject(StateManager sm, int[] fieldNumbers)
          Updates a persistent object in the datastore.
 

Method Detail

close

void close()
Method to close the persistence handler, and release any resources.


insertObject

void insertObject(StateManager sm)
Inserts a persistent object into the database.

Parameters:
sm - The state manager of the object to be inserted.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

fetchObject

void fetchObject(StateManager sm,
                 int[] fieldNumbers)
Fetches a persistent object from the database.

Parameters:
sm - The state manager of the object to be fetched.
fieldNumbers - The numbers of the fields to be fetched.
Throws:
NucleusObjectNotFoundException - if the object doesnt exist
NucleusDataStoreException - when an error occurs in the datastore communication

updateObject

void updateObject(StateManager sm,
                  int[] fieldNumbers)
Updates a persistent object in the datastore.

Parameters:
sm - The state manager of the object to be updated.
fieldNumbers - The numbers of the fields to be updated.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

deleteObject

void deleteObject(StateManager sm)
Deletes a persistent object from the datastore.

Parameters:
sm - The state manager of the object to be deleted.
Throws:
NucleusDataStoreException - when an error occurs in the datastore communication

locateObject

void locateObject(StateManager sm)
Locates this object in the datastore.

Parameters:
sm - The StateManager for the object to be found
Throws:
NucleusObjectNotFoundException - if the object doesnt exist
NucleusDataStoreException - when an error occurs in the datastore communication

findObject

java.lang.Object findObject(ObjectManager om,
                            java.lang.Object id)
Method to find a persistable object with the specified id from the datastore, if the StoreManager supports this operation (optional). This allows for datastores that perform the instantiation of objects directly (such as ODBMS). With other types of datastores (e.g RDBMS) this method returns null. If the StoreManager supports this operation yet the object is not found an exception should be thrown.

Parameters:
om - the ObjectManager which will manage the object
id - the id of the object in question.
Returns:
a persistable object with a valid object state (for example: hollow) or null, indicating that the implementation leaves the instantiation work to JPOX.


Copyright © 2009. All Rights Reserved.