Skip to content

v1 11. Plugins

Frank Hossfeld edited this page Nov 28, 2019 · 1 revision

Plugins

Nalu provides a mechanism to divide large application into smaller parts.

Plugin Project

A plugin project can contain everything a application project can contain except of the application interface and it needs a plugin interface. A plugin interface looks like that:

@Plugin(name = "loginPlugin")
public interface LoginPlugin
    extends IsPlugin<MyApplicationContext> {
}

Inside a plugin interface the @Filters-annotation can be used. Plugin projects are able to use handlers, Controllers, Composites and shells.

This is an example of a Nalu plugin project:

Plugin Project Layout

The 'base project' contains classes like events and the context class, which will be used inside the plugin projects and the application project.

To use plugins inside an application, use the @Plugin-annotation. Adding the following lines to the application interface:

@Application(loader = MyApplicationLoader.class,
             startRoute = "/loginShell/loginShell/login",
             context = MyApplicationContext.class,
             routeError = "/errorShell/error")
@Plugins({ ErrorPlugin.class,
           LoginPlugin.class })
interface MyApplication
    extends IsApplication {
}

will tell the application to use the ErrorPlugin and the LoginPlugin.

The NaluDominoLoginPluginApplication demonstrates the use of plugins.