org.objectweb.petals.tools.webadmin.mbean
Class TimeDatas

java.lang.Object
  extended by org.objectweb.petals.tools.webadmin.mbean.TimeDatas
All Implemented Interfaces:
TimeDatasMBean

public class TimeDatas
extends java.lang.Object
implements TimeDatasMBean


Constructor Summary
TimeDatas()
          Creates a new empty TimeDatas
TimeDatas(java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> datas)
          Creates a new TimeDatas with datas given
 
Method Summary
 int add(java.lang.String datasetName, long timestamp, long number)
          Adds the given pair of values to a dataset stored.
 int addAll(java.lang.String datasetName, java.util.Map<java.lang.Long,java.lang.Long> newDatas)
          Add all values of a given datas to a dataset
 void addDataset(java.lang.String datasetName, java.util.Map<java.lang.Long,java.lang.Long> newDatas)
          Sets a new dataset to store.
 int clear()
          Remove all datas stored
 java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> getDatas()
          Returns the datas, as a Map.
 java.util.Map<java.lang.Long,java.lang.Long> getDatas(java.lang.String datasetName, long sinceTime)
          gets the datas of a dataset from a given time
 java.util.Map<java.lang.Long,java.lang.Long> getDataset(java.lang.String datasetName)
           
 void setDatas(java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> datas)
          Sets datas to a new Map of datasets
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TimeDatas

public TimeDatas()
Creates a new empty TimeDatas


TimeDatas

public TimeDatas(java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> datas)
Creates a new TimeDatas with datas given

Parameters:
datas - a Map of datas to store
Method Detail

add

public int add(java.lang.String datasetName,
               long timestamp,
               long number)
Adds the given pair of values to a dataset stored.

Specified by:
add in interface TimeDatasMBean
Parameters:
datasetName - name of the dataset in which to add the datas
timestamp - a timestamp, used as the key with which the specified number value is to be associated.
number - value to be associated with the specified timestamp.
Returns:
0 if pair is correctly added, 1 if an exception occures

addAll

public int addAll(java.lang.String datasetName,
                  java.util.Map<java.lang.Long,java.lang.Long> newDatas)
Add all values of a given datas to a dataset

Specified by:
addAll in interface TimeDatasMBean
Parameters:
newDatas - datas to be stored
Returns:
0 if datas are correctly added, 1 if an Exception occures

addDataset

public void addDataset(java.lang.String datasetName,
                       java.util.Map<java.lang.Long,java.lang.Long> newDatas)
Sets a new dataset to store. If dataset with a same name already exists, it's replaced with new datas

Specified by:
addDataset in interface TimeDatasMBean
Parameters:
datasetName - name to use for key of the dataset
datas - Map of datas to store

clear

public int clear()
Remove all datas stored

Specified by:
clear in interface TimeDatasMBean
Returns:
0 if datas are correctly erased, 1 if an exception occures

getDatas

public java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> getDatas()
Returns the datas, as a Map.

Specified by:
getDatas in interface TimeDatasMBean
Returns:
a Map of datas stored

getDatas

public java.util.Map<java.lang.Long,java.lang.Long> getDatas(java.lang.String datasetName,
                                                             long sinceTime)
gets the datas of a dataset from a given time

Specified by:
getDatas in interface TimeDatasMBean
Parameters:
datasetName - the name of the dataset
sinceTime - time of search begin
Returns:
a Map representation of the datas, null if dataset is not found

getDataset

public java.util.Map<java.lang.Long,java.lang.Long> getDataset(java.lang.String datasetName)
Specified by:
getDataset in interface TimeDatasMBean

setDatas

public void setDatas(java.util.Map<java.lang.String,java.util.Map<java.lang.Long,java.lang.Long>> datas)
Sets datas to a new Map of datasets

Specified by:
setDatas in interface TimeDatasMBean
Parameters:
datas - Map containing datasets with their name as keys


Copyright © 2005-2007 ObjectWeb Consortium. All Rights Reserved.