Interface WriteableBeanDatabase
-
- All Superinterfaces:
BeanDatabase
- All Known Implementing Classes:
WriteableBeanDatabaseImpl
public interface WriteableBeanDatabase extends BeanDatabase
A writeable version of aBeanDatabase
. Types and instances can be added to this in-memory database- Author:
- jwells
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description WriteableType
addType(String typeName)
Adds a type of the given namevoid
commit()
This method should be called when the writeable database should become the current database.void
commit(Object commitMessage)
This method should be called when the writeable database should become the current database.WriteableType
findOrAddWriteableType(String typeName)
Gets or creates a writeable type with the given nameSet<WriteableType>
getAllWriteableTypes()
Gets an unmodifiable set of all the types in the bean databaseObject
getCommitMessage()
Gets the commit message for this writeable bean databaseTwoPhaseResource
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.WriteableType
getWriteableType(String typeName)
Gets a writeable type of the given nameType
removeType(String typeName)
Removed the given type and all of its instances from the database.void
setCommitMessage(Object commitMessage)
Sets the commit message for this writeable bean database-
Methods inherited from interface org.glassfish.hk2.configuration.hub.api.BeanDatabase
dumpDatabase, dumpDatabase, dumpDatabaseAsString, getAllTypes, getInstance, getType
-
-
-
-
Method Detail
-
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 createdMultiException
- if there were user implementations ofBeanDatabaseUpdateListener
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 anyBeanDatabaseUpdateListener
that is registered- Throws:
IllegalStateException
- if the current database has been modified since this writeable database copy was createdMultiException
- if there were user implementations ofBeanDatabaseUpdateListener
that failed by throwing exceptions this exception will be thrown wrapping those exceptions
-
-