Changes between Version 3 and Version 4 of PluginDevelopmentGuide


Ignore:
Timestamp:
06.04.2013 23:51:24 (12 years ago)
Author:
jri
Comment:

Build the plugin

Legend:

Unmodified
Added
Removed
Modified
  • PluginDevelopmentGuide

    v3 v4  
    1010 
    1111Requirements: 
     12 
    1213* **Java 6** (newer versions //might// work as well, older versions do //not// work) 
    1314* **Maven 3** (older versions do //not// work) 
     
    1516 
    1617Build DeepaMehta from source: 
    17 {{{ 
     18 
     19{{{ 
     20#!sh 
    1821git clone git://github.com/jri/deepamehta.git 
    1922cd deepamehta 
     
    2124}}} 
    2225 
     26This builds all components of the DeepaMehta Standard Distribution and installs them in your local Maven repository. 
     27 
     28After a minute or so you'll see: 
     29 
     30{{{ 
     31#!txt 
     32... 
     33[INFO] ------------------------------------------------------------------------ 
     34[INFO] BUILD SUCCESS 
     35[INFO] ------------------------------------------------------------------------ 
     36[INFO] Total time: 53.515s 
     37... 
     38}}} 
     39 
     40 
    2341== A very simple plugin: Tagging == 
    2442 
     
    3452 
    3553Setup a directory structure as follows: 
    36 {{{ 
     54 
     55{{{ 
     56#!txt 
    3757dm4-tagging/ 
    3858    pom.xml 
     
    4565}}} 
    4666 
     67The plugin directory can have an arbitrary name and exist at an arbitrary location. By convention the plugin directory begins with `dm4-` as it is aimed to the DeepaMehta 4 platform. 
     68 
    4769Create the file **`pom.xml`** with this content: 
     70 
    4871{{{ 
    4972#!xml 
     
    5174    <modelVersion>4.0.0</modelVersion> 
    5275 
    53     <name>DM4 Tagging</name> 
    54     <groupId>org.mydomain.dm4-plugins</groupId> 
     76    <name>DeepaMehta 4 Tagging</name> 
     77    <groupId>org.mydomain.dm4</groupId> 
    5578    <artifactId>tagging</artifactId> 
    5679    <version>0.1-SNAPSHOT</version> 
     
    6689 
    6790Create the file **`migration1.json`**: 
    68 {{{ 
     91 
     92{{{ 
     93#!js 
    6994{ 
    7095    topic_types: [ 
     
    88113 
    89114Create the file **`plugin.properties`**: 
    90 {{{ 
     115 
     116{{{ 
     117#!txt 
    91118requiredPluginMigrationNr=1 
    92119importModels=de.deepamehta.webclient 
     
    97124In order to let DeepaMehta hot-deploy the plugin you must include it in DeepaMehta's hot-deployment list. 
    98125 
    99 Add the line `/home/myhome/deepamehta-dev/dm4-tagging` to DeepaMehta's **`pom.xml`**. Impotant: append a comma to the previous line: 
     126In DeepaMehta's **`pom.xml`**: add the plugin's `target` directory (here: `/home/myhome/deepamehta-dev/dm4-tagging/target`) to the `felix.fileinstall.dir` property's `CDATA` section. Important: don't forget to append a comma to the previous line: 
     127 
    100128{{{ 
    101129#!xml 
     
    105133        <![CDATA[ 
    106134            ${project.basedir}/modules/dm4-core/target, 
     135            ${project.basedir}/modules/dm4-webservice/target, 
     136            ${project.basedir}/modules/dm4-webclient/target, 
    107137            ... 
    108138            ${project.basedir}/modules/dm4-storage-neo4j/target, 
    109             /home/myhome/deepamehta-dev/dm4-tagging 
     139            /home/myhome/deepamehta-dev/dm4-tagging/target 
    110140        ]]> 
    111141    </felix.fileinstall.dir> 
     142    ... 
    112143</project> 
    113144}}} 
    114145 
    115 Now start DeepaMehta: 
    116 {{{ 
    117 cd deepamehta 
     146Now start DeepaMehta. In the directory `deepamehta` (where you've build): 
     147 
     148{{{ 
     149#!sh 
    118150mvn pax:run 
    119151}}} 
    120152 
    121 This starts DeepaMehta in development mode, that is with hot-deployment activated. The terminal gets occupied by the //Gogo// shell now. Type `lb` to see the list of deployed bundles. Your plugin does not yet appear in that list as it is not yet build. 
     153This starts DeepaMehta in development mode, that is with hot-deployment activated. You'll see a lot of information logged, commulating with: 
     154 
     155{{{ 
     156#!txt 
     157... 
     158Apr 6, 2013 11:21:20 PM de.deepamehta.core.impl.PluginManager checkAllPluginsActivated 
     159INFO: ### Bundles total: 32, DeepaMehta plugins: 16, Activated: 16 
     160Apr 6, 2013 11:21:20 PM de.deepamehta.core.impl.PluginManager activatePlugin 
     161INFO: ########## All Plugins Activated ########## 
     162Apr 6, 2013 11:21:20 PM de.deepamehta.plugins.webclient.WebclientPlugin allPluginsActive 
     163INFO: ### Launching webclient (url="http://localhost:8080/de.deepamehta.webclient/") 
     164... 
     165}}} 
     166 
     167Then a browser windows opens automatically and displays the typical DeepaMehta webclient. 
     168 
     169The terminal is now occupied by the //Gogo// shell. Press the return key some times and you'll see its `g!` prompt. 
     170 
     171Type the `lb` command to get the list of activated bundles: 
     172 
     173{{{ 
     174#!sh 
     175g! lb 
     176}}} 
     177 
     178The output  looks like this: 
     179 
     180{{{ 
     181#!txt 
     182START LEVEL 6 
     183   ID|State      |Level|Name 
     184    0|Active     |    0|System Bundle (3.2.1) 
     185   ... 
     186   14|Active     |    5|DeepaMehta 4 Help (4.1.1.SNAPSHOT) 
     187   15|Active     |    5|DeepaMehta 4 Topicmaps (4.1.1.SNAPSHOT) 
     188   16|Active     |    5|DeepaMehta 4 Webservice (4.1.1.SNAPSHOT) 
     189   17|Active     |    5|DeepaMehta 4 Files (4.1.1.SNAPSHOT) 
     190   18|Active     |    5|DeepaMehta 4 Geomaps (4.1.1.SNAPSHOT) 
     191   19|Active     |    5|DeepaMehta 4 Storage - Neo4j (4.1.1.SNAPSHOT) 
     192   20|Active     |    5|DeepaMehta 4 Core (4.1.1.SNAPSHOT) 
     193   21|Active     |    5|DeepaMehta 4 Access Control (4.1.1.SNAPSHOT) 
     194   22|Active     |    5|DeepaMehta 4 Webclient (4.1.1.SNAPSHOT) 
     195   23|Active     |    5|DeepaMehta 4 Webbrowser (4.1.1.SNAPSHOT) 
     196   24|Active     |    5|DeepaMehta 4 Type Search (4.1.1.SNAPSHOT) 
     197   25|Active     |    5|DeepaMehta 4 Workspaces (4.1.1.SNAPSHOT) 
     198   26|Active     |    5|DeepaMehta 4 Notes (4.1.1.SNAPSHOT) 
     199   27|Active     |    5|DeepaMehta 4 Type Editor (4.1.1.SNAPSHOT) 
     200   28|Active     |    5|DeepaMehta 4 Contacts (4.1.1.SNAPSHOT) 
     201   29|Active     |    5|DeepaMehta 4 Facets (4.1.1.SNAPSHOT) 
     202   30|Active     |    5|DeepaMehta 4 File Manager (4.1.1.SNAPSHOT) 
     203   31|Active     |    5|DeepaMehta 4 Icon Picker (4.1.1.SNAPSHOT) 
     204}}} 
     205 
     206The //DeepaMehta 4 Tagging// plugin does not yet appear in that list as it is not yet build. 
    122207 
    123208=== Build the plugin === 
     
    125210In another terminal: 
    126211{{{ 
     212#!sh 
    127213cd dm4-tagging 
    128214mvn clean package 
    129215}}} 
    130216 
    131 This builds the plugin and hot-deploys it. 
    132  
     217This builds the plugin. After some seconds you'll see: 
     218 
     219{{{ 
     220#!txt 
     221... 
     222[INFO] ------------------------------------------------------------------------ 
     223[INFO] BUILD SUCCESS 
     224[INFO] ------------------------------------------------------------------------ 
     225[INFO] Total time: 3.988s 
     226... 
     227}}} 
     228 
     229Once build, DeepaMehta hot-deploys the plugin automatically. In the terminal where you've started DeepaMehta the logging informs you about plugin activation: 
     230 
     231{{{ 
     232#!txt 
     233Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl readConfigFile 
     234INFO: Reading config file "/plugin.properties" for plugin "DeepaMehta 4 Tagging" 
     235Apr 6, 2013 11:38:40 PM de.deepamehta.core.osgi.PluginActivator start 
     236INFO: ========== Starting plugin "DeepaMehta 4 Tagging" ========== 
     237Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl createPluginServiceTrackers 
     238INFO: Tracking plugin services for plugin "DeepaMehta 4 Tagging" ABORTED -- no consumed services declared 
     239Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl addService 
     240INFO: Adding DeepaMehta 4 core service to plugin "DeepaMehta 4 Tagging" 
     241Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl addService 
     242INFO: Adding Web Publishing service to plugin "DeepaMehta 4 Tagging" 
     243Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl registerWebResources 
     244INFO: Registering Web resources of plugin "DeepaMehta 4 Tagging" ABORTED -- no Web resources provided 
     245Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl registerRestResources 
     246INFO: Registering REST resources of plugin "DeepaMehta 4 Tagging" ABORTED -- no REST resources provided 
     247Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl registerRestResources 
     248INFO: Registering provider classes of plugin "DeepaMehta 4 Tagging" ABORTED -- no provider classes provided 
     249Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl addService 
     250INFO: Adding Event Admin service to plugin "DeepaMehta 4 Tagging" 
     251Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginManager activatePlugin 
     252INFO: ----- Activating plugin "DeepaMehta 4 Tagging" ----- 
     253Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl createPluginTopicIfNotExists 
     254INFO: Installing plugin "DeepaMehta 4 Tagging" in the database 
     255Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.MigrationManager runPluginMigrations 
     256INFO: Running 1 migrations for plugin "DeepaMehta 4 Tagging" (migrationNr=0, requiredMigrationNr=1) 
     257Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.MigrationManager$MigrationInfo readMigrationConfigFile 
     258INFO: Reading migration config file "/migrations/migration1.properties" ABORTED -- file does not exist 
     259Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.MigrationManager runMigration 
     260INFO: Running migration 1 of plugin "DeepaMehta 4 Tagging" (runMode=ALWAYS, isCleanInstall=true) 
     261Apr 6, 2013 11:38:40 PM de.deepamehta.core.util.DeepaMehtaUtils readMigrationFile 
     262INFO: Reading migration file "/migrations/migration1.json" 
     263Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.MigrationManager runMigration 
     264INFO: Completing migration 1 of plugin "DeepaMehta 4 Tagging" 
     265Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.MigrationManager runMigration 
     266INFO: Updating migration number (1) 
     267Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.AttachedTopic update 
     268INFO: Updating topic 2690 (new topic (id=-1, uri="", typeUri="dm4.core.plugin_migration_nr", value="1", composite={})) 
     269Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.AttachedDeepaMehtaObject updateSimpleValue 
     270INFO: ### Changing simple value of topic 2690 from "0" -> "1" 
     271Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl registerListeners 
     272INFO: Registering listeners of plugin "DeepaMehta 4 Tagging" at DeepaMehta 4 core service ABORTED -- no listeners implemented 
     273Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginImpl registerPluginService 
     274INFO: Registering OSGi service of plugin "DeepaMehta 4 Tagging" ABORTED -- no OSGi service provided 
     275Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginManager activatePlugin 
     276INFO: ----- Activation of plugin "DeepaMehta 4 Tagging" complete ----- 
     277Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginManager checkAllPluginsActivated 
     278INFO: ### Bundles total: 33, DeepaMehta plugins: 17, Activated: 17 
     279Apr 6, 2013 11:38:40 PM de.deepamehta.core.impl.PluginManager activatePlugin 
     280INFO: ########## All Plugins Activated ########## 
     281Apr 6, 2013 11:38:40 PM de.deepamehta.plugins.webclient.WebclientPlugin allPluginsActive 
     282INFO: ### Launching webclient (url="http://localhost:8080/de.deepamehta.webclient/") ABORTED -- already launched 
     283... 
     284}}} 
     285 
     286When you type again `lb` in the DeepaMehta terminal you'll see the plugin in the list of activated bundles: 
     287 
     288{{{ 
     289#!txt 
     290START LEVEL 6 
     291   ID|State      |Level|Name 
     292    0|Active     |    0|System Bundle (3.2.1) 
     293   ... 
     294   30|Active     |    5|DeepaMehta 4 File Manager (4.1.1.SNAPSHOT) 
     295   31|Active     |    5|DeepaMehta 4 Icon Picker (4.1.1.SNAPSHOT) 
     296   32|Active     |    5|DeepaMehta 4 Tagging (0.1.0.SNAPSHOT) 
     297}}}