This tutorial will guide you through an example scenario, how the Fosstrak Capturing Application can be used to link the Fosstrak ALE and the Fosstrak EPCIS-repository by retrieving ECReports from the ALE and delivering EPCIS-reports to the EPCIS-repository. The tutorial shows two different solutions to the scenario described below (A simple one and a more elaborate one).
We model a simple store equipped with three RFID readers. One reader (Reader_GoodsReceiving) in the backend, where incoming goods are registered by the staff. A second reader (Reader_PointOfExit) installed at the exit door that either warns about stolen goods or thanks the customer for the purchasing. The third reader (Reader_PointOfSale) is installed at the cash desk.
The preparations need to be performed for both solutions. Please follow the different steps carefully.
We use a simulator to generate the tag input for the Filtering & Collection. The multi reader simulator is capable of simulating several readers in one application, allowing you to move tags from one reader to another.
First unpack hal-impl-sim-VERSION-bin-with-dependencies to a folder of your choice (example c:\fosstrakDemo).
Open a commandline and run the simulator.
cd c:\fosstrakDemo java -cp hal-impl-sim-0.5.0\hal-impl-sim-0.5.0.jar org.fosstrak.hal.impl.sim.multi.SimulatorServerController
If everything runs fine, an empty window should pop up.
If you already have a running instance of an EPCIS-repository, you can safely skip this section. Otherwise follow the installation instructions of the Fosstrak EPCIS-repository. EPCIS-Documentation.
Deploy the Fosstrak Filtering & Collection to your Tomcat webapps folder (by simply copying the war-file into the folder). We need access to the configuration files packed into the war-file, so unpack the war-file into the webapps folder.
Copy the two configuration files SimulatorClient.xml and SimulatorController.xml into the folder webapps\fc-server-VERSION\WEB-INF\classes\props (Overwrite the existing copies).
We recommend you, to adjust the log-level for the Filtering & Collection from either DEBUG or INFO to ERROR. To do so, open the file webapps\fc-server-VERSION\WEB-INF\classes\log4j.properties and adjust the log-level:
file: <TOMCAT_FOLDER>\webapps\fc-server-VERSION\WEB-INF\classes\log4j.properties # class specific levels log4j.logger.org.fosstrak = ERROR
This solution sets up an EventCycle for each reader. This allows the capturing application to distinguish between different readers by the name of the EventCycle.
Please ensure, that you followed the setup in Preparations.
Copy the fc-webclient and the capturing-app war-files into the Tomcat webapps folder und unpack the capturing-app file (We need to adjust a few configuration parameters).
file: <TOMCAT_FOLDER>/webapps/capturing-app-VERSION/WEB-INF/classes/captureapplication.properties n=1 cap.0.port=9999 cap.0.name=myFirstCaptureApp cap.0.epcis=http://localhost:8080/epcis-repository-0.4.2/capture
file: <TOMCAT_FOLDER>/webapps/capturing-app-VERSION/WEB-INF/classes/changeset.xml <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > <add> <resource source='classpath:drools/SimpleWareHouse-3EventCycles.drl' type='DRL' /> </add> </change-set>
http://<SERVER>:<PORT>/<WEBCLIENT_VERSION>/services/ALEWebClient.jsp example: http://localhost:8080/fc-webclient-1.0.1/services/ALEWebClient.jsp
endpoint: http://<SERVER>:<PORT>/<FCSERVER_VERSION>/services/ALELRService example: http://localhost:8080/fc-server-1.0.1/services/ALELRService
Define three readers. Make sure to set the reader names exactly as they are written below.
Example: readerName: Reader_PointOfSale specFilePath: c:\fosstrakDemo\Reader_PointOfSale.xml
http://<SERVER>:<PORT>/<WEBCLIENT_VERSION>/services/ALEWebClient.jsp example: http://localhost:8080/fc-webclient-1.0.1/services/ALEWebClient.jsp
endpoint: http://<SERVER>:<PORT>/<FCSERVER_VERSION>/services/ALEService example: http://localhost:8080/fc-server-1.0.1/services/ALEService
For this scenario we need to create three EventCycles. Make sure to set the names of the EventCycles exactly as they are written below:
Example: specName: EventCycle_PointOfExit specFilePath: c:\fosstrakDemo\EventCycle_PointOfExit.xml
Invoke subscribe(String specName, String notificationUri). For each of the three EventCycles we just created, invoke the registration with the target URL http://localhost:9999.
Example: notificationURI: http://localhost:9999 specName: EventCycle_GoodsReceiving
Now all the applications should be linked together correctly. Switch back to the multi reader simulator and make sure, that you can look at the log-output of Tomcat (the capturing application will print the scenario output to the commandline provided by Tomcat).
Create a few tags (please use the tags from the list below, as they can be translated by the ALE to a meaningful representation).
Tags:
Move one tag on the reader Reader_GoodsReceiving and wait a few seconds. On the commandline a message will be printed informing you about newly registered items.
example: ===================================================== registering new items: urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag on the reader Reader_PointOfExit and wait a few seconds. On the commandline alert messages will be printed, as the goods have taken to the exit without being payed for.
example: ===================================================== !!!!!!!!!!!!! FOUND STOLEN GOODS!!!!!!!!!! urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag on the reader Reader_PointOfSale and wait a few seconds. On the commandline a message will inform you about a customer having purchased some goods.
example: ===================================================== customer purchased items: urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag back on the reader Reader_PointOfExit and a friendly message will be sent to you.
example: ===================================================== Dear customer, thank you for your purchasing. Goodbye =====================================================
If you want to run the demo with the same EPCs again, you need to clean out all the entries in the EPCIS-repository. A clean and dirty way, how you can achieve this, is via the mysql-commandline.
With the MySQL-Commandline client, connect to the MySQL server. Switch into the EPCIS database use epcis;. Then delete all the events delete from event_objectevent;.
This solution sets up one EventCycle retrieving tags from all the readers. Aside the tag information (EPC), the EventCycle delivers also tag stats (with the name of the reader that read the EPC). With this information, the capturing application can determine the name of the reader delivering the EPC.
Please ensure, that you followed the setup in Preparations.
Copy the fc-webclient and the capturing-app war-files into the Tomcat webapps folder und unpack the capturing-app file (We need to adjust a few configuration parameters).
file: <TOMCAT_FOLDER>/webapps/capturing-app-VERSION/WEB-INF/classes/captureapplication.properties n=1 cap.0.port=9999 cap.0.name=myFirstCaptureApp cap.0.epcis=http://localhost:8080/epcis-repository-0.4.2/capture
file: <TOMCAT_FOLDER>/webapps/capturing-app-VERSION/WEB-INF/classes/changeset.xml <change-set xmlns='http://drools.org/drools-5.0/change-set' xmlns:xs='http://www.w3.org/2001/XMLSchema-instance' xs:schemaLocation='http://drools.org/drools-5.0/change-set.xsd' > <add> <resource source='classpath:drools/SimpleWareHouse-1EventCycle.drl' type='DRL' /> </add> </change-set>
http://<SERVER>:<PORT>/<WEBCLIENT_VERSION>/services/ALEWebClient.jsp example: http://localhost:8080/fc-webclient-1.0.1/services/ALEWebClient.jsp
endpoint: http://<SERVER>:<PORT>/<FCSERVER_VERSION>/services/ALELRService example: http://localhost:8080/fc-server-1.0.1/services/ALELRService
Example: readerName: Reader_PointOfSale specFilePath: c:\fosstrakDemo\Reader_PointOfSale.xml
http://<SERVER>:<PORT>/<WEBCLIENT_VERSION>/services/ALEWebClient.jsp example: http://localhost:8080/fc-webclient-1.0.1/services/ALEWebClient.jsp
endpoint: http://<SERVER>:<PORT>/<FCSERVER_VERSION>/services/ALEService example: http://localhost:8080/fc-server-1.0.1/services/ALEService
Example: specName: fosstrakDemo specFilePath: c:\fosstrakDemo\fosstrakDemo.xml
Invoke subscribe(String specName, String notificationUri). Subscribe the capturing application to the results of the event cycle.
Example: notificationURI: http://localhost:9999 specName: fosstrakDemo
Now all the applications should be linked together correctly. Switch back to the multi reader simulator and make sure, that you can look at the log-output of Tomcat (the capturing application will print the scenario output to the commandline provided by Tomcat).
Create a few tags (please use the tags from the list below, as they can be translated by the ALE to a meaningful representation).
Tags:
Move one tag on the reader Reader_GoodsReceiving and wait a few seconds. On the commandline a message will be printed informing you about newly registered items.
example: ===================================================== registering new items: urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag on the reader Reader_PointOfExit and wait a few seconds. On the commandline alert messages will be printed, as the goods have taken to the exit without being payed for.
example: ===================================================== !!!!!!!!!!!!! FOUND STOLEN GOODS!!!!!!!!!! urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag on the reader Reader_PointOfSale and wait a few seconds. On the commandline a message will inform you about a customer having purchased some goods.
example: ===================================================== customer purchased items: urn:epc:raw:96:15001446348594317971238359205 =====================================================
Move the tag back on the reader Reader_PointOfExit and a friendly message will be sent to you.
example: ===================================================== Dear customer, thank you for your purchasing. Goodbye =====================================================
If you want to run the demo with the same EPCs again, you need to clean out all the entries in the EPCIS-repository. A clean and dirty way, how you can achieve this, is via the mysql-commandline.
With the MySQL-Commandline client, connect to the MySQL server. Switch into the EPCIS database use epcis;. Then delete all the events delete from event_objectevent;.