Skip to content

New Extension

papousek edited this page Apr 20, 2012 · 2 revisions

Create a New API Module

The module should have the following maven description

<groupId>org.sybila.parasim.extension</groupId>
<artifactId>your-new-extension-api</artifactId>
<packaging>jar</packaging>

To get configuration from Parasim

<parent>
    <groupId>org.sybila.parasim</groupId>
    <artifactId>parasim-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>${path.to.the.parasim.parent.pom.xml}</relativePath>
</parent>

Create a New Implementation Module

The module should have the following maven description

<groupId>org.sybila.parasim.extension</groupId>
<artifactId>your-new-extension-impl</artifactId>
<packaging>jar</packaging>

To get configuration from Parasim

<parent>
    <groupId>org.sybila.parasim</groupId>
    <artifactId>parasim-parent</artifactId>
    <version>1.0.0-SNAPSHOT</version>
    <relativePath>${path.to.the.parasim.parent.pom.xml}</relativePath>
</parent>

Loadable Extension

See Extension Loader page to create enter points to your implementation module.

Classes Providig Functionality

The first way:

public class FunctionalityRegistrar {
    @Inject
    private Instance<Functionality> functionality;

    public void registerFunctionality(@Observes ManagerStarted event, ...) {
        functionality.set(new Functionality(...));
    }
}

The second way:

public class FunctionalityRegistrar {
    @Provide
    public Functionality provideFunctionality(...) {
        functionality.set(new Functionality(...));
    }
}

You can fire a new event:

public class FunctionalityRegistrar {
    @Inject
    private Event<FunctionalityReady> event;

    @Provide
    public Functionality provideFunctionality(...) {
        functionality.set(new Functionality(...));
        event.fire(new FunctionalityReady());
    }
}