unbbayes.util.extension.manager
Class CorePluginNodeManager

java.lang.Object
  extended by unbbayes.util.extension.manager.CorePluginNodeManager

public class CorePluginNodeManager
extends Object

This class manages the plugin nodes (nodes loaded by plugins) for the UnBBayes' core module.

Author:
Shou Matsumoto

Field Summary
static String PARAMETER_CLASS
          Name of the extension point parameter for node's class IPluginNode or its builder PluginNodeBuilder
static String PARAMETER_CURSOR
          Name of the extension point parameter for a cursor displayed when a user selects this node at split button
static String PARAMETER_DESCRIPTION
          Name of the extension point parameter for this new node type's description (used as tool tip text)
static String PARAMETER_ICON
          Name of the extension point parameter for icons of the split button
static String PARAMETER_NAME
          Name of the extension point parameter for the name of this new node type (e.g.
static String PARAMETER_PANEL_BUILDER
          Name of the extension point parameter for a subclass/implementation of IProbabilityFunctionPanelBuilder @see IProbabilityFunctionPanelBuilder
static String PARAMETER_SHAPE
          Name of the extension point parameter for shape IPluginUShape or its builder IPluginUShapeBuilder
 
Constructor Summary
protected CorePluginNodeManager()
          the default constructor is made protected in order to make it easy to extend
 
Method Summary
 Collection<INodeClassDataTransferObject> getAllLoadedPluginNodes()
          Calls reloadPlugin() and then returns a set of all loaded plugin node's informations.
protected  String getMainExtensionPointID()
          Gets the static value of pluginNodeExtensionPointID, which is the ID of PluginNode extension point.
protected  Map<Class,INodeClassDataTransferObject> getNodeClassToDtoMap()
          this is a map to store the informations associated to classes extending IPluginNode (which are plugin nodes)
 INodeClassDataTransferObject getPluginNodeInformation(Class nodeClass)
          Obtains a plugin node information registered by registerNodeClass(Class, INodeClassDataTransferObject).
 UnBBayesPluginContextHolder getUnbbayesPluginContextHolder()
           
 void loadPlugin()
          This is equivalent to reloadPlugin()
static CorePluginNodeManager newInstance()
          Obtains a singleton instance of CorePluginNodeManager
 void registerNodeClass(Class nodeClass, INodeClassDataTransferObject dto)
          Associates a plugin node's class to its set of aditional information.
 void reloadPlugin()
          UnBBayesPluginContextHolder will be used to load the plugin nodes and fill the plugin informations that can be obtained by getPluginNodeInformation(Class).
protected  void setMainExtensionPointID(String pluginNodeID)
          Sets the static value of pluginNodeExtensionPointID, which is the ID of PluginNode extension point.
protected  void setNodeClassToDtoMap(Map<Class,INodeClassDataTransferObject> nodeClassToDtoMap)
          this is a map to store the informations associated to classes extending IPluginNode (which are plugin nodes)
 void setUnbbayesPluginContextHolder(UnBBayesPluginContextHolder unbbayesPluginContextHolder)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

PARAMETER_CLASS

public static final String PARAMETER_CLASS
Name of the extension point parameter for node's class IPluginNode or its builder PluginNodeBuilder

See Also:
Constant Field Values

PARAMETER_SHAPE

public static final String PARAMETER_SHAPE
Name of the extension point parameter for shape IPluginUShape or its builder IPluginUShapeBuilder

See Also:
Constant Field Values

PARAMETER_NAME

public static final String PARAMETER_NAME
Name of the extension point parameter for the name of this new node type (e.g. "Continuous Node", "Decision Node")

See Also:
Constant Field Values

PARAMETER_DESCRIPTION

public static final String PARAMETER_DESCRIPTION
Name of the extension point parameter for this new node type's description (used as tool tip text)

See Also:
Constant Field Values

PARAMETER_ICON

public static final String PARAMETER_ICON
Name of the extension point parameter for icons of the split button

See Also:
Constant Field Values

PARAMETER_CURSOR

public static final String PARAMETER_CURSOR
Name of the extension point parameter for a cursor displayed when a user selects this node at split button

See Also:
Constant Field Values

PARAMETER_PANEL_BUILDER

public static final String PARAMETER_PANEL_BUILDER
Name of the extension point parameter for a subclass/implementation of IProbabilityFunctionPanelBuilder @see IProbabilityFunctionPanelBuilder

See Also:
Constant Field Values
Constructor Detail

CorePluginNodeManager

protected CorePluginNodeManager()
the default constructor is made protected in order to make it easy to extend

Method Detail

newInstance

public static CorePluginNodeManager newInstance()
Obtains a singleton instance of CorePluginNodeManager

Returns:
a instance of CorePluginNodeManager

getNodeClassToDtoMap

protected Map<Class,INodeClassDataTransferObject> getNodeClassToDtoMap()
this is a map to store the informations associated to classes extending IPluginNode (which are plugin nodes)

Returns:
the nodeClassToDtoMap

setNodeClassToDtoMap

protected void setNodeClassToDtoMap(Map<Class,INodeClassDataTransferObject> nodeClassToDtoMap)
this is a map to store the informations associated to classes extending IPluginNode (which are plugin nodes)

Parameters:
nodeClassToDtoMap - the nodeClassToDtoMap to set

registerNodeClass

public void registerNodeClass(Class nodeClass,
                              INodeClassDataTransferObject dto)
Associates a plugin node's class to its set of aditional information. This information can be restored by calling getPluginNodeInformation(Class)

Parameters:
nodeClass -
dto -
See Also:
getPluginNodeInformation(Class)

getPluginNodeInformation

public INodeClassDataTransferObject getPluginNodeInformation(Class nodeClass)
Obtains a plugin node information registered by registerNodeClass(Class, INodeClassDataTransferObject). If not found, the plugins will be reloaded once and tried again.

Parameters:
nodeClass -
Returns:

reloadPlugin

public void reloadPlugin()
                  throws IOException
UnBBayesPluginContextHolder will be used to load the plugin nodes and fill the plugin informations that can be obtained by getPluginNodeInformation(Class).

Throws:
IOException - : when UnBBayesPluginContextHolder.publishPlugins() fails

loadPlugin

public void loadPlugin()
                throws IOException
This is equivalent to reloadPlugin()

Throws:
IOException - : thrown by reloadPlugin()
See Also:
reloadPlugin()

getAllLoadedPluginNodes

public Collection<INodeClassDataTransferObject> getAllLoadedPluginNodes()
Calls reloadPlugin() and then returns a set of all loaded plugin node's informations.

Returns:
a collection of all loaded plugin nodes. A change in this collection should not affect the plugin manager's state.

getMainExtensionPointID

protected String getMainExtensionPointID()
Gets the static value of pluginNodeExtensionPointID, which is the ID of PluginNode extension point.

Returns:
the pluginNodeExtensionPointID

setMainExtensionPointID

protected void setMainExtensionPointID(String pluginNodeID)
Sets the static value of pluginNodeExtensionPointID, which is the ID of PluginNode extension point.

Parameters:
pluginNodeExtensionPointID - the pluginNodeExtensionPointID to set

getUnbbayesPluginContextHolder

public UnBBayesPluginContextHolder getUnbbayesPluginContextHolder()
Returns:
the unbbayesPluginContextHolder

setUnbbayesPluginContextHolder

public void setUnbbayesPluginContextHolder(UnBBayesPluginContextHolder unbbayesPluginContextHolder)
Parameters:
unbbayesPluginContextHolder - the unbbayesPluginContextHolder to set


Copyright © 2001-2010 University of Brasilia - UnB. All Rights Reserved.