|
QuickServer v1.4.6 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.quickserver.net.server.QuickServer
Main class of QuickServer library. This class is used to create multi client servers quickly.
Ones a client is connected, it creates ClientHandler
object,
which is run using any thread available from the pool of threads
maintained by ClientPool
, which
handles the client.
QuickServer divides the application logic of its developer over eight
class,
Eg:
package echoserver;
import org.quickserver.net.*;
import org.quickserver.net.server.*;
import java.io.*;
public class EchoServer {
public static void main(String args[]) {
String cmdHandle = "echoserver.EchoCommandHandler";
QuickServer myServer = new QuickServer();
myServer.setClientCommandHandler(cmdHandle);
myServer.setPort(4123);
myServer.setName(Echo Server v1.0");
try {
myServer.startServer();
} catch(AppException e) {
System.err.println("Error in server : "+e);
e.printStackTrace();
}
}
}
Field Summary | |
protected java.lang.Class |
clientDataClass
|
Fields inherited from interface org.quickserver.net.Service |
INIT, RUNNING, STOPPED, SUSPENDED, UNKNOWN |
Constructor Summary | |
QuickServer()
Creates a new server without any configuration. |
|
QuickServer(java.lang.String commandHandler)
Creates a new server with the specified commandHandler has it ClientCommandHandler . |
|
QuickServer(java.lang.String commandHandler,
int port)
Creates a new server at port with the specified
commandHandler has it ClientCommandHandler . |
Method Summary | |
void |
clearAllPools()
Cleans all Object and Thread pools |
java.lang.Object |
clone()
Creates and returns a copy of this object. |
void |
closeAllPools()
Closes all Object and Thread pools |
void |
configQuickServer()
Configures QSAdminServer and QuickServer based on the internal QuickServerConfig object. |
void |
configQuickServer(QSAdminServerConfig config)
Configures QSAdminServer based on the passed QuickServerConfig object. |
void |
configQuickServer(QuickServerConfig config)
Configures QuickServer based on the passed QuickServerConfig object. |
java.util.Iterator |
findAllClient()
Returns an iterator containing all the ClientHandler that
are currently handling clients. |
java.util.Iterator |
findAllClientById(java.lang.String pattern)
Tries to find the Client by the matching pattern passed to the Id. |
java.util.Iterator |
findAllClientByKey(java.lang.String pattern)
Tries to find the Client by the matching pattern passed to the key. |
ClientHandler |
findClientByKey(java.lang.String key)
Tries to find the Client by the Key passed. |
ClientHandler |
findFirstClientById(java.lang.String id)
Tries to find the Client by the Id passed. |
AccessConstraintConfig |
getAccessConstraintConfig()
Returns Access constraints if present else null . |
java.lang.String |
getApplicationJarPath()
Returns the applications jar/s path. |
java.util.logging.Logger |
getAppLogger()
Returns the application logger associated with QuickServer. |
java.lang.String |
getAuthenticator()
Deprecated. since 1.4.6 use getClientAuthenticationHandler |
BasicServerConfig |
getBasicConfig()
Returns the basic confiuration of the QuickServer. |
java.net.InetAddress |
getBindAddr()
Returns the IP address binding to. |
boolean |
getBlockingMode()
Returns the current blocking mode of the server. |
org.apache.commons.pool.ObjectPool |
getByteBufferPool()
Returns ObjectPool of java.nio.ByteBuffer class. |
java.lang.Class |
getClass(java.lang.String name,
boolean reload)
Utility method to load a class |
java.lang.ClassLoader |
getClassLoader()
Gets the classloader used to load the dynamicaly resolved classes. |
java.lang.String |
getClientAuthenticationHandler()
Returns the ClientAuthenticationHandler class that handles the authentication of a client. |
java.lang.String |
getClientBinaryHandler()
Returns the ClientBinaryHandler class that interacts with client sockets. |
java.lang.String |
getClientCommandHandler()
Returns the ClientCommandHandler class that interacts with client sockets. |
long |
getClientCount()
Returns number of clients connected. |
java.lang.String |
getClientData()
Returns the ClientData class string that carries client data |
org.apache.commons.pool.ObjectPool |
getClientDataPool()
Returns ObjectPool of ClientData
class. |
java.lang.String |
getClientEventHandler()
Returns the ClientEventHandler class that gets notified of client events. |
java.lang.String |
getClientExtendedEventHandler()
Returns the ClientExtendedEventHandler class that gets notified of extended client events. |
org.apache.commons.pool.ObjectPool |
getClientHandlerPool()
Returns ObjectPool of ClientHandler
class. |
ClientIdentifier |
getClientIdentifier()
Returns the implementation that is used to do Client Identification. |
java.lang.String |
getClientObjectHandler()
Returns the ClientObjectHandler class that interacts with client sockets. |
ClientPool |
getClientPool()
Returns ClientPool class that
managing the pool of threads for handling clients. |
java.lang.String |
getClientWriteHandler()
Returns the ClientWriteHandler class that interacts with client sockets (only used in non-blocking mode). |
boolean |
getCommunicationLogging()
Returns the communication logging flag. |
QuickServerConfig |
getConfig()
Returns the confiuration of the QuickServer. |
java.lang.String |
getConsoleLoggingFormatter()
Gets the console log handler formatter. |
java.lang.String |
getConsoleLoggingLevel()
Gets the console log handler level. |
DBPoolUtil |
getDBPoolUtil()
Returns DBPoolUtil object if
DBObjectPoolConfig was set. |
DataMode |
getDefaultDataMode(DataType dataType)
Returns the default DataMode for the ClientHandler |
java.util.Date |
getLastStartTime()
Returns the date/time when the server was last started. |
int |
getMaxAuthTry()
Returns max allowed login attempts. |
java.lang.String |
getMaxAuthTryMsg()
Returns message to be displayed when maximum allowed login attempts has reached. |
long |
getMaxConnection()
Returns the maximum number of client connection allowed. |
java.lang.String |
getMaxConnectionMsg()
Returns the message to be sent to any new client connected after maximum client connection has reached. |
java.lang.String |
getName()
Returns the name of the QuickServer. |
static java.lang.String |
getNewLine()
Returns the new line string used by QuickServer. |
int |
getPort()
Returns the port for the QuickServer. |
QSAdminServer |
getQSAdminServer()
Returns QSAdminServer associated with this QuickServer |
java.lang.String |
getQSAdminServerAuthenticator()
Returns the Authenticator or ClientAuthenticationHandler class of QSAdminServer that handles the authentication of a client. |
int |
getQSAdminServerPort()
Returns the port to run QSAdminServer on. |
Secure |
getSecure()
Returns Secure setting for QuickServer |
java.lang.SecurityManager |
getSecurityManager()
|
java.lang.String |
getSecurityManagerClass()
Returns the SecurityManager class |
java.nio.channels.Selector |
getSelector()
Returns the Selector (NIO),if any. |
java.lang.String |
getServerBanner()
Returns the Server Banner of the QuickServer |
ServerHooks |
getServerHooks()
Returns ServerHooks if present else null . |
int |
getServiceState()
Returns the state of the process As any constant of Service interface. |
javax.net.ssl.SSLContext |
getSSLContext()
Returns the SSLContext from Secure configuring. |
javax.net.ssl.SSLContext |
getSSLContext(java.lang.String protocol)
Returns the SSLContext object that implements the specified
secure socket protocol from Secure configuring. |
javax.net.ssl.SSLSocketFactory |
getSSLSocketFactory()
Returns a SSLSocketFactory object to be used for creating SSLSockets. |
javax.net.ssl.SSLSocketFactory |
getSSLSocketFactory(java.lang.String protocol)
Returns a SSLSocketFactory object to be used for creating SSLSockets. |
java.lang.Object[] |
getStoreObjects()
Returns store of objects from QuickServer, if nothing was set will return null . |
int |
getTimeout()
Returns the Client socket timeout in milliseconds. |
java.lang.String |
getTimeoutMsg()
Returns timeout message. |
static java.lang.String |
getVersion()
Returns the version of the library. |
static float |
getVersionNo()
Returns the numerical version of the library. |
static float |
getVersionNo(java.lang.String ver)
Returns the numerical version of the library. |
java.lang.String |
info()
Information about the service. |
void |
initAllPools()
Initialise all Object and Thread pools. |
boolean |
initService(java.lang.Object[] param)
Initialise and create the service. |
boolean |
initService(QuickServerConfig qsConfig)
Initialise and create the service. |
boolean |
isClosed()
Returns the closed state of the QuickServer Socket. |
boolean |
isRunningSecure()
Returns if the server is running in Secure mode [SSL or TLS]. |
protected void |
loadBusinessLogic()
Loads all the Business Logic class |
void |
loadSSLContext()
Loads the SSLContext from Secure configuring if set. |
static void |
main(java.lang.String[] args)
Usage: QuickServer [-options] Where options include: -about Opens About Dialogbox -load |
protected void |
makeServerSocket()
Returns a ServerSocket object to be used for listening. |
void |
nextClientIsTrusted()
Sets next client has a trusted client. |
void |
registerChannel(java.nio.channels.SelectableChannel channel,
int ops,
java.lang.Object att)
Register the given channel for the given operations. |
void |
restartServer()
Restarts the QuickServer. |
boolean |
resumeService()
Resume the service. |
void |
run()
|
void |
setAccessConstraintConfig(AccessConstraintConfig accessConstraintConfig)
Sets the Access constraints |
protected void |
setApplicationJarPath(java.lang.String applicationJarPath)
Sets the applications jar/s path. |
void |
setAppLogger(java.util.logging.Logger appLogger)
Sets the application logger associated with QuickServer |
void |
setAuthenticator(java.lang.String authenticator)
Deprecated. since 1.4.6 use setClientAuthenticationHandler |
void |
setBasicConfig(BasicServerConfig basicConfig)
Sets the basic confiuration of the QuickServer. |
void |
setBindAddr(java.lang.String bindAddr)
Sets the Ip address to bind to. |
void |
setClassLoader(java.lang.ClassLoader classLoader)
Sets the classloader to be used to load the dynamicaly resolved classes |
void |
setClientAuthenticationHandler(java.lang.String authenticator)
Sets the ClientAuthenticationHandler class that handles the authentication of a client. |
void |
setClientBinaryHandler(java.lang.String handler)
Sets the ClientBinaryHandler class that interacts with client sockets to handle binary data. |
void |
setClientCommandHandler(java.lang.String handler)
Sets the ClientCommandHandler class that interacts with client sockets. |
void |
setClientData(java.lang.String data)
Sets the ClientData class that carries client data. |
void |
setClientEventHandler(java.lang.String handler)
Sets the ClientEventHandler class that gets notified of client events. |
void |
setClientExtendedEventHandler(java.lang.String handler)
Sets the ClientExtendedEventHandler class that gets notified of extended client events. |
void |
setClientObjectHandler(java.lang.String handler)
Sets the ClientObjectHandler class that interacts with client sockets to handle java objects. |
void |
setClientWriteHandler(java.lang.String handler)
Sets the ClientWriteHandler class that interacts with client sockets to handle data write (only used in non-blocking mode). |
void |
setCommunicationLogging(boolean communicationLogging)
Sets the communication logging flag. |
void |
setConfig(QuickServerConfig config)
Sets the confiuration of the QuickServer. |
void |
setConsoleLoggingFormatter(java.lang.String formatter)
Sets the console log handler formatter. |
void |
setConsoleLoggingLevel(java.util.logging.Level level)
Sets the console log handler level. |
void |
setConsoleLoggingToMicro()
Sets the console log handler formater to MicroFormatter |
void |
setConsoleLoggingToMini()
Sets the console log handler formater to MiniFormatter |
void |
setDBObjectPoolConfig(DBObjectPoolConfig dBObjectPoolConfig)
Sets DBObjectPoolConfig |
static void |
setDebugNonBlockingMode(boolean flag)
Sets the debug flag to ByteBufferOutputStream and ByteBufferInputStream class that are used in non-blcking mode |
void |
setDefaultDataMode(DataMode dataMode,
DataType dataType)
Sets the default DataMode for the ClientHandler |
void |
setDefaultDataMode(DefaultDataMode defaultDataMode)
Sets the default DataMode for the ClientHandler |
void |
setLoggingLevel(java.util.logging.Level level)
Sets the level for all log handlers. |
void |
setMaxAuthTry(int authTry)
Sets max allowed login attempts. |
void |
setMaxAuthTryMsg(java.lang.String msg)
Sets message to be displayed when maximum allowed login attempts has reached. |
void |
setMaxConnection(long maxConnection)
Sets the maximum number of client connection allowed. |
void |
setMaxConnectionMsg(java.lang.String maxConnectionMsg)
Sets the message to be sent to any new client connected after maximum client connection has reached. |
void |
setName(java.lang.String name)
Sets the name for the QuickServer |
void |
setPort(int port)
Sets the port for the QuickServer to listen on. |
void |
setQSAdminServer(QSAdminServer adminServer)
Sets QSAdminServer associated with this QuickServer |
void |
setQSAdminServerAuthenticator(java.lang.String authenticator)
Set the ClientAuthenticationHandler class of QSAdminServer that handles the authentication of a client. |
void |
setQSAdminServerPort(int port)
Set the port to run QSAdminServer on. |
void |
setRunningSecure(boolean runningSecure)
Sets the server mode if its running in Secure mode [SSL or TLS]. |
void |
setSecure(Secure secure)
Sets the Secure setting for QuickServer |
void |
setSecurityManagerClass(java.lang.String securityManagerClass)
Sets the SecurityManager class |
void |
setSelector(java.nio.channels.Selector selector)
Sets the Selector (NIO). |
void |
setServerBanner(java.lang.String banner)
Sets the serverBanner for the QuickServer that will be displayed on the standard output [console] when server starts. |
void |
setServerHooks(ServerHooks serverHooks)
Sets the ServerHooks |
void |
setServiceState(int state)
Sets the state of the process As any constant of Service interface. |
void |
setStoreObjects(java.lang.Object[] storeObjects)
Sets the store of objects to QuickServer, it is an array of objects that main program or the class that created QuickServer passes to the QuickServer. |
void |
setTimeout(int time)
Sets the client socket's timeout. |
void |
setTimeoutMsg(java.lang.String msg)
Sets timeout message. |
void |
startQSAdminServer()
Starts QSAdminServer for this QuickServer. |
void |
startQSAdminServer(int port,
java.lang.String authenticator)
Starts QSAdminServer for this QuickServer. |
void |
startServer()
Starts the QuickServer. |
boolean |
startService()
Start the service. |
void |
stopServer()
Stops the QuickServer. |
boolean |
stopService()
Stop the service. |
boolean |
suspendService()
Suspends the service. |
java.lang.String |
toString()
Returns the Server name : port of the QuickServer. |
Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.Class clientDataClass
Constructor Detail |
public QuickServer()
ClientEventHandler
,
ClientCommandHandler
,
ClientObjectHandler
,
ClientBinaryHandler
,
ClientWriteHandler
,
ClientAuthenticationHandler
,
ClientHandler
,
configQuickServer(org.quickserver.util.xmlreader.QuickServerConfig)
,
initService(java.lang.Object[])
,
setPort(int)
,
setClientCommandHandler(java.lang.String)
public QuickServer(java.lang.String commandHandler)
commandHandler
has it ClientCommandHandler
.
commandHandler
- the fully qualified name of the
desired class that implements ClientCommandHandler
ClientCommandHandler
,
ClientAuthenticationHandler
,
ClientHandler
,
setPort(int)
public QuickServer(java.lang.String commandHandler, int port)
port
with the specified
commandHandler
has it ClientCommandHandler
.
commandHandler
- fully qualified name of the class that
implements ClientCommandHandler
port
- to listen on.ClientCommandHandler
,
ClientAuthenticationHandler
,
ClientHandler
Method Detail |
public static final java.lang.String getVersion()
public static final float getVersionNo()
public static final float getVersionNo(java.lang.String ver)
public static java.lang.String getNewLine()
public java.lang.String toString()
public void startServer() throws AppException
AppException
- if Server already running or if it could not load the classes
[ClientCommandHandler, ClientAuthenticationHandler, ClientData].startService()
public void stopServer() throws AppException
AppException
- if could not stop serverstopService()
public void restartServer() throws AppException
AppException
- if could not stop server or if it could not start the server.public java.lang.String getName()
setName(java.lang.String)
public void setName(java.lang.String name)
name
- for the QuickServergetName()
public java.lang.String getServerBanner()
setServerBanner(java.lang.String)
public void setServerBanner(java.lang.String banner)
ClientEventHandler.gotConnected(org.quickserver.net.server.ClientHandler)
banner
- for the QuickServergetServerBanner()
public void setPort(int port)
port
- to listen on.getPort()
public int getPort()
setPort(int)
public void setClientCommandHandler(java.lang.String handler)
handler
- the fully qualified name of the class that
implements ClientCommandHandler
getClientCommandHandler()
public java.lang.String getClientCommandHandler()
setClientCommandHandler(java.lang.String)
public void setClientAuthenticationHandler(java.lang.String authenticator)
authenticator
- the fully qualified name of the class
that implements ClientAuthenticationHandler
.getClientAuthenticationHandler()
public java.lang.String getClientAuthenticationHandler()
setClientAuthenticationHandler(java.lang.String)
public void setAuthenticator(java.lang.String authenticator)
authenticator
- the fully qualified name of the class
that implements Authenticator
or ClientAuthenticationHandler
.getAuthenticator()
public java.lang.String getAuthenticator()
setAuthenticator(java.lang.String)
public void setClientData(java.lang.String data)
data
- the fully qualified name of the class that
extends ClientData
.getClientData()
public java.lang.String getClientData()
ClientData
.setClientData(java.lang.String)
public void setTimeout(int time)
time
- client socket timeout in milliseconds.getTimeout()
public int getTimeout()
setTimeout(int)
public void setMaxAuthTry(int authTry)
getMaxAuthTry()
public int getMaxAuthTry()
5
.
setMaxAuthTry(int)
public void setMaxAuthTryMsg(java.lang.String msg)
getMaxAuthTryMsg()
public java.lang.String getMaxAuthTryMsg()
getMaxAuthTryMsg()
public void setTimeoutMsg(java.lang.String msg)
getTimeoutMsg()
public java.lang.String getTimeoutMsg()
setTimeoutMsg(java.lang.String)
public void run()
run
in interface java.lang.Runnable
public void setMaxConnection(long maxConnection)
getMaxConnection()
public long getMaxConnection()
setMaxConnection(long)
public long getClientCount()
public void setMaxConnectionMsg(java.lang.String maxConnectionMsg)
-ERR Server Busy. Max Connection Reached
getMaxConnectionMsg()
public java.lang.String getMaxConnectionMsg()
setMaxConnectionMsg(java.lang.String)
public void setBindAddr(java.lang.String bindAddr) throws java.net.UnknownHostException
bindAddr
- argument can be used on a multi-homed host for a
QuickServer that will only accept connect requests to one
of its addresses. If not set, it will default accepting
connections on any/all local addresses.
java.net.UnknownHostException
- if no IP address for
the host could be foundgetBindAddr()
public java.net.InetAddress getBindAddr()
setBindAddr(java.lang.String)
public void setStoreObjects(java.lang.Object[] storeObjects)
storeObjects
- array of objectsgetStoreObjects()
public java.lang.Object[] getStoreObjects()
null
.
setStoreObjects(java.lang.Object[])
public void setQSAdminServerPort(int port)
public int getQSAdminServerPort()
public void setQSAdminServerAuthenticator(java.lang.String authenticator)
public java.lang.String getQSAdminServerAuthenticator()
public void startQSAdminServer(int port, java.lang.String authenticator) throws AppException
authenticator
- sets the ClientAuthenticationHandler class that
handles the authentication of a client,
if null uses Authenticator
.port
- to run QSAdminServer on
AppException
- if Server already running or if it could not load the classes
[ClientCommandHandler, ClientAuthenticationHandler, ClientData].QSAdminServer
public void startQSAdminServer() throws AppException
AppException
QSAdminServer
public QSAdminServer getQSAdminServer()
QSAdminServer
associated with this QuickServer
public void setQSAdminServer(QSAdminServer adminServer)
QSAdminServer
associated with this QuickServer
public boolean isClosed()
public java.util.logging.Logger getAppLogger()
public void setAppLogger(java.util.logging.Logger appLogger)
public void setClientObjectHandler(java.lang.String handler)
handler
- object the fully qualified name of the class that
implements ClientObjectHandler
getClientObjectHandler()
public java.lang.String getClientObjectHandler()
setClientObjectHandler(java.lang.String)
public void setConsoleLoggingFormatter(java.lang.String formatter) throws java.lang.ClassNotFoundException, java.lang.InstantiationException, java.lang.IllegalAccessException
formatter
- fully qualified name of the class that implements
Formatter
java.lang.ClassNotFoundException
java.lang.InstantiationException
java.lang.IllegalAccessException
public java.lang.String getConsoleLoggingFormatter()
public void setConsoleLoggingToMini()
MiniFormatter
public void setConsoleLoggingToMicro()
MicroFormatter
public void setConsoleLoggingLevel(java.util.logging.Level level)
public java.lang.String getConsoleLoggingLevel()
public void setLoggingLevel(java.util.logging.Level level)
public boolean initService(java.lang.Object[] param)
initService
in interface Service
param
- of the xml configuration file.
java.lang.RuntimeException
- if QuickServerConfig creation failed
from the xml config file.public boolean initService(QuickServerConfig qsConfig)
qsConfig
- QuickServerConfig object.public boolean startService()
startService
in interface Service
public boolean stopService()
stopService
in interface Service
public boolean suspendService()
suspendService
in interface Service
public boolean resumeService()
resumeService
in interface Service
public java.lang.String info()
info
in interface Service
public int getServiceState()
Service
interface.
getServiceState
in interface Service
public void setServiceState(int state)
Service
interface.
public void configQuickServer(QuickServerConfig config) throws java.lang.Exception
java.lang.Exception
public void configQuickServer(QSAdminServerConfig config) throws java.lang.Exception
java.lang.Exception
public void configQuickServer() throws java.lang.Exception
java.lang.Exception
public static void main(java.lang.String[] args)
public void clearAllPools() throws java.lang.Exception
java.lang.Exception
public void closeAllPools() throws java.lang.Exception
java.lang.Exception
public void initAllPools() throws java.lang.Exception
java.lang.Exception
public ClientPool getClientPool()
ClientPool
class that
managing the pool of threads for handling clients.
java.lang.IllegalStateException
- if pool is not created yet.public org.apache.commons.pool.ObjectPool getClientHandlerPool()
ClientHandler
class.
java.lang.IllegalStateException
- if pool is not created yet.public void setConfig(QuickServerConfig config)
public QuickServerConfig getConfig()
public org.apache.commons.pool.ObjectPool getClientDataPool()
ClientData
class. If ClientData was not poolable will return null.
public DBPoolUtil getDBPoolUtil()
DBPoolUtil
object if
DBObjectPoolConfig
was set.
null
public void setDBObjectPoolConfig(DBObjectPoolConfig dBObjectPoolConfig)
DBObjectPoolConfig
public ClientHandler findFirstClientById(java.lang.String id)
Note: This command is an expensive so do use it limitedly and cache the returned object. But before you start sending message to the cached object do validate that ClientHandler with you is currently connected and is pointing to the same clinet has it was before. This can be done as follows.
foundClientHandler.isConnected(); //this method will through SocketException if not connected Date newTime = foundClientHandler.getClientConnectedTime(); if(oldCachedTime!=newTime) { //Client had disconnected and ClientHandler was reused for //someother client, so write code to again find ur client foundClientHandler = handler.getServer().findFirstClientById("friendsid"); ... }
null
ClientIdentifiable
public java.util.Iterator findAllClient()
ClientHandler
that
are currently handling clients.
It is recommended not to change the collection under an iterator.
It is imperative that the user manually synchronize on the returned collection
when iterating over it:
Eg:
ClientData foundClientData = null;
Object syncObj = quickserver.getClientIdentifier().getObjectToSynchronize();
synchronized(syncObj) {
Iterator iterator = quickserver.findAllClient();
while(iterator.hasNext()) {
foundClientHandler = (ClientHandler) iterator.next();
....
}
}
//OR
ClientData foundClientData = null;
ClientIdentifier clientIdentifier = quickserver.getClientIdentifier();
synchronized(clientIdentifier.getObjectToSynchronize()) {
Iterator iterator = clientIdentifier.findAllClient();
while(iterator.hasNext()) {
foundClientHandler = (ClientHandler) iterator.next();
....
}
}
public java.util.Iterator findAllClientById(java.lang.String pattern)
Note: This command is an expensive so do use it limitedly and cache the returned object. But before you start sending message to the cached object do validate that ClientHandler with you is currently connected and is pointing to the same clinet has it was before. This can be done as follows.
foundClientHandler.isConnected(); //this method will through SocketException if not connected Date newTime = foundClientHandler.getClientConnectedTime(); if(oldCachedTime!=newTime) { //Client had disconnected and ClientHandler was reused for //someother client, so write code to again find ur client foundClientHandler = handler.getServer().findFirstClientById("friendsid"); ... }
null
ClientIdentifiable
public ClientHandler findClientByKey(java.lang.String key)
Note: This command is an expensive so do use it limitedly and cache the returned object. But before you start sending message to the cached object do validate that ClientHandler with you is currently connected and is pointing to the same clinet has it was before. This can be done as follows.
foundClientHandler.isConnected(); //this method will through SocketException if not connected Date newTime = foundClientHandler.getClientConnectedTime(); if(oldCachedTime!=newTime) { //Client had disconnected and ClientHandler was reused for //someother client, so write code to again find ur client foundClientHandler = handler.getServer().findClientByKey("friendskey"); ... }
null
ClientIdentifiable
public java.util.Iterator findAllClientByKey(java.lang.String pattern)
Note: This command is an expensive so do use it limitedly and cache the returned object. But before you start sending message to the cached object do validate that ClientHandler with you is currently connected and is pointing to the same clinet has it was before. This can be done as follows.
foundClientHandler.isConnected(); //this method will through SocketException if not connected Date newTime = foundClientHandler.getClientConnectedTime(); if(oldCachedTime!=newTime) { //Client had disconnected and ClientHandler was reused for //some other client, so write code to again find ur client foundClientHandler = handler.getServer().findFirstClientByKey("friendsid"); ... }
null
ClientIdentifiable
public void nextClientIsTrusted()
This will skip any authentication and will not set any timout.
public void setCommunicationLogging(boolean communicationLogging)
getCommunicationLogging()
public boolean getCommunicationLogging()
setCommunicationLogging(boolean)
public void setSecurityManagerClass(java.lang.String securityManagerClass)
securityManagerClass
- the fully qualified name of the class
that extends SecurityManager
.getSecurityManagerClass()
public java.lang.String getSecurityManagerClass()
setSecurityManagerClass(java.lang.String)
public java.lang.SecurityManager getSecurityManager() throws AppException
AppException
public void setAccessConstraintConfig(AccessConstraintConfig accessConstraintConfig)
public AccessConstraintConfig getAccessConstraintConfig()
null
.
public void setClassLoader(java.lang.ClassLoader classLoader)
public java.lang.ClassLoader getClassLoader()
public java.lang.Class getClass(java.lang.String name, boolean reload) throws java.lang.ClassNotFoundException
java.lang.ClassNotFoundException
protected void setApplicationJarPath(java.lang.String applicationJarPath)
getApplicationJarPath()
public java.lang.String getApplicationJarPath()
setApplicationJarPath(java.lang.String)
public void setServerHooks(ServerHooks serverHooks)
public ServerHooks getServerHooks()
null
.
public java.lang.Object clone()
public void setSecure(Secure secure)
public Secure getSecure()
public boolean isRunningSecure()
Returns if the server is running in Secure mode [SSL or TLS].
public void setRunningSecure(boolean runningSecure)
Sets the server mode if its running in Secure mode [SSL or TLS].
protected void makeServerSocket() throws java.net.BindException, java.io.IOException
java.net.BindException
java.io.IOException
public void setBasicConfig(BasicServerConfig basicConfig) throws java.lang.Exception
java.lang.Exception
public BasicServerConfig getBasicConfig()
public void loadSSLContext() throws java.io.IOException
SSLContext
from Secure configuring if set.
java.io.IOException
setSecure(org.quickserver.util.xmlreader.Secure)
public javax.net.ssl.SSLContext getSSLContext() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException
SSLContext
from Secure configuring.
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
loadSSLContext()
public javax.net.ssl.SSLContext getSSLContext(java.lang.String protocol) throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException
SSLContext
object that implements the specified
secure socket protocol from Secure configuring.
protocol
- the standard name of the requested protocol. If null
will use the protocol set in secure configuration of the server.
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
loadSSLContext()
public javax.net.ssl.SSLSocketFactory getSSLSocketFactory() throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
setSecure(org.quickserver.util.xmlreader.Secure)
public javax.net.ssl.SSLSocketFactory getSSLSocketFactory(java.lang.String protocol) throws java.io.IOException, java.security.NoSuchAlgorithmException, java.security.KeyManagementException
protocol
- the standard name of the requested protocol. If
null
will use the protocol set in secure configuration
of the server.
java.io.IOException
java.security.NoSuchAlgorithmException
java.security.KeyManagementException
setSecure(org.quickserver.util.xmlreader.Secure)
public void setClientBinaryHandler(java.lang.String handler)
handler
- object the fully qualified name of the class that
implements ClientBinaryHandler
getClientBinaryHandler()
public java.lang.String getClientBinaryHandler()
setClientBinaryHandler(java.lang.String)
public void setSelector(java.nio.channels.Selector selector)
public java.nio.channels.Selector getSelector()
public void registerChannel(java.nio.channels.SelectableChannel channel, int ops, java.lang.Object att) throws java.io.IOException, java.nio.channels.ClosedChannelException
java.io.IOException
java.nio.channels.ClosedChannelException
public org.apache.commons.pool.ObjectPool getByteBufferPool()
public void setClientWriteHandler(java.lang.String handler)
handler
- object the fully qualified name of the class that
implements ClientWriteHandler
getClientWriteHandler()
public java.lang.String getClientWriteHandler()
setClientWriteHandler(java.lang.String)
public java.util.Date getLastStartTime()
null
if never started.public static void setDebugNonBlockingMode(boolean flag)
public ClientIdentifier getClientIdentifier()
public boolean getBlockingMode()
protected void loadBusinessLogic() throws java.lang.Exception
java.lang.Exception
public void setClientEventHandler(java.lang.String handler)
handler
- the fully qualified name of the class that
implements ClientEventHandler
getClientEventHandler()
public java.lang.String getClientEventHandler()
setClientEventHandler(java.lang.String)
public void setDefaultDataMode(DataMode dataMode, DataType dataType) throws java.io.IOException
DataMode
for the ClientHandler
java.io.IOException
public void setDefaultDataMode(DefaultDataMode defaultDataMode) throws java.io.IOException
DataMode
for the ClientHandler
java.io.IOException
public DataMode getDefaultDataMode(DataType dataType)
DataMode
for the ClientHandler
public void setClientExtendedEventHandler(java.lang.String handler)
handler
- the fully qualified name of the class that
implements ClientExtendedEventHandler
getClientExtendedEventHandler()
public java.lang.String getClientExtendedEventHandler()
setClientExtendedEventHandler(java.lang.String)
|
QuickServer v1.4.6 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |