Home
Categories
Dictionary
Download
Project Details
Changes Log
What Links Here
How To
Syntax
FAQ
License

Plugins framework



The directory plugins allows to develop plugins which propose specific functionalities without incurring any dependencies from the core application: if the plugins directory is not present of any plugin is missing, the application should continue to work without any problem.

The project provides two built-in plugins:

Plugin structure

A Plugin is simply a Jar file with a specific property in its Manifest specifying where to look for the Plugin class. The Manifets must contain the following property:
  docJPluginFactory: <The plugin factory class>
The plugin factory class must be a class implementing the PluginFactory interface.

Plugin factory implementation

The PluginFactory implementation is a class which must implement the following interface:
public interface PluginFactory
Method Summary
Modifier and Type Method and Description
void getCustomProperties()
Return the CustomProperties (default is null, which means that there are no custom properties)
public getElementHook(DirectoryParser parser, HookContext context)
Return the ElementHook defined by this factory. Return null by default. Note that you must implement the hasElementHook() method accordingly.

Parameters
context - The HookContext context
parser - The directory parser
void getID()
Return the factory ID. Must be unique for each Plugin
void getSupportedOutputFormat()
Return the supported output format (default is null, which means that no specific output format is supported)
public hasElementHook()
Return true if this factory provides an ElementHook. Return false by default. Note that you must implement the getElementHook() method accordingly
public newDirectoryWriter()
Return a new Directory writer (default is null, which means that no specific DirectoryWriter is provided). Note that you should provide a DirectoryWriter if the getSupportedOutputFormat() method does not return null

Use cases

Providing a new output format

Main Article: Directory writer

To provide a new output format, you must implement the following methods:

Supporting custom properties

Main Article: Custom properties

If the Plugin supports specific custom properties, you should implement the getCustomProperties() method. Custom properties are usable both on the command-line and configuration file.

Note that if you define some of these properties in the command-line, they will be parsed only if you define them after specifying the docx output type. For example, this will not work:
      java -jar docGenerator.jar -input=wiki/input -output=wiki/output -hasTOC=false -outputType=docx
But this will work:
      java -jar docGenerator.jar -input=wiki/input -output=wiki/output -outputType=docx -hasTOC=false

Modifying the wiki content before the generation

Main Article: Plugin ElementHook

To modify the wiki source tree content before the generation, you must implement the following methods: Note that the Scripts plugin does use this capability.

See also


Categories: plugins

docJGenerator Copyright (c) 2016-2023 Herve Girod. All rights reserved.