Develop a system adapter in Java

Michael Röder edited this page Mar 7, 2017 · 1 revision

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();
    }

}
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.