pluginCore
Class AdminPlugin

java.lang.Object
  extended by java.lang.Thread
      extended by pluginCore.Plugin
          extended by pluginCore.AdminPlugin
All Implemented Interfaces:
Runnable

public class AdminPlugin
extends Plugin


Nested Class Summary
private  class AdminPlugin.FileListModel
          The FileListModel builds a list of .class files from the directory declared by AdminPlugin.pluginDirectoryPath excluding internal classes by ignoring every file with a $ in the name.
 
Nested classes/interfaces inherited from class java.lang.Thread
Thread.State, Thread.UncaughtExceptionHandler
 
Field Summary
private  JFrame adminFrame
           
private  JList fileList
           
private  AdminPlugin.FileListModel fileListModel
           
private  DefaultListModel listModel
           
private  JList loadedPlugList
           
private static String myHomePath
          This should be the path to the plugin you keep the plugins in.
private static String pluginDirectoryPath
          This should be the path to the plugin you keep the plugins in.
private static String pluginPrefix
          This is also a bit of a hack for this, you need to spesify the full package name of the plugin you want to load.
 
Fields inherited from class pluginCore.Plugin
DEBUG, frameworkCore, pluginID, pluginName, TRACE
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
AdminPlugin()
           
 
Method Summary
private  JList buildFileList()
          Creates the file list.
private  JPanel buildSwapMenue()
          This build the swap menue on the interface.
private  void fillLoadedPlugList()
          This method will get the list of plugins that are loaded and fill out the list in the interface.
private  JButton getLoadButton()
          Creates the load plugin button.
private  JButton getReloadListButton()
          Builds a button labled "Refresh Loaded Plugin List" and calls fillLoadedPlugList()
private  JButton getSwapButton()
          Creates the swap button.
private  void loadSelected()
           
 int receive(Message msgIn)
          Hands a message to the plug-in from another plug-in via the PluginCore.
 void run()
          The main loop of the plug-in.
 Object[] savePluginState()
          Saves the current state of the object in a Vector.
 boolean setPluginState(Object[] stateVec)
          Sets the current state of the object using a vector of objects.
 void shutdown()
          Called by the PluginCore, allows plug-ins to exit in a tidy and controlled manner.
private  void swapSelected()
          This is called to swap the plugins that are selected.
 
Methods inherited from class pluginCore.Plugin
debugStatus, getID, getPluginName, loadNewState, printDebug, printError, printTrace, safeJoin, safeJoin, safeSleep, setCoreHandeler, setID, toString
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

myHomePath

private static final String myHomePath
This should be the path to the plugin you keep the plugins in. It is used to tell the program where to look to get a list of available plugins.

See Also:
Constant Field Values

pluginPrefix

private static final String pluginPrefix
This is also a bit of a hack for this, you need to spesify the full package name of the plugin you want to load.

See Also:
Constant Field Values

pluginDirectoryPath

private static final String pluginDirectoryPath
This should be the path to the plugin you keep the plugins in. It is used to tell the program where to look to get a list of available plugins.

See Also:
Constant Field Values

adminFrame

private JFrame adminFrame

fileListModel

private AdminPlugin.FileListModel fileListModel

fileList

private JList fileList

loadedPlugList

private JList loadedPlugList

listModel

private DefaultListModel listModel
Constructor Detail

AdminPlugin

AdminPlugin()
Method Detail

fillLoadedPlugList

private void fillLoadedPlugList()
This method will get the list of plugins that are loaded and fill out the list in the interface.


buildSwapMenue

private JPanel buildSwapMenue()
This build the swap menue on the interface.

Returns:
The JPanel that will be loaded into the interface.

run

public void run()
Description copied from class: Plugin
The main loop of the plug-in.

Specified by:
run in interface Runnable
Specified by:
run in class Plugin

shutdown

public void shutdown()
Description copied from class: Plugin
Called by the PluginCore, allows plug-ins to exit in a tidy and controlled manner. This call is followed by a safeJoin() call.

Specified by:
shutdown in class Plugin

receive

public int receive(Message msgIn)
Description copied from class: Plugin
Hands a message to the plug-in from another plug-in via the PluginCore.

Specified by:
receive in class Plugin
Parameters:
msgIn - The message that is being delivered.
Returns:
1 on success, -1 on failure.

swapSelected

private void swapSelected()
This is called to swap the plugins that are selected.


loadSelected

private void loadSelected()

getReloadListButton

private JButton getReloadListButton()
Builds a button labled "Refresh Loaded Plugin List" and calls fillLoadedPlugList()

Returns:
Returns the button that was built.

getSwapButton

private JButton getSwapButton()
Creates the swap button.

Returns:
Returns the button that was built.

getLoadButton

private JButton getLoadButton()
Creates the load plugin button.

Returns:
Returns the button created.

buildFileList

private JList buildFileList()
Creates the file list.

Returns:
Returns the file list created.

savePluginState

public Object[] savePluginState()
Description copied from class: Plugin
Saves the current state of the object in a Vector. The order that objects are stored is very important to this and it is expected that the programer puts the fully qualified name of the originateing object as the frist field in the Vector so that other plugins can quickly identify the source of the data.

Specified by:
savePluginState in class Plugin
Returns:
The data from inside of the plugin held in a vector.

setPluginState

public boolean setPluginState(Object[] stateVec)
Description copied from class: Plugin
Sets the current state of the object using a vector of objects. It is the job of the programer to properly interpert and use the data that is handed in from the vector. According to protocol it is proper to put the object name as the first field in the vector so that a later object can quickly idnetify how to deal with the data in the vector.

Specified by:
setPluginState in class Plugin
Parameters:
stateVec - This Vector object will hold the objects to load from.
Returns:
True on sucess, false otherwise.