Class DataProviderScriptingModule

java.lang.Object
org.eclipse.tracecompass.incubator.scripting.core.data.provider.DataProviderScriptingModule

public class DataProviderScriptingModule extends Object
Scripting module to create data providers from scripted analyzes. Data providers are used to define what and how data will be exported, either as views or other means of exportation.

Example scripts with data providers can be found here:

Author:
Geneviève Bastien
  • Field Details

  • Constructor Details

    • DataProviderScriptingModule

      public DataProviderScriptingModule()
  • Method Details

    • createTimeGraphProvider

      public @Nullable ITimeGraphDataProvider<TimeGraphEntryModel> createTimeGraphProvider(IAnalysisModule analysis, Map<String,Object> data, @ScriptParameter(defaultValue="") String dpName)
      Create a data driven time graph provider from one of the built-in analysis's state system. This will use the specified data to get the entries and row data from the state system. When the data cannot be obtained in a straight-forward manner from the state system, the createScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function) method can be used instead.

      The possible keys for the data are:

      • ENTRY_PATH: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'
      • ENTRY_DISPLAY: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be used
      • ENTRY_NAME: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.
      • ENTRY_ID: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using the ENTRY_PARENT.
      • ENTRY_PARENT: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with the ENTRY_ID to create a hierarchy between the entries.
      Parameters:
      analysis - The analysis for which to create a time graph provider
      data - The time graph provider data
      dpName - The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title
      Returns:
      The time graph data provider
    • createTimeGraphProvider

      public @Nullable ITimeGraphDataProvider<TimeGraphEntryModel> createTimeGraphProvider(ScriptedAnalysis analysis, Map<String,Object> data, @ScriptParameter(defaultValue="") String dpName)
      Create a data driven time graph provider from a scripted analysis's state system. This will use the specified data to get the entries and row data from the state system. When the data cannot be obtained in a straight-forward manner from the state system, the createScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function) method can be used instead.

      The possible keys for the data are:

      • ENTRY_PATH: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*'
      • ENTRY_DISPLAY: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be used
      • ENTRY_NAME: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name.
      • ENTRY_ID: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using the ENTRY_PARENT.
      • ENTRY_PARENT: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with the ENTRY_ID to create a hierarchy between the entries.
      Parameters:
      analysis - The analysis for which to create a time graph provider
      data - The time graph provider data
      dpName - The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title
      Returns:
      The time graph data provider
    • createXYProvider

      public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> createXYProvider(IAnalysisModule analysis, Map<String,Object> data, @ScriptParameter(defaultValue="") String dpName)
      Create a data driven xy data provider from one of the built-in analyses. This will use the specified data to get the entries from the state system. ENTRY_PATH: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*' ENTRY_DISPLAY: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be used ENTRY_NAME: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name. ENTRY_ID: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using the ENTRY_PARENT. ENTRY_PARENT: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with the ENTRY_ID to create a hierarchy between the entries. ENTRY_DELTA: Specify the entry type. If it’s true, it will display the delta value of the entry otherwise it will show the absolute value of the entry.
      Parameters:
      analysis - The analysis for which to create a time graph provider
      data - The XY chart data
      dpName - The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title
      Returns:
      The XY data provider
    • createXYProvider

      public @Nullable ITmfTreeXYDataProvider<ITmfTreeDataModel> createXYProvider(ScriptedAnalysis analysis, Map<String,Object> data, @ScriptParameter(defaultValue="") String dpName)
      Create a data driven xy data provider from a scripted analysis. This will use the specified data to get the entries from the state system. ENTRY_PATH: MANDATORY, specifies the path in the state system (including wildcards) that is the root of the entries. For all root attributes, use '*' ENTRY_DISPLAY: The path from the entry's root of the attribute to display. If not specified, the root attribute itself will be used ENTRY_NAME: The path from the entry's root of the attribute that contains the name. If not specified, the name will be the attribute's name. ENTRY_ID: The path from the entry's root of the attribute that contains an identifier for this entry. The identifier can be used to build hierarchies of entries using the ENTRY_PARENT. ENTRY_PARENT: The path from the entry's root of the attribute that contains the parent's ID. This data will be used along with the ENTRY_ID to create a hierarchy between the entries. ENTRY_DELTA: Specify the entry type. If it’s true, it will display the delta value of the entry otherwise it will show the absolute value of the entry.
      Parameters:
      analysis - The scripted analysis for which to create a time graph provider
      data - The XY chart options
      dpName - The unique name of this data provider. If not set, the analysis name will be used. Output of this data provider will use this name as the title
      Returns:
      The XY data provider
    • createEntry

      public @Nullable ITmfTreeDataModel createEntry(String name, Map<String,Object> data)
      Create a time graph entry. This method will typically be used by scripts to create entries for data provider generated by the createScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function) method.
      Parameters:
      name - The name (label) of the entry
      data - A map of fields to create the entry. Possible fields are ENTRY_FIELD_QUARK (quark in the state system to use for the data. If not specified, it is expected the data provider will provide a method to retrieve the data), and ENTRY_FIELD_PARENT_ID for the ID of the parent entry
      Returns:
      A new entry model
    • createArrow

      public @Nullable ITimeGraphArrow createArrow(long sourceId, long destinationId, long time, long duration, int value)
      Create an arrow for a time graph data provider. This method will typically be used by scripts to create entries for data provider generated by the createScriptedTimeGraphProvider(ScriptedAnalysis, Function, Function, Function) method.
      Parameters:
      sourceId - the ID of the source entry of the arrow
      destinationId - The ID of the destination entry of the arrow
      time - The start time of the arrow
      duration - The duration of the arrow
      value - The value to associate with this arrow
      Returns:
      The new arrow
    • createScriptedTimeGraphProvider

      public ITimeGraphDataProvider<ITimeGraphEntryModel> createScriptedTimeGraphProvider(ScriptedAnalysis analysis, Function<Map<String,Object>,@Nullable List<ITimeGraphEntryModel>> entryMethod, @Nullable Function<Map<String,Object>,@Nullable List<ITimeGraphRowModel>> rowModelMethod, @Nullable Function<Map<String,Object>,@Nullable List<ITimeGraphArrow>> arrowMethod)
      Create a data provider from scripted functions. The script itself is responsible for generating the entries, optionally row data and arrows. For a simple state system, the createTimeGraphProvider(ScriptedAnalysis, Map, String) may be used instead
      Parameters:
      analysis - The analysis this data provider is for
      entryMethod - The function this data provider will use to get the entries. This parameter is mandatory.
      rowModelMethod - The function this data provider will use to get the row data for time ranges. If none is specified, the entries are expected to have a quark indicating which row in the state system to use for the data.
      arrowMethod - The function this data provider will use to get the arrow data for time ranges. If none is specified, no arrows will be drawn.
      Returns:
      A time graph data provider