public abstract class ClientCommand<C extends ClientContext> extends TransferableObject implements ClientObject<C>, DeliverableMessage, CancellableTask, Renderable, SimpleLogSupport
| Constructor and Description |
|---|
ClientCommand(ServerContext serverCtx,
SessionId toSessId,
java.lang.Object argument)
Used if the server itself sends the command.
|
ClientCommand(SessionId fromSessId) |
ClientCommand(SessionId fromSessId,
SessionId toSessId) |
ClientCommand(SessionId fromSessId,
SessionId toSessId,
java.lang.Object argument)
Used if the the command was caused by another client.
|
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
protected void |
checkCancelled()
Checks whether the task was cancelled and throws a
CancellationException
just in case. |
void |
executeAsync()
This method is called by the clients
ClientCommandTask. |
void |
executeSyncFinally()
This method is called after
executeAsync() only if the async execution was successful. |
java.lang.Object |
getArgument() |
C |
getClientContext()
Returns the the client runtime environment
|
java.lang.String |
getCommandId() |
SessionId |
getFromSession() |
LogChannel |
getLogChannel() |
java.lang.String |
getName() |
java.awt.Color |
getRenderColor() |
javax.swing.Icon |
getRenderIcon() |
java.lang.String |
getRenderText() |
ServerContext |
getServerContext()
Returns the ServerContext of the server in which this client is running as a co-client, or null
if this client is not a co-client.
|
SessionId |
getTargetSession() |
java.lang.String[] |
getTargetUsers() |
boolean |
hasFromSession() |
boolean |
hasTargetSession() |
boolean |
hasTargetUser() |
boolean |
isCoClient() |
boolean |
isGuiClient() |
boolean |
isLogDebug() |
boolean |
isLogVerbose() |
boolean |
isSkipSender()
If this flag is set, then the message is sent to all sessions except the
session of the sender himself.
|
void |
logDebug(java.lang.String message) |
void |
logDump(java.lang.String message) |
void |
logError(java.lang.String message) |
void |
logError(java.lang.String message,
java.lang.Exception e) |
void |
logFatal(java.lang.String message,
java.lang.Exception e) |
void |
logInfo(java.lang.String message) |
void |
logVerbose(java.lang.String message) |
void |
logWarning(java.lang.String message) |
void |
setArgument(java.lang.Object argument) |
void |
setcancelled() |
void |
setClientContext(C clientCtx) |
void |
setFromSession(SessionId sessId) |
void |
setLogChannel(LogChannel logCh) |
void |
setName(java.lang.String cmdName) |
void |
setSkipSender(boolean notToSender) |
void |
setTargetSession(SessionId sessId) |
void |
setTargetUser(java.lang.String userName) |
void |
setTargetUsers(java.lang.String[] userNames) |
void |
sleepChecked(long millis) |
DumpString |
toDumpString(DumpString s)
This method allows subclasses to add values to the existing DumpString of the superclass.
|
ToString |
toString(ToString s)
This method allows subclasses to add values to the existing ToString of the superclass.
|
boolean |
wasCancelled()
Tells whether ever an attempt has been made to cancel this task.
|
clone, deepCloneconfigureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toStringpublic ClientCommand(SessionId fromSessId)
public ClientCommand(ServerContext serverCtx, SessionId toSessId, java.lang.Object argument)
public boolean isGuiClient()
public boolean isCoClient()
public void setClientContext(C clientCtx)
public final C getClientContext()
ClientObjectgetClientContext in interface ClientObject<C extends ClientContext>public java.lang.String getCommandId()
public java.lang.String getName()
public void setName(java.lang.String cmdName)
public void cancel()
public void setcancelled()
public boolean wasCancelled()
CancellableTaskwasCancelled in interface CancellableTaskpublic void sleepChecked(long millis)
protected final void checkCancelled()
CancellationException
just in case. This methods should be called within loops in order to
react promptly on cancellation.public boolean isSkipSender()
DeliverableMessageisSkipSender in interface DeliverableMessagepublic void setSkipSender(boolean notToSender)
setSkipSender in interface DeliverableMessagepublic ServerContext getServerContext()
public SessionId getTargetSession()
getTargetSession in interface DeliverableMessagepublic void setTargetSession(SessionId sessId)
setTargetSession in interface DeliverableMessagepublic boolean hasTargetSession()
hasTargetSession in interface DeliverableMessagepublic SessionId getFromSession()
getFromSession in interface DeliverableMessagepublic void setFromSession(SessionId sessId)
setFromSession in interface DeliverableMessagepublic boolean hasFromSession()
hasFromSession in interface DeliverableMessagepublic java.lang.String[] getTargetUsers()
getTargetUsers in interface DeliverableMessagepublic void setTargetUsers(java.lang.String[] userNames)
setTargetUsers in interface DeliverableMessagepublic void setTargetUser(java.lang.String userName)
setTargetUser in interface DeliverableMessagepublic boolean hasTargetUser()
hasTargetUser in interface DeliverableMessagepublic void setArgument(java.lang.Object argument)
public java.lang.Object getArgument()
public void executeAsync()
throws java.lang.Exception
ClientCommandTask. You must NOT perform
any GUI updates within this method. The default implementation is empty.java.lang.Exceptionpublic void executeSyncFinally()
throws java.lang.Exception
executeAsync() only if the async execution was successful.
If the client has a GUI it runs in the EventDispatcher thread and thus may perform GUI updates.
The default implementation is empty.java.lang.Exceptionpublic javax.swing.Icon getRenderIcon()
getRenderIcon in interface Renderablepublic java.lang.String getRenderText()
getRenderText in interface Renderablepublic java.awt.Color getRenderColor()
getRenderColor in interface Renderablepublic LogChannel getLogChannel()
getLogChannel in interface SimpleLogSupportpublic boolean isLogDebug()
isLogDebug in interface SimpleLogSupportpublic boolean isLogVerbose()
isLogVerbose in interface SimpleLogSupportpublic void logDebug(java.lang.String message)
logDebug in interface SimpleLogSupportpublic void logDump(java.lang.String message)
logDump in interface SimpleLogSupportpublic void logError(java.lang.String message,
java.lang.Exception e)
logError in interface SimpleLogSupportpublic void logError(java.lang.String message)
logError in interface SimpleLogSupportpublic void logFatal(java.lang.String message,
java.lang.Exception e)
logFatal in interface SimpleLogSupportpublic void logInfo(java.lang.String message)
logInfo in interface SimpleLogSupportpublic void logVerbose(java.lang.String message)
logVerbose in interface SimpleLogSupportpublic void logWarning(java.lang.String message)
logWarning in interface SimpleLogSupportpublic void setLogChannel(LogChannel logCh)
setLogChannel in interface SimpleLogSupportpublic ToString toString(ToString s)
DumpabletoString in interface DumpabletoString in class DumpableObjectpublic DumpString toDumpString(DumpString s)
DumpabletoDumpString in interface DumpabletoDumpString in class DumpableObjectCopyright © 2014 EsprIT-Systems. All Rights Reserved.