Package org.datanucleus.store.federation
Class FederatedPersistenceHandler
java.lang.Object
org.datanucleus.store.federation.FederatedPersistenceHandler
- All Implemented Interfaces:
StorePersistenceHandler
Persistence handler for federated datastores.
Distributes the inserts/updates/deletes/fetches to the appropriate datastore.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.datanucleus.store.StorePersistenceHandler
StorePersistenceHandler.PersistenceBatchType
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
Signal that the current batch of operations are ending for the specified ExecutionContext.void
Signal that a batch of operations are starting for the specified ExecutionContext.void
close()
Method to close the persistence handler, and release any resources.void
Deletes a persistent object from the datastore.void
deleteObjects
(DNStateManager... sms) Method to delete an array of objects from the datastore.void
fetchObject
(DNStateManager sm, int[] fieldNumbers) Fetches specified fields of a persistent object from the database.void
fetchObjects
(int[] fieldNumbers, DNStateManager... sms) Fetches specified fields of several persistent objects (of the same type) from the database.findObject
(ExecutionContext ec, Object id) Method to find a persistable object with the specified id from the datastore, if the StoreManager supports this operation (optional).findObjectForUnique
(ExecutionContext ec, AbstractClassMetaData cmd, String[] memberNames, Object[] values) Method to find the object with the specified value(s) for the member(s) of the specified type.Object[]
findObjects
(ExecutionContext ec, Object[] ids) Method to find an array of objects with the specified identities from the datastore.void
Inserts a persistent object into the database.void
insertObjects
(DNStateManager... sms) Method to insert an array of objects to the datastore.void
Locates this object in the datastore.void
locateObjects
(DNStateManager[] sms) Locates object(s) in the datastore.void
updateObject
(DNStateManager sm, int[] fieldNumbers) Updates a persistent object in the datastore.boolean
-
Field Details
-
storeMgr
FederatedStoreManager storeMgrManager for the store.
-
-
Constructor Details
-
FederatedPersistenceHandler
Constructor.- Parameters:
storeMgr
- StoreManager
-
-
Method Details
-
close
public void close()Description copied from interface:StorePersistenceHandler
Method to close the persistence handler, and release any resources.- Specified by:
close
in interfaceStorePersistenceHandler
-
useReferentialIntegrity
public boolean useReferentialIntegrity() -
insertObjects
Description copied from interface:StorePersistenceHandler
Method to insert an array of objects to the datastore.- Specified by:
insertObjects
in interfaceStorePersistenceHandler
- Parameters:
sms
- StateManagers for the objects to insert
-
deleteObjects
Description copied from interface:StorePersistenceHandler
Method to delete an array of objects from the datastore.- Specified by:
deleteObjects
in interfaceStorePersistenceHandler
- Parameters:
sms
- StateManagers for the objects to delete
-
batchStart
Description copied from interface:StorePersistenceHandler
Signal that a batch of operations are starting for the specified ExecutionContext. The batch type allows the store plugin to create whatever type of batch it needs.- Specified by:
batchStart
in interfaceStorePersistenceHandler
- Parameters:
ec
- The ExecutionContextbatchType
- Type of this batch that is starting
-
batchEnd
Description copied from interface:StorePersistenceHandler
Signal that the current batch of operations are ending for the specified ExecutionContext.- Specified by:
batchEnd
in interfaceStorePersistenceHandler
- Parameters:
ec
- The ExecutionContexttype
- Type of batch that is ending
-
insertObject
Description copied from interface:StorePersistenceHandler
Inserts a persistent object into the database.- Specified by:
insertObject
in interfaceStorePersistenceHandler
- Parameters:
sm
- StateManager of the object to be inserted.
-
updateObject
Description copied from interface:StorePersistenceHandler
Updates a persistent object in the datastore.- Specified by:
updateObject
in interfaceStorePersistenceHandler
- Parameters:
sm
- StateManager of the object to be updated.fieldNumbers
- The numbers of the fields to be updated.
-
deleteObject
Description copied from interface:StorePersistenceHandler
Deletes a persistent object from the datastore.- Specified by:
deleteObject
in interfaceStorePersistenceHandler
- Parameters:
sm
- StateManager of the object to be deleted.
-
fetchObject
Description copied from interface:StorePersistenceHandler
Fetches specified fields of a persistent object from the database.- Specified by:
fetchObject
in interfaceStorePersistenceHandler
- Parameters:
sm
- StateManager of the object to be fetched.fieldNumbers
- The numbers of the fields to be fetched.
-
fetchObjects
Description copied from interface:StorePersistenceHandler
Fetches specified fields of several persistent objects (of the same type) from the database.- Specified by:
fetchObjects
in interfaceStorePersistenceHandler
- Parameters:
fieldNumbers
- The numbers of the fields to be fetched.sms
- StateManagers of the objects to be fetched.
-
locateObject
Description copied from interface:StorePersistenceHandler
Locates this object in the datastore.- Specified by:
locateObject
in interfaceStorePersistenceHandler
- Parameters:
sm
- StateManager for the object to be found
-
locateObjects
Description copied from interface:StorePersistenceHandler
Locates object(s) in the datastore.- Specified by:
locateObjects
in interfaceStorePersistenceHandler
- Parameters:
sms
- StateManagers for the object(s) to be found
-
findObject
Description copied from interface:StorePersistenceHandler
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.- Specified by:
findObject
in interfaceStorePersistenceHandler
- Parameters:
ec
- The ExecutionContextid
- 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 DataNucleus.
-
findObjects
Description copied from interface:StorePersistenceHandler
Method to find an array of objects with the specified identities from the datastore. 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.- Specified by:
findObjects
in interfaceStorePersistenceHandler
- Parameters:
ec
- The ExecutionContextids
- identities of the object(s) to retrieve- Returns:
- The persistable objects with these identities (in the same order as
ids
)
-
findObjectForUnique
public Object findObjectForUnique(ExecutionContext ec, AbstractClassMetaData cmd, String[] memberNames, Object[] values) Description copied from interface:StorePersistenceHandler
Method to find the object with the specified value(s) for the member(s) of the specified type.- Specified by:
findObjectForUnique
in interfaceStorePersistenceHandler
- Parameters:
ec
- ExecutionContextcmd
- Metadata for the class in questionmemberNames
- Member(s) that define the objectvalues
- Value(s) for the member(s)- Returns:
- The object with these member value(s)
-