c408h003.omnieditor
Class OmniEditor

java.lang.Object
  extended byc408h003.omnieditor.OmniEditor

public class OmniEditor
extends java.lang.Object


Constructor Summary
OmniEditor()
          Constructor of the OmniEditor
 
Method Summary
 java.lang.String[] download(int userId, java.lang.String[] fileNames)
          Sends the current editing state of the specified buffer to the user initiates this service.
 int find(int userId, java.lang.String text, java.lang.String fileName)
          Finds a string in the specified editing buffer.
 java.lang.String[] getFileNames(int userId)
          Gets all files available on the webserver
 void logout(int userId)
          Logout the web service.
static void main(java.lang.String[] args)
           
 int register()
          Gets the user id to start to use the Web service.
 java.lang.String[] update(int userId, java.lang.String fileName)
          Gets the difference of the file.
 void upload(int userId, java.lang.String fileName, java.lang.String fileContent)
          Opens a channel with the editing state, such as the content of the local text buffer and the position of the cursor in the buffer.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OmniEditor

public OmniEditor()
Constructor of the OmniEditor

Method Detail

main

public static void main(java.lang.String[] args)

upload

public void upload(int userId,
                   java.lang.String fileName,
                   java.lang.String fileContent)
Opens a channel with the editing state, such as the content of the local text buffer and the position of the cursor in the buffer.

Parameters:
userId - the user who want to upload a file
fileName - the name of the file
fileContent - the file contents of which the user want to share

download

public java.lang.String[] download(int userId,
                                   java.lang.String[] fileNames)
Sends the current editing state of the specified buffer to the user initiates this service.

Parameters:
userId - the user who wants to download a file
fileNames - the file namess of which the user want to get
Returns:
the current contents of each file in the buffer.

find

public int find(int userId,
                java.lang.String text,
                java.lang.String fileName)
Finds a string in the specified editing buffer.

Parameters:
userId - the user who want to search in the file
text - the string to be looked for in a file
fileName - the file name in which the user want to find the string
Returns:
the the current occurance position of the text in the file

register

public int register()
Gets the user id to start to use the Web service.

Returns:
an integer id number assigned by the web service.

update

public java.lang.String[] update(int userId,
                                 java.lang.String fileName)
Gets the difference of the file.

Parameters:
userId - the user's indentification
fileName - the name of the file to be updated
Returns:
a string array stands for all actions perform on the file. Each string stands for one action.

getFileNames

public java.lang.String[] getFileNames(int userId)
Gets all files available on the webserver

Parameters:
userId - the user's identification number
Returns:
a string array of all file names currently available.

logout

public void logout(int userId)
Logout the web service.

Parameters:
userId - the user's identification number