com.enderak.procol.server.net
Class ServerConnection

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--com.enderak.procol.server.net.ServerConnection
All Implemented Interfaces:
java.util.Observer, java.lang.Runnable

public class ServerConnection
extends java.lang.Thread
implements java.util.Observer

Maintains the server-side connection between the client and the server

Author:
Justin Dieters

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
ServerConnection(javax.net.ssl.SSLSocket sslsocket)
          Constructor for the ServerConnection object
 
Method Summary
 int addBugItem(java.lang.String sender, java.lang.String subject, java.lang.String priority, java.lang.String assignedTo, java.lang.String dueDate, java.lang.String complete, java.lang.String description)
          Add a bug item to the list
 int addPrivateMessage(java.lang.String sender, java.lang.String recipient, java.lang.String replyTo, java.lang.String subject, java.lang.String message)
          Adds a private message to the recipient's list
 int addPublicMessage(java.lang.String sender, java.lang.String replyTo, java.lang.String subject, java.lang.String message)
          Adds a public message to the list
 int addTodoItem(java.lang.String sender, java.lang.String subject, java.lang.String priority, java.lang.String assignedTo, java.lang.String dueDate, java.lang.String complete, java.lang.String description)
          Add a todo item to the list
 void checkOutFiles(java.net.URI filePath)
          Check out files
 int checkProtocol(ProColIncomingMessage message)
          Checks the client protocol version compared to this protocol version
 void close()
          closes this connection
 void closeProject()
          closes the project associated with this connection
 int deleteBugItem(java.lang.String messageID)
          Deletes a bug item
 int deletePrivateMessage(java.lang.String messageID)
          Deletes a private message
 int deletePublicMessage(java.lang.String messageID)
          Deletes a public message
 int deleteTodoItem(java.lang.String messageID)
          Deletes a todo item
 java.lang.String getBugItem(java.lang.String messageID)
          Return contents of a todo item to the client
 void getBugItemList()
          Send bug list to the client
 javax.net.ssl.SSLSocket getClientSocket()
          Gets the client socket that is associated with this connection
 MessageFactory getMessageFactory()
          Gets the message factory that is associated with this connection
 PacketFactory getPacketFactory()
          Gets the packet factory that is associated with this connection
 java.lang.String getPrivateMessage(java.lang.String messageID)
          Return contents of a message to the client
 void getPrivateMessageList()
          Send private message list to the client
 ProColServerProject getProject()
          Gets the project that is associated with this connection
 java.lang.String getPublicMessage(java.lang.String messageID)
          Return contents of a message to the client
 void getPublicMessageList()
          Send public message list to the client
 java.lang.String getTodoItem(java.lang.String messageID)
          Return contents of a todo item to the client
 void getTodoItemList()
          Send todo list to the client
 ProColUser getUser()
          Gets the user associated with this ServerConnection
 void openProject(java.lang.String projectNameIn)
          Description of the Method
 void receive()
          receives a packet from the network
 void run()
          Main processing method for the ServerConnection object
 void sendFileHistory(java.net.URI filePath)
          Sends the file history to the client
 void sendFiles(int request)
          Send all files to the client
 void sendFiles(java.net.URI fileURI, int request)
          Sends multiple files to the client
 void sendFileTree()
          Sends the file tree to the client
 void sendSnapshot()
          Send all files to the client, as a snapshot
 void setUser(ProColUser userIn)
          Sets the user associated with this connection
 void update(java.util.Observable o, java.lang.Object arg)
          Invoked whenever a class that is being observed changes.
 int updateBugItem(java.lang.String sender, java.lang.String currentID, java.lang.String subject, java.lang.String priority, java.lang.String assignedTo, java.lang.String dueDate, java.lang.String complete, java.lang.String description)
          Update a bug item in the list
 int updateTodoItem(java.lang.String sender, java.lang.String currentID, java.lang.String subject, java.lang.String priority, java.lang.String assignedTo, java.lang.String dueDate, java.lang.String complete, java.lang.String description)
          Update a todo item in the list
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, 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
 

Constructor Detail

ServerConnection

public ServerConnection(javax.net.ssl.SSLSocket sslsocket)
Constructor for the ServerConnection object

Parameters:
sslsocket - Description of the Parameter
Method Detail

run

public void run()
Main processing method for the ServerConnection object

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread

receive

public void receive()
receives a packet from the network


close

public void close()
closes this connection


closeProject

public void closeProject()
closes the project associated with this connection


openProject

public void openProject(java.lang.String projectNameIn)
Description of the Method

Parameters:
projectNameIn - Description of the Parameter

checkProtocol

public int checkProtocol(ProColIncomingMessage message)
Checks the client protocol version compared to this protocol version

Parameters:
message - the message
Returns:
the reply code to the client

getClientSocket

public javax.net.ssl.SSLSocket getClientSocket()
Gets the client socket that is associated with this connection

Returns:
The client socket

getUser

public ProColUser getUser()
Gets the user associated with this ServerConnection

Returns:
The user

setUser

public void setUser(ProColUser userIn)
Sets the user associated with this connection

Parameters:
userIn -

getProject

public ProColServerProject getProject()
Gets the project that is associated with this connection

Returns:
The project

getPacketFactory

public PacketFactory getPacketFactory()
Gets the packet factory that is associated with this connection

Returns:
The packet factory

getMessageFactory

