Class JAddinThread

java.lang.Object
  extended by java.lang.Thread
      extended by lotus.domino.NotesThread
          extended by JAddinThread
All Implemented Interfaces:
java.lang.Runnable

public abstract class JAddinThread
extends lotus.domino.NotesThread

This abstract class is started as an separate thread by the JAddin. It establishes the JAddin user framework and calls the user code.

See Also:
addinStart(), addinStop(), addinCommand(String)

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 lotus.domino.NotesThread
dummyObj, isLoaded
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JAddinThread()
          Dummy constructor
 
Method Summary
 void addinCommand(java.lang.String pCommand)
          This method is executed for every command entered at the Domino console, e.g.
 void addinInitialize(JAddin pMainThread, java.lang.String pStartArguments)
          This method is called by the main JAddin thread to initialize the JAddinThread
 void addinNextDay()
          This method is called at the beginning of a new day.
 void addinNextHour()
          This method is called at the beginning of an hour.
abstract  void addinStart()
          This method is called by JAddinThread after all initialization work is done.
abstract  void addinStop()
          This method is executed when the command "Quit" or "Exit" is entered or during Domino server shutdown.
 void addinTerminate()
          Terminate the current addin.
 void finalize()
          This method is called by the Java runtime during garbage collection to free all resources owned by this object.
 java.lang.String getAddinParameters()
          Get the parameters passed to the addin.
 lotus.domino.Session getDominoSession()
          Return the Domino session object.
 void logDebug(java.lang.String pMessage)
          Write debug message to the standard output (Domino console).
 void logMessage(java.lang.String pMessage)
          Write a log message to the Domino console.
 void runNotes()
          This method is called from the JAddin framework.
 boolean sendMessage(java.lang.String pMessageFrom, java.lang.String pMessageTo, java.lang.String pMessageSubject, java.lang.String pMessageBody)
          Create and send a message.
 boolean sendMessage(java.lang.String pMessageFrom, java.lang.String pMessageTo, java.lang.String pMessageCC, java.lang.String pMessageBCC, java.lang.String pMessageSubject, java.lang.String pMessageBody)
          Create and send a message.
 void setAddinState(java.lang.String pMessage)
          Set the addin status message text.
 void setDebugState(boolean pDebugState)
          Set the debug state.
 void waitMilliSeconds(long pWaitTime)
          Wait some time.
 
Methods inherited from class lotus.domino.NotesThread
initThread, run, sinitThread, stermThread, termThread
 
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
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JAddinThread

public JAddinThread()
Dummy constructor

Method Detail

runNotes

public final void runNotes()
This method is called from the JAddin framework. Its main purpose is to call the user code thru addinStart().

Overrides:
runNotes in class lotus.domino.NotesThread

addinInitialize

public final void addinInitialize(JAddin pMainThread,
                                  java.lang.String pStartArguments)
This method is called by the main JAddin thread to initialize the JAddinThread

Parameters:
pMainThread - JAddin thread
pStartArguments - Passed arguments or null ("Load RunJava JAddin AddinName xxxxx")

addinStart

public abstract void addinStart()
This method is called by JAddinThread after all initialization work is done. When this method returns, all necessary cleanup tasks are executed and the addin will terminate.


addinStop

public abstract void addinStop()
This method is executed when the command "Quit" or "Exit" is entered or during Domino server shutdown. After this method returns, the addin will be terminated. Note: This method is called asynchronously from the JAddin framework and not from the users thread. It should return as quickly as possible to avoid any processing delays of the Domino server message queue.


addinCommand

public void addinCommand(java.lang.String pCommand)
This method is executed for every command entered at the Domino console, e.g. "Tell AddinName xxxxxxxx". Note: This method is called asynchronously from the JAddin framework and not from the users thread. It should return as quickly as possible to avoid any processing delays of the Domino server message queue.

Parameters:
pCommand - Command line

addinNextHour

public void addinNextHour()
This method is called at the beginning of an hour. Note: This method is called asynchronously from the JAddin framework and not from the users thread. It should return as quickly as possible to avoid any processing delays of the Domino server message queue.


addinNextDay

public void addinNextDay()
This method is called at the beginning of a new day. Note: This method is called asynchronously from the JAddin framework and not from the users thread. It should return as quickly as possible to avoid any processing delays of the Domino server message queue.


addinTerminate

public final void addinTerminate()
Terminate the current addin. This call will not return since the thread will loose control.


setAddinState

public final void setAddinState(java.lang.String pMessage)
Set the addin status message text. This text is shown in response to the Domino console command "show tasks".

Parameters:
pMessage - Status message or null to set the string to "Idle"

setDebugState

public final void setDebugState(boolean pDebugState)
Set the debug state.

Parameters:
pDebugState - Debug state

getAddinParameters

public final java.lang.String getAddinParameters()
Get the parameters passed to the addin.

Returns:
String with the arguments or null

getDominoSession

public final lotus.domino.Session getDominoSession()
Return the Domino session object.

Returns:
Domino object

logMessage

public final void logMessage(java.lang.String pMessage)
Write a log message to the Domino console. The message string will be prepended with the addin name followed by a column, e.g. "HelloWorld: xxxxxxxx"

Parameters:
pMessage - Message to be displayed

logDebug

public final void logDebug(java.lang.String pMessage)
Write debug message to the standard output (Domino console). The message string will be prepended by Domino and by this method with e.g. "RunJava JVM: AddInName(ThreadID).MethodName(LineNumber): xxxxxxxx". The message is only logged if the debug flag is enabled thru setDebug(true) or thru the Domino console command "Tell AddinName Debug!".

Parameters:
pMessage - Message to be displayed
See Also:
setDebugState(boolean)

sendMessage

public final boolean sendMessage(java.lang.String pMessageFrom,
                                 java.lang.String pMessageTo,
                                 java.lang.String pMessageSubject,
                                 java.lang.String pMessageBody)
                          throws java.lang.Exception
Create and send a message. If the message delivery fails, a message will be written to the Domino console.

Parameters:
pMessageFrom - Senders name
pMessageTo - Recipient name
pMessageSubject - Subject of message
pMessageBody - Body of message
Returns:
Success or failure indicator
Throws:
java.lang.Exception

sendMessage

public final boolean sendMessage(java.lang.String pMessageFrom,
                                 java.lang.String pMessageTo,
                                 java.lang.String pMessageCC,
                                 java.lang.String pMessageBCC,
                                 java.lang.String pMessageSubject,
                                 java.lang.String pMessageBody)
                          throws java.lang.Exception
Create and send a message. If the message delivery fails, a message will be written to the Domino console.

Parameters:
pMessageFrom - Senders name
pMessageTo - Recipient name
pMessageCC - Carbon copy recipient or null
pMessageBCC - Blind carbon copy recipient or null
pMessageSubject - Subject of message
pMessageBody - Body of message
Returns:
Success or failure indicator
Throws:
java.lang.Exception

waitMilliSeconds

public final void waitMilliSeconds(long pWaitTime)
Wait some time.

Parameters:
pWaitTime - Wait time in milliseconds (0.00x seconds)

finalize

public void finalize()
This method is called by the Java runtime during garbage collection to free all resources owned by this object.

Overrides:
finalize in class lotus.domino.NotesThread