Interface WriteableBeanDatabase

All Superinterfaces:
BeanDatabase
All Known Implementing Classes:
WriteableBeanDatabaseImpl

public interface WriteableBeanDatabase extends BeanDatabase
A writeable version of a BeanDatabase. Types and instances can be added to this in-memory database
  • Method Details

    • getAllWriteableTypes

      Set<WriteableType> getAllWriteableTypes()
      Gets an unmodifiable set of all the types in the bean database
      Returns:
      A non-null unmodifiable and possibly empty set of all the types in the database
    • addType

      WriteableType addType(String typeName)
      Adds a type of the given name
      Parameters:
      typeName - The name of the type to add
      Returns:
      The non-null type that has been added to the database
    • removeType

      Type removeType(String typeName)
      Removed the given type and all of its instances from the database. The set of changes will include the instances removed prior to the change indicating that the type was removed
      Parameters:
      typeName - The non-null type name
      Returns:
      The type that was removed
    • getWriteableType

      WriteableType getWriteableType(String typeName)
      Gets a writeable type of the given name
      Parameters:
      typeName - The non-null name of the type to fetch
      Returns:
      The existing type, or null if the type does not already exist
    • findOrAddWriteableType

      WriteableType findOrAddWriteableType(String typeName)
      Gets or creates a writeable type with the given name
      Parameters:
      typeName - The non-null name of the type to find or create
      Returns:
      The non-null writeable type that was created or found
    • getCommitMessage

      Object getCommitMessage()
      Gets the commit message for this writeable bean database
      Returns:
      The possibly null commit message for this writeable bean database
    • setCommitMessage

      void setCommitMessage(Object commitMessage)
      Sets the commit message for this writeable bean database
      Parameters:
      commitMessage - The possibly null commit message for this writeable bean database
    • getTwoPhaseResource

      TwoPhaseResource getTwoPhaseResource()
      Returns a two-phase resource that can be used by a DynamicConfiguration to tie the transaction done by this WriteableBeanDatabase into a commit done by the DynamicConfiguration. When the DynamicConfiguration calls commit this WriteableBeanDatabase will be part of the transaction
      Returns:
      A non-null TwoPhaseResource to be used by a DynamicConfiguration
    • commit

      void commit() throws IllegalStateException, MultiException
      This method should be called when the writeable database should become the current database. All changes will be communicated to the listeners. If the current database has been modified since this writeable database was created then this method will throw an IllegalStateException. This version of commit will use the commit message set on this writeable bean database
      Throws:
      IllegalStateException - if the current database has been modified since this writeable database copy was created
      MultiException - if there were user implementations of BeanDatabaseUpdateListener that failed by throwing exceptions this exception will be thrown wrapping those exceptions
    • commit

      void commit(Object commitMessage) throws IllegalStateException, MultiException
      This method should be called when the writeable database should become the current database. All changes will be communicated to the listeners. If the current database has been modified since this writeable database was created then this method will throw an IllegalStateException. This version of commit will use the commit message passed in rather than the one set on this writeable bean database
      Parameters:
      commitMessage - An object to pass to any BeanDatabaseUpdateListener that is registered
      Throws:
      IllegalStateException - if the current database has been modified since this writeable database copy was created
      MultiException - if there were user implementations of BeanDatabaseUpdateListener that failed by throwing exceptions this exception will be thrown wrapping those exceptions