Class XmlFileConfigurationContext
- java.lang.Object
-
- net.officefloor.configuration.impl.ConfigurationContextImpl
-
- net.officefloor.configuration.impl.configuration.XmlFileConfigurationContext
-
- All Implemented Interfaces:
PropertyConfigurable
,ConfigurationContext
,ResourceSource
public class XmlFileConfigurationContext extends ConfigurationContextImpl implements PropertyConfigurable, ResourceSource
ConfigurationContext
obtainingConfigurationItem
instances from a single XMLFile
.This reduces the number of files required for unit testing.
- Author:
- Daniel Sagenschneider
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class net.officefloor.configuration.impl.ConfigurationContextImpl
ConfigurationContextImpl.ConfigurationSource
-
-
Field Summary
-
Fields inherited from interface net.officefloor.configuration.ConfigurationContext
DEFAULT_TAG_PREFIX, DEFAULT_TAG_SUFFIX, PROPERTY_CONFIGURATION_INPUT_CHARSET, PROPERTY_CONFIGURATION_INPUT_TAG_PREFIX, PROPERTY_CONFIGURATION_INPUT_TAG_SUFFIX, PROPERTY_CONFIGURATION_OUTPUT_CHARSET
-
-
Constructor Summary
Constructors Constructor Description XmlFileConfigurationContext(java.lang.Class<?> offsetClass, java.lang.String singleXmlFileName)
Obtains theConfigurationContext
contained in the XML file found in the package of the offset object.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addProperty(java.lang.String name, java.lang.String value)
Adds aProperty
to configure the item.protected ConfigurationContextImpl.ConfigurationSource
getConfigurationSource()
Obtains theConfigurationContextImpl.ConfigurationSource
.java.io.InputStream
sourceResource(java.lang.String location)
Attempts to source the resource.-
Methods inherited from class net.officefloor.configuration.impl.ConfigurationContextImpl
createConfigurationItem, getConfigurationItem, getOptionalConfigurationItem
-
-
-
-
Constructor Detail
-
XmlFileConfigurationContext
public XmlFileConfigurationContext(java.lang.Class<?> offsetClass, java.lang.String singleXmlFileName) throws java.lang.Exception
Obtains theConfigurationContext
contained in the XML file found in the package of the offset object.- Parameters:
offsetClass
- OffsetClass
identifying the package containing the XML file. This is typically theTestCase
class.singleXmlFileName
- Name of the XML file.- Throws:
java.lang.Exception
- If fails to initialise.
-
-
Method Detail
-
addProperty
public void addProperty(java.lang.String name, java.lang.String value)
Description copied from interface:PropertyConfigurable
Adds aProperty
to configure the item.- Specified by:
addProperty
in interfacePropertyConfigurable
- Parameters:
name
- Name ofProperty
.value
- Value ofProperty
.
-
sourceResource
public java.io.InputStream sourceResource(java.lang.String location)
Description copied from interface:ResourceSource
Attempts to source the resource.- Specified by:
sourceResource
in interfaceResourceSource
- Parameters:
location
- Location of the resource.- Returns:
InputStream
to the content of the resource ornull
if not able to source the resource.
-
getConfigurationSource
protected ConfigurationContextImpl.ConfigurationSource getConfigurationSource()
Description copied from class:ConfigurationContextImpl
Obtains theConfigurationContextImpl.ConfigurationSource
.- Overrides:
getConfigurationSource
in classConfigurationContextImpl
- Returns:
ConfigurationContextImpl.ConfigurationSource
.
-
-