Implementation of LPS-42166 - aka hooks in Scala

This change was based on implementation used for LPS-31419 (portlets in Scala)