|
Ila | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.topoweb.ila.server.RequestProcessor
An org.topoweb.util.concurrent.SingleRun
that processes
incoming requests. Receives new IlaSession
s
representing requests. These requests are processed and enqueued for
writing. The processing model here is single threaded.
Currently, this implementation is a quick hack at getting the thing working ASAP. It uses XML/DOM processing which is inherently inefficient. There are a number of ways to improve this. Likely, we'll end up writing a library that arranges read-only byte buffers for XML output. That's an interesting project in its own right, but will be deferred for the time being.
run
in a single thread and then only once.
Field Summary | |
protected static java.util.logging.Logger |
LOGGER
The logger used to log messages. |
Fields inherited from interface org.topoweb.ila.NodeConstants |
BACK, FIRST_PAGE, FORE, LAST_PAGE, LINK_MASK, PAGE_MASK |
Fields inherited from interface org.topoweb.ila.protocol.SpiProtocolConstants |
SPC_REGISTER, SPC_REMOVE_BACKLINK, SPC_SET_LINK, SPC_SPI, SPC_SPI_NAMESPACE |
Fields inherited from interface org.topoweb.ila.protocol.ProtocolConstants |
PC_BACKLINK_COUNT, PC_BACKLINKS, PC_CO_BACKLINK_COUNT, PC_CO_FORELINK_COUNT, PC_CONTENT_LENGTH, PC_CONTENT_TYPE, PC_ERROR_CODE, PC_EXPIRATION, PC_FAIL, PC_FIRST, PC_FORELINK_COUNT, PC_FORELINKS, PC_GET_KNOWN, PC_GET_LINK_NODE, PC_GET_LINKS, PC_GET_NODE, PC_HI, PC_HTTP, PC_ID, PC_ILA, PC_INCOMMUNICADO, PC_LAST, PC_LAST_MODIFIED, PC_LINK_NODE, PC_LINK_TYPE, PC_LO, PC_MAX_COUNT, PC_NODE, PC_NODE_SET, PC_OKAY, PC_ORI, PC_PAGE, PC_REGISTER, PC_REQUEST, PC_RESPONSE, PC_SIZE, PC_STATE, PC_STATUS, PC_SYNC_VERSION_ID, PC_SYNC_VERSION_TIMESTAMP, PC_TITLE, PC_USER, PC_USER_AGENT, PC_USER_NAMESPACE, PC_VERSION, PC_VERSION_ID, PC_VERSION_TIMESTAMP |
Fields inherited from interface org.topoweb.ila.server.DefaultConstants |
DEF_MAX_COUNT |
Constructor Summary | |
RequestProcessor(org.topoweb.util.concurrent.Takable processPendingQueue,
org.topoweb.util.concurrent.Puttable writePendingQueue)
Creates a new instance with the given parameters. |
Method Summary | |
protected void |
backOut(org.topoweb.net.server.Session session)
|
protected void |
checkVersion(org.w3c.dom.Element env)
Checks the protocol version. |
protected void |
doGetKnown(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doGetLinkNode(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doGetLinks(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doGetNode(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doRegister(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doRemoveBacklink(org.w3c.dom.Element func,
IlaSession session)
|
protected void |
doSetLink(org.w3c.dom.Element func,
IlaSession session)
|
protected boolean |
enqueue(org.topoweb.net.server.Session session)
Enqueue's the given session in the read-completed
queue. |
protected int |
getDefaultMaxCount()
Returns the default "max count" property. |
void |
init()
Initializes the instance. |
protected void |
initImpl()
Initialization implementation method. |
boolean |
isAlive()
|
void |
join(int timeout)
|
protected void |
processLocalRequest(Request request)
Processes the given local request . |
protected void |
processRemoteRequest(Request request)
Processes the given remote request . |
void |
run()
Runs the session processor loop. |
void |
stop()
|
protected void |
writeError(IlaException ix,
org.topoweb.net.server.Session session)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected static final java.util.logging.Logger LOGGER
Constructor Detail |
public RequestProcessor(org.topoweb.util.concurrent.Takable processPendingQueue, org.topoweb.util.concurrent.Puttable writePendingQueue) throws java.lang.IllegalArgumentException
processPendingQueue
- the queue from which "write-pending"
Session
s arrivewritePendingQueue
- the queue on which Session
s
are sent to once processing is completed
java.lang.IllegalArgumentException
- if any of the arguments is null
Method Detail |
public void init() throws java.lang.IllegalStateException, IlaException
java.lang.IllegalStateException
- if this method has already been successfully invoked
IlaException
- if an error occursprotected void initImpl() throws IlaException, java.lang.Exception
java.lang.Exception
- if an error occurs during startup
IlaException
public void run() throws java.lang.IllegalStateException
run
in interface org.topoweb.util.concurrent.SingleRun
java.lang.IllegalStateException
- if the instance was not first
initialized; if invoked
more than onceinit()
,
stop()
protected void processLocalRequest(Request request)
request
.
protected void processRemoteRequest(Request request)
request
.
protected void writeError(IlaException ix, org.topoweb.net.server.Session session)
protected void backOut(org.topoweb.net.server.Session session)
protected int getDefaultMaxCount()
DEF_MAX_COUNT
.
protected void doGetKnown(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doGetLinkNode(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doGetLinks(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doGetNode(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doRegister(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doSetLink(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void doRemoveBacklink(org.w3c.dom.Element func, IlaSession session) throws IlaException
IlaException
protected void checkVersion(org.w3c.dom.Element env) throws IlaException
PC_VERSION
attribute. The base
implementation performs no checks.
env
- the envelope (root) element (<ila>)
IlaException
- if this instance cannot handle the protocol version
requested by the clientpublic void stop() throws java.lang.IllegalStateException
stop
in interface org.topoweb.util.concurrent.SingleRun
java.lang.IllegalStateException
public boolean isAlive()
isAlive
in interface org.topoweb.util.concurrent.SingleRun
public void join(int timeout) throws java.lang.InterruptedException
join
in interface org.topoweb.util.concurrent.SingleRun
java.lang.InterruptedException
protected boolean enqueue(org.topoweb.net.server.Session session)
session
in the read-completed
queue. The basic implementation waits at most roughly 1 second for
the queuing operation to succeed.
session
- the session to be enqueued
true
, if successfully enqueued;
false
, o.w.
|
Ila | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |