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, deepClone
configureDumpHeadlineLength, configureDumpMaxElementsPrinted, copyDumpStringValues, copyToStringValues, createDumpHeader, toDumpString, toString
public 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()
ClientObject
getClientContext
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()
CancellableTask
wasCancelled
in interface CancellableTask
public 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()
DeliverableMessage
isSkipSender
in interface DeliverableMessage
public void setSkipSender(boolean notToSender)
setSkipSender
in interface DeliverableMessage
public ServerContext getServerContext()
public SessionId getTargetSession()
getTargetSession
in interface DeliverableMessage
public void setTargetSession(SessionId sessId)
setTargetSession
in interface DeliverableMessage
public boolean hasTargetSession()
hasTargetSession
in interface DeliverableMessage
public SessionId getFromSession()
getFromSession
in interface DeliverableMessage
public void setFromSession(SessionId sessId)
setFromSession
in interface DeliverableMessage
public boolean hasFromSession()
hasFromSession
in interface DeliverableMessage
public java.lang.String[] getTargetUsers()
getTargetUsers
in interface DeliverableMessage
public void setTargetUsers(java.lang.String[] userNames)
setTargetUsers
in interface DeliverableMessage
public void setTargetUser(java.lang.String userName)
setTargetUser
in interface DeliverableMessage
public boolean hasTargetUser()
hasTargetUser
in interface DeliverableMessage
public 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.Exception
public 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.Exception
public javax.swing.Icon getRenderIcon()
getRenderIcon
in interface Renderable
public java.lang.String getRenderText()
getRenderText
in interface Renderable
public java.awt.Color getRenderColor()
getRenderColor
in interface Renderable
public LogChannel getLogChannel()
getLogChannel
in interface SimpleLogSupport
public boolean isLogDebug()
isLogDebug
in interface SimpleLogSupport
public boolean isLogVerbose()
isLogVerbose
in interface SimpleLogSupport
public void logDebug(java.lang.String message)
logDebug
in interface SimpleLogSupport
public void logDump(java.lang.String message)
logDump
in interface SimpleLogSupport
public void logError(java.lang.String message, java.lang.Exception e)
logError
in interface SimpleLogSupport
public void logError(java.lang.String message)
logError
in interface SimpleLogSupport
public void logFatal(java.lang.String message, java.lang.Exception e)
logFatal
in interface SimpleLogSupport
public void logInfo(java.lang.String message)
logInfo
in interface SimpleLogSupport
public void logVerbose(java.lang.String message)
logVerbose
in interface SimpleLogSupport
public void logWarning(java.lang.String message)
logWarning
in interface SimpleLogSupport
public void setLogChannel(LogChannel logCh)
setLogChannel
in interface SimpleLogSupport
public ToString toString(ToString s)
Dumpable
toString
in interface Dumpable
toString
in class DumpableObject
public DumpString toDumpString(DumpString s)
Dumpable
toDumpString
in interface Dumpable
toDumpString
in class DumpableObject
Copyright © 2014 EsprIT-Systems. All Rights Reserved.