public MessageFactory getMessageFactory()
Gets the message factory that is associated with this connection

Returns:
The message factory

update

public void update(java.util.Observable o,
                   java.lang.Object arg)
Invoked whenever a class that is being observed changes.

Specified by:
update in interface java.util.Observer
Parameters:
o - the observable object
arg - an argument passed to the notifyObservers method

sendFileTree

public void sendFileTree()
Sends the file tree to the client


sendFileHistory

public void sendFileHistory(java.net.URI filePath)
Sends the file history to the client

Parameters:
filePath - the file path

sendFiles

public void sendFiles(java.net.URI fileURI,
                      int request)
Sends multiple files to the client

Parameters:
fileURI - the root URI or file URI
request - The request type

sendFiles

public void sendFiles(int request)
Send all files to the client

Parameters:
request - The request type

sendSnapshot

public void sendSnapshot()
Send all files to the client, as a snapshot


checkOutFiles

public void checkOutFiles(java.net.URI filePath)
Check out files

Parameters:
filePath - The root URI or the file URI

addPrivateMessage

public int addPrivateMessage(java.lang.String sender,
                             java.lang.String recipient,
                             java.lang.String replyTo,
                             java.lang.String subject,
                             java.lang.String message)
Adds a private message to the recipient's list

Parameters:
sender - The Sender
recipient - The Recipient
replyTo - The previous message number, if any
subject - The subject
message - The message
Returns:
Reply code to the client

getPrivateMessageList

public void getPrivateMessageList()
Send private message list to the client


getPrivateMessage

public java.lang.String getPrivateMessage(java.lang.String messageID)
Return contents of a message to the client

Parameters:
messageID - The message to get
Returns:
The message

deletePrivateMessage

public int deletePrivateMessage(java.lang.String messageID)
Deletes a private message

Parameters:
messageID - The message ID to delete
Returns:
Reply code to the client

addPublicMessage

public int addPublicMessage(java.lang.String sender,
                            java.lang.String replyTo,
                            java.lang.String subject,
                            java.lang.String message)
Adds a public message to the list

Parameters:
sender - The senter
replyTo - The previous message being replied to, if any
subject - The subject
message - The message
Returns:
Reply code to the client

getPublicMessageList

public void getPublicMessageList()
Send public message list to the client


getPublicMessage

public java.lang.String getPublicMessage(java.lang.String messageID)
Return contents of a message to the client

Parameters:
messageID - The message to get
Returns:
The message

deletePublicMessage

public int deletePublicMessage(java.lang.String messageID)
Deletes a public message

Parameters:
messageID - The message ID to delete
Returns:
Reply code to the client

addTodoItem

public int addTodoItem(java.lang.String sender,
                       java.lang.String subject,
                       java.lang.String priority,
                       java.lang.String assignedTo,
                       java.lang.String dueDate,
                       java.lang.String complete,
                       java.lang.String description)
Add a todo item to the list

Parameters:
sender - The sender
subject - The subject
priority - The priority
assignedTo - The assignee
dueDate - The due date
complete - percent complete
description - Description of item
Returns:
Reply code to client

updateTodoItem

public int updateTodoItem(java.lang.String sender,
                          java.lang.String currentID,
                          java.lang.String subject,
                          java.lang.String priority,
                          java.lang.String assignedTo,
                          java.lang.String dueDate,
                          java.lang.String complete,
                          java.lang.String description)
Update a todo item in the list

Parameters:
sender - The sender
subject - The subject
priority - The priority
assignedTo - The assignee
dueDate - The due date
complete - percent complete
description - Description of item
currentID - Description of the Parameter
Returns:
Reply code to client

getTodoItemList

public void getTodoItemList()
Send todo list to the client


getTodoItem

public java.lang.String getTodoItem(java.lang.String messageID)
Return contents of a todo item to the client

Parameters:
messageID - The item to get
Returns:
The description

deleteTodoItem

public int deleteTodoItem(java.lang.String messageID)
Deletes a todo item

Parameters:
messageID - The item to delete
Returns:
Reply code to the client

addBugItem

public int addBugItem(java.lang.String sender,
                      java.lang.String subject,
                      java.lang.String priority,
                      java.lang.String assignedTo,
                      java.lang.String dueDate,
                      java.lang.String complete,
                      java.lang.String description)
Add a bug item to the list

Parameters:
sender - The sender
subject - The subject
priority - The priority
assignedTo - The assignee
dueDate - The due date
complete - percent complete
description - Description of item
Returns:
Reply code to client

updateBugItem

public int updateBugItem(java.lang.String sender,
                         java.lang.String currentID,
                         java.lang.String subject,
                         java.lang.String priority,
                         java.lang.String assignedTo,
                         java.lang.String dueDate,
                         java.lang.String complete,
                         java.lang.String description)
Update a bug item in the list

Parameters:
sender - The sender
subject - The subject
priority - The priority
assignedTo - The assignee
dueDate - The due date
complete - percent complete
description - Description of item
currentID - Description of the Parameter
Returns:
Reply code to client

getBugItemList

public void getBugItemList()
Send bug list to the client


getBugItem

public java.lang.String getBugItem(java.lang.String messageID)
Return contents of a todo item to the client

Parameters:
messageID - The item to get
Returns:
The description

deleteBugItem

public int deleteBugItem(java.lang.String messageID)
Deletes a bug item

Parameters:
messageID - The item to delete
Returns:
Reply code to the client