7.5. Plugin structure
Being built on top of Apache Karaf, Unomi leverages OSGi to support plugins. A Unomi plugin is, thus, an OSGi bundle specifying some specific metadata to tell Unomi the kind of entities it provides. A plugin can provide the following entities to extend Unomi, each with its associated definition (as a JSON file), located in a specific spot within the META-INF/cxs/
directory of the bundle JAR file:
Entity | Location in cxs directory |
---|---|
ActionType | actions |
ConditionType | conditions |
Persona | personas |
PropertyMergeStrategyType | mergers |
PropertyType | properties then profiles or sessions subdirectory then <category name> directory |
Rule | rules |
Scoring | scorings |
Segment | segments |
ValueType | values |
Blueprint is used to declare what the plugin provides and inject any required dependency. The Blueprint file is located, as usual, at OSGI-INF/blueprint/blueprint.xml
in the bundle JAR file.
The plugin otherwise follows a regular maven project layout and should depend on the Unomi API maven artifact:
<dependency>
<groupId>org.apache.unomi</groupId>
<artifactId>unomi-api</artifactId>
<version>...</version>
</dependency>
Some plugins consists only of JSON definitions that are used to instantiate the appropriate structures at runtime while some more involved plugins provide code that extends Unomi in deeper ways.
In both cases, plugins can provide more that one type of extension. For example, a plugin could provide both ActionType
s and ConditionType
s.