|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object de.smartics.properties.spi.config.support.AbstractConfigurationPropertiesFactory<T>
T
- the concrete type of the returned configuration properties.
@ThreadSafe public abstract class AbstractConfigurationPropertiesFactory<T extends ConfigurationPropertiesManagement>
Base implementation of the ConfigurationPropertiesManagementFactory
.
Constructor Summary | |
---|---|
protected |
AbstractConfigurationPropertiesFactory() Default constructor. |
Method Summary | |
---|---|
void |
addPropertyProviders(Collection<PropertyProvider> providers) Adds the given providers of properties as additional property definitions. |
void |
addPropertyProviders(PropertyProvider... providers) Adds the given providers of properties as additional property definitions. |
void |
addRootLocations(Collection<URL> urls) Adds the given URLs to the locations to search for property declarations and definitions. |
void |
addRootLocations(URL... urls) Adds the given additional URLs to the locations to search for property declarations and definitions. |
String |
addRootUrls(ArtifactId artifactId) Adds the URLs derived from the dependencies provided by the given artifactId to the locations to search for property declarations and definitions. |
T |
create(ConfigurationKey<?> key) Creates the configuration properties instance for the given key. |
T |
createDefault() Returns the configuration for the default key. |
ConfigurationPropertiesManagement |
createDefaultManagement() Returns the management view on a configuration for the default key. |
T |
createManagement(ConfigurationKey<?> key) Returns the configuration properties for the given key . |
protected abstract T |
createNewConfiguration(ConfigurationKey<?> key) Creates an empty instance of the configuration properties instance. |
ArtifactRef |
getArtifactRef(String artifactId) Returns the artifact reference by its short ID. |
FactoryConfiguration |
getFactoryConfiguration() Returns the factory configuration and changes values. |
String |
getId() Returns the unique id for this factory |
Collection<ConfigurationKey<?>> |
getRegisteredConfigurationKeys() Returns a list of keys to the registered configurations. |
PropertyDescriptorRegistry |
getRegistry() Returns the registry of declarations used by all created configurations. |
Collection<ConfigurationKey<?>> |
materialize() Materializes all configurations found by this factory. |
void |
release() Releases resources acquired by this instance. |
ConfigurationPropertiesManagement |
remove(ConfigurationKey<?> key) Removes the configuration with the given key from the cache. |
String |
toString() |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
protected AbstractConfigurationPropertiesFactory()
Method Detail |
---|
public String getId()
ConfigurationPropertiesFactory
getId
in interface
ConfigurationPropertiesFactory
public final PropertyDescriptorRegistry getRegistry()
ConfigurationPropertiesFactory
getRegistry
in interface
ConfigurationPropertiesFactory
public final FactoryConfiguration getFactoryConfiguration()
ConfigurationPropertiesFactory
Since factories are not thread-safe according to configuration changes, it is expected that the factory is configured prior to any creation calls.
getFactoryConfiguration
in interface
ConfigurationPropertiesFactory
public final void addRootLocations(Collection<URL> urls)
ConfigurationPropertiesFactory
declarations
and definitions. Property definitions are e.g. properties files or similar resources that define the actual value of a property.
Adding URLs only affects later creations of ConfigurationProperties
instances.
addRootLocations
in interface
ConfigurationPropertiesFactory
urls
- the URLs to add as search location. If the list is empty or
urls
is
null
, nothing is added without a warning.
public final void addRootLocations(URL... urls)
ConfigurationPropertiesFactory
declarations
and definitions. Property definitions are e.g. properties files or similar resources that define the actual value of a property.
Adding URLs only affects later creations of ConfigurationProperties
instances.
addRootLocations
in interface
ConfigurationPropertiesFactory
urls
- the URLs to add as search location. If the list is empty or
urls
is
null
, nothing is added without a warning.
public final void addPropertyProviders(Collection<PropertyProvider> providers)
ConfigurationPropertiesFactory
Adding providers only affects later creations of ConfigurationProperties
instances.
addPropertyProviders
in interface
ConfigurationPropertiesFactory
providers
- property providers for additional property name-value pairs. If the list is empty or
providers
is
null
, nothing is added without a warning.
public final void addPropertyProviders(PropertyProvider... providers)
ConfigurationPropertiesFactory
Adding providers only affects later creations of ConfigurationProperties
instances.
addPropertyProviders
in interface
ConfigurationPropertiesFactory
providers
- property providers for additional property name-value pairs. If the list is empty or
providers
is
null
, nothing is added without a warning.
public final String addRootUrls(ArtifactId artifactId) throws de.smartics.util.lang.NullArgumentException, RepositoryException, CompoundConfigurationException
ConfigurationPropertiesManagementFactory
artifactId
to the locations to search for property
declarations
and definitions. Property definitions are e.g. properties files or similar resources that define the actual value of a property.
Adding URLs only affects later creations of ConfigurationProperties
instances.
addRootUrls
in interface
ConfigurationPropertiesManagementFactory
artifactId
- the reference to the property resources.
de.smartics.util.lang.NullArgumentException
- if
artifactId
is
null
.
RepositoryException
- on any problem accessing the remote repository.
CompoundConfigurationException
- if loading property resources encountered problems.
public final ArtifactRef getArtifactRef(String artifactId) throws NullPointerException
ConfigurationPropertiesManagementFactory
getArtifactRef
in interface
ConfigurationPropertiesManagementFactory
artifactId
- the GAV concatenated and separated by colons.
null
if there is no artifact reference with the given
artifactId
registered.
NullPointerException
- if
artifactId
is
null
.
public final Collection<ConfigurationKey<?>> getRegisteredConfigurationKeys()
ConfigurationPropertiesFactory
getRegisteredConfigurationKeys
in interface
ConfigurationPropertiesFactory
public final T create(ConfigurationKey<?> key) throws NullPointerException, ConfigurationException
ConfigurationPropertiesManagementFactory
create
in interface
ConfigurationPropertiesFactory
create
in interface
ConfigurationPropertiesManagementFactory
key
- the key to identify the requested configuration.
ConfigurationPropertiesFactory.createManagement(ConfigurationKey)
,
EnvAppConfigurationKeyHelper
NullPointerException
- if
key
is
null
.
ConfigurationException
- on any problem loading the configuration properties.
public final T createDefault()
ConfigurationPropertiesFactory
createDefault
in interface
ConfigurationPropertiesFactory
null
.
public final ConfigurationPropertiesManagement createDefaultManagement()
ConfigurationPropertiesFactory
createDefaultManagement
in interface
ConfigurationPropertiesFactory
null
.
public final T createManagement(ConfigurationKey<?> key) throws NullPointerException, ConfigurationException
ConfigurationPropertiesFactory
key
. May return a cached instance.
createManagement
in interface
ConfigurationPropertiesFactory
key
- the identifier of the configuration properties that is requested.
ConfigurationPropertiesFactory.create(ConfigurationKey)
,
EnvAppConfigurationKeyHelper
null
.
NullPointerException
- if
key
is
null
.
ConfigurationException
- on any problem loading the configuration properties.
public Collection<ConfigurationKey<?>> materialize()
ConfigurationPropertiesFactory
materialize
in interface
ConfigurationPropertiesFactory
null
.
protected abstract T createNewConfiguration(ConfigurationKey<?> key) throws NullPointerException, ConfigurationException
key
- the key to the instance.
null
.
NullPointerException
- if
key
is
null
.
ConfigurationException
- if the configuration cannot be created.
public void release()
ConfigurationPropertiesManagementFactory
release
in interface
ConfigurationPropertiesManagementFactory
public final ConfigurationPropertiesManagement remove(ConfigurationKey<?> key) throws NullPointerException
ConfigurationPropertiesManagementFactory
remove
in interface
ConfigurationPropertiesManagementFactory
key
- the key of the configuration to remove.
NullPointerException
- if
key
is
null
.
public String toString()
toString
in class
Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |