Class SchemaAutoStarter
java.lang.Object
org.datanucleus.store.autostart.AbstractAutoStartMechanism
org.datanucleus.store.rdbms.autostart.SchemaAutoStarter
- All Implemented Interfaces:
org.datanucleus.store.autostart.AutoStartMechanism
public class SchemaAutoStarter
extends org.datanucleus.store.autostart.AbstractAutoStartMechanism
Implementation of an Auto-Start Mechanism for DataNucleus.
This implementation stores the classes supported in a table in the datastore.
It is initialised and read at startup, and is continually updated during the lifetime of the
calling application.
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.datanucleus.store.autostart.AutoStartMechanism
org.datanucleus.store.autostart.AutoStartMechanism.Mode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.datanucleus.store.connection.ManagedConnection
protected SchemaTable
protected RDBMSStoreManager
Fields inherited from class org.datanucleus.store.autostart.AbstractAutoStartMechanism
mode, open
-
Constructor Summary
ConstructorsConstructorDescriptionSchemaAutoStarter
(org.datanucleus.store.StoreManager store_mgr, org.datanucleus.ClassLoaderResolver clr) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addClass
(org.datanucleus.store.StoreData data) Method to add a class to the supported list.private void
Assert that the mechanism is closed from writing.private void
Assert that the mechanism is open from writingsvoid
close()
Closes a transaction for writing (add/delete) classes to the auto start mechanismvoid
Method to drop support for all current classes.void
deleteClass
(String class_name) Method to drop support for a class.Collection
<org.datanucleus.store.StoreData> Accessor for the data for the classes supported.Utility to output the storage description for this mechanism.boolean
isOpen()
Whether it's open for writing (add/delete) classes to the auto start mechanismvoid
open()
Starts a transaction for writing (add/delete) classes to the auto start mechanismMethods inherited from class org.datanucleus.store.autostart.AbstractAutoStartMechanism
getMode, setMode
-
Field Details
-
schemaTable
-
storeMgr
-
mconn
protected org.datanucleus.store.connection.ManagedConnection mconn
-
-
Constructor Details
-
SchemaAutoStarter
public SchemaAutoStarter(org.datanucleus.store.StoreManager store_mgr, org.datanucleus.ClassLoaderResolver clr) Constructor.- Parameters:
store_mgr
- The RDBMSManager managing the store that we are auto-starting.clr
- The ClassLoaderResolver
-
-
Method Details
-
getAllClassData
public Collection<org.datanucleus.store.StoreData> getAllClassData() throws org.datanucleus.exceptions.DatastoreInitialisationExceptionAccessor for the data for the classes supported.- Returns:
- Collection of classes supported (StoreData). Collection of StoreData elements
- Throws:
org.datanucleus.exceptions.DatastoreInitialisationException
- if an error occurs in datastore communication
-
assertIsOpen
private void assertIsOpen()Assert that the mechanism is open from writings -
assertIsClosed
private void assertIsClosed()Assert that the mechanism is closed from writing. -
open
public void open()Starts a transaction for writing (add/delete) classes to the auto start mechanism- Specified by:
open
in interfaceorg.datanucleus.store.autostart.AutoStartMechanism
- Overrides:
open
in classorg.datanucleus.store.autostart.AbstractAutoStartMechanism
-
close
public void close()Closes a transaction for writing (add/delete) classes to the auto start mechanism- Specified by:
close
in interfaceorg.datanucleus.store.autostart.AutoStartMechanism
- Overrides:
close
in classorg.datanucleus.store.autostart.AbstractAutoStartMechanism
-
isOpen
public boolean isOpen()Whether it's open for writing (add/delete) classes to the auto start mechanism- Specified by:
isOpen
in interfaceorg.datanucleus.store.autostart.AutoStartMechanism
- Overrides:
isOpen
in classorg.datanucleus.store.autostart.AbstractAutoStartMechanism
- Returns:
- whether this is open for writing
-
addClass
public void addClass(org.datanucleus.store.StoreData data) Method to add a class to the supported list.- Parameters:
data
- Data for the class to add.
-
deleteClass
Method to drop support for a class.- Parameters:
class_name
- The class
-
deleteAllClasses
public void deleteAllClasses()Method to drop support for all current classes. -
getStorageDescription
Utility to output the storage description for this mechanism.- Returns:
- The storage description
-