Many Extension Points (MailInfoTabProvider, MenuItemProvider, ...) allow your plugins to define custom frontends. The easiest way to build such a frontend is to use the same frontend technology novomind iAGENT uses: JavaServer Faces (JSF). Since novomind iAGENT uses an OSGi framework to run the plugins you have to consider the following:
The static resources of your plugins need to be inside the META-INF/resources
directory. Please use a subdirectory with an unique name to avoid conflicts with other plugins.
Your .xhtml view resources need to be inside the META-INF/views
or META-INF/includes
directory, depending on the extension point you want to implement. Keep an eye on the Javadoc of the extension point you are trying to implement, it will tell you where to place your .xhtml view resources.
Since novomind iAGENT runs your plugins on an OSGi framework you cannot use beans like in a normal JSF application. As a workaround we have defined delegator beans which you can use to access your instances of the CustomBean interface. The following beans are defined:
name | scope |
---|---|
asb | application |
ssb | session |
vsb | view |
rsb | request |
You can use those beans inside you .xhtml view resources to access your CustomBean instances like this:
<h:outputText value="#{vsb.get('MyCustomBean').text}" />
Whereas MyCustomBean
is a plugin defined like this:
import com.novomind.ecom.common.api.frontend.CustomBean;
import com.novomind.ecom.common.api.frontend.CustomManagedBean;
@CustomManagedBean("MyCustomBean")
public class MyCustomBean implements CustomBean {
public String getText() {
return "Hello World";
}
}
The instance of your CustomBean will be instanciated on first usage. It will have the same lifecycle like the delegator bean you use to access it. The preDestroy
method of your CustomBean instance is called when the delegator bean is destroyed.
Several operations to interact with the frontend from out of the backend of the novomind iAGENT app are provided by a FrontendController. The controller is accessible via dependency injection in the CustomBean.