Interface WriteableBeanDatabase
- All Superinterfaces:
BeanDatabase
- All Known Implementing Classes:
WriteableBeanDatabaseImpl
A writeable version of a
BeanDatabase
. Types and instances can be
added to this in-memory database-
Method Summary
Modifier and TypeMethodDescriptionAdds a type of the given namevoid
commit()
This method should be called when the writeable database should become the current database.void
This method should be called when the writeable database should become the current database.findOrAddWriteableType
(String typeName) Gets or creates a writeable type with the given nameGets an unmodifiable set of all the types in the bean databaseGets the commit message for this writeable bean databaseReturns 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.getWriteableType
(String typeName) Gets a writeable type of the given nameremoveType
(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 databaseMethods inherited from interface org.glassfish.hk2.configuration.hub.api.BeanDatabase
dumpDatabase, dumpDatabase, dumpDatabaseAsString, getAllTypes, getInstance, getType
-
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
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
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
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
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
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
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
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
-