|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread net.clackrouter.application.ClackApplication
public abstract class ClackApplication
Abstract class to be sub-classed by all applications to be run on Clack.
The functionality of the application should be implemented with application_main(String[])
with
parameters passed in using the argument array.
Sockets are created by calling either of the supplied methods, createTCPSocket()
or createUDPSocket()
.
Nested Class Summary |
---|
Nested classes/interfaces inherited from class java.lang.Thread |
---|
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
ClackApplication()
|
Method Summary | |
---|---|
protected void |
alert(java.lang.String msg)
Creates a simple dialog box to display a message |
abstract void |
application_main(java.lang.String[] args)
Abstract "main method" to be implemented by sub-class |
void |
configure(java.lang.String name,
Router router,
java.lang.String[] config)
Used to configure the application before it is run (for internal Clack use). |
protected TCPSocket |
createTCPSocket()
Create a TCPSocket running on this router |
protected UDPSocket |
createUDPSocket()
Create a UDPSocket running on this router |
java.lang.String |
getAppName()
Get application name |
abstract java.lang.String |
getDescription()
Returns a very brief (single line) description of the application |
Router |
getRouter()
Get the router associated with this application |
long |
getTime()
|
void |
notifyAlarm()
call-back method implemented by the code setting the alarm. |
void |
pause(long msecs)
|
protected void |
print(java.lang.String s)
Print out a message to the application console |
void |
run()
Starts the application (for internal Clack use) |
void |
setAlarm(long msecs_from_now)
Sets a timer |
void |
setShell(ClackShell shell)
Set active shell for this application. |
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, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public ClackApplication()
Method Detail |
---|
public void configure(java.lang.String name, Router router, java.lang.String[] config)
name
- An identifier for this applicationrouter
- The router hosting this applicationconfig
- A String[] of parameterspublic void setShell(ClackShell shell)
shell
- public void run()
run
in interface java.lang.Runnable
run
in class java.lang.Thread
protected TCPSocket createTCPSocket() throws java.lang.Exception
java.lang.Exception
- errors if TCP is not enabled on the routerprotected UDPSocket createUDPSocket() throws java.lang.Exception
java.lang.Exception
- errors if UDP is not enabled on the routerprotected void alert(java.lang.String msg)
msg
- message to be displayedprotected void print(java.lang.String s)
s
- text to be printedpublic abstract void application_main(java.lang.String[] args) throws java.lang.InterruptedException
args
- the application arguments
java.lang.InterruptedException
public abstract java.lang.String getDescription()
public Router getRouter()
getRouter
in interface Alarm
public java.lang.String getAppName()
public void pause(long msecs)
public void setAlarm(long msecs_from_now)
Alarm
setAlarm
in interface Alarm
msecs_from_now
- milliseconds later in "clack time" that the alarm will fire.public long getTime()
public void notifyAlarm()
Alarm
notifyAlarm
in interface Alarm
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |