Package com.xceptance.xlt.api.report

# Interface ReportProvider

All Superinterfaces:
  `ReportCreator`

All Known Implementing Classes:
  `AbstractReportProvider`

public interface ReportProvider extends ReportCreator
The `ReportProvider` defines the interface that custom report providers must implement to take part in report generation.

The process of generating the test report comprises of two steps:

1. Data processing: Each data record logged during the test is passed to each report provider. If a report provider is not interested in a certain data record, it simply ignores it. Otherwise, it updates internal statistics. Note that the passed data records should not be stored internally as this may cause memory problems.
2. Report fragment generation: After all data records have been processed, each report provider is asked to generate its share of the test report from the information gathered during data processing.

   The final test report is an XML file. Each report provider creates a section of the test report. However, the fragment returned need not be an XML snippet, but can be an ordinary structured Java object, for example:

        @XStreamAlias("general")
        public class GeneralReport
        {
            public long bytesSent;

            public long bytesReceived;

            public long hits;

            public Date startTime;

            public Date endTime;

            public int duration;
        }

   This object and its attributes are automatically converted to XML by the report generator framework:

        <general>
            <bytesSent>3911638522</bytesSent>
            <bytesReceived>368679396567</bytesReceived>
            <hits>23463398</hits>
            <startTime>2009-02-18 00:15:19.632 CET</startTime>
            <endTime>2009-02-18 08:20:57.951 CET</endTime>
            <duration>29138</duration>
          </general>

   This XML snippet is finally inserted into the test report.

   Note that this conversion to XML is done via the XStream library. This means, by using the XStream annotations `@XStreamAlias` and `@XStreamImplicit` with the report object, one has some control how the object's state is represented in XML.

Report provider implementations must be registered with the framework by listing them in the file "xlt/config/reportgenerator.properties". This file may also be used to hold additional implementation specific configuration values. Use `ReportProviderConfiguration.getProperties()` to get access to these values.

See Also:
  - `AbstractReportProvider`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `boolean`
  `lock()`
  Tries to lock this provider for data record processing.
  `void`
  `processAll(PostProcessedDataContainer dataContainer)`
  Processes all data records in the passed container to gather information needed for the test report.
  `void`
  `processDataRecord(Data data)`
  Processes the passed data record to gather information needed for the test report.
  `void`
  `setConfiguration(ReportProviderConfiguration config)`
  Sets the report provider's configuration.
  `void`
  `unlock()`
  Unlocks this provider after data record processing has finished.
  `default boolean`
  `wantsDataRecords()`
  Announce that we want to actually see data for processDataRecord because it might happen that we have some report providers which are using other data

  ### Methods inherited from interface com.xceptance.xlt.api.report.ReportCreator

  `createReportFragment`

- ## Method Details

  - ### processDataRecord

    void processDataRecord(Data data)
    Processes the passed data record to gather information needed for the test report. Typically, only some internal statistics will be updated.
    Parameters:
      `data` - the data record to process

  - ### processAll

    void processAll(PostProcessedDataContainer dataContainer)
    Processes all data records in the passed container to gather information needed for the test report. Typically, only some internal statistics will be updated.

    This method should call `processDataRecord(Data)` for each data record in the container.

    Parameters:
      `dataContainer` - the data records to process

  - ### setConfiguration

    void setConfiguration(ReportProviderConfiguration config)
    Sets the report provider's configuration. Use the configuration object to get access to general as well as provider-specific properties stored in the global configuration file.
    Parameters:
      `config` - the report provider configuration

  - ### wantsDataRecords

    default boolean wantsDataRecords()
    Announce that we want to actually see data for processDataRecord because it might happen that we have some report providers which are using other data
    Returns:
      true if it needs data false otherwise

  - ### lock

    boolean lock()
    Tries to lock this provider for data record processing.
    Returns:
      `true` if the lock could be acquired, `false` if this provider is already locked by another thread

  - ### unlock

    void unlock()
    Unlocks this provider after data record processing has finished.