The main plugin for a worker, which binds its allocated resources,
even though it doesn't use them. See Section ![[*]](crossref.png) for more on using resources.
for more on using resources.
package org.jtrix.project.skeleton2.plugins;
import org.jtrix.base.*;
import org.jtrix.project.libjtrix.debug.*;
import org.jtrix.project.beatrix.plugins.*;
import org.jtrix.project.beatrix.plugins.hooks.*;
import org.jtrix.project.beatrix.plugins.util.*;
/**
 * Basic skeleton worker functionality. It binds its resources, just as a demo,
 * although it doesn't do anything with them.
 * 
 * @author  ulf@jtrix.org
 * @author  nadia@jtrix.org
 * @version $Revision: 1.10 $
 */
public class SkeletonWorker extends AbstractPlugin implements IPlugin
{
    private IService _net_service;
    private IService _disk_service;
    public boolean init(IPluginManager plugin_manager, Object data)
    {
        try
        {
            Debug.set("skeletonworker",-1,0);
            super.init(plugin_manager, data);
            IWorkerResourceProvider wrp = (IWorkerResourceProvider)pluginManager()
                .lookup(IWorkerResourceProvider.class)[0];
            IPeerSupport ps = (IPeerSupport)pluginManager().lookup(IPeerSupport.class)[0];
            _net_service = wrp.bindResource("net", ps.createClientSession(false));
            _disk_service = wrp.bindResource("disk", ps.createClientSession(false));
            
            Debug.msg(Debug.INFO, this, "Skeleton worker started");
        }
        catch (Exception e)
        {
            Debug.exc(this, e, "Init failed");
            return false;
        }
        return true;
    }
}
Nik Silver 2002-03-09