Kieker 1.11

kieker.common.record
Class AbstractMonitoringRecord

java.lang.Object
  extended by kieker.common.record.AbstractMonitoringRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IMonitoringRecord>, IMonitoringRecord
Direct Known Subclasses:
AbstractEvent, AbstractJVMRecord, AggregationWindow, BranchingRecord, CPUUtilizationRecord, EmptyRecord, KiekerMetadataRecord, MemSwapUsageRecord, NamedDoubleRecord, NamedTSPoint, OperationExecutionRecord, RegistryRecord, ResourceUtilizationRecord, StorableDetectionResult, TimestampRecord, TraceMetadata

public abstract class AbstractMonitoringRecord
extends java.lang.Object
implements IMonitoringRecord

Since:
1.2
Author:
Andre van Hoorn, Jan Waller, Nils Christian Ehmke
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from interface kieker.common.record.IMonitoringRecord
IMonitoringRecord.BinaryFactory, IMonitoringRecord.Factory
 
Field Summary
static int TYPE_SIZE_BOOLEAN
           
static int TYPE_SIZE_BYTE
           
static int TYPE_SIZE_CHARACTER
           
static int TYPE_SIZE_DOUBLE
           
static int TYPE_SIZE_FLOAT
           
static int TYPE_SIZE_INT
           
static int TYPE_SIZE_LONG
           
static int TYPE_SIZE_SHORT
           
static int TYPE_SIZE_STRING
           
 
Constructor Summary
AbstractMonitoringRecord()
           
 
Method Summary
static void checkArray(java.lang.Object[] values, java.lang.Class<?>[] valueTypes)
          This method checks the given arrays, making sure that they have the same length and that the value elements are compatible with the given value types.
static java.lang.Class<? extends IMonitoringRecord> classForName(java.lang.String classname)
          This method tries to find a monitoring record class with the given name.
 int compareTo(IMonitoringRecord otherRecord)
          Provides an ordering of IMonitoringRecords by the loggingTimestamp.
static IMonitoringRecord createFromArray(java.lang.Class<? extends IMonitoringRecord> clazz, java.lang.Object[] values)
          This method creates a new monitoring record from the given data.
static IMonitoringRecord createFromArray(java.lang.String recordClassName, java.lang.Object[] values)
           
static IMonitoringRecord createFromByteBuffer(int clazzid, java.nio.ByteBuffer buffer, IRegistry<java.lang.String> stringRegistry)
          This method creates a new monitoring record from a byte buffer containing a serialized record.
static IMonitoringRecord createFromByteBuffer(java.lang.String recordClassName, java.nio.ByteBuffer buffer, IRegistry<java.lang.String> stringRegistry)
           
static IMonitoringRecord createFromStringArray(java.lang.Class<? extends IMonitoringRecord> clazz, java.lang.String[] values)
          This method creates a new monitoring record from the given data encoded in strings.
 boolean equals(java.lang.Object obj)
           
static java.lang.Object[] fromStringArrayToTypedArray(java.lang.String[] recordFields, java.lang.Class<?>[] valueTypes)
          This helper method converts the given array with string objects into an array containing objects from the specified type.
 long getLoggingTimestamp()
          Delivers the current timestamp of the record.
 int hashCode()
           
 void registerStrings(IRegistry<java.lang.String> stringRegistry)
          Registers the string attributes of the record at the given stringRegistry.
 void setLoggingTimestamp(long timestamp)
          Sets the logging timestamp to a new value.
 java.lang.String toString()
          Creates a string representation of this record.

This method should not be used for serialization purposes since this is not the purpose of Object's toString method.
static java.lang.Class<?>[] typesForClass(java.lang.Class<? extends IMonitoringRecord> clazz)
          This method delivers the types array of the given class, either by finding the declared field (in case of a factory record) or via the getValueTypes method.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface kieker.common.record.IMonitoringRecord
getSize, getValueTypes, initFromArray, initFromBytes, toArray, writeBytes
 

Field Detail

TYPE_SIZE_INT

public static final int TYPE_SIZE_INT
See Also:
Constant Field Values

TYPE_SIZE_LONG

public static final int TYPE_SIZE_LONG
See Also:
Constant Field Values

TYPE_SIZE_FLOAT

public static final int TYPE_SIZE_FLOAT
See Also:
Constant Field Values

TYPE_SIZE_DOUBLE

public static final int TYPE_SIZE_DOUBLE
See Also:
Constant Field Values

TYPE_SIZE_SHORT

public static final int TYPE_SIZE_SHORT
See Also:
Constant Field Values

TYPE_SIZE_BYTE

public static final int TYPE_SIZE_BYTE
See Also:
Constant Field Values

TYPE_SIZE_CHARACTER

public static final int TYPE_SIZE_CHARACTER
See Also:
Constant Field Values

TYPE_SIZE_STRING

public static final int TYPE_SIZE_STRING
See Also:
Constant Field Values

TYPE_SIZE_BOOLEAN

public static final int TYPE_SIZE_BOOLEAN
See Also:
Constant Field Values
Constructor Detail

AbstractMonitoringRecord

public AbstractMonitoringRecord()
Method Detail

getLoggingTimestamp

public final long getLoggingTimestamp()
Description copied from interface: IMonitoringRecord
Delivers the current timestamp of the record.

Specified by:
getLoggingTimestamp in interface IMonitoringRecord
Returns:
The timestamp.

setLoggingTimestamp

