Download presentation
Presentation is loading. Please wait.
Published byAlaina Berry Modified over 8 years ago
1
Group 2 Web Service For Collaborative editing Uses scalable Client-Server architecture to minimize network communication and improve reliability Provides Upload, Download, Find functionality Easily extendable to near real-time “live” collaboration
2
ARCHITECTURE Web Service Document Repository Editor Line 1 Line 2 Line 3 … Editor Line 1 Line 2 Line 3 … upload download upload
3
UPLOAD There are 2 options when uploading a file to the web-server: Option 1) Upload the entire file at once Option 2) Upload the file line by line
4
Option 1 : Upload the entire file Function: int ns__uploadFile(char *fileName, int bytes, char *fileContents, char **status); Uploads the desired file. Entire file is received. If a file with the same name exists on the server, the contents of the file on the server are over written. Input: fileName: name of the file to upload to the web-service bytes:size of the file in bytes fileContents:actual contents of the file to be uploaded (string) Output: - the function can return the following strings 1) "CNO~!" Could Not Open the requested file name 2) "CNW~!" Could Not Write to requested file 3) "OK~!" contents of the file uploaded and written correctly.
5
Option 2 : Upload the file line by line Function: int ns__startUpload(char *fileName, char **status); Creates a file on the server to be uploaded line by line thus enabling the user to manually manage network flow of traffic. If a file with the same name exists on the server, the contents of the file on the server are over written. Input: fileName: name of the file to upload to the web-service Output: - the function can return the following strings 1) "CNC~!" Could Not Create the requested file on the server 2) "OK~!" contents of the file uploaded and written correctly.. Before the client can begin uploading the file the user must call the following function in order to create the physical file on the server.
6
Option 2 : Upload the file line by line Function: int ns__upload(char *fileName, char *text, char **result); Uploads a file line by line thus enabling the user to manually manage network flow of traffic. Caller sets the length of line on the client side. Each line is appended to the file created by the startUpload() function. Input: fileName: name of the file to upload to the webservice text: the contents of each line Output: - the function can return the following strings 1) "CNO~!“Could Not Open the requested file name 2) "CNA~!" Could Not Append to requested file 3) "OK~!" contents of the file uploaded and written correctly.. Once the file has been created the user can begin the line by line upload.
7
DOWNLOAD There are 2 options when uploading a file to the web-server: Option 1) Download the entire file at once Option 2) Download the file line by line
8
Option 1 : Download the entire file Function: int ns__downloadFile(char *fileName, char **fileContents); Downloads the requested file. Entire file is sent. Input: fileName: name of the file to download from the web-service Output: - the function can return the following strings 1) "DNE~!" the requested file Does Not Exist on the server 2) all contents of the file (as a string)
9
Option 2 : Download the file line by line Function: int ns__download(char *fileName, long position, int bytes, char **result); Downloads the requested file line by line. The caller sets the length of each line in bytes to be downloaded. This enables the user to manually manage network flow of traffic. Input: filename: Name of the file to download from the web-service position: Position of the next line in the file to download bytes: Size of each line to download Output: - the function can return the following strings 1) "DNE~!" the requested file Does Not Exist on the server 2) "EOF~!" the file has reached the end. 3) actual line of text from the requested file.
10
FIND
11
FIND – sending to web-service Function: int ns__setFind(char *sessionID,int offset, char *searchString, char **result); Send the search string to the server as well as the location of the search string in the file. Also sessionID is required to keep track of all the users working on the same file.. Input: sessionID: user’s/clien’s sessionID; offset:location of the seach string in the file (byte offset) searchString: string the user has searched for Output: - the function can return the following strings 1) "OK~!" uploaded all information correctly 2) "NOT OK~!“the information was not uploaded
12
FIND – receive from the web-service Function: int ns__getFindOffset(char *sessionID,char *result); Sends the client the offset of the last searched string according to the sessionID. Input: sessionID: user’s/client’s sessionID; Output: - the function can return the following strings 1)the offset/byte location of the last search for the given session. 2) "DNE~!" the information for the given session ID Does Not Exist. In other words there were no searches performed yet.
13
FIND – receive from the web-service Function: int ns__getFindString(char *sessionID,char *result); Sends the client the search string of the last search according to the sessionID. Input: sessionID: user’s/client’s sessionID; Output: - the function can return the following strings 1)the search string of the last search for the given session. 2) "DNE~!" the information for the given session ID Does Not Exist. In other words there were no searches performed yet.
14
Ideas for extension of web service: To inform web service of local changes: modify upload operation to allow byte offfset of text accumulate changes locally send periodic uploads with incremental changes and byte offsets To receive changes from web service: modify download operation to allow byte offfset of text accumulate changes on web service using log periodically download changes from web service so that client buffer remains up to date
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.