|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object java.lang.Thread fr.lip6.sma.simulacion.app.CLIApplication fr.lip6.sma.simulacion.server.http.HTTPServer
public class HTTPServer
Classe pour le serveur HTTP qui gère les différents clients.
HTTPServerTest
Nested Class Summary | |
---|---|
private class |
HTTPServer.ClientData
Classe pour les données sur un client. |
Nested classes/interfaces inherited from class java.lang.Thread |
---|
Thread.State, Thread.UncaughtExceptionHandler |
Field Summary | |
---|---|
private Map |
mAgentsRegistry
La liste des agents enregistrés. |
private int |
mClientNextID
ID du prochain client. |
private Map |
mClients
La liste des événements pour les clients. |
private String |
mGameID
Identification du jeu. |
private int |
mMDNSRegistrationOpID
Registration operation ID or 0 if we don't register to the mDNS server. |
private com.kallisys.zeroconf.MulticastDNSServer |
mMDNSServer
Reference to the mDNS server (or null if we don't publish
the server over mDNS). |
private int |
mOperationNextID
ID de la prochaine opération. |
private Map |
mPendingOperations
La liste des opérations en cours. |
private WebServer |
mServer
Référence sur le serveur. |
private boolean |
mVerboseMode
If we're in verbose mode. |
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Fields inherited from interface com.kallisys.zeroconf.MulticastDNSClient |
---|
BROWSERFLAG_MORECOMING, BROWSERFLAG_REMOVE |
Constructor Summary | |
---|---|
HTTPServer(String[] inArgs)
Constructeur à partir des arguments. |
Method Summary | |
---|---|
protected void |
displayHelp(String inLine)
Display the help. |
private void |
endClient(int inClientID)
Fin d'un client. |
Object |
execute(String inMethod,
Vector inParams)
Point d'entrée du serveur XML-RPC. |
private String |
executeAgentMethod(int inClientID,
String inAgentClass,
String inAgentName,
String inMethodName,
Map inParams)
Exécute une méthode sur un agent. |
private void |
executeAgentMethodAsync(int inClientID,
String inAgentClass,
String inAgentName,
String inMethodName,
Map inParams)
Exécute une méthode sur un agent de manière asynchrone. |
private void |
filterEvents(List inEventList)
Filter an event list by removing unnecessary events (register & unregister events). |
protected void |
init()
Method called at the beginning of the application. |
private List |
listen(int inClientID)
Envoie à un client tous les nouveaux événements. |
private void |
logExecuteAgentMethodVerbose(int inClientID,
String inAgentClass,
String inAgentName,
String inMethodName,
Map inParams,
String inResult)
Affiche l'exécution d'une méthode sur un agent. |
static void |
main(String[] inArgs)
Point d'entrée du serveur. |
void |
multicastDNSBrowserCallBack(int inRequestID,
int inBrowserFlags,
com.kallisys.zeroconf.NetService inService,
IOException inException)
Ignored. |
void |
multicastDNSRegistrationCallBack(int inRequestID,
com.kallisys.zeroconf.NetService inService,
IOException inException)
|
void |
multicastDNSResolutionCallBack(int inRequestID,
com.kallisys.zeroconf.NetService inService,
IOException inException)
Ignored. |
private int |
newClient()
Nouveau client. |
private void |
postEvent(int inClientID,
Map inEvent)
Nouvel événement pour un client. |
private void |
postEventToAll(Map inEvent)
Nouvel événement pour tous les clients. |
protected boolean |
processCommand(String inCommand,
String inLine)
Method called to process commands. |
private static void |
queueEventInList(List inEventList,
Map inEvent)
Add an event in a list. |
protected void |
quit()
Method called to quit the application. |
private boolean |
register(int inClientID,
String inAgentClass,
String inAgentName)
Enregistre un agent. |
private void |
shutdown()
Arrête le serveur. |
private void |
unregister(int inClientID,
String inAgentClass,
String inAgentName)
Désenregistre un agent. |
private static void |
usage()
Affiche la syntaxe de ce programme sur radio stderr. |
Methods inherited from class fr.lip6.sma.simulacion.app.CLIApplication |
---|
flush, print, println, printStackTrace, run |
Methods inherited from class java.lang.Thread |
---|
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
private final boolean mVerboseMode
private final WebServer mServer
private final com.kallisys.zeroconf.MulticastDNSServer mMDNSServer
null
if we don't publish
the server over mDNS).
private final int mMDNSRegistrationOpID
private final String mGameID
private final Map mClients
private int mClientNextID
private final Map mPendingOperations
private int mOperationNextID
private final Map mAgentsRegistry
Constructor Detail |
---|
public HTTPServer(String[] inArgs)
inArgs
- arguments sur la ligne de commandeMethod Detail |
---|
private static void usage()
protected void init()
init
in class CLIApplication
protected void quit()
quit
in class CLIApplication
private void shutdown()
public Object execute(String inMethod, Vector inParams) throws Exception
execute
in interface XmlRpcHandler
inMethod
- nom de la méthode appelée (objet.nom).inParams
- liste des paramètres.
Exception
- si un problème est survenu.private int newClient()
private List listen(int inClientID)
inClientID
- le numéro du client.
private void endClient(int inClientID)
inClientID
- le numéro du client.private boolean register(int inClientID, String inAgentClass, String inAgentName)
inClientID
- le numéro du client.inAgentClass
- la classe de l'agent.inAgentName
- le nom de l'agent.
true
si l'enregistrement a réussi.private void unregister(int inClientID, String inAgentClass, String inAgentName)
inClientID
- le numéro du client.inAgentClass
- la classe de l'agent.inAgentName
- le nom de l'agent.private String executeAgentMethod(int inClientID, String inAgentClass, String inAgentName, String inMethodName, Map inParams) throws NetworkAgentException
inClientID
- le numéro du client.inAgentClass
- la classe de l'agent.inAgentName
- le nom de l'agent.inMethodName
- la méthode à exécuter.inParams
- les paramètres de l'agent.
null
si on n'a
jamais eu le résultat.
NetworkAgentException
- si un problème est survenu.private void executeAgentMethodAsync(int inClientID, String inAgentClass, String inAgentName, String inMethodName, Map inParams) throws NetworkAgentException
inClientID
- le numéro du client.inAgentClass
- la classe de l'agent.inAgentName
- le nom de l'agent.inMethodName
- la méthode à exécuter.inParams
- les paramètres de l'agent.
NetworkAgentException
- si un problème est survenu.private void logExecuteAgentMethodVerbose(int inClientID, String inAgentClass, String inAgentName, String inMethodName, Map inParams, String inResult)
inClientID
- le numéro du client.inAgentClass
- la classe de l'agent.inAgentName
- le nom de l'agent.inMethodName
- la méthode à exécuter.inParams
- les paramètres de l'agent.inResult
- résultat.private void filterEvents(List inEventList)
inEventList
- list of event where to insert the event.private static void queueEventInList(List inEventList, Map inEvent)
inEventList
- list of event where to insert the event.inEvent
- event to insert.private void postEvent(int inClientID, Map inEvent)
inClientID
- le numéro du client.inEvent
- un dictionnaire qui décrit l'événement.private void postEventToAll(Map inEvent)
inEvent
- un dictionnaire qui décrit l'événement.protected boolean processCommand(String inCommand, String inLine)
processCommand
in class CLIApplication
inCommand
- command to parse (in uppercase).inLine
- the full line.
false
if the command was unknown, true
otherwise.protected void displayHelp(String inLine)
displayHelp
in class CLIApplication
inLine
- line for the help command (unused).public final void multicastDNSRegistrationCallBack(int inRequestID, com.kallisys.zeroconf.NetService inService, IOException inException)
multicastDNSRegistrationCallBack
in interface com.kallisys.zeroconf.MulticastDNSClient
public final void multicastDNSResolutionCallBack(int inRequestID, com.kallisys.zeroconf.NetService inService, IOException inException)
multicastDNSResolutionCallBack
in interface com.kallisys.zeroconf.MulticastDNSClient
public final void multicastDNSBrowserCallBack(int inRequestID, int inBrowserFlags, com.kallisys.zeroconf.NetService inService, IOException inException)
multicastDNSBrowserCallBack
in interface com.kallisys.zeroconf.MulticastDNSClient
public static void main(String[] inArgs)
inArgs
- arguments sur la ligne de commande.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |