Class YmlToEmfConverter
java.lang.Object
be.kuleuven.cs.distrinet.sparta.io.convert.YmlToEmfConverter
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classThe representation of a very simple txtmodel of a DFD. -
Method Summary
Modifier and TypeMethodDescriptionstatic FileConvert the given txt/yml DFD model to an EMF SPARTA model.static FileConvert the given txt/yml DFD model to an EMF SPARTA model.static voidRun the YmlToEmfConverter from the command line.static String[]parseDataFlowEndpoints(String entry) Parse a data-flow entry of the form"sender->recipient"into its two endpoints.
-
Method Details
-
main
Run the YmlToEmfConverter from the command line. The first argument is the file name.- Parameters:
args- Command line arguments. The first argument should be the filename.- Throws:
IOException
-
convert
Convert the given txt/yml DFD model to an EMF SPARTA model. The input file is resolved against the current working directory (user.dir), which is also where the converted model is written.- Parameters:
file- the txt/yml input file (absolute, or relative touser.dir).- Returns:
- the file the converted model was written to.
- Throws:
IOException- if the input cannot be read or parsed, or the converted model cannot be written.
-
convert
Convert the given txt/yml DFD model to an EMF SPARTA model.The converted model is written to
<workingDir>/dfd.spartaand the threat catalog is loaded from<workingDir>/ThreatSpecification.sparta.- Parameters:
workingDir- the directory against which the input is resolved and to which the output is written.file- the txt/yml input file (absolute, or relative toworkingDir).- Returns:
- the file the converted model was written to.
- Throws:
IOException- if the input cannot be read or parsed, or the converted model cannot be written.
-
parseDataFlowEndpoints
Parse a data-flow entry of the form"sender->recipient"into its two endpoints. The entry must contain exactly one"->"separator and both endpoints must be non-blank.- Parameters:
entry- the raw data-flow entry.- Returns:
- a two-element array
[sender, recipient](both trimmed). - Throws:
IllegalArgumentException- if the entry is null, does not contain exactly one"->"separator, or has an empty endpoint.
-