Implementation of stateful and stateless.
Appendix A illustrates how to implement the Bean Provider interface. This code is in the BeanProviderImpl.java file, located in the WindwardReports.jar file. This is a do-nothing bean. If you set this as a bean in a tag, it would be identical to not having the bean there.
Appendix B illustrates how to use a bean in a template.
Appendix C illustrates how to use beans when calling WR directly.
Appendix D illustrates how to use beans when running WR as a server.
The stateful and stateless methods are totally dependent on what you need when running from the report server. Unless you are 100% certain you will never use your bean via the report server, make sure you have written and tested your beans via the report server.
The best rule of thumb for the bean interface is this – it’s simple. The code inside your bean may be complex, but the interface comes down to four methods called, depending on the tag they are used within, and two to four methods that are called as the report is started and ended.
The method StatelessBeanProvider.serverSetup() is called on an instantiated bean once, right after the Report Server creates it. It is passed a set of properties that are set in the Report Server’s configuration file. The information for this file is in the System Administrator’s Guide.
The method StatelessBeanProvider.serverTeardown() is called when the Report Server is shutdown. If the Report Server is not shut down but is instead terminated (i.e. the process is just killed), this method will not be called.
These methods are not called when the bean is used via direct Java calls to Windward Reports.
The method StatefulBeanProvider.reportSetup() is called on an instantiated bean once, right after the bean is created. At this point in time, the passed in ProcessReport object has completed the ProcessReport.processSetup() call but has not yet processed any data sources.
The method StatefulBeanProvider.reportTeardown() is called after the report has been generated. This is the last call that will be made to the bean. In the case of a bean used by the Report Server, the bean will be available for garbage collection after this call. In the case of a bean passed in direct Java access, the bean belongs to the calling program at this time.
The method StatefulBeanProvider.datasourceSetup() is called before each data source is applied to the report. The method StatefulBeanProvider.datasourceTeardown() is called after each data source is applied to the report.
Therefore, these methods will be called once, in a pair, for each data source applied to the report. If the same data source is applied multiple times, these methods will be called multiple times for that data source.