-
Notifications
You must be signed in to change notification settings - Fork 5
Plugin
Pierre T. edited this page Jan 12, 2015
·
7 revisions
Plugin is the main API used by Nuun users. Its role is to provide scan request to the kernel and compute the results to provide classes to bind to the DI engine (e.g. Guice Module).
Plugins can have different kind of concern:
- Boostraping the application (WebPlugin, CLIPlugin, ITPlugin)
- Implementing technical support for a third-party library (JMS, Apache Shiro, etc.)
- Implementing business convention (Domain Driven Design)
- Extend
AbstractPlugin
. This abstract class provides default method for thePlugin
interface, so when you extend it, the only mandatory method ispublic String name()
.
public class MyPlugin extends AbstractPlugin {
@Override
public String name() {
return "my-plugin";
}
...
}
- Register the plugin using the service loader. Add a file
io.nuun.kernel.api.Plugin
in theMETA-INF/services
directory referring your plugin.
Now that you have your plugin,
- Do some action at the plugin life cycle steps (See Plugin life cycle).
- Do some requests to the kernel by implementing associated methods (See Request API).
- If you have some classes to bind implements the following method (See Native module).
@Override
public Object nativeUnitModule() {
return new MyModule(classesToBind); // Could be a Guice Module
}
- Use the API of other modules (See Dependencies).
Notice that these steps are optional, is it regarding your needs.
- Introduction
- ... Motivation
- ... Features
- ... Manifesto
- User manual
- ... Kernel
- ...... Kernel Life Cycle
- ...... Kernel Configuration
- ... Plugin
- ...... Plugin Life cycle
- ...... Request API
- ...... Native Module
- ...... Dependencies
- ... Tests
- ...... Integration Tests
- Advanced topics
- ... Design Best Practices
- ... Multi-Round Plugin
- ... Kernel param aliases
- ... SPI
- ...... DI Provider
- ...... Concern
- ...... Extension
- Definitions
- ... Framework
- ... Entreprise Stack
- ... API
- ... SPI
- ... Library
- ... Inversion of Control
- ... Dependency Injection
- Concepts
- ... UnitModule
- ... GlobalModule
- ... ObjectGraph