org.kaariboga.plugin
Class KbPlugInManager

java.lang.Object
  |
  +--org.kaariboga.plugin.KbPlugInManager

public class KbPlugInManager
extends java.lang.Object

Handles plug-ins that can be used to extend a Kaariboga server. Plug-ins should be within the usual Java class path.


Field Summary
(package private)  KaaribogaBase base
          The base this plug-in is connected to
(package private)  java.util.LinkedList plugIns
          List of all the plugIns that are currently loaded
 
Constructor Summary
KbPlugInManager(KaaribogaBase base)
           
 
Method Summary
 java.util.Collection getPlugIns()
          Returns the currently loaded plug-ins
 KbPlugIn loadPlugIn(java.lang.String classname, java.util.Properties props)
          Loads a plug-in with a given name and a given set of properties.
 KbPlugIn loadPlugIn(java.lang.String classname, java.lang.String propertiesFile)
          Loads a plug-in with a given name and a given set of properties.
 boolean registerPlugIn(KbPlugIn plugIn)
          Adds the specified plug-in to the KaaribogaBase A plug-in is only active after it has been registered.
 boolean unregisterPlugIn(KbPlugIn plugIn)
          Removes the specified plug-in to the KaaribogaBase
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

plugIns

java.util.LinkedList plugIns
List of all the plugIns that are currently loaded

base

KaaribogaBase base
The base this plug-in is connected to
Constructor Detail

KbPlugInManager

public KbPlugInManager(KaaribogaBase base)
Parameters:
base - The base at which this plug-in manager should register services. The base is also needed to generate unique IDs for the plug-ins.
Method Detail

loadPlugIn

public KbPlugIn loadPlugIn(java.lang.String classname,
                           java.util.Properties props)
                    throws java.lang.Exception
Loads a plug-in with a given name and a given set of properties. In this version the plug-ins loaded by the PlugInManager are not executed as agents on the base, because they are not mobile.
Parameters:
classname - Name of the class to load
props - Properties for the plug-in, may be null
Returns:
The plug-in if it was loaded successfully.

loadPlugIn

public KbPlugIn loadPlugIn(java.lang.String classname,
                           java.lang.String propertiesFile)
                    throws java.lang.Exception
Loads a plug-in with a given name and a given set of properties.
Parameters:
classname - Name of the class to load
propertiesFile - Name of a properties file for the required plug-in
Returns:
The plug-in if it was loaded successfully.

registerPlugIn

public boolean registerPlugIn(KbPlugIn plugIn)
Adds the specified plug-in to the KaaribogaBase A plug-in is only active after it has been registered. If registration fails this method tries to undo the whole operation.
Parameters:
plugIn - A plug-in to extend the KaaribogaBase

unregisterPlugIn

public boolean unregisterPlugIn(KbPlugIn plugIn)
Removes the specified plug-in to the KaaribogaBase
Parameters:
plugIn - A plug-in to extend the KaaribogaBase

getPlugIns

public java.util.Collection getPlugIns()
Returns the currently loaded plug-ins