Class AbstractData

  • All Implemented Interfaces:
    Data
    Direct Known Subclasses:
    CustomValue, EventData, TimerData

    public abstract class AbstractData
    extends java.lang.Object
    implements Data
    The AbstractData class may be the super class of a special data record class.

    Import change in 7.0: We are not longer automatically capturing the start time when this object is created for performance reasons. You have to set the time explicitly.

    • Field Summary

      • Fields inherited from interface com.xceptance.xlt.api.engine.Data

        DELIMITER
    • Constructor Summary

      Constructors 
      Constructor Description
      AbstractData​(char typeCode)
      Creates a new AbstractData object and gives it the specified type code.
      AbstractData​(java.lang.String name, char typeCode)
      Creates a new AbstractData object and gives it the specified name and type code.
    • Method Summary

      All Methods Instance Methods Abstract Methods Concrete Methods 
      Modifier and Type Method Description
      protected java.util.List<java.lang.String> addValues()
      Builds a list of string values that represents the state of this object.
      void baseValuesFromCSV​(SimpleArrayList<XltCharBuffer> result, XltCharBuffer s)
      Recreates a partial state of this object by reading the data from a buffer s and parsing it as comma-delimited line.
      java.lang.String getAgentName()
      Returns the name of the agent that produced this data record.
      protected int getMinNoCSVElements()
      Returns the minimum number of elements in the CSV string.
      java.lang.String getName()
      Returns the name of this data record.
      long getTime()
      Returns the time when the event occurred that this data record was created for.
      java.lang.String getTransactionName()
      Returns the name of the transaction that produced this data record.
      char getTypeCode()
      Returns the type code of this data record.
      protected void parseBaseValues​(java.util.List<XltCharBuffer> values)
      Recreates the base state: type code, name, and time.
      protected abstract void parseRemainingValues​(java.util.List<XltCharBuffer> values)
      Recreates the state of this object from an array of values.
      void parseValues​(SimpleArrayList<XltCharBuffer> result)
      Mainly for testing, we can recreate the state from a list at once
      void remainingValuesFromCSV​(SimpleArrayList<XltCharBuffer> result)
      Recreates the full state of the object by parsing the remaining data of the passed list.
      void setAgentName​(java.lang.String agentName)
      Sets the name of the agent that produced this data record.
      void setName​(java.lang.String name)
      Sets the name of this data record.
      void setTime​(long time)
      Sets the time when this record's event occurred.
      void setTransactionName​(java.lang.String transactionName)
      Sets the name of the transaction that produced this data record.
      java.lang.StringBuilder toCSV()
      Returns the state of this object as a StringBuilder reflecting a list of values separated by the DELIMITER constant.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • AbstractData

        public AbstractData​(java.lang.String name,
                            char typeCode)
        Creates a new AbstractData object and gives it the specified name and type code.
        Parameters:
        name - the request name
        typeCode - the type code
      • AbstractData

        public AbstractData​(char typeCode)
        Creates a new AbstractData object and gives it the specified type code.
        Parameters:
        typeCode - the type code
    • Method Detail

      • baseValuesFromCSV

        public final void baseValuesFromCSV​(SimpleArrayList<XltCharBuffer> result,
                                            XltCharBuffer s)
        Recreates a partial state of this object by reading the data from a buffer s and parsing it as comma-delimited line. The result is an empty reusable object that is here for speed not functionality. The data will be internally stored and only the most essential state will be recreated first, because later we might filter things out anyway, so why waste cycles. The passed list must be empty and it will be mutated to hold the full parse result.
        Specified by:
        baseValuesFromCSV in interface Data
        Parameters:
        result - reusable list for the parsing results
        s - the csv data as charbuffer
      • parseValues

        public final void parseValues​(SimpleArrayList<XltCharBuffer> result)
        Mainly for testing, we can recreate the state from a list at once
      • remainingValuesFromCSV

        public final void remainingValuesFromCSV​(SimpleArrayList<XltCharBuffer> result)
        Recreates the full state of the object by parsing the remaining data of the passed list. It is the programmers responsibility to make sure that the result list matches the one initially created when calling baseValuesFromCSV. This is an implementation focusing on speed not a nice API aka you can reuse a list over and over again as long as the calling order is right.
        Specified by:
        remainingValuesFromCSV in interface Data
        Parameters:
        result - the previously parsed data as list
      • getAgentName

        public java.lang.String getAgentName()
        Returns the name of the agent that produced this data record. Only used during report generation or analysis.
        Specified by:
        getAgentName in interface Data
        Returns:
        the agent's name
      • getName

        public java.lang.String getName()
        Returns the name of this data record.
        Specified by:
        getName in interface Data
        Returns:
        the name
      • getTime

        public long getTime()
        Returns the time when the event occurred that this data record was created for.
        Specified by:
        getTime in interface Data
        Returns:
        the time
      • getTransactionName

        public java.lang.String getTransactionName()
        Returns the name of the transaction that produced this data record. Only used during report generation or analysis.
        Specified by:
        getTransactionName in interface Data
        Returns:
        the transaction's name
      • getTypeCode

        public char getTypeCode()
        Returns the type code of this data record.
        Specified by:
        getTypeCode in interface Data
        Returns:
        the type code
      • setAgentName

        public void setAgentName​(java.lang.String agentName)
        Sets the name of the agent that produced this data record. Only used during report generation or analysis.
        Specified by:
        setAgentName in interface Data
        Parameters:
        agentName - the agent's name
      • setName

        public void setName​(java.lang.String name)
        Sets the name of this data record.
        Specified by:
        setName in interface Data
        Parameters:
        name - the name
      • setTime

        public void setTime​(long time)
        Sets the time when this record's event occurred. To obtain the timestamp, please use GlobalClock.millis().
        Specified by:
        setTime in interface Data
        Parameters:
        time - the timestamp
      • setTransactionName

        public void setTransactionName​(java.lang.String transactionName)
        Sets the name of the transaction that produced this data record. Only used during report generation or analysis.
        Specified by:
        setTransactionName in interface Data
        Parameters:
        transactionName - the transaction's name
      • toCSV

        public final java.lang.StringBuilder toCSV()
        Returns the state of this object as a StringBuilder reflecting a list of values separated by the DELIMITER constant.
        Specified by:
        toCSV in interface Data
        Returns:
        the list of values as CSV line
      • addValues

        protected java.util.List<java.lang.String> addValues()
        Builds a list of string values that represents the state of this object. Override this method in sub classes to add custom values and use the list created by the super class.
        Returns:
        the list of values
      • getMinNoCSVElements

        protected int getMinNoCSVElements()
        Returns the minimum number of elements in the CSV string.
        Returns:
        minimum number of elements in the CSV string
      • parseBaseValues

        protected void parseBaseValues​(java.util.List<XltCharBuffer> values)
        Recreates the base state: type code, name, and time.
        Parameters:
        values - the list of values, must have at least the length getMinNoCSVElements()
      • parseRemainingValues

        protected abstract void parseRemainingValues​(java.util.List<XltCharBuffer> values)
        Recreates the state of this object from an array of values. Override this method in sub classes to restore custom values.
        Parameters:
        values - the list of values, must have at least the length getMinNoCSVElements()