Class AbstractProfileConfigMapper<T extends ConfigurationProfile>
- java.lang.Object
-
- org.craftercms.commons.config.profiles.AbstractProfileConfigMapper<T>
-
- All Implemented Interfaces:
ConfigurationMapper<T>
- Direct Known Subclasses:
AbstractAwsProfileMapper
,BoxProfileMapper
,WebDavProfileMapper
public abstract class AbstractProfileConfigMapper<T extends ConfigurationProfile> extends Object implements ConfigurationMapper<T>
Base class for configuration mappers that read configuration profiles and map them to profile classes.- Author:
- avasquez
-
-
Field Summary
Fields Modifier and Type Field Description protected ConfigurationResolver
configurationResolver
protected String
serviceName
-
Constructor Summary
Constructors Constructor Description AbstractProfileConfigMapper(String serviceName, ConfigurationResolver configurationResolver)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract T
mapProfile(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> profileConfig)
T
processConfig(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config)
Reads a single profile from the given configurationT
readConfig(ConfigurationProvider provider, String module, String path, String encoding, String profileId)
Reads the configuration from the specified input stream, extracts the specific sub-configuration identified byconfigId
and maps the configuration to a Java bean.
-
-
-
Field Detail
-
serviceName
protected String serviceName
-
configurationResolver
protected ConfigurationResolver configurationResolver
-
-
Constructor Detail
-
AbstractProfileConfigMapper
public AbstractProfileConfigMapper(String serviceName, ConfigurationResolver configurationResolver)
-
-
Method Detail
-
readConfig
public T readConfig(ConfigurationProvider provider, String module, String path, String encoding, String profileId) throws ConfigurationException
Description copied from interface:ConfigurationMapper
Reads the configuration from the specified input stream, extracts the specific sub-configuration identified byconfigId
and maps the configuration to a Java bean.- Specified by:
readConfig
in interfaceConfigurationMapper<T extends ConfigurationProfile>
- Parameters:
provider
- the provider to read the configuration fileencoding
- the charset encoding of the configuration fileprofileId
- the ID of the specific sub-configuration to map- Returns:
- the configuration object
- Throws:
ConfigurationException
- if an error occurs
-
processConfig
public T processConfig(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> config) throws ConfigurationException
Description copied from interface:ConfigurationMapper
Reads a single profile from the given configuration- Specified by:
processConfig
in interfaceConfigurationMapper<T extends ConfigurationProfile>
- Parameters:
config
- the profile configuration- Returns:
- the configuration object
- Throws:
ConfigurationException
- if an error occurs
-
mapProfile
protected abstract T mapProfile(org.apache.commons.configuration2.HierarchicalConfiguration<org.apache.commons.configuration2.tree.ImmutableNode> profileConfig) throws ConfigurationException
- Throws:
ConfigurationException
-
-