You will design and implement a "file-explorer app" that might be used on a tablet or PC to access a file system saved in "cloud storage".
Here is some background: When you use a remote server to store your file system (it's a collection of nested folders and text files), the server actually encodes your file system as a single sequential text file with embedded XML tags. When you use an app on a tablet to login to the server and retrieve your file system, the server locates the text file, reads and decodes some small part of it, and returns to your app only the top-level folder of your file system. (The server won't decode and return the entire file system --- if you have, say, 10GB of data stored, it wastes time and bandwidth to decode and load everything, especially because you won't be looking at everything!)
As you open the top folder and examine its contents and then open other, nested folders, the app decodes and loads these folders as needed. You use your app make changes to your local copy of the file system, the one on your tablet, and when you logout, the app copies the local copy of your filesystem back to the server.
You will design and implement a system that works in this manner.
XML is just "bracket language" --- HTML is an example of an XML language. We use a simple version here. Say we have this example file system, where
<folder ""> <file "a.txt"> ... lines of a.txt go here... </file> <file "b.txt"> ... lines of b.txt go here... </file> <flink "F"> <flink "G"> </folder> <folder "F"> <flink "H"> <file "c.txt"> ... lines of c.txt go here... </file> </folder> <folder "G"> </folder> <folder "F/H"> <file "a.txt>" ... lines of a.txt go here... </file> </folder>The flinks mark where the nested folders should be inserted. Notice that the folders are listed in "breadth-first" ordering, which works best when the file system is opened level by level.
The syntax of the XML encoding should be easy to figure out, but here's a precise
regular-expression definition of the format:
EncodedFileSystem = EncodedFolder+
EncodedFolder = <folder "FolderPath"> EncodedEntry* </folder>
EncodedEntry = EncodedTextFile || EncodedFolderLink
EncodedTextFile = <file "Name"> TextLine* </file>
EncodedFolderLink = <flink "Name">
FolderPath = ε || Name(/Name)*
Name = sequence of letters, numerals, and periods
TextLine = string ended by "\r\n"
(Recall that + means ``one or more'' and * means ``zero or more''
and ε means ''nothing at all''.)
Part of your job is to write a subassembly that reads the text file from disk, one folder's-worth at a time, and rebuilds it into its tiered (tree) form, like we studied in class. Details are below.
Here is a picture of how the app might be used.
Here is the explanation:
First off,
for the system's "model subassembly" (the back-end):
NO REMOTE PROXIES:
Don't implement the Remote Proxy design pattern. It is true that a remote proxy should be added for deployment on a tablet that connects to cloud storage, but that step can be implemented later. We have enough to do already.
NO NEED FOR THREADS AND LOCKS:
we won't accommodate multiple users --- so, no multiple threads nor locks are needed --- this Assignment is about a single-user file system and not about a file system that is shared by multiple users.
Based on the object diagram,
use Nclass to draw a class diagram of the system. Remember the design patterns, and ensure that they are present in the class diagram.
You might need to update your object diagram after you draw your class diagram.
Start coding in Visual Studio:
I have included a
small demo VS solution that should give
you some ideas about how to construct and link Forms.
Unit tests are not required for the Forms --- just connect them to your already tested "back end" and run the system.
You can read about reading/writing disk files in the reference notes
I wrote:
Textfile I/O and String manipulation.
You will also see there
how to use pattern matching on strings to process the XML tags.
Study also the in-class exercises we did with virtual proxies and the file system.
When you use the ControlPanel to CloseAll the system and write the contents of the file-system tree to a sequential file, you must do a tree traversal
in breadth-first order. To do this, you use a helper data structure, a queue. If you don't remember how to use a queue to do a breadth-first traversal of tree, ask me or the T.A.
When you use the file, please place it inside the VS Solution Folder,
at the very top level,
so that it is referenced in your code with this path:
"..\\..\\..\\filesIn.txt". (This is 3 levels up from where the exe files are saved --- see how I did this in the in-class exercise we did with virtual proxies.)
When your system shuts down, it writes the updated file to this path:
"..\\..\\..\\filesOut.txt".
This assignment is a bit more challenging than the banking project, so you must start working early if you want to finish the entire system by the deadline. In any case, design and build as much as you can, working on the implementation in the steps listed above in the
section, "What you must do".
Again, at this link, there is a "use-case diagram" of what appears when a user
starts the app and then generates two DirectoryForms and an EditForm.
(There might be other useful operations, but we have enough already, so we stop here!)
Software architecture
Design patterns are the "design language" used by software engineers.
To implement the above behaviors, you are required to use design patterns.
Within the "controllers" that you include in your app,
The system's "view" consists of the ControlPanel form,
the multiple DirectoryForms, and the multiple EditForms.
Make these appear like shown in my use-case diagram. Add controllers
to these forms as needed. (The EditForm might not need a controller --- it's very simple.)
What you must do
Test data
I have written a starting file system, filesIn.txt, and coded it in the XML format we use.
Use this file to you test your system. The file is posted
with this assignment sheet.
What you submit for Assignment 6
Design-review meeting the week of April 27
After you submit your design, you will meet with me in my office to discuss your design and your progress on the implementation.
You should start work on the implementation before we meet
so that we can discuss any technical problems you encounter.
What you submit for Assignment 7
You submit your finished implementation to satisfy Assignment 7.
Make a folder with the name, MyLastName.MyFirstName.Assn7, and copy into it
Zip the folder and upload on K-State Online.
This is individual work
You must do this exercise solo. This is because I must assess the skills
you have acquired so far in your studies. If you have difficulties, we
can discuss what can be done to improve your abilities.
If I determine that you had unauthorized aid, I will award no points
for your work.