org.datanucleus.store.autostart
Class XMLAutoStarter

java.lang.Object
  extended by org.datanucleus.store.autostart.AbstractAutoStartMechanism
      extended by 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
protected  org.w3c.dom.Document doc
           
protected  java.net.URL fileUrl
           
protected  org.w3c.dom.Element rootElement
           
 
Fields inherited from class org.datanucleus.store.autostart.AbstractAutoStartMechanism
LOCALISER, mode, open
 
Constructor Summary
XMLAutoStarter(StoreManager storeMgr, ClassLoaderResolver clr)
          Constructor, taking the XML file URL.
 
Method Summary
 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(java.lang.String className)
          Method to remove a class from the starter
 java.util.Collection getAllClassData()
          Accessor for all auto start data for this starter.
 java.lang.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
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileUrl

protected final java.net.URL fileUrl

doc

protected org.w3c.dom.Document doc

rootElement

protected org.w3c.dom.Element rootElement
Constructor Detail

XMLAutoStarter

public XMLAutoStarter(StoreManager storeMgr,
                      ClassLoaderResolver clr)
               throws java.net.MalformedURLException
Constructor, taking the XML file URL.

Parameters:
storeMgr - The StoreManager managing the store that we are auto-starting.
clr - The ClassLoaderResolver
Throws:
java.net.MalformedURLException
Method Detail

getAllClassData

public java.util.Collection getAllClassData()
                                     throws DatastoreInitialisationException
Accessor for all auto start data for this starter.

Returns:
The class auto start data. Collection of StoreData elements
Throws:
DatastoreInitialisationException

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 interface AutoStartMechanism
Overrides:
isOpen in class AbstractAutoStartMechanism
Returns:
whether this is open for writing

close

public void close()
Performs the write to the XML file.

Specified by:
close in interface AutoStartMechanism
Overrides:
close in class AbstractAutoStartMechanism

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(java.lang.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 java.lang.String getStorageDescription()
Method to give a descriptive name for the starter process.

Returns:
Description of the starter process.


Copyright © 2011. All Rights Reserved.