public final class NetworkHandler extends java.lang.Object implements MessageHandler
Modifier and Type | Field and Description |
---|---|
private static java.util.logging.Logger |
logger |
private MetaRegister |
metaRegister |
private MetaServer |
metaServer |
Constructor and Description |
---|
NetworkHandler(MetaServer metaServer,
MetaRegister metaRegister)
The constructor to use.
|
Modifier and Type | Method and Description |
---|---|
private org.w3c.dom.Element |
disconnect(Connection connection,
org.w3c.dom.Element element)
Handles a "disconnect"-request.
|
private org.w3c.dom.Element |
getServerList(Connection connection,
org.w3c.dom.Element element)
Handles a "getServerList"-request.
|
org.w3c.dom.Element |
handle(Connection connection,
org.w3c.dom.Element element)
Handles a network message.
|
private org.w3c.dom.Element |
register(Connection connection,
org.w3c.dom.Element element)
Handles a "register"-request.
|
private org.w3c.dom.Element |
remove(Connection connection,
org.w3c.dom.Element element)
Handles a "remove"-request.
|
private org.w3c.dom.Element |
update(Connection connection,
org.w3c.dom.Element element)
Handles an "update"-request.
|
private static final java.util.logging.Logger logger
private final MetaServer metaServer
private final MetaRegister metaRegister
public NetworkHandler(MetaServer metaServer, MetaRegister metaRegister)
metaServer
- The MetaServer
this
NetworkHandler
has been created
for.metaRegister
- An object containing a list
of all the servers.public org.w3c.dom.Element handle(Connection connection, org.w3c.dom.Element element)
handle
in interface MessageHandler
connection
- The Connection
the message came from.element
- The message to be processed.private org.w3c.dom.Element getServerList(Connection connection, org.w3c.dom.Element element)
connection
- The Connection
the message
was received on.element
- The element containing the request.Element
with a list of the
servers in the MetaRegister
.private org.w3c.dom.Element register(Connection connection, org.w3c.dom.Element element)
connection
- The connection the message was received on.element
- The element containing the request.null
.private org.w3c.dom.Element update(Connection connection, org.w3c.dom.Element element)
connection
- The connection the message came from.element
- The element containing the request.null
.private org.w3c.dom.Element remove(Connection connection, org.w3c.dom.Element element)
connection
- The connection the message came from.element
- The element containing the request.null
.private org.w3c.dom.Element disconnect(Connection connection, org.w3c.dom.Element element)
connection
- The connection the message came from.element
- The element containing the request.null
.