|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.sf.basedb.clients.jobagent.handlers.MultiProtocolRequestHandler
public class MultiProtocolRequestHandler
Request handler implementation that forwards all requests to a registered
protocol-specific handler. All unknown protocols are forwarded to a
default request handler. Protocols and their handlers are
registered with registerProtocols(RequestHandler, String[]).
An incoming request should be of the form: protocol://additional-info.
Requests for protocols that doesn't have a registered handler and requests
that doesn't follow the above form are forwarded to the default handler.
| Field Summary | |
|---|---|
private Agent |
agent
|
private RequestHandler |
defaultHandler
|
private Map<String,RequestHandler> |
handlers
|
private boolean |
isClosed
|
private static Logger |
log
Logger. |
| Constructor Summary | |
|---|---|
MultiProtocolRequestHandler(Agent agent,
RequestHandler defaultHandler)
Create a new multi-protocol request handler. |
|
| Method Summary | |
|---|---|
void |
close()
Close this handler. |
String |
handleCmd(Socket socket,
String cmd)
Handle a command that was sent by an incoming request. |
boolean |
isClosed()
If the request handler is closed, it will igore all method calls. |
void |
registerProtocols(RequestHandler handler,
String... protocols)
Register a handler for one or more protocols. |
void |
unregisterProtocols(String... protocols)
Unregister a handler for one or more protocols. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static final Logger log
private final Agent agent
private final RequestHandler defaultHandler
private final Map<String,RequestHandler> handlers
private boolean isClosed
| Constructor Detail |
|---|
public MultiProtocolRequestHandler(Agent agent,
RequestHandler defaultHandler)
defaultHandler - The default handler that should
receive all requests that hasn't a registered specific
handler| Method Detail |
|---|
public String handleCmd(Socket socket,
String cmd)
RequestHandler
handleCmd in interface RequestHandlersocket - The socket that is handling the communication with the
remote clientcmd - The command
public void registerProtocols(RequestHandler handler,
String... protocols)
handler - The handlerprotocols - An array with protocol namespublic void unregisterProtocols(String... protocols)
protocols - An array with protocol namespublic void close()
public boolean isClosed()
|
3.1.1: 2012-03-29 | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||