Package org.datanucleus.store.autostart
Class XMLAutoStarter
- java.lang.Object
-
- org.datanucleus.store.autostart.AbstractAutoStartMechanism
-
- org.datanucleus.store.autostart.XMLAutoStarter
-
- All Implemented Interfaces:
AutoStartMechanism
public class XMLAutoStarter extends AbstractAutoStartMechanism
An auto-starter mechanism storing its definition in an XML file. Is independent of the datastore since it is stored as a file and not in the actual datastore. TODO Add a DataNucleusAutoStart DTD to validate the file automatically. TODO If we have one per PMF, need to guarantee unique naming of file.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.datanucleus.store.autostart.AutoStartMechanism
AutoStartMechanism.Mode
-
-
Field Summary
Fields Modifier and Type Field Description protected Documentdocprotected URLfileUrlprotected ElementrootElement-
Fields inherited from class org.datanucleus.store.autostart.AbstractAutoStartMechanism
mode, open
-
-
Constructor Summary
Constructors Constructor Description XMLAutoStarter(StoreManager storeMgr, ClassLoaderResolver clr)Constructor, taking the XML file URL.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClass(StoreData data)Method to add a class to the starter.voidclose()Performs the write to the XML file.voiddeleteAllClasses()Remove all classes from the starter.voiddeleteClass(String className)Method to remove a class from the starterCollection<StoreData>getAllClassData()Accessor for all auto start data for this starter.StringgetStorageDescription()Method to give a descriptive name for the starter process.booleanisOpen()Whether it's open for writing (add/delete) classes to the auto start mechanism.-
Methods inherited from class org.datanucleus.store.autostart.AbstractAutoStartMechanism
getMode, open, setMode
-
-
-
-
Constructor Detail
-
XMLAutoStarter
public XMLAutoStarter(StoreManager storeMgr, ClassLoaderResolver clr) throws MalformedURLException
Constructor, taking the XML file URL.- Parameters:
storeMgr- The StoreManager managing the store that we are auto-starting.clr- The ClassLoaderResolver- Throws:
MalformedURLException- if an error occurs processing the URL
-
-
Method Detail
-
getAllClassData
public Collection<StoreData> getAllClassData() throws DatastoreInitialisationException
Accessor for all auto start data for this starter.- Returns:
- The class auto start data. Collection of StoreData elements
- Throws:
DatastoreInitialisationException- If an error occurs in datastore init
-
isOpen
public boolean isOpen()
Whether it's open for writing (add/delete) classes to the auto start mechanism. This autostarter is always open- Specified by:
isOpenin interfaceAutoStartMechanism- Overrides:
isOpenin classAbstractAutoStartMechanism- Returns:
- whether this is open for writing
-
close
public void close()
Performs the write to the XML file.- Specified by:
closein interfaceAutoStartMechanism- Overrides:
closein classAbstractAutoStartMechanism
-
addClass
public void addClass(StoreData data)
Method to add a class to the starter. Adds attributes for all defined properties.- Parameters:
data- The store data to add
-
deleteClass
public void deleteClass(String className)
Method to remove a class from the starter- Parameters:
className- The name of the class to remove.
-
deleteAllClasses
public void deleteAllClasses()
Remove all classes from the starter.
-
getStorageDescription
public String getStorageDescription()
Method to give a descriptive name for the starter process.- Returns:
- Description of the starter process.
-
-