|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--java.lang.Thread | +--simulator.Connection
This is the class that mantains the connection between the client and server and executes the comunication with it
Field Summary | |
protected Semaphore[] |
availableCells
This is the array of semaphore that contains the available resources of the index-array type (It's a reference to Server 's) |
static java.lang.String |
availableCommands
Contains the list of commands available for clients. |
protected java.net.Socket |
client
Contains the socket that cliet uses to comunicate |
protected java.net.InetAddress |
clientAddress
Contains the IP client address |
protected java.util.Hashtable |
clientCommands
Contains the available client commands; the hash key is the name of the command, the value is an ClientCommand object |
protected java.lang.String |
clientName
Contains a string name of the client |
protected int |
clientPort
Contais the local client port for connecting to server |
protected java.util.Hashtable |
connectedUsers
Contains the list of client users that are connected |
protected int |
dimQueue
Max dimension for the queue |
protected ProcessesHandler |
GP
Contains the time handler of processes |
protected java.io.DataInputStream |
in
This is the input client-socket stream |
protected java.lang.String |
line
This contains a line read by the socket |
protected java.util.Hashtable |
nodesList
Contains the list of nodes of virtual world |
protected java.io.PrintStream |
out
This is the output client-socket stream |
protected Semaphore[] |
presentMessage
This is the array of semaphore that contains the occupied resources of the index-array type (It's a reference to Server 's) |
protected java.util.Hashtable |
processesList
Contains the list of agents processes (It's a reference to Server 's) |
protected Queue[] |
processesQueue
A queue of message changed by client agents and the server (It's a reference to Server 's) |
protected ServerAmbient |
ServAmb
Contains the process for serving an ambient (It's a reference to Server 's) |
protected java.util.Hashtable |
state
Contains instance of the actual states of agents |
protected Ambient |
staticAmb
This is the abstract class to build your static ambient (It's a reference to Server 's) |
protected SendVRML |
SV
This is the thread that updates the simulator state and send the VRML view to the client |
Fields inherited from class java.lang.Thread |
contextClassLoader,
daemon,
eetop,
group,
inheritedAccessControlContext,
MAX_PRIORITY,
MIN_PRIORITY,
name,
NORM_PRIORITY,
priority,
single_step,
stillborn,
stopThreadPermission,
target,
threadInitNumber,
threadQ,
values |
Constructor Summary | |
Connection(java.net.Socket client_socket,
Server server)
initialize the streams and start thread |
Method Summary | |
void |
broadcast(java.lang.String s)
Send a string command to all the connected users |
static void |
fail(java.lang.Exception e,
java.lang.String msg)
Print fail information and exit from server program |
void |
logActivity(java.lang.String message)
Print log activities information |
void |
logException(java.lang.Exception e,
java.lang.String message)
Print exception information |
java.lang.String |
readFile(java.lang.String fileName)
Read a file and return a string rappresentation of it |
void |
run()
This is the thread that reads command from socket and runs them |
private boolean |
runCommand(java.lang.String comm)
Execute a command that a user client pass to it. |
java.lang.String |
whoString()
Gets the names of the connected users |
Methods inherited from class java.lang.Thread |
|
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
Field Detail |
public static java.lang.String availableCommands
clientCommands
Hashtable.protected java.net.Socket client
protected java.io.DataInputStream in
protected java.io.PrintStream out
protected java.net.InetAddress clientAddress
protected int clientPort
protected java.lang.String clientName
protected java.lang.String line
protected java.util.Hashtable clientCommands
ClientCommand
objectprotected java.util.Hashtable processesList
Server
's)protected ServerAmbient ServAmb
Server
's)protected Semaphore[] availableCells
Server
's)protected Semaphore[] presentMessage
Server
's)protected Queue[] processesQueue
Server
's)protected int dimQueue
protected Ambient staticAmb
Server
's)protected java.util.Hashtable state
protected SendVRML SV
protected ProcessesHandler GP
protected java.util.Hashtable connectedUsers
protected java.util.Hashtable nodesList
Constructor Detail |
public Connection(java.net.Socket client_socket, Server server)
Method Detail |
public static void fail(java.lang.Exception e, java.lang.String msg)
e
- the exception that fails servermsg
- the message to print in err filepublic java.lang.String whoString()
public void run()
public void logException(java.lang.Exception e, java.lang.String message)
e
- the exception that fails servermsg
- the message to print in err filepublic void logActivity(java.lang.String message)
message
- the message to printpublic void broadcast(java.lang.String s)
s
- the string command to sendprivate boolean runCommand(java.lang.String comm)
ClientCommand
object that is stored in the
clientCommands
hashtable.comm
- the string that rappresent the commandClientCommand
,
Server.clientCommands
public java.lang.String readFile(java.lang.String fileName)
fileName
- the string name of the file
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |