public class ServerController
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
private java.util.LinkedList<ConnectionProcessor> |
connectionList |
private GroupLib |
groupLib |
private java.sql.Date |
initTime |
static int |
maxPollID |
private MessageLib |
messageLib |
private PollLib |
pollLib |
private java.util.LinkedList<Poll> |
polls |
private static int |
PORT |
private boolean |
serverShouldRun |
private java.net.ServerSocket |
serverSocket |
static User |
SYSTEM |
private java.util.HashMap<Group,TeamInfo> |
teamMap |
private java.util.HashMap<UserLogin,java.util.LinkedList<Group>> |
userGroupMap |
private UserLib |
userLib |
Constructor and Description |
---|
ServerController() |
Modifier and Type | Method and Description |
---|---|
private void |
addConnection(ConnectionProcessor cp)
Adds the selected ConnectionThread to the LinkedList
|
void |
addGroup(User addingUser,
java.lang.String content) |
boolean |
addUser(UserLogin userToAdd,
MessageInputListener newListener) |
void |
changeUser(UserLogin newUser) |
private void |
closeConnections()
Loop to listen to ServerCommands
|
void |
createTeamMap() |
void |
createUserGroupMap() |
LoginData |
getLoginUpdates(UserLogin loggedInUser) |
PermissionRole |
getRightsInGroup(User sendingUser,
Group group) |
TeamInfo |
getTeamFromGroup(Group g) |
java.util.HashMap<Group,TeamInfo> |
getTeamMap() |
static void |
main(java.lang.String[] args)
Initialize Server
|
void |
notifyObservers(Message messageToSend) |
void |
removeConnection(ConnectionProcessor cp)
Deletes the selected ConnectionProcessor from the LinkedList
|
void |
removeUserListener(UserLogin loggedInUser,
MessageInputListener inputListenerToRemove) |
boolean |
serverShouldRun() |
private void |
shutDown(int status)
Shuts the server down
|
private void |
startConnectionLoop()
Waits for incoming connection requests and creates a new thread for them
Adding the new Thread to the connectionList
|
private void |
updateDB() |
boolean |
userRegistered(UserLogin user) |
UserLogin |
validateLogin(java.lang.String username,
java.lang.String password) |
public static volatile int maxPollID
private static final int PORT
private java.util.LinkedList<ConnectionProcessor> connectionList
private volatile boolean serverShouldRun
private java.net.ServerSocket serverSocket
public static final User SYSTEM
private MessageLib messageLib
private PollLib pollLib
private GroupLib groupLib
private UserLib userLib
private java.sql.Date initTime
private java.util.LinkedList<Poll> polls
private void updateDB()
public void createTeamMap()
public void createUserGroupMap()
public void notifyObservers(Message messageToSend)
public boolean serverShouldRun()
private void addConnection(ConnectionProcessor cp)
cp
- is the selected ConnectionThreadpublic void removeConnection(ConnectionProcessor cp)
cp
- is the selected ConnectionProcessorprivate void startConnectionLoop()
private void closeConnections()
private void shutDown(int status)
status
- Exit codepublic static void main(java.lang.String[] args)
args
- public void removeUserListener(UserLogin loggedInUser, MessageInputListener inputListenerToRemove)
public UserLogin validateLogin(java.lang.String username, java.lang.String password)
public boolean addUser(UserLogin userToAdd, MessageInputListener newListener)
public PermissionRole getRightsInGroup(User sendingUser, Group group)
public boolean userRegistered(UserLogin user)
public void addGroup(User addingUser, java.lang.String content)
public void changeUser(UserLogin newUser)