# Jive Messenger Plugin Guide

# Jive Messenger Plugin Developer Guide

## Introduction

Plugins enhance the functionality of Jive Messenger. This document is a developer's guide for creating plugins.

## Structure of a Plugin

Plugins live in the `plugins` directory of `messengerHome`. If a plugin is deployed as a JAR file, it will be automatically expanded into a directory. The files in a plugin directory are as follows:

    plugin.xml
    classes/
    lib/
    web/
      |
      -- web.xml
      -- images/

The `plugin.xml` file specifies the main Plugin class. A sample file might look like the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <plugin>
        <class>org.example.ExamplePlugin</class>
    </plugin>

Your plugin class must be implement the Plugin interface from the Jive Messenger API. The Plugin interface has methods for initializing and destroying the plugin, as well as methods for retrieving meta-data such as the plugin name, description, version, and author.

The `classes` and `lib` directories contain resources that will be loaded into the classpath of the plugin.

The `web` directory exists for plugins that need to add content to the Jive Messenger admin console. Further details are below.

## Modifying the Admin Console

Plugins can add tabs, sections, and pages to the admin console. There are a several steps to accomplishing this:

- An <adminconsole/> section must be added to the `plugin.xml` file.
- JSP files must be compiled and put into the classpath of the plugin. A `web.xml` file containing the compiled JSP servlet entries must be put into the `web/` directory of the plugin. Note: the Jive Messenger build script can assist with compiling JSPs and creating the web.xml. This is detailed later in the developer guide.
- Any images required by your JSP pages must live in `web/images/` directory. Only GIF and PNG images are supported.

The <adminconsole/> section of `plugin.xml` defines additional tabs, sections and entries in the Admin Console framework. A sample `plugin.xml` file might look like the following:

    <?xml version="1.0" encoding="UTF-8"?>
    <plugin>
        <class>org.example.ExamplePlugin</class>
        <tab id="example" name="Example" description="Click to try the example tab">
            <sidebar name="Test Section">
                <item id="test-page" name="Test Page" url="test.jsp" description="Test page" />
            </sidebar>
        </tab>
    </plugin>

In this example, we've defined a new tab "Example", a sidebar section "Test Section" and a page "Test Page". We've registered `test.jsp` as the page.