Files
2025-06-07 01:59:34 -04:00

359 lines
27 KiB
HTML
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><TITLE>Lab 5. NetTxt Xtreme (Lab Only)</TITLE><link rel="stylesheet" href="http://www.cc.gatech.edu/classes/AY2003/cs2335_spring/labs/style.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="chapter" lang="en"><div class="titlepage"><div><h2 class="title"><a name="id2748662"></a>Chapter 5. 
NetTxt Xtreme -- A networked text editor.
</h2></div><div><div class="author"><h3 class="author">Andrew Pilsch</h3></div></div><div><div class="author"><h3 class="author">Hemal Shah</h3></div></div><div><div class="author"><h3 class="author">Ryan Seekely</h3></div></div><div><div class="revhistory"><table border="1" width="100%" summary="Revision history"><tr><th align="left" valign="top" colspan="3"><b>Revision History</b></th></tr><tr><td align="left">Revision 1.1</td><td align="left">2004.02.12</td><td align="left">JC4</td></tr><tr><td align="left" colspan="3">Revisions made, image added.</td></tr><tr><td align="left">Revision 1.0</td><td align="left">2004.02.07</td><td align="left">ATP</td></tr><tr><td align="left" colspan="3">Initial Draft of the Lab</td></tr></table></div></div></div><div class="toc"><p><b>Table of Contents</b></p><dl><dt><a href="lab5.html#id2792118">1. Introduction</a></dt><dd><dl><dt><a href="lab5.html#id2792123">1.1. Overview of NetTxt Xtreme</a></dt><dt><a href="lab5.html#id2792150">1.2. User Story</a></dt><dt><a href="lab5.html#id2792225">1.3. A Screen Shot</a></dt></dl></dd><dt><a href="lab5.html#id2792260">2. Requirements</a></dt><dd><dl><dt><a href="lab5.html#id2792266">2.1. Locking Mechanism and Sections</a></dt><dt><a href="lab5.html#id2792358">2.2. Server Responsibilities</a></dt><dt><a href="lab5.html#id2791919">2.3. Chat System</a></dt><dt><a href="lab5.html#id2791957">2.4. Client Editing </a></dt><dt><a href="lab5.html#id2792769">2.5. More on Updating Sections</a></dt><dt><a href="lab5.html#id2792386">2.6. File Importing (and New Document Creation)</a></dt><dt><a href="lab5.html#id2792450">2.7. File Exporting</a></dt></dl></dd><dt><a href="lab5.html#id2792483">3. Deliverables</a></dt><dt><a href="lab5.html#id2793448">4. Extra Credit</a></dt></dl></div><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="http://www.cc.gatech.edu/classes/AY2003/cs2335_spring/labs/images/warning.png"></td><th align="left">Warning</th></tr><tr><td colspan="2" align="left" valign="top"><p>
This lab is due on WebCT before 2004.02.27 08:00
<span class="emphasis"><em>(that means turn it in no later than 7:59am)</em></span>
</p><p>
*** DO NOT WAIT UNTIL THE LAST MINUTE TO SUBMIT YOUR ASSIGNMENT ***
</p></td></tr></table></div><div class="section" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2792118"></a>1. Introduction</h2></div></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792123"></a>1.1. Overview of NetTxt Xtreme</h3></div></div><p>
NetTxt Xtreme is a collaborative, on-line text editing
community. It is a system whereby multiple, distributed users
can open and collaboratively edit documents using the power of
cyberspace. </p><p>
NetTxt Xtreme will be significantly more advanced than previous
assignments, but build on many of the same concepts. There are
many requirements, so read carefully. We do not constrain the
design of your system, only the functionality requirements that
<span class="emphasis"><em>must</em></span> be met.
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792150"></a>1.2. User Story</h3></div></div><p>
Joe User logs into the system. Joe finds himself in the Global
chat room for the entire system. By browsing the server's list of
collaborative files and chatting with his peers, he can ascertain what
file he would like to edit.</p><p>After Joe User has selected a file, he chooses that file from
the community file browser. Joe can also choose to create a new file
that the community can work on. Today, though, Joe would like to work
on an already existing file. When he connects to the file he wants to
edit, he then sees a list of the various editable sections of that
document. (Think of sections as being analogous to chapters in a
novel.) Joe can chose to create a new section for a document or edit
a section that is not already locked. Joe choses to edit a section of
the document that is not already in use.</p><p>The server notes that Joe has locked that section of the file
and tells Joe's client to display a text editor for that section.
When Joe is done editing his section, he can click &quot;save&quot; and the
changes he made will be committed to the system.</p><p>Jane User, Joe's long-lost cousin, is also editing Joe's
document. She notices Joe is editing a section and that he has been
doing so for over an hour. She tells the client that she would like
to see the current state of Joe's section. The server then grabs
Joe's section out of his editor window and updates Jane's local
display. Jane likes what Joe has done and decides to create a local
copy of the entire document. Jane types Joe a compliment on his work
that Joe sees in his local file chat-room. She tells her client that
she would like to export a copy to her system. The client then
creates a copy of the document on her system from what she has, and
Jane reads through it using her HTML web browser.</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792225"></a>1.3. A Screen Shot</h3></div></div><p>
Here is a <span class="bold"><b>simplified</b></span> version of what
the client's editing window <span class="bold"><b>might</b></span>
look like. Your final version will differ significantly.
</p><div align="center"><img src="./Lab5_ScreenShot.gif" align="middle"></div></div></div><div class="section" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2792260"></a>2. Requirements</h2></div></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792266"></a>2.1. Locking Mechanism and Sections</h3></div></div><p>
Each file that is being worked on should be divided into
sections that may be edited by the user. Only one user may
work on a particular section at any given time, and that
section should be considered locked until released by said
user. A user, however, may work on more than one section at
a time, and it is the server's responsibility to track which
sections are locked (by whom) and allowed to be edited.
Sections are not required to be embedded. In other words, a
section does not need to have the ability to contain other
sections (this is an extra credit opportunity, however).
</p><p>
When a new document is started, it is assumed that there are no
existing sections. A user's client should have the ability to
both create new sections, and edit existing, non-locked sections.
A section should have the following attributes:
</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc">
A <span class="bold"><b>unique key</b></span> that identifies
the section <span class="emphasis"><em>(The key may be just a simple ID number
or a text string of the section name -- it's up to
you.)</em></span></li><li style="list-style-type: disc">
A <span class="bold"><b>position</b></span> which indicates
the order the sections should appear on the client view. The
position of a section may be changed, but no two sections
should ever share the same position.
</li><li style="list-style-type: disc">
The <span class="bold"><b>current user</b></span> (if any) that
has the section locked, to prevent others from editing it.
</li><li style="list-style-type: disc">
A <span class="bold"><b>time-stamp</b></span> which displays
the length of time since the section has gone unedited (e.g.
&quot;this section un-edited for 2 days, 3 hours, 27 minutes&quot;), or
the time the section has been locked by a user (e.g. &quot;this
section locked by 'TxtWiz37' for 18 minutes&quot;), depending on
the appropriate situation.
</li></ul></div><p>
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792358"></a>2.2. Server Responsibilities</h3></div></div><p>
The Server must be multi-threaded and connect multiple users as always.
The Server must first accept connections and then login users by
letting the client choose a handle/screen-name which the Server ensures
is unique (otherwise, the client must re-prompt). Chat room functionality
will be handled by the Server as well.
</p><p>
The Server will handle all files for NetTxt Xtreme. It will manage
the updates/posts to a document, creation of a new document, and
receive files from the client which the Server will then import
into NetTxt Xtreme section format. The Server will also provide
the client with a list of all available files and those that are
currently open by other users. The Server will also save
open files to its local file system with the latest updates it
has either on an unlocking of a section or by client request.
</p><p>
The server must have a graceful way of exiting (one possible way
would be to have a GUI console that pops up while the server is
running that has a &quot;disconnect server&quot; button). When the server
exits it needs to save a current copy of the file on the server
(in a pre-determined location).
</p><p>
<span class="bold"><b>Suggestion:</b></span> If you have a GUI
&quot;console&quot; that controls the server, you may wish to use it to
permit the user to choose which port the server uses and
the location where the files are to be saved (remember to
include reasonable default values for these).
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2791919"></a>2.3. Chat System</h3></div></div><p>
The chat system for NetTxt Xtreme is vital to the collaborative
effort. The chat system required will be of the global and chat
room style.
</p><p>
All users, from the time they are logged in to the server to the
time they disconnect, will have a unique handle/scree-name and
will join the global chat room. The UI should provide a list of
all users currently in the global chat room and allow for chat
room messaging.
</p><p>
When a user opens a particular file or creates one, that user
enters a new chat room with all other users currently working
on that particular file. The UI should provide a list of all
users currently working on that file and allow for chat room
messaging in an area separate from the global chat room.
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2791957"></a>2.4. Client Editing </h3></div></div><p>
Upon joining a server and choosing a document to work on, a client should
have the ability to create a new section to work on, or editing any existing
section. Either selection (assuming the selected section was unlocked or new)
should bring up an editing window which allows the user to edit the contents
of a section. The section should be considered locked by the server, and no
other clients should be allowed editing capabilities to the section until the
locking user releases the section. If a user attempts to lock/edit an already
locked section, an indication should be made to the client that the section
is currently locked and NO editing window should be presented.
</p><p>
When working on a section, the user should have the capability to Post the
changes the user has made, which would tell the server to accept the changes
made by the user and then update all of the currently connected clients.
The user should be allowed to continue working on the section until he chooses
to Release the section. A Release would perform the operation of a Post and
unlock the section to allow other users to edit it. A client should also be able
to unlock the section disregarding any changes that may have been made.
</p><p>
The client should have the following editing capabilities <span class="emphasis"><em>(These should
be able to be applied by the user by highlighting a section of text and clicking
the appropriate icon -- much like other editing programs)</em></span>:
</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc">
The ability to bold, italic, or underline any specified text in a section
</li><li style="list-style-type: disc">
Multiple fonts
</li><li style="list-style-type: disc">
Colorized text with a full array of colors
</li><li style="list-style-type: disc">
Alignment of text, such as Center, Left or Right
</li><li style="list-style-type: disc">
Different font sizes
</li></ul></div><p>
As you can tell, the requirements resemble those that are already easily
supported by HTML, and we once again highly recommend using HTML with the
combination of multiple JEditPanes. Although, the editing window does not
need to support a rendered view and may just show the HTML tags in conjunction
with the text for the user to edit.
</p><p>
The client should at all times display the most updated version (since
that particular client updated last) of the document, fully rendered (i.e.
if you are using HTML, no bold tags should be displayed, but rather the text
should be <span class="emphasis"><em> bold'ed </em></span>). The view should obey the order
specified by each sections position.
</p><p>
Remember as well, the client should be allowed to request updates on any
given section (or all sections), which should immediately be reflected in
the rendered view of the client's document.
</p><p>
Finally, the client should present visually to the user the following properties
of each section
</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc">
An indication if the section is locked, and by which user
</li><li style="list-style-type: disc">
The key that uniquely identifies the section
</li><li style="list-style-type: disc">
A flag that indicates if the section has been edited/changed since the
client last updated the section
</li><li style="list-style-type: disc">
The amount of time the section has been locked by a user,
or the amount of time since the section has been edited
depending on the appropriate situation
</li></ul></div><p>
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792769"></a>2.5. More on Updating Sections</h3></div></div><p>
The main purpose of NetTxt Xtreme is to allow for multiple
people to simultaneously collaborate on a text file. When one
user has a section locked, only that user can make changes to
that section. However, other users may want to view that same
locked section, and should be able to do so by asking for an
update from the server, which will retrieve the current text
of that section and send it to the requesting user only.
</p><p>
Your UI should display a time-stamp of the last time a
particular section was updated. The UI must give some
indication to the user that a section has been changed by its
owner since the last time the user updated it. You must be able
to request an update of locked sections from the server and
properly display those updated sections. You should also be able
to request that all locked sections not under your control be
updated.
</p><p>
The client should also be able to post a section that a user
is currently working on, either manually through the UI or
when the client unlocks a particular section. That section
should then be updated on all other clients and on the server.
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792386"></a>2.6. File Importing (and New Document Creation)</h3></div></div><p>
When creating a new file in NetTxt Xtreme, the user
shall be given two options: creating a blank document or
importing a file. When creating a blank document, the
user shall be able to add sections, just as in a regular
document.
</p><p>
You are required, also, to implement a basic file
importer. This importer shall be able to read in a
plain text file (you should assume a standard ASCII file
with unix line termination, i.e. using '\n' characters)
and, using some scheme that is up to you, be able to
break it into sections (<span class="bold"><b>Note:
creating one section for the entire document is not
a valid scheme</b></span>).
One such scheme would be to break the document into
sections based on paragraphs, in other words,
every time you encounter two new lines (i.e. &quot;\n\n&quot;
in the file), start a new section.
</p><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="http://www.cc.gatech.edu/classes/AY2003/cs2335_spring/labs/images/important.png"></td><th align="left">Important</th></tr><tr><td colspan="2" align="left" valign="top"><p>
The file to be imported is going to be located
on the local computer of the client. You will
have to build some mechanism to get the file
data to the server so that it can be stored
as a new collaborative document within the
NetTxt Xtreme system.
</p></td></tr></table></div><p>
See the extra credit section for points you can earn
by implementing a more complicated importer.
</p></div><div class="section" lang="en"><div class="titlepage"><div><h3 class="title"><a name="id2792450"></a>2.7. File Exporting</h3></div></div><p>
Sometimes, a user may want a copy of the complete file
on their local system. In order to facilitate this, you
need to give the users the ability to export a copy of
the file they are currently editing. Exporting will
produce a document that is a properly formatted HTML
document conforming to the current state of the
document, as the user currently sees it.
<span class="bold"><b>This is very important.</b></span>
File Exporting should produce a copy of the document
based on any sections the user may have updated that
differ from the server copy.
</p></div></div><div class="section" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2792483"></a>3. Deliverables</h2></div></div><p>You must submit the following things:
</p><div class="itemizedlist"><ul type="bullet"><li style="list-style-type: disc">
All source code and libraries
needed to run your program.
</li><li style="list-style-type: disc">
The Ant build-file (build.xml), which needs
to contain the following targets (with the
appropriate dependencies):
<div class="itemizedlist"><ul type="disc"><li><span class="bold"><b>runclient</b></span> -
Runs the client program <span class="emphasis"><em>this
should be the default target</em></span></li><li><span class="bold"><b>runserver</b></span> -
Runs the server program
</li><li><span class="bold"><b>build</b></span> -
Compiles your program
</li><li><span class="bold"><b>checkstyle</b></span>
- Runs Checkstyle on your source code
</li><li><span class="bold"><b>pmd</b></span>
- Runs PMD on your source code
</li><li><span class="bold"><b>jar</b></span> -
Creates an executable Jar of your
program
</li><li><span class="bold"><b>javadoc</b></span>
- Creates the JavaDoc for your program
<span class="emphasis"><em>(NOTE: JavaDoc must not
produce any errors/warnings to receive
credit)</em></span></li><li><span class="bold"><b>clean</b></span>
- Removes all files created from all
other targets
</li></ul></div></li><li style="list-style-type: disc">
A completed README file (see &quot;README.txt&quot;
in the supplemental files provided with
the lab).
</li><li style="list-style-type: disc">
If you are seeking extra credit for
implementing other importers, please include
one example file in the format you seek to
import.
</li></ul></div><p>
The above items must be submitted in an archive file in one
of the following formats: zip, tar, jar, or gzip.
</p><p>
</p><div class="warning" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Warning"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Warning]" src="http://www.cc.gatech.edu/classes/AY2003/cs2335_spring/labs/images/warning.png"></td><th align="left">Warning</th></tr><tr><td colspan="2" align="left" valign="top"><span class="bold"><b>
The following are part of the grading criteria for
this lab:
<div class="itemizedlist"><ul type="disc"><li>
-15 points (off the top) if your program fails
to pass PMD.
</li><li>
-15 points (off the top) if your program fails
to pass checkstyle.
</li><li>
-5 points (off the top) if your program fails
to pass JavaDoc without any errors or warnings.
</li><li>
-10 points (off the top) if the archive you
submit to WebCT has the wrong file extension.
</li><li>
AUTOMATIC ZERO if you fail to upload your
source code to WebCT in an archive (i.e.
uploading all of your files individually
is not allowed).
</li><li>
NO EXTRA CREDIT will be given it you fail to
document the extra credit options completed.
</li></ul></div>
</b></span></td></tr></table></div><p>
</p></div><div class="section" lang="en"><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="id2793448"></a>4. Extra Credit</h2></div></div>
You may receive up to 20 points on your final grade for completing
any combination of the following extra credit options:
<div class="itemizedlist"><ul type="disc"><li>
Advanced Editing Mode (give users the option to use the
standard WYSIWYG editor or let them directly edit the
HTML source code and it should be easy to switch between the
two) - 5 pts.
</li><li>
Advanced Importing. You can get 5 pts each for
implementing any of the following schemes (you must
include a large (40 or more line) example of the format
you are attempting to import):
<div class="itemizedlist"><ul type="circle"><li>Rich Text Format</li><li>HTML</li><li>DocBook (XML file format)</li><li>
Some other format (e.g. LaTeX). <span class="emphasis"><em>E-mail
a format idea to a TA by 23:59 Wednesday, February 18
to get approval for another format.</em></span></li></ul></div></li><li>
Auto-saving Server - server auto-saves open files every
<span class="emphasis"><em>configurable</em></span> time interval. - 5pts.
</li><li>
Embedded locking. The ability to have nested locking
sections. An example of this would be if you were
editing a java source code file, a user could look the
whole class or just the methods. - 20pts.
</li><li>
Amazing UI - 5pts (this is decided by your TA)
</li><li>
Other ideas. If you have an idea you'd like to try for
extra credit, email it to a TA for approval by 23:59
Wednesday, February 18. The TA will determine how many
(if any) points are merited.
</li></ul></div></div><div class="important" style="margin-left: 0.5in; margin-right: 0.5in;"><table border="0" summary="Important"><tr><td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="http://www.cc.gatech.edu/classes/AY2003/cs2335_spring/labs/images/important.png"></td><th align="left">Important</th></tr><tr><td colspan="2" align="left" valign="top"><p>
Unless arranged in advance (in writing), your TA will be grading this
assignment on the RedHat systems available in the States Lab and will
be using the Java tools provided in the &quot;~cs2335/&quot; directory. It is
YOUR responsibility to verify that your program will work on these
systems prior to submitting it.
</p></td></tr></table></div></div></body></html>