Changes between Version 1 and Version 2 of PluginDevelopmentGuide


Ignore:
Timestamp:
06.04.2013 17:29:57 (12 years ago)
Author:
jri
Comment:

A very simple plugin

Legend:

Unmodified
Added
Removed
Modified
  • PluginDevelopmentGuide

    v1 v2  
    88 
    99Requirements: 
    10 * **Java 6** (newer versions //might// work as well, older Java versions do //not// work) 
    11 * **Maven 3** (Maven 2 does //not// work) 
     10* **Java 6** (newer versions //might// work as well, older versions do //not// work) 
     11* **Maven 3** (older versions do //not// work) 
    1212* **Git** 
    1313 
     
    2020 
    2121== A very simple plugin == 
     22 
     23Let's start with a very simple plugin. This plugin will just create a new topic type called `Tag`. Once the plugin is installed the topic type will appear in the DeepaMehta webclient's //Create// menu, so you can create instances. And you will be able to fulltext search for tags. 
     24 
     25Developing such a simple plugin involves no Java coding at all. All is declarative, mainly in JSON format. 
     26 
     27Of course the topic type could be created interactively as well, by using DeepaMehta's type editor. However, being packaged as a plugin you can publish it. When other DeepaMehta users install your plugin they can use your type definitions. 
     28 
     29You create the plugin just by creating directories and text files. A DeepaMehta plugin project adheres to a certain directory structure and file name conventions. 
     30 
     31Setup a directory structure as follows: 
     32{{{ 
     33dm4-tagging/ 
     34    pom.xml 
     35    src/ 
     36        main/ 
     37            resources/ 
     38                migrations/ 
     39                    migration1.json 
     40                plugin.properties 
     41}}} 
     42 
     43Create the file **`pom.xml`** with this content: 
     44{{{ 
     45<project> 
     46    <modelVersion>4.0.0</modelVersion> 
     47 
     48    <name>DM4 Tagging</name> 
     49    <groupId>org.mydomain.dm4-plugins</groupId> 
     50    <artifactId>tagging</artifactId> 
     51    <version>0.1-SNAPSHOT</version> 
     52    <packaging>bundle</packaging> 
     53 
     54    <parent> 
     55        <groupId>de.deepamehta</groupId> 
     56        <artifactId>deepamehta-plugin-parent</artifactId> 
     57        <version>4.1.1-SNAPSHOT</version> 
     58    </parent> 
     59</project> 
     60}}} 
     61 
     62Create the file **`migration1.json`**: 
     63{{{ 
     64{ 
     65    topic_types: [ 
     66        { 
     67            value: "Tag", 
     68            uri: "domain.tagging.tag", 
     69            data_type_uri: "dm4.core.text", 
     70            index_mode_uris: ["dm4.core.fulltext"], 
     71            view_config_topics: [ 
     72                { 
     73                    type_uri: "dm4.webclient.view_config", 
     74                    composite: { 
     75                        dm4.webclient.show_in_create_menu: true 
     76                    } 
     77                } 
     78            ] 
     79        } 
     80    ] 
     81} 
     82}}} 
     83 
     84Create the file **`plugin.properties`**: 
     85{{{ 
     86requiredPluginMigrationNr = 1 
     87importModels = de.deepamehta.webclient 
     88}}}