org.fosstrak.capturingapp
Class ECReportsHandler

java.lang.Object
  extended by org.fosstrak.capturingapp.ECReportsHandler
Direct Known Subclasses:
DefaultECReportHandler

public abstract class ECReportsHandler
extends java.lang.Object

An ECReportHandler receives a ECReport and generates a EPCIS document that can be sent to an EPCIS repository. If you would like to implement your own handler, you will find some guide-lines below. In addition you can get inspiration by the default reports handler DefaultECReportHandler.

Default Execution Sequence:

If you do not override the method LinkedList<EPCISDocumentType> handle(ECReports reports), the execution sequence of the handler is as following:
  1. abstract loadRules(): load drools rules from disc.
  2. checkErrors(): checks if errors in the rule-set. If there are errors, an exception is thrown.
  3. registerKnowledgeBase(): Create a new knowledge-base kbase from the kbuilder.
  4. createSession(): Creates a drools session. By default, a StatefulKnowledgeSession is created. Notice, that all subsequent generic methods are programmed in such a way, that they can handle both StatefulKnowledgeSession and StatelessKnowledgeSession.
  5. prepareGlobalCollector(ksession): Registers a collector for the EPCIS documents. If you override the method handle make sure, to call this method before you execute the drools rules as otherwise third-party drools rules might crash.
  6. executeSession(reports):: Execute the drools rules. In StatefulKnowledgeSession the ECReports are injected via insert, in StatelessKnowledgeSession the rules are executed via execute.
  7. collectResults(): Retrieves the results from the global collector and submits them to the capture application for further delivery.

Methods to be implemented: