Command Flow

From RifidiWiki

Jump to: navigation, search


This page shows how commands go through the components in the engine. In particular it describes the various transformations that a single message goes through.

How a command flows through the engine
  1. Commands are sent to the TCP Incomming buffer which is located inside the TCP Socket. The Stream Reader is a reader-specific class designed to read bytes off of the socket. It is needed because some types of readers, such as the Alien, use plain text for their commands, so it is easier to use a readLine() method to read from the socket. Other readers, such as the LLRP reader need to use a readByte() method, because the commands are byte strings.
  2. From there, the command moves to the protocol. The Protocol is a reader-specific class that performs two functions:
    1. It removes any kind of protocol that the reader uses to communicate, such as HTTP
    2. It is possible for a client to send two commands at once. If this happens, The protocol breaks up multiple commands and places each one on the Incomming Message Buffer to be processed individually.
  3. After a Command is placed onto the Incomming Message Buffer, the buffer notifies the command controller to take off the next command from it
  4. Next the command goes through the command Formatter, which transforms the message from a sequence of bytes into a command object that can be executed in a handler method
  5. The Adapter uses the newly formed command object and the command searcher to look up a handler method name in the reader.xml file. After it finds the handler method which should process the command, it invokes the handler method using reflection.
  6. The handler method processes the command in some specific way. For example, if the command is 'get taglist' in an alien reader, it will scan the radio and collect the tag information. The radio will read the reader's tag memory. The handler method will put any return value into the command object and return back to the adapter.
  7. The adapter now passes the command back through the formatter to turn the command object into a response message.
  8. The command formatter will place the outgoing message onto the outgoing message buffer
  9. The Buffer will pass the message back through the protocol to add back in a protocol if it needs to be done
  10. The TCP Outgoing Buffer will send the response back to the clien
Personal tools