Class ConfigurationListener
java.lang.Object
org.glassfish.hk2.configuration.internal.ConfigurationListener
- All Implemented Interfaces:
BeanDatabaseUpdateListener
@Singleton
@Visibility(LOCAL)
public class ConfigurationListener
extends Object
implements BeanDatabaseUpdateListener
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate HashSet
<ActiveDescriptor<?>> private DynamicConfigurationService
private ConfiguredByContext
private Hub
private ConfiguredByInjectionResolver
private ServiceLocator
private final Object
private final ConcurrentHashMap
<String, ConfigurationListener.ModificationInformation> -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate ActiveDescriptor
<?> addInstanceDescriptor
(DynamicConfiguration config, ActiveDescriptor<?> parent, String name, String type, Object bean, Object metadata) private void
void
commitDatabaseChange
(BeanDatabase reference, BeanDatabase newDatabase, Object commitMessage, List<Change> changes) This method is called after the change of database has already happened.private String
getTypeFromConfiguredBy
(ActiveDescriptor<?> descriptor) private void
initialize
(BeanDatabase database) private void
invokePostMethod
(Object target, List<PropertyChangeEvent> changes, String typeName) private boolean
invokePreMethod
(Object target, List<PropertyChangeEvent> changes, String typeName) private static boolean
isEager
(ActiveDescriptor<?> descriptor) private void
modifyInstanceDescriptor
(ActiveDescriptor<?> parent, String name, Object bean, Object metadata, String typeName, List<PropertyChangeEvent> changes) private void
void
prepareDatabaseChange
(BeanDatabase currentDatabase, BeanDatabase proposedDatabase, Object commitMessage, List<Change> changes) This method will be called prior to the bean database being updated.void
rollbackDatabaseChange
(BeanDatabase currentDatabase, BeanDatabase proposedDatabase, Object commitMessage, List<Change> changes) If anyBeanDatabaseUpdateListener.prepareDatabaseChange(BeanDatabase, BeanDatabase, Object, List)
throws an exception this method will be called on all listeners whoseBeanDatabaseUpdateListener.prepareDatabaseChange(BeanDatabase, BeanDatabase, Object, List)
had already been succesfully called.toString()
-
Field Details
-
hub
-
locator
-
configurationService
-
injectionResolver
-
context
-
typeInformation
private final ConcurrentHashMap<String,ConfigurationListener.ModificationInformation> typeInformation -
progenitorLock
-
allProgenitors
-
-
Constructor Details
-
ConfigurationListener
public ConfigurationListener()
-
-
Method Details
-
postConstruct
-
addInstanceDescriptor
private ActiveDescriptor<?> addInstanceDescriptor(DynamicConfiguration config, ActiveDescriptor<?> parent, String name, String type, Object bean, Object metadata) -
invokePreMethod
-
invokePostMethod
-
modifyInstanceDescriptor
private void modifyInstanceDescriptor(ActiveDescriptor<?> parent, String name, Object bean, Object metadata, String typeName, List<PropertyChangeEvent> changes) -
initialize
-
isEager
-
getTypeFromConfiguredBy
-
commitDatabaseChange
public void commitDatabaseChange(BeanDatabase reference, BeanDatabase newDatabase, Object commitMessage, List<Change> changes) Description copied from interface:BeanDatabaseUpdateListener
This method is called after the change of database has already happened. If this method throws an exception subsequent listeners commit methods will be called, but theWriteableBeanDatabase.commit()
method will throw an exception, indicating a possibly inconsistent state- Specified by:
commitDatabaseChange
in interfaceBeanDatabaseUpdateListener
- Parameters:
reference
- The database from which the current database was derivednewDatabase
- The current bean databasecommitMessage
- An object passed to the commit method in a dynamic changechanges
- The changes that were made to arrive at the current database
-
calculateProgenitorAddsAndRemoves
private void calculateProgenitorAddsAndRemoves() -
prepareDatabaseChange
public void prepareDatabaseChange(BeanDatabase currentDatabase, BeanDatabase proposedDatabase, Object commitMessage, List<Change> changes) Description copied from interface:BeanDatabaseUpdateListener
This method will be called prior to the bean database being updated. If this method throws an exception subsequent listeners prepare methods will not be called and the rollback method of any listeners that had run previously will be called and the proposedDatabase will not become the current database. If all the registered bean update listeners prepare methods return normally then the proposedDatabase will become the current database- Specified by:
prepareDatabaseChange
in interfaceBeanDatabaseUpdateListener
- Parameters:
currentDatabase
- The bean database that is current in effectproposedDatabase
- The bean database that will go into effectcommitMessage
- An object passed to the commit method in a dynamic changechanges
- The changes that were made to the current database
-
rollbackDatabaseChange
public void rollbackDatabaseChange(BeanDatabase currentDatabase, BeanDatabase proposedDatabase, Object commitMessage, List<Change> changes) Description copied from interface:BeanDatabaseUpdateListener
If anyBeanDatabaseUpdateListener.prepareDatabaseChange(BeanDatabase, BeanDatabase, Object, List)
throws an exception this method will be called on all listeners whoseBeanDatabaseUpdateListener.prepareDatabaseChange(BeanDatabase, BeanDatabase, Object, List)
had already been succesfully called. If this method throws an exception subsequent listeners rollback methods will be called and the exception will be returned in the exception thrown to the caller ofWriteableBeanDatabase.commit()
method- Specified by:
rollbackDatabaseChange
in interfaceBeanDatabaseUpdateListener
- Parameters:
currentDatabase
- The bean database that is current in effectproposedDatabase
- The bean database that was to go into effect (but which will not)commitMessage
- An object passed to the commit method in a dynamic changechanges
- The changes that were proposed to be made to the current database
-
toString
-