lexx.server.http
Class ClientHttp

java.lang.Object
  |
  +--lexx.server.http.ClientHttp
All Implemented Interfaces:
ClientBase, java.util.EventListener, HttpListener

public final class ClientHttp
extends java.lang.Object
implements HttpListener, ClientBase

Client uses the HTTP protocol to communicate<

Due to the limitations of HTTP protocol the client will need to connect to server continously to enable full duplex communication

Copyright (c) 2002-2003

Since:
20/03/2003
Version:
1.0
Author:
Mohammed Imran

Constructor Summary
ClientHttp(java.lang.String url, java.lang.String userName)
           
 
Method Summary
 int getClientNum()
          Tells you the number of clients that are on-line
 javax.swing.JPanel getPanel()
          The GUI for instant messaging.
static void main(java.lang.String[] argv)
          Usage: java TestClient
 void releaseFile(java.lang.String filename)
          Unlocks the file when you have finished with it, so other clients can use it
 boolean requestFile(java.lang.String filename)
          Requset of file for editing
 void sendFile(java.io.File f)
          Sends the file to the server
 void service(java.io.InputStream data)
          Method invoked when a message is sent from the HttpServer
 void setStatus(javax.swing.JLabel newStatus)
          Used if you would like to log when the client performs a task
 void updateMyFiles()
          Downloads all the changed files from the server
 void updateServer()
          Uploads all the changed files to the server
 void waitUtilCached()
          This is called when you call the updataMyFiles() method, as it waits until all the files have been successfully updated
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClientHttp

public ClientHttp(java.lang.String url,
                  java.lang.String userName)
           throws java.lang.Exception
Method Detail

updateMyFiles

public final void updateMyFiles()
Downloads all the changed files from the server

Specified by:
updateMyFiles in interface ClientBase

updateServer

public final void updateServer()
Uploads all the changed files to the server

Specified by:
updateServer in interface ClientBase

setStatus

public final void setStatus(javax.swing.JLabel newStatus)
Used if you would like to log when the client performs a task

Specified by:
setStatus in interface ClientBase
Parameters:
newStatus - where the text will be logged

getClientNum

public final int getClientNum()
Tells you the number of clients that are on-line

Specified by:
getClientNum in interface ClientBase
Returns:
numner of clients that are on-line

service

public final void service(java.io.InputStream data)
Description copied from interface: HttpListener
Method invoked when a message is sent from the HttpServer

Specified by:
service in interface HttpListener
Parameters:
data - Message data
Returns:
void

main

public static void main(java.lang.String[] argv)
                 throws java.lang.Exception
Usage: java TestClient

java.lang.Exception

getPanel

public final javax.swing.JPanel getPanel()
The GUI for instant messaging. It should contain inside it all the interactions required for chatting on-line.

Specified by:
getPanel in interface ClientBase
Returns:
panel for instant messaging

sendFile

public final void sendFile(java.io.File f)
Sends the file to the server

Specified by:
sendFile in interface ClientBase
Parameters:
f - the file you wish to send

waitUtilCached

public final void waitUtilCached()
This is called when you call the updataMyFiles() method, as it waits until all the files have been successfully updated

Specified by:
waitUtilCached in interface ClientBase

releaseFile

public final void releaseFile(java.lang.String filename)
Unlocks the file when you have finished with it, so other clients can use it

Specified by:
releaseFile in interface ClientBase
Parameters:
filename - name of the file you have just unlocked

requestFile

public final boolean requestFile(java.lang.String filename)
Requset of file for editing

Specified by:
requestFile in interface ClientBase
Parameters:
filename - the name of the file you wish to edit
Returns:
tells you if someone else has locked the file