c408h006
Class OmniEditor

java.lang.Object
  extended byc408h006.OmniEditor

public class OmniEditor
extends java.lang.Object

OmniEditor allows multiple users access to shared data. It is the web service through which all clients are connected to the shared data. Clients perform changes/actions on files by sending messages to the OmniEditor Web Service. A client must first be connected to the OmniEditor in order to perform any action on a file.


Constructor Summary
OmniEditor()
          Constructs an instance of this class.
 
Method Summary
 java.lang.String disConnect(int id, java.lang.String fileName)
          Disconnect a User from the OmniEditor system.
 FileState getFileState(int id, java.lang.String fileName)
          Return the current state of the file.
 int makeConnection(java.lang.String fileName)
          Establishes a connection to a file specified by the user.
 java.lang.String sendCommand(Command c)
          Send the command to be performed on the file to appropriate Connection.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

OmniEditor

public OmniEditor()
Constructs an instance of this class.

Method Detail

makeConnection

public int makeConnection(java.lang.String fileName)
Establishes a connection to a file specified by the user.

Parameters:
fileName - The name of the file to connect to
Returns:
The connection to the file specified by fileName

disConnect

public java.lang.String disConnect(int id,
                                   java.lang.String fileName)
Disconnect a User from the OmniEditor system.

Parameters:
id - The id of the User to disconnect
fileName - The file the User is connected to
Returns:
"#OK#" if the disconnect was successfull, "#ERR#" otherwise

sendCommand

public java.lang.String sendCommand(Command c)
Send the command to be performed on the file to appropriate Connection.

Parameters:
c - A Command object which contains the command to be performed and the name of the file on which to perform the command
Returns:
A message which indicates whether the command was performed successfully

getFileState

public FileState getFileState(int id,
                              java.lang.String fileName)
Return the current state of the file.

Parameters:
id - The id of the User who is requesting the FileState
fileName - The name of the file who's FileState is being requested
Returns:
The current state of the file