|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread pluginCore.Plugin
public abstract class Plugin
The base class for all plug-ins that are to be loaded in the PluginCore. Plugin saveing and loading. The plugin must have a number of abstract methods written that will allow it to operate with other plugins and the plugin core. int send( Message messIn) This method receves the messages sent from other plugins, if your plugin does not intend to receve messages it can safely return error (-1) on this. boolean init( CoreHandler coreIn ) void run() void shutdown() Object[] savePluginState( ) boolean setPluginState( Object[] stateVec )
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
protected boolean |
DEBUG
Enable or disables debugging. |
protected CoreHandler |
frameworkCore
The stub used to make calls back to the PluginCore. |
protected int |
pluginID
The Id of this plug-in. |
protected String |
pluginName
The name of this plug-in. |
protected boolean |
TRACE
Enable or disable the traceing. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
Plugin()
Nice empty constructor. |
Method Summary | |
---|---|
boolean |
debugStatus()
Identifies if Debugging is enabled for this plug-in. |
int |
getID()
Gets the plugin's Id. |
String |
getPluginName()
Gets the name of the plug-in. |
boolean |
loadNewState(Object[] stateIn,
CoreHandler coreIn)
Sets the plugin's state with a object array from a previous plugin. |
protected void |
printDebug(String debugMsg)
This will place debugging output in your program, turn on or off by setting DEBUG true/false. |
protected void |
printError(String errorMsg)
This will allways print out the errorMsg to System.err |
protected void |
printTrace(String traceString)
This can be turned off by setting TRACE to false, but will print the class name, plus the included method name. |
abstract int |
receive(Message msgIn)
Hands a message to the plug-in from another plug-in via the PluginCore. |
abstract void |
run()
The main loop of the plug-in. |
boolean |
safeJoin()
Calls join and returns true if it was successful, false otherwise. |
boolean |
safeJoin(int timer)
Calls join and returns true if it was successful, false otherwise. |
boolean |
safeSleep(int timeToSleep)
Sleeps the thread for timeToSleep milliseconds. |
abstract Object[] |
savePluginState()
Saves the current state of the object in a Vector. |
void |
setCoreHandeler(CoreHandler coreIn)
Saves the core handler to the frameworkCore variable. |
void |
setID(int id)
Sets the plug-in id for this plug-in. |
abstract boolean |
setPluginState(Object[] stateVec)
Sets the current state of the object using a vector of objects. |
abstract void |
shutdown()
Called by the PluginCore, allows plug-ins to exit in a tidy and controlled manner. |
String |
toString()
Gets the String value of the plug-in. |
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 |
---|
protected transient CoreHandler frameworkCore
protected int pluginID
protected boolean DEBUG
protected boolean TRACE
protected String pluginName
Constructor Detail |
---|
public Plugin()
Method Detail |
---|
public abstract void run()
run
in interface Runnable
run
in class Thread
public abstract void shutdown()
public abstract int receive(Message msgIn)
msgIn
- The message that is being delivered.
public abstract Object[] savePluginState()
public abstract boolean setPluginState(Object[] stateVec)
stateVec
- This Vector object will hold the objects to load from.
public void setID(int id)
id
- The new Id.public void setCoreHandeler(CoreHandler coreIn)
coreIn
- The core that is to be saved.public int getID()
public boolean loadNewState(Object[] stateIn, CoreHandler coreIn) throws IOException
stateIn
- The object array with the saved state.coreIn
- The CoreHandler from the running core.
IOException
public boolean safeJoin()
public boolean safeSleep(int timeToSleep)
public boolean debugStatus()
public boolean safeJoin(int timer)
timer
- The number of milliseconds to wait before forceing shutdown.
public String getPluginName()
protected void printTrace(String traceString)
traceString
- This is also printed with the trace call.protected void printDebug(String debugMsg)
debugMsg
- This is the message to be printed with the debug.protected void printError(String errorMsg)
errorMsg
- The error to print.public String toString()
toString
in class Thread
|
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |