public class ReloadingCombinedConfigurationBuilder extends CombinedConfigurationBuilder implements ReloadingControllerSupport
An extension of CombinedConfigurationBuilder which also supports
reloading operations.
This class differs from its super class in the following aspects:
ReloadingController is created which manages all child
configuration builders supporting reloading operations.ConfigurationBuilder is provided for the definition
configuration, a builder with reloading support is created.This class can be used exactly as its super class for creating combined configurations from multiple configuration sources. In addition, the combined reloading controller managed by an instance can be used to react on changes in one of these configuration sources or in the definition configuration.
ADDITIONAL_NAME| Constructor and Description |
|---|
ReloadingCombinedConfigurationBuilder()
Creates a new instance of
ReloadingCombinedConfigurationBuilder. |
ReloadingCombinedConfigurationBuilder(Map<String,Object> params)
Creates a new instance of
ReloadingCombinedConfigurationBuilder
and sets the specified initialization parameters. |
ReloadingCombinedConfigurationBuilder(Map<String,Object> params,
boolean allowFailOnInit)
Creates a new instance of
ReloadingCombinedConfigurationBuilder
and sets the specified initialization parameters and the
allowFailOnInit flag. |
| Modifier and Type | Method and Description |
|---|---|
ReloadingCombinedConfigurationBuilder |
configure(BuilderParameters... params)
Appends the content of the specified
BuilderParameters objects to
the current initialization parameters. |
protected ReloadingController |
createReloadingController()
Creates the
ReloadingController for this builder. |
protected ConfigurationBuilder<? extends HierarchicalConfiguration<?>> |
createXMLDefinitionBuilder(BuilderParameters builderParams)
Creates a default builder for the definition configuration and
initializes it with a parameters object.
|
CombinedConfiguration |
getConfiguration()
Returns the configuration provided by this builder.
|
ReloadingController |
getReloadingController()
Returns the
ReloadingController associated with this object. |
protected void |
initResultInstance(CombinedConfiguration result)
Initializes a newly created result object.
|
static void |
obtainReloadingController(Collection<ReloadingController> subControllers,
Object builder)
Checks whether the passed in builder object supports reloading.
|
builderNames, configureEntityResolver, createAdditionalsConfiguration, createResultDeclaration, getChildBuilders, getDefinitionBuilder, getDefinitionConfiguration, getNamedBuilder, initChildBuilderParameters, initFileSystem, initSystemProperties, providerForTag, registerConfiguredLookups, resetParameters, setupDefinitionBuilderaddEventListener, addParameters, connectToReloadingController, copyEventListeners, copyEventListeners, createResult, createResultInstance, fetchBeanHelper, fireBuilderEvent, getParameters, getResultClass, getResultDeclaration, installEventListener, isAllowFailOnInit, removeEventListener, reset, resetResult, setParameterspublic ReloadingCombinedConfigurationBuilder()
ReloadingCombinedConfigurationBuilder.
No parameters are set.public ReloadingCombinedConfigurationBuilder(Map<String,Object> params, boolean allowFailOnInit)
ReloadingCombinedConfigurationBuilder
and sets the specified initialization parameters and the
allowFailOnInit flag.params - a map with initialization parametersallowFailOnInit - the allowFailOnInit flagpublic ReloadingCombinedConfigurationBuilder configure(BuilderParameters... params)
BuilderParameters objects to
the current initialization parameters. Calling this method multiple times
will create a union of the parameters provided. This method is overridden to adapt the return type. This method is overridden to adapt the return type.configure in class CombinedConfigurationBuilderparams - an arbitrary number of objects with builder parameterspublic ReloadingController getReloadingController()
ReloadingController associated with this object. This implementation returns a
CombinedReloadingController which contains sub controllers for
all child configuration sources with reloading support. If the definition
builder supports reloading, its controller is contained, too. Note that
the combined reloading controller is initialized when the result
configuration is created (i.e. when calling getConfiguration()
for the first time). So this method does not return a meaningful result
before.getReloadingController in interface ReloadingControllerSupportReloadingControllerpublic CombinedConfiguration getConfiguration() throws ConfigurationException
ImmutableConfiguration object. This implementation creates the result configuration on
first access. Later invocations return the same object until this builder
is reset. The double-check idiom for lazy initialization is used (Bloch,
Effective Java, item 71). This implementation makes sure that the reloading state of
the managed reloading controller is reset. Note that this has to be done
here and not in initResultInstance(CombinedConfiguration)
because it must be outside of a synchronized block; otherwise, a
dead-lock situation can occur.getConfiguration in interface ConfigurationBuilder<CombinedConfiguration>getConfiguration in class BasicConfigurationBuilder<CombinedConfiguration>ConfigurationException - if an error occursprotected ConfigurationBuilder<? extends HierarchicalConfiguration<?>> createXMLDefinitionBuilder(BuilderParameters builderParams)
XMLConfiguration; it expects a corresponding file specification.
Note: This method is called in a synchronized block. This implementation creates a builder for XML
configurations with reloading support.createXMLDefinitionBuilder in class CombinedConfigurationBuilderbuilderParams - the parameters object for the builderprotected void initResultInstance(CombinedConfiguration result) throws ConfigurationException
BeanHelper class to initialize the
object's property based on the BeanDeclaration returned by
BasicConfigurationBuilder.getResultDeclaration(). Note: This method is invoked in a
synchronized block. This is required because internal state is accessed.
Sub classes must not call this method without proper synchronization. This implementation processes the definition configuration
in order to
CombinedConfigurationCombinedConfigurationCombinedReloadingController for all child configuration sources
with reloading support.initResultInstance in class CombinedConfigurationBuilderresult - the object to be initializedConfigurationException - if an error occursprotected ReloadingController createReloadingController() throws ConfigurationException
ReloadingController for this builder. This method is
called after the result configuration has been created and initialized.
It is called from a synchronized block. This implementation creates a
CombinedReloadingController.ReloadingController for this builderConfigurationException - if an error occurspublic static void obtainReloadingController(Collection<ReloadingController> subControllers, Object builder)
subControllers - the list with sub controllersbuilder - the builder object to be checkedCopyright © 2001–2020 The Apache Software Foundation. All rights reserved.