Skip to content

External interface change from version 0.4 to 0.5

Thomas Volden edited this page Jan 26, 2018 · 5 revisions

The external interface for 0.5 isn't fully backward compatible with 0.4

I have changed the design, so the JSONClient, SOAPClient, JSONServer and SOAPServer implements IClientAPI or IServerAPI, this is instead of inheriting from Client and Server.

Why would you change it?!

The external interface was exposing some abstract classes (Client/Server) from the core, which made them hard to refactor or change. To solve this I have used the bridge pattern and created two abstractions, one as a driver and the other as the implementation. This makes it possible to change implementations without affect to the external interfaces. Some quick wins by doing this:

  • I can refactor the client/Server into more precise classes.
  • I change some bad design choices and better use dependency injection.
  • I transformed the JSONClient (and the like) into composite roots.
  • I can now restructure the project for the next OCPP version.

What does this mean for you?

This shouldn't effect you, if you only stick to the concrete types. Example:

SOAPServer server = new SOAPServer(serverCoreProfile);

For server, you have to change the following:

Server server = new SOAPServer(serverCoreProfile);

To this:

IServerAPI server = new SOAPServer(serverCoreProfile);

For Client, you have to change the following:

Client client = new JSONClient(core, "test", false);

To this:

IClientAPI client = new JSONClient(core, "test", false);

If you need any help, then please don't hesitate to get in touch:

I will do my very best to help.

- Thomas Volden