Develop an Apromore Plugin

Versions Compared

Key

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

...

  1. Make sure Maven binaries are in your path. (Maven Installation)
  2. Make sure you checked out the Apromore source code and you can build it successfully using the command:

    Code Block
    mvn clean install
  3. Change your directory to your Plugin APIs directory. (Example uses canoniser-api)

    Code Block
    cd Apromore-Plugins
    cd plugin-canoniser
  4. You need to create a new Maven module (project) for your plug-in. The easiest way of doing so, is to use a copy of an existing plug-in (here yawl-canoniser) and adjust the pom.xml file to your need. The following block shows you the parts of the pom.xml you (probably) need to change:

    Code Block
        <artifactId>canoniser-yawl</artifactId>
        <name>Apromore YAWL Canoniser</name>
        <description>Responsible for (de)canonising YAWL 2.2.</description>
        <inceptionYear>2012</inceptionYear>
    
       <dependencies>
           <!-- Plugin APIs -->
            <dependency>
                <groupId>org.apromore.plugin</groupId>
                <artifactId>plugin-api</artifactId>
            </dependency>
            <dependency>
                <groupId>org.apromore.plugin</groupId>
                <artifactId>canoniser-api</artifactId>
            </dependency>
    		<!-- Your own dependencies -->
              [..]
            <!-- Test dependencies -->
              [..]
        </dependencies>

    Change canoniser-api to the artifactId of the plug-in API you are using (e.g. deplyment-api for a Deployment plug-in).

  5. Delete the existing sources in /src/main/java/ and /src/test/java/
  6. Create your own plug-in class that implements the API by extending the provided "default" implementation or implementing the interface. For example a Canoniser plug-in should extend DefaultAbstractCanoniser or implement the interface Canoniser. Important: Your plug-in class has to be annotated with the Spring annotation @Component("pluginName") so the plug-in framework can discover it.
  7. If you choose to extend the "default" implementation, then you can take advantage of the built-in configuration mechanism. You need to the configuration file /src/main/resources/org.apromore.canoniser.yawl.YAWL22Canoniser.config as described in DefaultPlugin and change the configuration according to your own needs.
  8. To

    The last step is to make your plug-in visible to the OSGi environment, so it can be picked up by Apromore. Please edit the file src/main/resources/META-INF/spring/osgi-context.xml and adjust the following lines to reflect your plug-in:

    Code Block
    <context:component-scan base-package="org.apromore.canoniser.yawl" />       
    <service ref="yawlCanoniser" interface="org.apromore.canoniser.Canoniser" auto-export="interfaces" />

    You need to change the base package and adjust yawlCanoniser to the component name you choose in Step 6.

  9. Now build your plugin using Maven:

    Code Block
    mvn clean install
  10. If you see BUILD SUCCESS everything works and you can start modifiying the generated Java files in /src/main/java/...

...

YAWL Deployment Plugin