Rudimentary Client-Server Message Board Ricky Landry COP5611
Download
Report
Transcript Rudimentary Client-Server Message Board Ricky Landry COP5611
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)
2
Critical Design Decisions
Client-Server Architecture
Multi-threaded Server
Stateless
Messaging Protocol
Java Swing Client Front-End (GUI)
3
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
4
Server Database Design
Singleton-patterned database consists of:
List of MbdbTopic objects, stored as a Hashtable
List of MbdbComment objects, stored as a Hashtable
5
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
6
Server Database Design
MbdbComment object consists of:
comment message
author name
creation time
comment header
deleted state
unique identifier of its parent topic
7
Server Database Design
TopicHeader and CommentHeader Objects contain:
Topic/Comment unique identifier
Topic/Comment last update time
Definition of TopicHeaderList and CommentHeaderList
containers, respectively
8
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
9
Server Design
10
Protocol Design
Defines the following aspects of the client-server model:
Credentials
Topic message data payloads
Comment message data payloads
Message structure
Message types
11
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
12
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
13
Client Database Design
The client has its own database that contains the client
state
Has four containers:
One
One
One
One
containing MbdbTopic objects
containing MbdbComment objects
containing the read state for each topic
containing the read state for each comment
Defines wrappers for Topic/Comment objects and their
respective read state
14
Client Database Design
15
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
16
Client Front-End Design
Built using the Java Swing API
Provides basic interface to underlying function
Topic Window Mockup
Comment Window Mockup
17
Client Front-End Design
18
Client Front-End Design
Topic Window
Comment Window
19
Questions
20