Interface AutoStartMechanism

All Known Implementing Classes:
AbstractAutoStartMechanism, ClassesAutoStarter, MetaDataAutoStarter

public interface AutoStartMechanism
Interface defining an Auto-Start Mechanism. An Auto-Start Mechanism is a means of auto-populating the classes supported by a StoreManager.

If the user changes their persistence definition a problem can occur when starting up DataNucleus. DataNucleus loads up its existing data from a repository (e.g the table "NUCLEUS_TABLES" for SchemaTableAutoStarter) and finds that a table/class required by the repository data no longer exists. There are 3 options for what DataNucleus will do in this situation.

  • Checked will mean that DataNucleus will throw an exception and the user will be expected to manually fix their datastore mismatch (perhaps by removing the existing tables).
  • Quiet (the default) will simply remove the entry from the repository and continue without exception.
  • Ignored will simply continue without doing anything.

Implementations must have a public constructor taking the arguments StoreManager and ClassLoaderResolver

  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Interface
    Description
    static enum 
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Method to add a class/field (with its data) to the currently-supported list.
    void
    Closes a transaction for writing (add/delete) classes to the auto start mechanism.
    void
    Method to delete all classes that are currently listed as supported in the internal storage.
    void
    Method to delete a class/field that is currently listed as supported in the internal storage.
    Accessor for the data for the classes that are currently auto started.
    Accessor for the mode of operation.
    Utility to return a description of the storage for this mechanism.
    boolean
    Whether it's open for writing (add/delete) classes to the auto start mechanism.
    void
    Starts a transaction for writing (add/delete) classes to the auto start mechanism.
    void
    Mutator for the mode of operation.
  • Method Details

    • getMode

      Accessor for the mode of operation.
      Returns:
      The mode of operation
    • setMode

      void setMode(AutoStartMechanism.Mode mode)
      Mutator for the mode of operation.
      Parameters:
      mode - The mode of operation
    • getAllClassData

      Accessor for the data for the classes that are currently auto started.
      Returns:
      Collection of StoreData elements
      Throws:
      DatastoreInitialisationException - If there is an error initialising the datastore
    • open

      void open()
      Starts a transaction for writing (add/delete) classes to the auto start mechanism.
    • close

      void close()
      Closes a transaction for writing (add/delete) classes to the auto start mechanism.
    • isOpen

      boolean isOpen()
      Whether it's open for writing (add/delete) classes to the auto start mechanism.
      Returns:
      whether this is open for writing
    • addClass

      void addClass(StoreData data)
      Method to add a class/field (with its data) to the currently-supported list.
      Parameters:
      data - The data for the class.
    • deleteClass

      void deleteClass(String name)
      Method to delete a class/field that is currently listed as supported in the internal storage. It does not drop the schema of the DatastoreClass neither the contents of it. It only removes the class from the AutoStart mechanism. TODO Rename this method to allow for deleting fields
      Parameters:
      name - The name of the class/field
    • deleteAllClasses

      void deleteAllClasses()
      Method to delete all classes that are currently listed as supported in the internal storage. It does not drop the schema of the DatastoreClass neither the contents of it. It only removes the classes from the AutoStart mechanism.
    • getStorageDescription

      String getStorageDescription()
      Utility to return a description of the storage for this mechanism.
      Returns:
      The storage description.