Kieker 1.12

kieker.common.record.misc
Class RegistryRecord

java.lang.Object
  extended by kieker.common.record.AbstractMonitoringRecord
      extended by kieker.common.record.misc.RegistryRecord
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<IMonitoringRecord>, IMonitoringRecord, IMonitoringRecord.BinaryFactory, IMonitoringRecord.Factory

public final class RegistryRecord
extends AbstractMonitoringRecord
implements IMonitoringRecord.Factory, IMonitoringRecord.BinaryFactory

Record used to associate Objects (typically Strings) with unique ids.

Since:
1.5
Author:
Jan Waller
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 CLASS_ID
           
static java.lang.String ENCODING
           
static int SIZE
           
static java.lang.Class<?>[] TYPES
           
 
Fields inherited from class kieker.common.record.AbstractMonitoringRecord
TYPE_SIZE_BOOLEAN, TYPE_SIZE_BYTE, TYPE_SIZE_CHARACTER, TYPE_SIZE_DOUBLE, TYPE_SIZE_FLOAT, TYPE_SIZE_INT, TYPE_SIZE_LONG, TYPE_SIZE_SHORT, TYPE_SIZE_STRING
 
Constructor Summary
RegistryRecord(java.nio.ByteBuffer buffer, IRegistry<java.lang.String> stringRegistry)
          This constructor converts the given array into a record.
RegistryRecord(int id, java.lang.String string)
          Creates a new instance of this class using the given parameters.
RegistryRecord(java.lang.Object[] values)
          This constructor converts the given array into a record.
 
Method Summary
 int getId()
           
 int getSize()
          This method should deliver the size of a binary representation of this record.
 byte[] getStrBytes()
           
 java.lang.String getString()
           
 java.lang.Class<?>[] getValueTypes()
          This method should deliver an array with the classes of the single values for the record.
 void initFromArray(java.lang.Object[] values)
          Deprecated. This record uses the IMonitoringRecord.Factory mechanism. Hence, this method is not implemented.
 void initFromBytes(java.nio.ByteBuffer buffer, IRegistry<java.lang.String> stringRegistry)
          Deprecated. This record uses the IMonitoringRecord.BinaryFactory mechanism. Hence, this method is not implemented.
static void registerRecordInRegistry(java.nio.ByteBuffer buffer, ILookup<java.lang.String> stringRegistry)
          Static function used to register strings stored in a byte buffer as string in the string registry with the proper id.
 java.lang.Object[] toArray()
          This method should deliver an array containing the content of the record.
 void writeBytes(java.nio.ByteBuffer buffer, IRegistry<java.lang.String> stringRegistry)
          This method should deliver an byte array containing the content of the record.
 
Methods inherited from class kieker.common.record.AbstractMonitoringRecord
checkArray, classForName, compareTo, createFromArray, createFromArray, createFromByteBuffer, createFromByteBuffer, createFromStringArray, equals, fromStringArrayToTypedArray, getLoggingTimestamp, hashCode, registerStrings, setLoggingTimestamp, toString, typesForClass
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

SIZE

public static final int SIZE
See Also:
Constant Field Values

TYPES

public static final java.lang.Class<?>[] TYPES

ENCODING

public static final java.lang.String ENCODING
See Also:
Constant Field Values

CLASS_ID

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

RegistryRecord

public RegistryRecord(int id,
                      java.lang.String string)
Creates a new instance of this class using the given parameters.

Parameters:
id - The ID.
string - The string.

RegistryRecord

public RegistryRecord(java.lang.Object[] values)
This constructor converts the given array into a record. It is recommended to use the array which is the result of a call to toArray().

Parameters:
values - The values for the record.

RegistryRecord

public RegistryRecord(java.nio.ByteBuffer buffer,
                      IRegistry<java.lang.String> stringRegistry)
               throws java.nio.BufferUnderflowException
This constructor converts the given array into a record.

Parameters:
buffer - The bytes for the record.
stringRegistry - the string registry to decode the string ids in the byte buffer.
Throws:
java.nio.BufferUnderflowException - if buffer not sufficient
Method Detail

toArray

public java.lang.Object[] toArray()
This method should deliver an array containing the content of the record. It should be possible to convert this array later into a record again.

Specified by:
toArray in interface IMonitoringRecord
Returns:
An array with the values of the record.

writeBytes

public void writeBytes(java.nio.ByteBuffer buffer,
                       IRegistry<java.lang.String> stringRegistry)
                throws java.nio.BufferOverflowException
This method should deliver an byte array containing the content of the record. It should be possible to convert this array later into a record again.

Specified by:
writeBytes in interface IMonitoringRecord
Parameters:
buffer - The used ByteBuffer with sufficient capacity
stringRegistry - Usually the associated MonitoringController
Throws:
java.nio.BufferOverflowException - if buffer not sufficient

initFromArray

@Deprecated
public final void initFromArray(java.lang.Object[] values)
Deprecated. This record uses the IMonitoringRecord.Factory mechanism. Hence, this method is not implemented.

This method should initialize the record based on the given values. The array should be one of those resulting from a call to IMonitoringRecord.toArray().

Specified by:
initFromArray in interface IMonitoringRecord
Parameters:
values - The values for the record.

initFromBytes

@Deprecated
public final void initFromBytes(java.nio.ByteBuffer buffer,
                                           IRegistry<java.lang.String> stringRegistry)
                         throws java.nio.BufferUnderflowException
Deprecated. This record uses the IMonitoringRecord.BinaryFactory mechanism. Hence, this method is not implemented.

This method should initialize the record based on the given values. The array should be one of those resulting from a call to IMonitoringRecord.writeBytes(ByteBuffer, IRegistry).

Specified by:
initFromBytes in interface IMonitoringRecord
Parameters:
buffer - The bytes for the record.
stringRegistry - The Registry storing the strings.
Throws:
java.nio.BufferUnderflowException - if buffer not sufficient

getValueTypes

public java.lang.Class<?>[] getValueTypes()
This method should deliver an array with the classes of the single values for the record.

Specified by:
getValueTypes in interface IMonitoringRecord
Returns:
The types of the values. This returned array should be treated readonly.
See Also:
IMonitoringRecord.toArray()

getSize

public int getSize()
This method should deliver the size of a binary representation of this record.

Specified by:
getSize in interface IMonitoringRecord
Returns:
The size.

getStrBytes

public final byte[] getStrBytes()
Returns:
the String as byte[]

getId

public final int getId()
Returns:
the id

getString

public final java.lang.String getString()
Returns:
the string

registerRecordInRegistry

public static final void registerRecordInRegistry(java.nio.ByteBuffer buffer,
                                                  ILookup<java.lang.String> stringRegistry)
                                           throws java.nio.BufferOverflowException
Static function used to register strings stored in a byte buffer as string in the string registry with the proper id.

Parameters:
buffer - the byte buffer containing the string
stringRegistry - the registry where the string is stored
Throws:
java.nio.BufferOverflowException - if the length encoded in the buffer exceeds the buffers boundary

Kieker 1.12

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