Develop an Apromore Plugin API

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

First you need to write your own interfaces that extends the Plugin or ParameterAwarePlugin interface and defines the methods your plug-ins have to implement. Afterwards you should write a PluginProvider that exposes all plug-ins that implement your plug-in API. The PluginProvider will be used by Apromore to find all installed Plugins at runtime.

Your Plugin API and Plugin API Provider should be kept separate from each other, so you need to create two new Maven modules (projects).

Create a new Plugin API project

...

  1. To create a new Plug-in API Provider project you can simply use one of the existing Plug-in API Provider projects as template and copy it to a new directory. You could, for example, use the Canoniser API Provider and copy it to the directory:

    Code Block
    COPY Apromore-Plugins/plugin-canoniser/core/provider TO Apromore-Plugins/plugin-yourplugin/core/provider
  2. Now you MUST modify the Maven project file (pom.xml) to reflect your new Plug-in. The important parts that need to be changed are shown below. Be sure to include the Plug-in API project you just created in the dependencies. For example, the Canoniser API Provider defines a dependency to the Canoniser API.

    Code Block
    languagehtml/xml
        <artifactId>canoniser-api-provider</artifactId>
        <name>Apromore Canoniser API Provider</name>
        <description>Provider for Canonisers using OSGi to dynamically discover available Canonisers</description>
    
        <dependencies>
            <dependency>
                <groupId>org.apromore.plugin</groupId>
                <artifactId>plugin-api</artifactId>
                <version>1.1</version>
            </dependency>
    
            <dependency>
                <groupId>org.apromore.plugin</groupId>
                <artifactId>canoniser-api</artifactId>
                <version>1.1</version>
            </dependency>
    
            <!-- Schemas used for utility methods provided by the DefaultAbstractCanoniser -->
            <dependency>
                <groupId>org.apromore</groupId>
                <artifactId>anf-schema</artifactId>
                <version>1.1</version>
            </dependency>
            <dependency>
                <groupId>org.apromore</groupId>
                <artifactId>cpf-schema</artifactId>
                <version>1.1</version>
            </dependency>
    
            <!-- Test dependencies -->
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
            </dependency>
        </dependencies>
  3. Next, rename the Java class CanoniserProviderImpl.java in the directory src\main\java\org\apromore\canoniser\provider\impl to match your plug-in package and name.
    You can probably re-use some of the existing code, as plug-in providers are mostly just a convencience convenience layer on top of the OSGi services.
  4. GoTo enable the automatic discovery of OSGi services (i.e. all available plug-ins) you need to adapt the file osgi-context.xml in the directory src\main\resources\META-INF\spring to your needs.

  5. Now try to build your API Provider using Maven:

    Code Block
    cd deployment-api-provider
    mvn clean install
  6. If you see BUILD SUCCESS everything works and you can start modifying the generated Java files in "/src/main/java/....".

Resources

...

  • Canoniser API Sources (coming soon)
  • Canoniser API JavaDoc (coming soon)

...

  • Plugin API Sources (coming soon)
  • Plugin API JavaDoc (coming soon)

Class diagram of Plugin API

Image Removed

  1. !