Class SpartaCliProcessor
java.lang.Object
be.kuleuven.cs.distrinet.sparta.cli.SpartaCliProcessor
- All Implemented Interfaces:
CliProcessor
Command line processor. Every
GenericCliCmd and Exporter can
provide a list of options and will be called with the provided arguments to
check if they need to perform any action.-
Constructor Summary
ConstructorsConstructorDescriptionSpartaCliProcessor(Set<GenericCliCmd> gens, Set<Exporter> exporters) Create a new SpartaCliProcessor. -
Method Summary
Modifier and TypeMethodDescriptionorg.apache.commons.cli.OptionsGet the full set of command line options.static ResourceSetLoad a model from the provided filename.voidProcess the provided command line arguments.voidregisterGeneric(GenericCliCmd genCmd) Register a generic command with this cli processor.runThreatAnalysis(String target) Run a threat analysis on user-specified model.static voidSetup EMF for running it outside of an eclipse instance.static voidSetup VIATRA for running it outside of an eclipse instance.
-
Constructor Details
-
SpartaCliProcessor
Create a new SpartaCliProcessor.- Parameters:
gens- Set of generic command such as help, about, etc.exporters- Set of potential exporters to provide export functionality to csv, xlsx, etc.
-
-
Method Details
-
process
Process the provided command line arguments.- Specified by:
processin interfaceCliProcessor- Parameters:
args- the cli arguments
-
runThreatAnalysis
Run a threat analysis on user-specified model. The model file is retrieved from the cli arguments.- Parameters:
target- the model- Returns:
- the resulting list of threats
-
loadModel
Load a model from the provided filename. This is a helper method that returns the ResourceSet. It does not run the threat analysis. To load a model and run the threat analysis use runThreatAnalysis.- Parameters:
target- the filename of the model- Returns:
- the ResourceSet with the model.
-
registerGeneric
Register a generic command with this cli processor. Its options will be taken into account.- Parameters:
genCmd- theGenericCliCmdto register
-
setupVIATRAStandalone
public static void setupVIATRAStandalone()Setup VIATRA for running it outside of an eclipse instance. -
setupEMFStandalone
public static void setupEMFStandalone()Setup EMF for running it outside of an eclipse instance. -
getOptions
public org.apache.commons.cli.Options getOptions()Description copied from interface:CliProcessorGet the full set of command line options.- Specified by:
getOptionsin interfaceCliProcessor- Returns:
- the set of supported options.
-