lexx.server.socket
Class Client

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--lexx.server.socket.Client
All Implemented Interfaces:
ClientBase, java.lang.Runnable

public final class Client
extends java.lang.Thread
implements ClientBase

Client uses direct communication via a socket

Copyright (c) 2002-2003

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

Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
Client(java.lang.String hostname, int port, java.lang.String userName)
           
 
Method Summary
protected  void finalize()
           
 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[] args)
          lexx.server.socket.Client [directory to store project] [server address] [server port]
lexx.server.socket.Client [directory to store project] [server address] [server port] [proxy address] [proxy port]
 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 run()
           
 void sendFile(java.io.File f)
          Sends the file to the server
 void setStatus(javax.swing.JLabel l)
          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.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Client

public Client(java.lang.String hostname,
              int port,
              java.lang.String userName)
Method Detail

setStatus

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

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

main

public static void main(java.lang.String[] args)
lexx.server.socket.Client [directory to store project] [server address] [server port]
lexx.server.socket.Client [directory to store project] [server address] [server port] [proxy address] [proxy port]


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

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

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

finalize

protected final void finalize()
                       throws java.lang.Throwable
Overrides:
finalize in class java.lang.Object
java.lang.Throwable

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

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

run

public final void run()
Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread