DESIGN: Create plugin architecture (zz)

Source: Internet
Author: User
Tags xsl

Address: http://dita-ot.sourceforge.net/SourceForgeFiles/doc/plugin/design.html

DESIGN: Create plugin architecture

Introduction

There are 2 options for the plugin architecture.

Option one is just like Eclipse plugin architecture. we load the Plugins every time a build is invoked.

Opion two is like Mozilla Firefox. Every time when we installed new plugin, We shocould start a program to install those plugin and integrate them with toolkit.

Overviewin order to implement either of the above options. we can write a program to generate an integrated interface for ant script or XSL etc. which will be called in the building process. in the following dimo-integrator is such a program which combine every ant script into one integrated script which imports the content from the script of each plugins. this mechanism can ensure that we can implement either option 1 or option 2. when we want to remove a plugin, we can just delete that plugin and call the integrator again to regenerate integrated ant script. integrator can also works on the validation of plugins dependency which will make sure that each plugin we will load can work properly.

Figure 1. Structure of ant script

Note: In the figure, ant Script 1 is the ant script provided by plugin 1. integrated ant script is generated by integrator. it imports different ant scripts from every plugin and serves as the call interface.

If we want to implement option one, we need to put the integration step before the preprocess when a build is invoked. if we want to implement option two, we can just put Integrator as utility in the Toolkit and ask users to run that whenever they update, install or remove any plugin. now we decided to support option one. so the integrator shocould be run every time when a build is started and generate the General ant script to be called in the main transformation.

Here is the internal class structure between integrator and other Java classes

Figure 2. Internal Class Structure

Note: In this divisor, integrator is used to generate all of the integrated ant script, XSL or catalog files. plugtable is used to find and register all of the Plugins. class plugin is just like every entry in the plugin table which contains the all of the information for each plugin.

Here is the sequce diagrams for the overall build process and detail integration process.

Figure 3. Overall build process figure 4. Detail sequence of Integration

The plugin can also contains the document which serves as the sample document for the plugin. it shoshould contain at least the build script for the document or the document in Web pages style with a TOC file. the toolkit won't run the build script automatically. any document plugin with only the source Dita files and build script will be considered as the source document plugin and can be build into plugin that Toolkit can integrate.

The integration of document is similar to that of ant script. the integrator will generate a general TOC file which links to different TOC files for each plugin.

Plugin descriptor is an XML file which describe the structure of the plugin and what the plugin contains. the plugintable search the plugin according plugin descriptor. if there is no plugin descriptor then the plugin cannot be integrated by the Toolkit.

Plugin descriptor also contains the dependency information of the plugin and contact information of plugin author. integrator will validate the dependency between plugins and it will not load the plugin if its required plugin is not loaded. the plugin author information will also be put to website but it can be found in the plugin when the website is inaccessable.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.