public interface ConfigurationFormat
PropertySource
. Complex file formats, however, may contain entries
of different priorities. In this cases, each ordinal type found typically is returned as a separate section so the
consuming PropertySourceProvider
implementation can distribute the different part to
individual PropertySource
s.
Modifier and Type | Method and Description |
---|---|
boolean |
accepts(URL url)
Allows the format to examine the given resource, e.g. for a matching file ending.
|
String |
getName()
Get a unique name of the format.
|
ConfigurationData |
readConfiguration(String resource,
InputStream inputStream)
Reads a configuration from an URL, hereby parsing the given
InputStream . |
String getName()
boolean accepts(URL url)
url
- the url to read the configuration data from (could be a file, a remote location, a classpath
resource or something else, not null.ConfigurationData readConfiguration(String resource, InputStream inputStream)
InputStream
. Dependening on
the capabilities of the format the returned ConfigurationData
may contain
different levels of data:
ConfigurationData.getCombinedProperties()
. This allows to use the properties as inout to a default mapping,
which is always appropriate as long as no other semnatics
are defined in the concrete target scenario.PropertySource
instances with different ordinal levels. As an example imagine a custom format that contains sections
'defaults', 'global-defaults', 'application', 'server-overrides'.PropertySource
.resource
- a descriptive name for the resource, since an InputStream does not have any)inputStream
- the inputStream to read the configuration data from (could be a file, a remote location, a classpath
resource or something else.ConfigurationData
containing sections/properties read, never null
.ConfigException
- if parsing of the input fails.PropertySource
Copyright © 2014–2015 Apache Software Foundation. All rights reserved.