Implementing sightly can be basically done with two important APIs (although few others are also available). In my other article I have cover up how you can Access OSGI service from the WCMUse-class in Sightly, here we are going to cover next important one which shows how you can implements the Use-interface in Java and combine your business logic with component file.
Let’s see
Use
interface first, later we will jump to code.
Looking to Java Documentation of Use,
All you need to make sure is to implement public void init(javax.script.Bindings bindings). The initmethod will be called on initialization of the class with a Bindings object that holds all the context objects and any parameters passed into the use-class. Business logic will be present in this method, although you are free to create custom method which will be called from
init()
.
Binding object is an mapping of key/value pairs, all of whose keys are
Strings
.
No comments :
Post a Comment