Difference between revisions of "Package Structure for a reader project"

From RifidiWiki

Jump to: navigation, search
(org.rifidi.emulator.reader.READERNAME.protocol)
m (Reverted edits by Amesycyxa (Talk); changed back to last version by Stefan)
 
(12 intermediate revisions by 4 users not shown)
Line 5: Line 5:
 
This page enumerates the very basic packages that a reader will need to have and the important files in each one.  Complex readers will have more packages than these, but this is a bare minimum.  These packages correspond with what you will need to program in [[Reader_Development_Stages#Stage_2_Reader_Core_Implementation| stage 2 of reader creation]].
 
This page enumerates the very basic packages that a reader will need to have and the important files in each one.  Complex readers will have more packages than these, but this is a bare minimum.  These packages correspond with what you will need to program in [[Reader_Development_Stages#Stage_2_Reader_Core_Implementation| stage 2 of reader creation]].
 
==org.rifidi.emulator.reader.READERNAME==
 
==org.rifidi.emulator.reader.READERNAME==
This package just contains the osgi activator.  It should be created for you automatically when you create the project.  You shouldn't have to modify it.
+
This package just contains the osgi activator.  It should be created for you automatically when you create the project.  You have to modify it only to make sure it sets up the reader. [[Reader_Activator.java|Activator.java]]
==org.rifidi.emualtor.reader.READERNAME.command.exception==
+
 
 +
==org.rifidi.emulator.reader.READERNAME.command.exception==
 
This package contains a file that handles exceptions that occur in the parsing and execution of reader commands.
 
This package contains a file that handles exceptions that occur in the parsing and execution of reader commands.
*[[READERNAME_ExceptionHanlder.java]]  
+
*[[READERNAME_ExceptionHandler.java]]
==org.rifidi.emualtor.reader.READERNAME.commandhandler==
+
 
 +
==org.rifidi.emulator.reader.READERNAME.commandhandler==
 
This package contains one or more files that handle incoming reader messages.  Normally commands can be divided into general categories.  For example, with the LLRP reader, there are a set of commands that deal with ROSPec messages (such as ADD_ROSPEC, ENABLE_ROSPEC, etc.) and a separate set of commands that deal with AccessSpec messages (such as ADD_ACCESSSPEC, ENABLE_ACCESSSPEC).  So for the LLRP reader, there is one file called 'LLRPReaderOperationControl.java' that contains the handler methods for ROSpec commands and  a file called 'LLRPAccessControl.java' that contains the handler methods for AccessSpec commands.   
 
This package contains one or more files that handle incoming reader messages.  Normally commands can be divided into general categories.  For example, with the LLRP reader, there are a set of commands that deal with ROSPec messages (such as ADD_ROSPEC, ENABLE_ROSPEC, etc.) and a separate set of commands that deal with AccessSpec messages (such as ADD_ACCESSSPEC, ENABLE_ACCESSSPEC).  So for the LLRP reader, there is one file called 'LLRPReaderOperationControl.java' that contains the handler methods for ROSpec commands and  a file called 'LLRPAccessControl.java' that contains the handler methods for AccessSpec commands.   
 
*[[READERNAME_CATEGORY_Handler.java]]
 
*[[READERNAME_CATEGORY_Handler.java]]
==org.rifidi.emualtor.reader.READERNAME.formatter==
+
==org.rifidi.emulator.reader.READERNAME.formatter==
 
Any kind of formatters used should go into this package.  You will definitely need a formatter that handles the parsing of incoming and outgoing commands called  
 
Any kind of formatters used should go into this package.  You will definitely need a formatter that handles the parsing of incoming and outgoing commands called  
 
*[[READERNAME_CommandFormatter.java]]
 
*[[READERNAME_CommandFormatter.java]]
 
But you may also need formatters such as  
 
But you may also need formatters such as  
*[[READERNAME_LogFormatter.java]]
+
*[[READERNAME_LogFormatter.java]] (not required)
 
that handles how incoming and outgoing messages should look in the log file.
 
that handles how incoming and outgoing messages should look in the log file.
 
Another useful formatter that may be necessary is
 
Another useful formatter that may be necessary is
*[[READERNAME_StreamReaderFormatter.java]]
+
*[[READERNAME_StreamReaderFormatter.java]] (not required)
 
that controls how bytes are read off of and written to the TCPSocket.
 
that controls how bytes are read off of and written to the TCPSocket.
 +
 
==org.rifidi.emulator.reader.READERNAME.protocol==
 
==org.rifidi.emulator.reader.READERNAME.protocol==
 
The protocol package contains one file whose purpose is twofold.  The protocol needs to:
 
The protocol package contains one file whose purpose is twofold.  The protocol needs to:
 
#strip any extra protocol-- such as HTTP that the reader uses to communicate-- off of incoming messages and apply these protocols back to outgoing messages.
 
#strip any extra protocol-- such as HTTP that the reader uses to communicate-- off of incoming messages and apply these protocols back to outgoing messages.
 
#Sometimes two or more commands can be read off of the TCP socket at the same time if the messages are sent quickly.  Therefore the protocol needs to make sure that each command is placed on the incoming buffer individually.
 
#Sometimes two or more commands can be read off of the TCP socket at the same time if the messages are sent quickly.  Therefore the protocol needs to make sure that each command is placed on the incoming buffer individually.
*[[READER_Protocol.java]]
+
*[[READERNAME_Protocol.java]]
 +
 
 +
==org.rifidi.emulator.reader.READERNAME.module==
 +
The module is the heart of the reader.  It contains all the essential classes to get the reader up and running.
 +
*[[reader.xml]] is a file that has the mappings between command names and handler methods
 +
*[[emulator.xml]] is a file that contains with some basic configuration information
 +
*[[REDERNAME_Module.java]] has the constructor for the reader
 +
*[[READERNAME_ReaderSharedResources.java]] - The shared resources for this reader.  It allows various pieces of the reader to be accessed in different parts.
 +
*[[READERNAME_ReaderModuleOnPowerState.java]] - contains the transition functions for how to go from on->off and on->suspend
 +
*[[READERNAME_ReaderModuleOffPowerState.java]] - contains the transition functions for how to go from off->on
 +
*[[READERNAME_ReaderModuleSuspendPowerState.java]] - contains the transition functions for how to go from suspended->on and suspended->off
  
==org.rifidi.emualtor.reader.READERNAME.module==
+
==org.rifidi.emulator.reader.READERNAME.tagbuffer==
==org.rifidi.emualtor.reader.READERNAME.tagbuffer==
+
Because every real reader has a slightly different way that they remember tags, each virtual reader will need a class to handle tag reads.
 +
* [[READERNAME_TagMemory.java]] is a class that keeps up with tag reads for the reader.

Latest revision as of 19:40, 26 November 2010


Please refer to this document to figure out how to create a new reader project in eclipse

This page enumerates the very basic packages that a reader will need to have and the important files in each one. Complex readers will have more packages than these, but this is a bare minimum. These packages correspond with what you will need to program in stage 2 of reader creation.

org.rifidi.emulator.reader.READERNAME

This package just contains the osgi activator. It should be created for you automatically when you create the project. You have to modify it only to make sure it sets up the reader. Activator.java

org.rifidi.emulator.reader.READERNAME.command.exception

This package contains a file that handles exceptions that occur in the parsing and execution of reader commands.

org.rifidi.emulator.reader.READERNAME.commandhandler

This package contains one or more files that handle incoming reader messages. Normally commands can be divided into general categories. For example, with the LLRP reader, there are a set of commands that deal with ROSPec messages (such as ADD_ROSPEC, ENABLE_ROSPEC, etc.) and a separate set of commands that deal with AccessSpec messages (such as ADD_ACCESSSPEC, ENABLE_ACCESSSPEC). So for the LLRP reader, there is one file called 'LLRPReaderOperationControl.java' that contains the handler methods for ROSpec commands and a file called 'LLRPAccessControl.java' that contains the handler methods for AccessSpec commands.

org.rifidi.emulator.reader.READERNAME.formatter

Any kind of formatters used should go into this package. You will definitely need a formatter that handles the parsing of incoming and outgoing commands called

But you may also need formatters such as

that handles how incoming and outgoing messages should look in the log file. Another useful formatter that may be necessary is

that controls how bytes are read off of and written to the TCPSocket.

org.rifidi.emulator.reader.READERNAME.protocol

The protocol package contains one file whose purpose is twofold. The protocol needs to:

  1. strip any extra protocol-- such as HTTP that the reader uses to communicate-- off of incoming messages and apply these protocols back to outgoing messages.
  2. Sometimes two or more commands can be read off of the TCP socket at the same time if the messages are sent quickly. Therefore the protocol needs to make sure that each command is placed on the incoming buffer individually.

org.rifidi.emulator.reader.READERNAME.module

The module is the heart of the reader. It contains all the essential classes to get the reader up and running.

org.rifidi.emulator.reader.READERNAME.tagbuffer

Because every real reader has a slightly different way that they remember tags, each virtual reader will need a class to handle tag reads.

Personal tools