c408h003.omnieditor
Class OmniEditingService

java.lang.Object
  extended byc408h003.omnieditor.OmniEditingService

public class OmniEditingService
extends java.lang.Object


Field Summary
static OmniEditor omniEditorSingleton
          omniEditorSingleton: A singleton object of OmniEditor
 
Constructor Summary
OmniEditingService()
          Constructor of OmniEditingService class
 
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
protected  OmniEditor getInstance()
           
 void logout(int userId)
          Logout the web service.
 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
 

Field Detail

omniEditorSingleton

public static OmniEditor omniEditorSingleton
omniEditorSingleton: A singleton object of OmniEditor

Constructor Detail

OmniEditingService

public OmniEditingService()
Constructor of OmniEditingService class

Method Detail

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.

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.

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.

logout

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

Parameters:
userId - the user's identification number

getInstance

protected OmniEditor getInstance()