Class WriteableBeanDatabaseImpl

    • Method Detail

      • getAllTypes

        public Set<Type> getAllTypes()
        Description copied from interface: BeanDatabase
        Gets an unmodifiable set of all the types in the bean database
        Specified by:
        getAllTypes in interface BeanDatabase
        Returns:
        A non-null unmodifiable and possibly empty set of all the types in the database
      • getType

        public Type getType​(String type)
        Description copied from interface: BeanDatabase
        Gets the type with the given name
        Specified by:
        getType in interface BeanDatabase
        Parameters:
        type - The non-null name
        Returns:
        The type corresponding to the given name. May return null
      • getInstance

        public Instance getInstance​(String type,
                                    String instanceKey)
        Description copied from interface: BeanDatabase
        Returns the instance with the given instanceKey from the type with the given name
        Specified by:
        getInstance in interface BeanDatabase
        Parameters:
        type - The non-null name of the type to get the instance from
        instanceKey - The non-null key of the instance
        Returns:
        The bean from the given type with the given name. Will return null if the type does not exist or an instance with that key does not exist
      • removeType

        public Type removeType​(String typeName)
        Description copied from interface: WriteableBeanDatabase
        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
        Specified by:
        removeType in interface WriteableBeanDatabase
        Parameters:
        typeName - The non-null type name
        Returns:
        The type that was removed
      • commit

        public void commit()
        Description copied from interface: WriteableBeanDatabase
        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
        Specified by:
        commit in interface WriteableBeanDatabase
      • commit

        public void commit​(Object commitMessage)
        Description copied from interface: WriteableBeanDatabase
        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
        Specified by:
        commit in interface WriteableBeanDatabase
        Parameters:
        commitMessage - An object to pass to any BeanDatabaseUpdateListener that is registered
      • dumpDatabase

        public void dumpDatabase()
        Description copied from interface: BeanDatabase
        Dumps the type and instance names to stderr
        Specified by:
        dumpDatabase in interface BeanDatabase
      • dumpDatabase

        public void dumpDatabase​(PrintStream output)
        Description copied from interface: BeanDatabase
        Dumps the type and instance names to the given stream
        Specified by:
        dumpDatabase in interface BeanDatabase
        Parameters:
        output - - The non-null outut stream to write the database to
      • dumpDatabaseAsString

        public String dumpDatabaseAsString()
        Description copied from interface: BeanDatabase
        Dumps the type and instance names to a String for debugging
        Specified by:
        dumpDatabaseAsString in interface BeanDatabase
        Returns:
        A string with all type and instance names
      • getTwoPhaseResource

        public TwoPhaseResource getTwoPhaseResource()
        Description copied from interface: WriteableBeanDatabase
        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
        Specified by:
        getTwoPhaseResource in interface WriteableBeanDatabase
        Returns:
        A non-null TwoPhaseResource to be used by a DynamicConfiguration
      • setCommitMessage

        public void setCommitMessage​(Object commitMessage)
        Description copied from interface: WriteableBeanDatabase
        Sets the commit message for this writeable bean database
        Specified by:
        setCommitMessage in interface WriteableBeanDatabase
        Parameters:
        commitMessage - The possibly null commit message for this writeable bean database