Changes between Version 17 and Version 18 of PluginDevelopmentGuide


Ignore:
Timestamp:
15.04.2013 15:46:04 (7 years ago)
Author:
jri
Comment:

Plugin main file example

Legend:

Unmodified
Added
Removed
Modified
  • PluginDevelopmentGuide

    v17 v18  
    33= Plugin Development Guide = 
    44 
    5 DeepaMehta is made to be extensible by 3rd-party developers. Developers extend DeepaMehta by developing plugins (resp. "modules" resp. "applications" which is all synonymous). 
     5DeepaMehta is made to be extensible by 3rd-party developers. Developers extend DeepaMehta by developing plugins (resp. "modules" resp. "applications" which is all synonymous). This guide teaches you how to develop DeepaMehta plugins. 
    66 
    77== Build DeepaMehta from source == 
     
    586586=== The plugin main file === 
    587587 
    588 You must write a //plugin main file// if your plugin needs to a) listen to DeepaMehta Core events and/or b) provide a service. The plugin main file contains the event handling code resp. the implementation of the service methods then. A plugin main file is a Java class that is derived from `de.deepamehta.core.osgi.PluginActivator`. 
     588You must write a //plugin main file// if your plugin needs to a) listen to DeepaMehta Core events and/or b) provide a service. The plugin main file contains the event handlers resp. the service implementation then. 
    589589 
    590590The plugin main file must be located directly in the plugin's `src/main/java/<your plugin package>/` directory. By convention the plugin main class ends with `Plugin`. 
     
    607607Here the plugin package is `org.mydomain.deepamehta4.mycoolplugin` and the plugin main class is `MyCoolPlugin`. 
    608608 
    609 Furthermore you must add 2 entries in the plugin's **`pom.xml`**: 
    610     1. A <dependencies> element to include the `deepamehta-core` dependency. This is needed as your plugin main file requires the `PluginActivator` class. 
    611     2. a <build> element to configure the Maven Bundle Plugin. It needs to know what your plugin's main class is. You must specify its fully-qualified class name. 
     609A plugin main file is a Java class that is derived from `de.deepamehta.core.osgi.PluginActivator`. The smallest possible plugin main file looks like this: 
     610 
     611{{{ 
     612#!java 
     613package org.mydomain.deepamehta4.mycoolplugin; 
     614 
     615import de.deepamehta.core.osgi.PluginActivator; 
     616 
     617public class MyCoolPlugin extends PluginActivator { 
     618} 
     619}}} 
     620 
     6213 things are illustrated here: 
     622    * The plugin should be packaged in an unique namespace. 
     623    * The `PluginActivator` class needs to be imported. 
     624    * The plugin main class must be derived from `PluginActivator` and must be public. 
     625 
     626Furthermore when writing a plugin main file you must add 2 entries in the plugin's **`pom.xml`**: 
     627    1. a <dependencies> element to include the `deepamehta-core` dependency. This brings you the `PluginActivator` class. 
     628    2. a <build> element to configure the Maven Bundle Plugin. It needs to know what your plugin main class is. You must specify the fully-qualified class name. 
    612629 
    613630{{{