The services.xml file
Prev | Chapter 18. Implementing a Simple Plugin | Next

## The services.xml file

A "service" is a mechanism by which one plugin can work with other plugins and avoid a bidirectional build-dependency. For example, the XML plugin "depends" on Sidekick, but in fact, it is SideKick which creates and operates on an object (a `SideKickParser`, in fact) defined in the XML plugin. In a way, the dependency is bidirectional.

Similarly, the AntFarm plugin defines but does not instantiate a `Shell` object. It is the Console plugin which creates a specific shell for each available service. SideKick and Console use the ServiceManager to search for services offered by other plugins.

Here is an example of a service from the XML plugin, which extends Sidekick:

    <!DOCTYPE SERVICES SYSTEM "services.dtd">

    <SERVICES>
            <SERVICE CLASS="sidekick.SideKickParser" NAME="xml">
                    new xml.parser.SAXParserImpl();
            </SERVICE>
    </SERVICES>

The object it returns tells Sidekick how it can parse files of a specific type. The API docs for SideKickParser indicate exactly which methods must be implemented in a plugin which offers this service. It should be enough information to let Sidekick, which has its own dockable, display the tree information in its own view.

For more information about services, refer to the ServiceManager class API documentation. There, you can find out what the tags and attributes mean, as well as how to register and use services.

Prev | Up | Next
The dockables.xml Window Catalog | Home | The QuickNotepad Class