Class BabylonServer
java.lang.Object
java.lang.Thread
BabylonServer
- All Implemented Interfaces:
- java.lang.Runnable
public class BabylonServer
- extends java.lang.Thread
The main thread of the chat server. This class contains the server's
behavioural parameters, provides access to the password file, logs,
etc., and listens for connections from clients.
- Author:
- Andy McLaughlin
| Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
| 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 |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
passwordFileName
protected static final java.lang.String passwordFileName
- See Also:
- Constant Field Values
logFileName
protected static final java.lang.String logFileName
- See Also:
- Constant Field Values
messageFileName
protected static final java.lang.String messageFileName
- See Also:
- Constant Field Values
welcomeFileName
protected static final java.lang.String welcomeFileName
- See Also:
- Constant Field Values
baseURL
protected java.net.URL baseURL
strings
protected BabylonStringManager strings
graphics
protected boolean graphics
window
protected BabylonServerWindow window
port
protected int port
connections
protected java.util.Vector connections
messages
protected java.util.Vector messages
chatRooms
protected java.util.Vector chatRooms
passwordEncryptor
protected BabylonPasswordEncryptor passwordEncryptor
requirePasswords
protected boolean requirePasswords
mainRoom
protected BabylonChatRoom mainRoom
logChats
protected boolean logChats
currentConnections
protected int currentConnections
totalConnections
protected int totalConnections
allowNewUsers
protected boolean allowNewUsers
peakConnections
protected int peakConnections
adminConnection
protected BabylonServerConnection adminConnection
BabylonServer
public BabylonServer(java.lang.String[] args)
checkPassword
protected boolean checkPassword(java.lang.String fileName,
java.lang.String userName,
java.lang.String password)
throws java.lang.Exception
- Return true if the supplied user name/password combo match.
- Throws:
java.lang.Exception
findChatRoom
protected BabylonChatRoom findChatRoom(java.lang.String roomName)
- This will return the chat room object with the corresponding name.
isUserAllowed
protected boolean isUserAllowed(BabylonChatRoom room,
BabylonServerConnection connection,
java.lang.String password)
- Return true if a user is allowed to enter a chat room. False
otherwise.
disconnect
protected void disconnect(BabylonServerConnection who,
boolean notify)
disconnectAll
protected void disconnectAll(boolean notify)
run
public void run()
- Specified by:
run in interface java.lang.Runnable- Overrides:
run in class java.lang.Thread
getUserId
protected int getUserId()
createNewUser
protected void createNewUser(java.lang.String userName,
java.lang.String encryptedPassword)
throws java.lang.Exception
- Throws:
java.lang.Exception
serverOutput
protected void serverOutput(java.lang.String message)
readMessages
protected void readMessages()
saveMessages
protected void saveMessages()
shutdown
protected void shutdown()
main
public static void main(java.lang.String[] args)