com.asdf.client
Class PluginLoader

java.lang.Object
  extended by com.asdf.client.PluginLoader

public class PluginLoader
extends java.lang.Object

Handles loading of dynamic plugins.


Constructor Summary
PluginLoader()
          Constructor for PluginLoader which searches for plugins only in location defined in client.conf file.
PluginLoader(java.net.URL[] urls)
          Constructor for PluginLoader which takes url -locations as parameters to search for plugins.
 
Method Summary
 CreateGamePanel loadCreateGamePanel(java.lang.String className, long gameID, java.lang.String name)
          Tries to load and initialize CreateGamePanel with given className.
 GameController loadGame(java.lang.String className, long gameID, java.lang.String name)
          Tries to load and initialize a GameController found in classDir in package className.
 java.lang.Object loadObject(java.lang.String className)
          Tries to load and initialize an object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginLoader

public PluginLoader(java.net.URL[] urls)
Constructor for PluginLoader which takes url -locations as parameters to search for plugins.

Parameters:
urls - Locations for plugins.

PluginLoader

public PluginLoader()
Constructor for PluginLoader which searches for plugins only in location defined in client.conf file.

Method Detail

loadGame

public GameController loadGame(java.lang.String className,
                               long gameID,
                               java.lang.String name)
                        throws PluginLoadException
Tries to load and initialize a GameController found in classDir in package className. Class is casted to GameController before returning.

Parameters:
className - Fully qualified name of the class
gameID - ID of the new game
name - Name of the game
Returns:
Instance of requested Game
Throws:
PluginLoadException - If plugin could not be loaded.

loadCreateGamePanel

public CreateGamePanel loadCreateGamePanel(java.lang.String className,
                                           long gameID,
                                           java.lang.String name)
                                    throws PluginLoadException
Tries to load and initialize CreateGamePanel with given className.

Parameters:
className - Fully qualified name of the class
gameID - ID of the new game
name - Name of the panel
Returns:
Instance of requested Game
Throws:
PluginLoadException - If plugin could not be loaded.

loadObject

public java.lang.Object loadObject(java.lang.String className)
                            throws PluginLoadException
Tries to load and initialize an object.

Parameters:
className - Fully qualified name of the class
Returns:
instance of Object
Throws:
PluginLoadException - If object could not be loaded