Class specLoader
java.lang.Object
name.moore.kevin.ze.XMLdata.specs.specLoader
Class that loads all specifications held in XML into java objects.
Once loaded they can be converted into entities and their components
- Author:
- Kevin Moore
<dev@kevin.moore.name>
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidLoad specifications from disk which we will only need to do once.private voidloadSingleSpec(File fxml)Load the specific XML specifications file.
-
Field Details
-
LOGGER
private static final org.slf4j.Logger LOGGER -
xstream
public static com.thoughtworks.xstream.XStream xstreamXStream object to process XML files into java objects. -
allspecs
All the collected spec objects. These can be processed elsewhere.
-
-
Constructor Details
-
specLoader
public specLoader(com.thoughtworks.xstream.XStream x)
-
-
Method Details
-
load
Load specifications from disk which we will only need to do once.Store the loaded objects for later access. If the parameter is a directory then all XML files in that directory will be treated as a spec and loaded. Alternatively a single XML spec file can be passed for loading. Can be called repeatedly and will append to the already collected specs.
This loader also sets the required security so we only allow XStream abilities from this package.
- Parameters:
s- path to the directory from which to load specs from or to specific single file.- Throws:
FileNotFoundExceptioncom.thoughtworks.xstream.XStreamException
-
loadSingleSpec
private void loadSingleSpec(File fxml) throws FileNotFoundException, com.thoughtworks.xstream.XStreamExceptionLoad the specific XML specifications file. The file expects a<list>...</list>XML element wrapper containing one or more specs (of the same type).- Parameters:
fxml- full path to the file to load- Throws:
FileNotFoundException- XStreamExceptioncom.thoughtworks.xstream.XStreamException
-