Refactor plugin system.

Introduce a new base classes for all the plugins.
They works like interfaces in Java: force the user to
implement some method.