public final void setLoggingTimestamp(long timestamp)
Description copied from interface: IMonitoringRecord
Sets the logging timestamp to a new value.

Specified by:
setLoggingTimestamp in interface IMonitoringRecord
Parameters:
timestamp - The new timestamp for the record.

toString

public final java.lang.String toString()
Description copied from interface: IMonitoringRecord
Creates a string representation of this record.

This method should not be used for serialization purposes since this is not the purpose of Object's toString method.

Specified by:
toString in interface IMonitoringRecord
Overrides:
toString in class java.lang.Object
Returns:
A (human readable) string of this record.

compareTo

public int compareTo(IMonitoringRecord otherRecord)
Provides an ordering of IMonitoringRecords by the loggingTimestamp. Classes overriding the implementation should respect this ordering. (see #326)

Specified by:
compareTo in interface java.lang.Comparable<IMonitoringRecord>
Parameters:
otherRecord - The record to be compared.
Returns:
-1 if this object is less than, +1 if it is greater than or 0 if it is equal to the specified record.

equals

public final boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

hashCode

public final int hashCode()
Overrides:
hashCode in class java.lang.Object

checkArray

public static final void checkArray(java.lang.Object[] values,
                                    java.lang.Class<?>[] valueTypes)
This method checks the given arrays, making sure that they have the same length and that the value elements are compatible with the given value types. If the arrays are not compatible, this method throws an IllegalArgumentException.

Parameters:
values - The values.
valueTypes - The value types.

fromStringArrayToTypedArray

public static final java.lang.Object[] fromStringArrayToTypedArray(java.lang.String[] recordFields,
                                                                   java.lang.Class<?>[] valueTypes)
                                                            throws java.lang.IllegalArgumentException
This helper method converts the given array with string objects into an array containing objects from the specified type. (e.g. via the valueOf methods).

Parameters:
recordFields - The array containing the string objects.
valueTypes - The array containing the types the new array will have.
Returns:
An array of objects, converted from the given string array.
Throws:
java.lang.IllegalArgumentException - If one or more of the given types are not supported.

classForName

public static final java.lang.Class<? extends IMonitoringRecord> classForName(java.lang.String classname)
                                                                       throws MonitoringRecordException
This method tries to find a monitoring record class with the given name.

Parameters:
classname - The name of the class.
Returns:
A Class instance corresponding to the given name, if it exists.
Throws:
MonitoringRecordException - If either a class with the given name could not be found or if the class doesn't implement IMonitoringRecord.

typesForClass

public static final java.lang.Class<?>[] typesForClass(java.lang.Class<? extends IMonitoringRecord> clazz)
                                                throws MonitoringRecordException
This method delivers the types array of the given class, either by finding the declared field (in case of a factory record) or via the getValueTypes method.

Parameters:
clazz - The record class.
Returns:
The value types of the specified record.
Throws:
MonitoringRecordException - If this method failed to access the value types.

createFromArray

public static final IMonitoringRecord createFromArray(java.lang.Class<? extends IMonitoringRecord> clazz,
                                                      java.lang.Object[] values)
                                               throws MonitoringRecordException
This method creates a new monitoring record from the given data.

Parameters:
clazz - The class of the monitoring record.
values - The array which will be used to initialize the fields of the record.
Returns:
An initialized record instance.
Throws:
MonitoringRecordException - If this method failed to create the record for some reason.

createFromByteBuffer

public static final IMonitoringRecord createFromByteBuffer(int clazzid,
                                                           java.nio.ByteBuffer buffer,
                                                           IRegistry<java.lang.String> stringRegistry)
                                                    throws MonitoringRecordException,
                                                           java.nio.BufferUnderflowException
This method creates a new monitoring record from a byte buffer containing a serialized record.

Parameters:
clazzid - The class id of the monitoring record.
buffer - The byte buffer containing the data.
stringRegistry - the string registry used to find the correct strings for the given string ids in the serialization.
Returns:
An initialized record instance.
Throws:
MonitoringRecordException - If this method failed to create the record for some reason.
java.nio.BufferUnderflowException - If the byte buffer is to small to hold all necessary information for a record.

createFromStringArray

public static final IMonitoringRecord createFromStringArray(java.lang.Class<? extends IMonitoringRecord> clazz,
                                                            java.lang.String[] values)
                                                     throws MonitoringRecordException
This method creates a new monitoring record from the given data encoded in strings.

Parameters:
clazz - The class of the monitoring record.
values - The string array which will be used to initialize the fields of the record.
Returns:
An initialized record instance.
Throws:
MonitoringRecordException - If this method failed to create the record for some reason.

createFromByteBuffer

public static final IMonitoringRecord createFromByteBuffer(java.lang.String recordClassName,
                                                           java.nio.ByteBuffer buffer,
                                                           IRegistry<java.lang.String> stringRegistry)
                                                    throws java.nio.BufferUnderflowException,
                                                           MonitoringRecordException
Throws:
java.nio.BufferUnderflowException
MonitoringRecordException

createFromArray

public static final IMonitoringRecord createFromArray(java.lang.String recordClassName,
                                                      java.lang.Object[] values)
                                               throws MonitoringRecordException
Throws:
MonitoringRecordException

registerStrings

public void registerStrings(IRegistry<java.lang.String> stringRegistry)
Description copied from interface: IMonitoringRecord
Registers the string attributes of the record at the given stringRegistry.

Specified by:
registerStrings in interface IMonitoringRecord

Kieker 1.11

Copyright 2015 Kieker Project, http://kieker-monitoring.net