Rudimentary Client-Server Message Board Ricky Landry COP5611 – Operating Systems Design Principles University of Central Florida April 16, 2012
Fundamental Requirements Ability to create topics Ability to create comments associated with a topic Ability to produce information on the author of a topic or comment Ability to produce the timestamp of creation and last modification time of a topic or a comment Ability to remove a topic or comment (only if requested by the author)
Critical Design Decisions Client-Server Architecture Multi-threaded Server Stateless Messaging Protocol Java Swing Client Front-End (GUI)
Message Board Database Server-side database was written specifically for the application to explore design challenges Multi-threaded server design required mutually exclusive access to the database to handle concurrency and atomicity concerns Accomplished through the use of object locks built into the Java language synchronized(this){ … } wraps database access calls
Server Database Design Singleton-patterned database consists of: List of MbdbTopic objects, stored as a Hashtable List of MbdbComment objects, stored as a Hashtable
Server Database Design MbdbTopic object consists of: topic name author name creation time topic header deleted state list of the comment headers of child comments
Server Database Design MbdbComment object consists of: comment message author name creation time comment header deleted state unique identifier of its parent topic
Server Database Design TopicHeader and CommentHeader Objects contain: Topic/Comment unique identifier Topic/Comment last update time Definition of TopicHeaderList and CommentHeaderList containers, respectively
Server Design Used the Java Serialization API for serialized object transfer between server and client. Listen socket is a Java ServerSocket object When a connection is made, the new socket connected to the client is handed off to a worker thread spawned specifically for the client
Server Design
Protocol Design Defines the following aspects of the client-server model: Credentials Topic message data payloads Comment message data payloads Message structure Message types
Protocol Design Client-to-Server Message Types: CREATE_TOPIC CREATE_COMMENT REMOVE_TOPIC REMOVE_COMMENT GET_TOPIC_HEADERS GET_TOPIC_OBJECT GET_COMMENT_OBJECT CREDENTIALS CLOSING_CONNECTION
Protocol Design Server-to-Client Message Types: TOPIC_HEADERS_REPLY TOPIC_OBJECT_REPLY COMMENT_OBJECT_REPLY AUTHETICATION_SUCCESS AUTHETICATION_FAILURE INVALID_TOPIC_ID INVALID_COMMENT_ID INVALID_REPLY_RECEIVED
Client Database Design The client has its own database that contains the client state Has four containers: One containing MbdbTopic objects One containing MbdbComment objects One containing the read state for each topic One containing the read state for each comment Defines wrappers for Topic/Comment objects and their respective read state
Client Database Design
Client Controller Design Responsible for client database management and access Updates the client database with server data Provides current (undeleted) client data to the front-end Responsible for communication with the server Responsible for managing client credentials
Client Front-End Design Built using the Java Swing API Provides basic interface to underlying function Topic Window Mockup Comment Window Mockup
Client Front-End Design
Client Front-End Design Topic Window Comment Window
Questions ?