Home
Categories
Dictionary
Download
Project Details
Changes Log
Tutorials
FAQ
License

Plugin properties



The Plugin.getProperty(Object) is called by the PluginsManager to retrieve the plugin characteristics. The minimum elements to return are: Note that if you get the Application description from the configuration

Plugin dependencies

Main Article: Plugins dependencies

Additionally, the PluginElementTypes.PROPERTY_DEPEND property allow to specify other plugins (by their name) on which the Plugin depend on. It can contain a single String or a List of Strings. If one of the Plugins on which a Plugins depends on is not present or is disabled, the dependent Plugin will be disabled.

Examples

Simple Plugin properties

  public Object getPluginProperty(String prop) {
    if (prop.equals(PluginElementTypes.PROPERTY_DATE)) {
      return "26/07/2016";
    } else if (prop.equals(PluginElementTypes.PROPERTY_DESC)) {
      return "My Plugin description";
    } else if (prop.equals(PluginElementTypes.PROPERTY_VERSION)) {
      return "1.0";
    } else {
      return null;
    }
  }

Example with one dependency

In the following example, the Plugin depend on the "masterPlugin" Plugin:
   public Object getPluginProperty(String prop) {
     if (prop.equals(PluginElementTypes.PROPERTY_DATE)) {
       return "26/07/2016";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DESC)) {
       return "My Plugin description";
     } else if (prop.equals(PluginElementTypes.PROPERTY_VERSION)) {
       return "1.0";
     } else if (prop.equals(PluginElementTypes.PROPERTY_DEPEND)) {
       return "masterPlugin";
     }
   }

Categories: plugins

Copyright 2006-2023 Herve Girod. All Rights Reserved. Documentation and source under the LGPL v2 and Apache 2.0 licences