-
Notifications
You must be signed in to change notification settings - Fork 9
Develop a system adapter in Java
Michael Röder edited this page Mar 7, 2017
·
2 revisions
For implementing a system adapter in Java, you should first take a look at the general implementation of a component.
The system adapter implements the API defined by the benchmark and enables the communication between the benchmark and the benchmarked system. The system adapter might be part of the same Docker container as the system or located in a different container. Since the system adapter can create additional containers both variants are supported by the Hobbit platform.
For implementing a system adapter, the existing abstract system adapter class can be extended.
public class ExampleSystemAdapter extends AbstractSystemAdapter {
@Override
public void init() throws Exception {
super.init();
// Your initialization code comes here...
// You can access the RDF model this.systemParamModel to retrieve meta data about this system adapter
}
@Override
public void receiveGeneratedData(byte[] data) {
// handle the incoming data as described in the benchmark description
}
@Override
public void receiveGeneratedTask(String taskId, byte[] data) {
// handle the incoming task and create a result
byte[] result = ...;
// Send the result to the evaluation storage
sendResultToEvalStorage(taskId, result);
}
@Override
public void close() throws IOException {
// Free the resources you requested here
...
// Always close the super class after yours!
super.close();
}
}