org.opends.testqa.monitoringclient
Class DatasBuffer

java.lang.Object
  extended by org.opends.testqa.monitoringclient.DatasBuffer

public class DatasBuffer
extends java.lang.Object

Buffer to store the datas retrieved by the producers.


Constructor Summary
DatasBuffer(MonitoringClient client)
          Construct a DatasBuffer object.
 
Method Summary
 boolean addAttributeToMonitor(java.lang.String attribute, java.util.Properties params)
          Add an attribute to monitor.
 DatasBuffer clone()
          Clone the DatasBuffer and reset it if all the consumers have cloned it.
 boolean containsData(java.lang.String attribute, java.util.Properties parameters)
          Test if the DatasBuffer contains a data.
 void dataError(Data d, java.lang.String message)
          Fill a data with the error code and create a new error.
 java.util.Vector<Data> getAllDatas()
          Return the datas retrieved by the producers.
 java.util.Vector<Data> getAttributesToMonitor(java.lang.String protocol)
          Returns the attributes to monitor for a well known protocol.
 Data getData(java.lang.String attribute, java.util.Properties parameters)
          Returns the specified data.
 java.util.Date getDate()
          Return the date of the datas.
 boolean isFull()
          Test if the DatasBuffer is full.
 void protocolError(java.lang.String protocol, java.lang.String message)
          Fill all the datas of a well known protocol with the error code and create a general error.
 Data removeAttributeToMonitor(java.lang.String attribute, java.util.Properties params)
          Remove an attribute to monitor.
 void setData(Data d, java.lang.String value, int timer)
          Sets a data in the buffer.
 void timeoutExpired()
          If the buffer isn't full, fill the empty data with the error code and wake up the consumers; else, reset the date and the number of consumers.
 void verifyDatas(java.lang.String protocol)
          Verify if all the attribute to monitor of a protocol have been set.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DatasBuffer

public DatasBuffer(MonitoringClient client)
Construct a DatasBuffer object.

Parameters:
client - The main class of the client.
Method Detail

addAttributeToMonitor

public boolean addAttributeToMonitor(java.lang.String attribute,
                                     java.util.Properties params)
Add an attribute to monitor.

Parameters:
params - The parameters to monitor the attribute.
attribute - The name of the attibute to monitor.
Returns:
true if the attribute have been add; false otherwise.

removeAttributeToMonitor

public Data removeAttributeToMonitor(java.lang.String attribute,
                                     java.util.Properties params)
Remove an attribute to monitor.

Parameters:
attribute - The name of the attibute to monitor.
params - The parameters to monitor the attribute.
Returns:
true if the attribute have been removed; false otherwise.

getAttributesToMonitor

public java.util.Vector<Data> getAttributesToMonitor(java.lang.String protocol)
Returns the attributes to monitor for a well known protocol.

Parameters:
protocol - The name of the protocol.
Returns:
The attributes to monitor.

containsData

public boolean containsData(java.lang.String attribute,
                            java.util.Properties parameters)
Test if the DatasBuffer contains a data.

Parameters:
attribute - The name of the attibute monitored.
parameters - The parameters to monitor the attribute.
Returns:
true if the DatasBuffer contains a data, false otherwise.

getData

public Data getData(java.lang.String attribute,
                    java.util.Properties parameters)
Returns the specified data.

Parameters:
attribute - The name of the attibute monitored.
parameters - The parameters to monitor the attribute.
Returns:
The data with the specified protocol and attribute

setData

public void setData(Data d,
                    java.lang.String value,
                    int timer)
Sets a data in the buffer.

Parameters:
d - The data to set
value - The value of the attribute monitored.
timer - The number of milliseconds beetween the launch of the request and the creation of the data.

verifyDatas

public void verifyDatas(java.lang.String protocol)
Verify if all the attribute to monitor of a protocol have been set.

Parameters:
protocol - The name of the protocol used to retrieve the datas.

timeoutExpired

public void timeoutExpired()
If the buffer isn't full, fill the empty data with the error code and wake up the consumers; else, reset the date and the number of consumers.


protocolError

public void protocolError(java.lang.String protocol,
                          java.lang.String message)
Fill all the datas of a well known protocol with the error code and create a general error.

Parameters:
protocol - The name of the protocol.
message - The message of the error.

dataError

public void dataError(Data d,
                      java.lang.String message)
Fill a data with the error code and create a new error.

Parameters:
d - The data who has the error.
message - The message of the error.

getAllDatas

public java.util.Vector<Data> getAllDatas()
Return the datas retrieved by the producers.

Returns:
The datas retrieved by the producers.

getDate

public java.util.Date getDate()
Return the date of the datas.

Returns:
The date of the datas.

clone

public DatasBuffer clone()
Clone the DatasBuffer and reset it if all the consumers have cloned it.

Overrides:
clone in class java.lang.Object
Returns:
A clone of the DatasBuffer.

isFull

public boolean isFull()
Test if the DatasBuffer is full.

Returns:
true if the DatasBuffer is full; false otherwise.