The first thing to add a new Simulator or Checker is to implement the Factory interface. The Factory interfaces are as follows:
Each Factory implementation declares a new plugin. Plugins are identified by the @PluginImplementation annotation.
@PluginImplementation
public class DummyPlugin implements AbstractModelFactory, AbstractRequirementFactory
Note that we are implementing in the same plugin a Simulator and a Checker. So we implement the two interfaces.
Then we implement functions of the AbstractDataFactory interface. These three functions shouldn’t need too much explanation. They will be used by the Graphical User Interface to display information about our plugin. The id, here fr.inria.plasmalab.dummy is a unique identifier. It allows to link a model saved in a PLASMA Lab project or transmitted for a distributed experiment to its dedicated simulator.
@Override
public String getName() {
return "Dummy plugin";
}
@Override
public String getId() {
return "fr.inria.plasmalab.dummy";
}
public String toString(){
return "Dummy plugin";
}
@Override
public String getDescription() {
return "This is the tutorial plugin";
}
The main purpose of the Factory interface is to provide a way of instentiating a Simulator or a Checker without knowing their classes. This is done by implementing the next two methods (inherited from their respective interfaces).
@Override
public Simulator createAbstractModel(String name) {
return new DummySimulator(name);
}
@Override
public Checker createAbstractRequirement(String name) {
return new DummySimulator(name);
}
And that’s it for the Factory!