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 Document
doc
protected URL
fileUrl
protected Element
rootElement
-
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 void
addClass(StoreData data)
Method to add a class to the starter.void
close()
Performs the write to the XML file.void
deleteAllClasses()
Remove all classes from the starter.void
deleteClass(String className)
Method to remove a class from the starterCollection<StoreData>
getAllClassData()
Accessor for all auto start data for this starter.String
getStorageDescription()
Method to give a descriptive name for the starter process.boolean
isOpen()
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:
isOpen
in interfaceAutoStartMechanism
- Overrides:
isOpen
in classAbstractAutoStartMechanism
- Returns:
- whether this is open for writing
-
close
public void close()
Performs the write to the XML file.- Specified by:
close
in interfaceAutoStartMechanism
- Overrides:
close
in 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.
-
-