QuickServer
v1.4.7

org.quickserver.net.qsadmin
Class CommandHandler

java.lang.Object
  extended byorg.quickserver.net.qsadmin.CommandHandler
All Implemented Interfaces:
ClientCommandHandler, ClientEventHandler

public class CommandHandler
extends java.lang.Object
implements ClientCommandHandler, ClientEventHandler

ClientCommandHandler for QSAdminServer.

= Protocol =
Each response starts with a status.

If response if one lined then it follows the status. Else You will get "info follows" as the first line followed by with many lines of response ending by a dot in a line by itself. i.e., <CR><LF>.<CR><LF>
Command supported are give below .. [ Note: <<target>> = server|self ]
 
CommandParamEffect
start<<target>>Starts target.
stop<<target>>Stops target.
restart<<target>>=stop+start command
shutdown Stops server and self.
kill or exit Stops server and self and kill all threads.
info<<target>>Information about target.
noclient<<target>>No Client connected to the target.
running<<target>>Checks if target is running.
get<<target>> maxClientGets max no of client for the target.
get<<target>> portGets port for the target.
get<<target>> maxAuthTryMsgGets maxAuthTryMsg for the target.
get<<target>> clientCommandHandlerGets ClientCommandHandler class for the target.
get<<target>> clientAuthenticationHandlerGets ClientAuthenticationHandler class for the target.
get<<target>> clientDataGets ClientData class for the target.
get<<target>> timeoutGets timeout set for clients for the target.
set<<target>> maxClient <<value>>Sets max no of client for the target.
set<<target>> port <<value>>Sets port for the target.*
set<<target>> maxAuthTryMsg <<value>>Sets maxAuthTryMsg for the target. *
set<<target>> clientCommandHandler <<value>>Sets ClientCommandHandler class for the target. *
set<<target>> clientAuthenticationHandler <<value>>Sets ClientAuthenticationHandler class for the target. *
set<<target>> clientData <<value>>Sets ClientData class for the target. *
set<<target>> timeout <<value>>Sets timeout set for clients for the target. *
version Gets the version of the QuickServer library used.
quit Close session.
New Command in v1.2
getself pluginGets pluggable command handler for QsAdminServer. *
setself plugin <<full class name>>Sets Pluggable command handler for QsAdminServer. *
New Command in v1.3
suspendService<<target>>Suspends target.
resumeService<<target>>Resume target.
get<<target>> maxAuthTryGets maxAuthTry for the target.
set<<target>> maxAuthTrySets maxAuthTry for the target.*
get<<target>> clientObjectHandlerGets ClientObjectHandler class for the target.
set<<target>> clientObjectHandlerSets ClientObjectHandler class for the target.*
get<<target>> timeoutMsgGets timeout Message for the target.
set<<target>> timeoutMsgSets timeout Message for the target.*
get<<target>> serviceStateGets Service State for the target.
get<<target>> consoleLoggingFormatterSets consoleLoggingFormatter for the target.
set<<target>> consoleLoggingFormatterSets consoleLoggingFormatter for the target.
get<<target>> consoleLoggingLevelSets consoleLoggingLevel for the target.
set<<target>> consoleLoggingLevelSets consoleLoggingLevel for the target.
[SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST]
set<<target>> maxClientMsgSets maxClientMsg for the target.
get<<target>> maxClientMsgGets maxClientMsg for the target.
New Command in v1.3.1
set<<target>> loggingLevelSets LoggingLevel for the target.
[SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST]
New Command in v1.3.2
memoryInfo Memory Information {Total:Used:Max}
set<<target>> communicationLoggingSets communication logging flag for the target.
get<<target>> communicationLoggingGets communication logging flag for the target.
set<<target>> objectPoolConfig-maxActiveSets maxActive of objectPoolConfig for the target.
get<<target>> objectPoolConfig-maxActiveGets maxActive of objectPoolConfig for the target.
set<<target>> objectPoolConfig-maxIdleSets maxIdle of objectPoolConfig for the target.
get<<target>> objectPoolConfig-maxIdleGets maxIdle of objectPoolConfig for the target.
New Command in v1.4.5
all-pool-info<<target>>Gives stats of all pools for the target.
client-thread-pool-dump<<target>>Gives dump of all threads in pool for the target.
start<<console>>Starts console shell.
stop<<console>>Stops console shell.
New Command in v1.4.6
client-handler-pool-dump<<target>>Gives dump of all ClientHandler in pool for the target.
get<<target>> clientEventHandlerGets ClientEventHandler class for the target.
set<<target>> clientEventHandler <<value>>Sets ClientEventHandler class for the target. *
get<<target>> clientWriteHandlerGets ClientWriteHandler class for the target.
set<<target>> clientWriteHandler <<value>>Sets ClientWriteHandler class for the target. *
get<<target>> clientExtendedEventHandlerGets ClientExtendedEventHandler class for the target.
set<<target>> clientExtendedEventHandler <<value>>Sets ClientExtendedEventHandler class for the target. *
set<<target>> objectPoolConfig-initSizeSets initSize of objectPoolConfig for the target.
get<<target>> objectPoolConfig-initSizeGets initSize of objectPoolConfig for the target.
* = Take effect after a restart command.
value if set null then key will be set to null

Note: Eg:
noClient server
noClient self
get server maxClient
set server maxClient 10

Since:
1.1

Constructor Summary
CommandHandler()
           
 
Method Summary
 void closingConnection(ClientHandler handler)
          Method called when client connection is closed.
 void gotConnected(ClientHandler handler)
          Method called when there is a new client connects to the QuickServer.
 void handleCommand(ClientHandler handler, java.lang.String command)
          Method called every time client sends character/string data.
 void lostConnection(ClientHandler handler)
          Method called when client connection is lost.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CommandHandler

public CommandHandler()
Method Detail

gotConnected

public void gotConnected(ClientHandler handler)
                  throws java.net.SocketTimeoutException,
                         java.io.IOException
Description copied from interface: ClientEventHandler
Method called when there is a new client connects to the QuickServer. Can be used to send welcome message to the client and logging.

Specified by:
gotConnected in interface ClientEventHandler
Throws:
java.io.IOException - if io error in socket
java.net.SocketTimeoutException - if socket times out

lostConnection

public void lostConnection(ClientHandler handler)
                    throws java.io.IOException
Description copied from interface: ClientEventHandler
Method called when client connection is lost. Don't write to the connection in this method. Its just information, to be used at the Server end. It can be caused due to network errors.

Specified by:
lostConnection in interface ClientEventHandler
Throws:
java.io.IOException - if io error in socket

closingConnection

public void closingConnection(ClientHandler handler)
                       throws java.io.IOException
Description copied from interface: ClientEventHandler
Method called when client connection is closed. Don't write to the connection in this method. Its just information, you can use to log time and ip of client closing connection.

Specified by:
closingConnection in interface ClientEventHandler
Throws:
java.io.IOException - if io error in socket

handleCommand

public void handleCommand(ClientHandler handler,
                          java.lang.String command)
                   throws java.net.SocketTimeoutException,
                          java.io.IOException
Description copied from interface: ClientCommandHandler
Method called every time client sends character/string data. Should be used to handle the command sent and send any requested data.

Specified by:
handleCommand in interface ClientCommandHandler
Throws:
java.net.SocketTimeoutException - if socket times out
java.io.IOException - if io error in socket

QuickServer
v1.4.7

Copyright © 2003-2006 QuickServer.org