DefaultDiskPublisher

In package com.cdsap.talaiot.publisher.graphpublisher

class com.cdsap.talaiot.publisher.graphpublisher.DefaultDiskPublisher

Abstract class implementing DiskPublisher. Use this class if you need to compose the output of one GraphPublisher writing in Disk the next format: HEADER + CONTENT + LEGEND + FOOTER Consumers should implement how to write the legend, nodes and edges.

Fields

open var logTracker: LogTracker

LogTracker to print in console depending on the Mode

open var fileWriter: FileWriter

File I/O utility

Constructors

constructor(logTracker: LogTracker, fileWriter: FileWriter)

Abstract class implementing DiskPublisher. Use this class if you need to compose the output of one GraphPublisher writing in Disk the next format: HEADER + CONTENT + LEGEND + FOOTER Consumers should implement how to write the legend, nodes and edges.

Parameters:

Methods

abstract fun formatNode(internalId: Int, module: String, taskName: String, numberDependencies: Int, cached: Boolean): String

Abstract function to format the information related with the node. Depending on the Publisher we may want to format the node representation on different way. Node here represent a tracked Task with Talaiot

Parameters:
  • internalId: Int

    internalId for the node

  • module: String

    module which belongs the task

  • taskName: String

    name of the task tracked

  • numberDependencies: Int

    number of task dependencies

  • cached: Boolean

    represents if the task has been cached during the execution

abstract fun formatEdge(from: Int, to: Int?): String

Abstract function to format the information related with the edge.

Parameters:
  • from: Int

    origin of the relation, internalId

  • to: Int?

    destination of the relation, internalId

It builds a String with the different parts of the required format defined. This format is composed by a header a content and a footer. Optionally it can be defined a legend. Used by the HtmlPublisher

Parameters:
  • task: String

    content related with the results formatted of the tracked build

  • header: String

    header of the file

  • legend: String?

    legend to represent the information included in the graph, optional.

  • footer: String

    footer of the file

fun writeFile(contentFile: String, name: String)
Parameters:
  • contentFile: String
  • name: String
fun buildGraph(report: ExecutionReport): String

Once we have the results of the build(metrics + tasks), we need to build graph with the relation between the tasks. The implementations of the abstract class will require the construction of the graph. The format of the graph is given by the formatNode and formatEdge of this class.

Parameters: