Package org.datanucleus.store
Class StoreDataManager
- java.lang.Object
-
- org.datanucleus.store.StoreDataManager
-
public class StoreDataManager extends Object
Manager for store information. Keeps a record of which classes are managed by this datastore, and key information about how that class is handled.
-
-
Field Summary
Fields Modifier and Type Field Description protected Map<String,StoreData>savedStoreDataByNamethe memory image of schema data before running itprotected Map<String,StoreData>storeDataByNameMap of all managed store data, keyed by the class/field name.
-
Constructor Summary
Constructors Constructor Description StoreDataManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbegin()Begin a transaction that changes the StoreData cachevoidclear()Clear the cachevoidcommit()Commit the transaction changes to the StoreData cachevoidderegisterClass(String className)StoreDataget(String className)Get the StoreData by the given class nameStoreDataget(AbstractMemberMetaData mmd)Get the StoreData by the given field/property when SCO, if it has some specific store data component (join table).Collection<StoreData>getManagedStoreData()Accessor for the StoreData currently managed by this store.StoreData[]getStoreDataForProperties(String key1, Object value1, String key2, Object value2)Convenience accessor for all store data where property 1 has value1 and property 2 has value2.booleanmanagesClass(String className)Accessor for whether the specified class (when FCO) or fully qualified field (when SCO) is managed currentlyprotected voidregisterStoreData(StoreData data)Method to register some data with the store.voidrollback()Rollback the transaction changes to the StoreData cacheintsize()Accessor to the number of StoreData in cache
-
-
-
Method Detail
-
clear
public void clear()
Clear the cache
-
deregisterClass
public void deregisterClass(String className)
-
registerStoreData
protected void registerStoreData(StoreData data)
Method to register some data with the store.- Parameters:
data- The StoreData to add
-
getStoreDataForProperties
public StoreData[] getStoreDataForProperties(String key1, Object value1, String key2, Object value2)
Convenience accessor for all store data where property 1 has value1 and property 2 has value2. Uses equals() on the values. Doesn't cater for null values.- Parameters:
key1- Property 1 namevalue1- Property 1 valuekey2- Property 2 namevalue2- Property 2 value- Returns:
- Store data with the specified property values
-
managesClass
public boolean managesClass(String className)
Accessor for whether the specified class (when FCO) or fully qualified field (when SCO) is managed currently- Parameters:
className- The name of the class (or fully qualified field)- Returns:
- Whether it is managed
-
getManagedStoreData
public Collection<StoreData> getManagedStoreData()
Accessor for the StoreData currently managed by this store.- Returns:
- Collection of the StoreData being managed
-
get
public StoreData get(String className)
Get the StoreData by the given class name- Parameters:
className- the fully qualified class name- Returns:
- the StoreData
-
get
public StoreData get(AbstractMemberMetaData mmd)
Get the StoreData by the given field/property when SCO, if it has some specific store data component (join table).- Parameters:
mmd- metadata for the the field/property- Returns:
- the StoreData
-
size
public int size()
Accessor to the number of StoreData in cache- Returns:
- the number of StoreData in cache
-
begin
public void begin()
Begin a transaction that changes the StoreData cache
-
rollback
public void rollback()
Rollback the transaction changes to the StoreData cache
-
commit
public void commit()
Commit the transaction changes to the StoreData cache
-
-