140 likes | 234 Views
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. ARCHITECTURE. download. upload.
E N D
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
ARCHITECTURE download upload Editor Web Service Editor download upload Line 1 Line 2 Line 3 … Line 1 Line 2 Line 3 … Document Repository
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
Option 1 : Upload the entire file 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. Function: int ns__uploadFile(char *fileName, int bytes, char *fileContents, char **status); 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.
Option 2 : Upload the file line by line 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. 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. Function: int ns__startUpload(char *fileName, char **status); 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. .
Option 2 : Upload the file line by line Once the file has been created the user can begin the line by line upload. 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. Function: int ns__upload(char *fileName, char *text, char **result); 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. .
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
Option 1 : Download the entire file Downloads the requested file. Entire file is sent. Function: int ns__downloadFile(char *fileName, char **fileContents); 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)
Option 2 : Download the file line by line 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. Function: int ns__download(char *fileName, long position, int bytes, char **result); 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 .
FIND – sending to web-service 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.. Function: int ns__setFind(char *sessionID,int offset, char *searchString, char **result); 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
FIND – receive from the web-service Sends the client the offset of the last searched string according to the sessionID. Function: int ns__getFindOffset(char *sessionID,char *result); Input: sessionID: user’s/client’s sessionID; • Output: - the function can return the following strings • 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.
FIND – receive from the web-service Sends the client the search string of the last search according to the sessionID. Function: int ns__getFindString(char *sessionID,char *result); Input: sessionID: user’s/client’s sessionID; • Output: - the function can return the following strings • 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.
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