Class TraceRecord

java.lang.Object
de.iip_ecosphere.platform.transport.status.TraceRecord

public class TraceRecord extends Object
Optional generic tracing of platform actions. [preliminary]
Author:
Holger Eichelberger, SSE
  • Field Details

    • TRACE_STREAM

      public static final String TRACE_STREAM
      See Also:
    • ACTION_RECEIVING

      public static final String ACTION_RECEIVING
      A data item was received. Payload is the data item.
      See Also:
    • ACTION_SENDING

      public static final String ACTION_SENDING
      A data item was processed and send further. Payload is the data item.
      See Also:
    • ACTION_PARAMETER_CHANGE

      public static final String ACTION_PARAMETER_CHANGE
      A parameter was changed.
      See Also:
    • ACTION_SWITCHING_SERVICE

      public static final String ACTION_SWITCHING_SERVICE
      A family starts switching a service. Payload is the id of the service to switch to.
      See Also:
    • ACTION_SWITCHED_SERVICE

      public static final String ACTION_SWITCHED_SERVICE
      A family completed switching a service. Payload is the id of the actual service (may be the old one).
      See Also:
    • source

      private String source
    • timestamp

      private long timestamp
    • action

      private String action
    • payload

      private Object payload
  • Constructor Details

    • TraceRecord

      TraceRecord()
      Creates a trace record. [serialization]
    • TraceRecord

      public TraceRecord(String source, String action, Object payload)
      Creates a trace record with the current time as timestamp.
      Parameters:
      source - the source of the record
      action - the action
      payload - arbitrary payload
    • TraceRecord

      public TraceRecord(String source, long timestamp, String action, Object payload)
      Creates a trace record.
      Parameters:
      source - the source of the record
      timestamp - the timestamp indicating the creation of the record
      action - the action
      payload - arbitrary payload
  • Method Details

    • getSource

      public String getSource()
      Returns the source of the record.
      Returns:
      the source, may be a service id, an AAS URL, ...
    • setSource

      void setSource(String source)
      Defines the source of the record.
      Parameters:
      source - the source, may be a service id, an AAS URL, ...
    • getTimestamp

      public long getTimestamp()
      Returns the timestamp of record creation.
      Returns:
      the timestamp
    • setTimestamp

      void setTimestamp(long timestamp)
      Changes the timestamp of record creation.
      Parameters:
      timestamp - the timestamp
    • getAction

      public String getAction()
      Characterizes the action causing the creation of the record.
      Returns:
      the action, e.g., classification; may be empty
    • setAction

      void setAction(String action)
      Changes the action causing the creation of the record.
      Parameters:
      action - the action, e.g., classification; may be empty
    • getPayload

      public Object getPayload()
      Returns the (arbitrary) payload.
      Returns:
      the payload, may be null
    • setPayload

      void setPayload(Object payload)
      Changes the (arbitrary) payload.
      Parameters:
      payload - the payload, may be null
    • send

      public void send(TransportConnector conn) throws IOException
      Sends this message to the given connector on #TRACE_STREAM. [convenience]
      Parameters:
      conn - the connector
      Throws:
      IOException - if sending fails
    • ignoreClass

      public static void ignoreClass(Class<?> cls)
      Registers a type to be ignored when serializing trace record (payloads). [convenience]
      Parameters:
      cls - the class representing the type to be ignored
    • ignoreField

      public static void ignoreField(Class<?> cls, String field)
      Registers a field to be ignored when serializing trace record (payloads). [convenience]
      Parameters:
      cls - the class representing the type containing the field
      field - the field to be ignored
    • ignoreFields

      public static void ignoreFields(Class<?> cls, String... fields)
      Registers fields to be ignored when serializing trace record (payloads). [convenience]
      Parameters:
      cls - the class representing the type containing the field
      fields - the fields to be ignored
    • clearIgnores

      public static void clearIgnores()
      Clears all ignored types and fields. [convenience]