Plugin Library Repository

From DOC

Jump to: navigation, search

Contents

Overview

Library repositories are normally expected to be available on remote servers, providing access to a library of plugins available for download. Since they are defined by URLs, they can be defined just about anywhere, even locally to their counterpart Runtime Repository

Library Repository Structure

tpf-metadata.xml
plugins
     pluginId1-version.zip
     pluginId2-version.zip
     pluginId3-version.zip
  • The tpf-metadata.xml describes all of the plugins located in the plugins directory by their versions and inter-dependencies.
  • The plugins directory itself simply contains all of the zipped plugins.

Directory Of Plugins

The plugins consist of a number of zip files in the form pluginId-version.zip. Since this is a library repository, multiple versions of a given plugin can be present at the same time. However, once a user has downloaded a subset of the plugins to form a local Runtime Repository, then only the presence of one version of each plugin is valid.

Tolven Plugin Framework Metadata

The metadata file is called tpf-metadata.xml, and is located as shown above at the top level of the repository. When a remote user initializes or upgrades their local Runtime Repository, the file is downloadeded in order to compare the library repository with the local Runtime Repository information. A section is shown below:

<plugins xmlns="urn:tolven-org:tpf-metadata:1.0">
    <plugin id="org.tolven.prototype.application.global">
        <version id="0.0.1">
            <uri>...</uri>
        </version>
    </plugin>
    <plugin id="org.tolven.application">
        <version id="0.0.1">
            <uri>...</uri>
        </version>
        <dependent version="0.0.1" id="org.tolven.prototype.application.global"/>
        <dependent version="0.0.1" id="org.tolven.config.voc.rxnorm"/>
    </plugin>
    <plugin id="org.tolven.config.voc.rxnorm">
        <version id="0.0.1">
            <uri>...</uri>
        </version>
    </plugin>
    ...
</plugins>

Here, one can see three plugins in this particular tpf-metadata.xml. Users do not have to concern themselves with the structure of this metadata file, since it is read and used by a number of Runtime Repository commands. But it reads as follows:

  • org.tolven.prototype.application.global v0.0.1 is a dependent of the plugin org.tolven.application v0.0.1
  • org.tolven.config.voc.rxnorm v0.0.1 is a dependent of the plugin org.tolven.application v0.0.1

Basically, if org.tolven.prototype.application.global v0.0.1 and/or org.tolven.config.voc.rxnorm v0.0.1 has been downloaded to a local Runtime Repository, then they require org.tolven.application v0.0.1 to also be in that Runtime Repository.

Creating A Library Repository

Directory Structure

The directory structure is trivial. First identify the directory to be the repository, and in that directory create a subdirectory called plugins.

Zip Source Plugins Into Plugins Directory

The source plugin directories can be manually zipped using any number of tools. However Tolven provides a command, which takes a directory of plugins and zips each with the correct format into a target directory. In the Tolven Primer directory, execute:

zipPlugins -sourceDir aSourceDir -destDir plugins

The destination plugins directory should of course be the full path to the repository plugins directory.

Generate Metadata File

Now that the plugins are in place, you need to generate a plugins.xml file, which describes all of the plugins in the repository. This can take two main forms. First you have the plugins already existing in a directory, and you want to generate a plugins.xml, whose URLs all indicate that same directory as a source of plugins. Alternatively, you may just happen to have the plugins locally, and want to generate a plugins.xml, which says that the plugins are actually to be downloaded from a different URL.

Each URI tag in the plugins.xml will start with the URL given by liburl. Execute:

genMetadata -plugins plugins -liburl http://some-org/download -outdir outputDir

The library URL will appear as a prefix in the URI tag of each of the plugins in the plugins.xml, so that download code can find them. The plugins.xml will be output into the directory outputDir. When complete, the final directory structure of plugins.xml and plugins will appear as they do in Plugin Library Repository#Library Repository Structure.

Personal tools