A complete and simple plugin

Here is the complete code to a simple plugin. It will be explained in the sections that follow.


package com.mycompany.jtrix.plugins;

import org.jtrix.base.*;

import org.jtrix.facets1.util.properties.Property;
import org.jtrix.project.libjtrix.netlet.FacetCollection;
import org.jtrix.project.beatrix.plugins.*;
import org.jtrix.project.beatrix.plugins.util.ISimpleServiceProvider;

/**
 * A plugin to provide an "admin" service for the application owner.
 * Should be added to an IServiceManager, which is a plugin manager.
 */

public class AdminServicePlugin implements IPlugin, IServiceProvider
{
    private IPluginManager _plugin_manager;

    // Two methods to implement IPlugin
   
    public boolean init(IPluginManager plugin_manager, Object data)
    {
        _plugin_manager = plugin_manager;
        return true;
    }

    public void shutdown()
    {}

    // Two methods to implement ISimpleServiceProvider
   
    public IFacetCollection createFacetCollection(String service_type, Property args)
    {
        return new FacetCollection();
    }
    
    public boolean isAdminProvider()
    {
        return true;
    }
}

Nik Silver 2002-03-09