changeset 600:6bb30e80f53a

Replace Storage.putChunk() with putPojo(). Reviewed-by: neugens, omajid Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2012-September/003132.html
author Roman Kennke <rkennke@redhat.com>
date Tue, 11 Sep 2012 17:56:15 +0200
parents 7cdd2c84ef35
children c36e9751cda4 55792b78bcc4
files agent/core/src/main/java/com/redhat/thermostat/backend/system/CpuStatBuilder.java agent/core/src/test/java/com/redhat/thermostat/backend/system/CpuStatBuilderTest.java client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java client/core/src/test/java/com/redhat/thermostat/client/ui/HostCpuControllerTest.java client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommandTest.java common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoConverter.java common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/Converter.java common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatConverter.java common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoConverter.java common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmClassStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoConverter.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOImpl.java common/core/src/main/java/com/redhat/thermostat/common/heap/HeapDump.java common/core/src/main/java/com/redhat/thermostat/common/model/AgentInformation.java common/core/src/main/java/com/redhat/thermostat/common/model/BackendInformation.java common/core/src/main/java/com/redhat/thermostat/common/model/CpuStat.java common/core/src/main/java/com/redhat/thermostat/common/model/HeapInfo.java common/core/src/main/java/com/redhat/thermostat/common/model/HostInfo.java common/core/src/main/java/com/redhat/thermostat/common/model/MemoryStat.java common/core/src/main/java/com/redhat/thermostat/common/model/NetworkInterfaceInfo.java common/core/src/main/java/com/redhat/thermostat/common/model/VmClassStat.java common/core/src/main/java/com/redhat/thermostat/common/model/VmCpuStat.java common/core/src/main/java/com/redhat/thermostat/common/model/VmGcStat.java common/core/src/main/java/com/redhat/thermostat/common/model/VmInfo.java common/core/src/main/java/com/redhat/thermostat/common/storage/Chunk.java common/core/src/main/java/com/redhat/thermostat/common/storage/ChunkAdapter.java common/core/src/main/java/com/redhat/thermostat/common/storage/Key.java common/core/src/main/java/com/redhat/thermostat/common/storage/MongoStorage.java common/core/src/main/java/com/redhat/thermostat/common/storage/Storage.java common/core/src/test/java/com/redhat/thermostat/common/dao/AgentInfoDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/BackendInfoDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/HeapDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/HostInfoConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/HostInfoDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/HostLatestPojoListGetterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmLatestPojoListGetterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatConverterTest.java common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOTest.java common/core/src/test/java/com/redhat/thermostat/common/model/HeapInfoTest.java common/core/src/test/java/com/redhat/thermostat/common/storage/ChunkAdapterTest.java common/core/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadMXBeanCollector.java thread/client-common/src/test/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadCollectorTest.java thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadInformationController.java thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTableController.java thread/collector/src/main/java/com/redhat/thermostat/thread/collector/HarvesterCommand.java thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java thread/collector/src/main/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImpl.java thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadInfoData.java thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadSummary.java thread/collector/src/main/java/com/redhat/thermostat/thread/model/VMThreadCapabilities.java thread/collector/src/test/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImplTest.java thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/Harvester.java thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/ThreadHarvester.java thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/HarvesterTest.java thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/ThreadHarvesterTest.java
diffstat 91 files changed, 965 insertions(+), 848 deletions(-) [+]
line wrap: on
line diff
--- a/agent/core/src/main/java/com/redhat/thermostat/backend/system/CpuStatBuilder.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/agent/core/src/main/java/com/redhat/thermostat/backend/system/CpuStatBuilder.java	Tue Sep 11 17:56:15 2012 +0200
@@ -85,13 +85,13 @@
         long currentTime = clock.getMonotonicTimeNanos();
         long[] currentValues = getCurrentCpuTicks();
 
-        double[] cpuUsage = new double[currentValues.length];
+        List<Double> cpuUsage = new ArrayList<Double>(currentValues.length);
 
         double timeDelta = (currentTime - previousTime) * 1E-9;
-        for (int i = 0; i < cpuUsage.length; i++) {
+        for (int i = 0; i < currentValues.length; i++) {
             long cpuTicksDelta = currentValues[i] - previousCpuTicks[i];
             // 100 as in 100 percent.
-            cpuUsage[i] = cpuTicksDelta * (100.0 / timeDelta / ticksPerSecond);
+            cpuUsage.add(cpuTicksDelta * (100.0 / timeDelta / ticksPerSecond));
         }
         previousTime = currentTime;
         previousCpuTicks = currentValues;
--- a/agent/core/src/test/java/com/redhat/thermostat/backend/system/CpuStatBuilderTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/agent/core/src/test/java/com/redhat/thermostat/backend/system/CpuStatBuilderTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,10 +37,9 @@
 package com.redhat.thermostat.backend.system;
 
 import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
+import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
@@ -53,6 +52,7 @@
 import com.redhat.thermostat.common.Clock;
 import com.redhat.thermostat.common.SystemClock;
 import com.redhat.thermostat.common.model.CpuStat;
+import com.redhat.thermostat.common.utils.ArrayUtils;
 
 public class CpuStatBuilderTest {
 
@@ -105,7 +105,7 @@
         CpuStat stat = builder.build();
 
         verify(dataSource, times(2)).getStatReader();
-        assertArrayEquals(new double[] {100, 100}, stat.getPerProcessorUsage(), 0.01);
+        assertArrayEquals(new double[] {100, 100}, ArrayUtils.toPrimitiveDoubleArray(stat.getPerProcessorUsage()), 0.01);
     }
 
 }
--- a/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/client/core/src/main/java/com/redhat/thermostat/client/ui/HostCpuController.java	Tue Sep 11 17:56:15 2012 +0200
@@ -131,12 +131,12 @@
         List<CpuStat> cpuStats = cpuStatDAO.getLatestCpuStats(ref);
         List<List<DiscreteTimeData<Double>>> results = new ArrayList<>();
         for (CpuStat stat : cpuStats) {
-            double[] data = stat.getPerProcessorUsage();
-            for (int i = 0 ; i < data.length; i++) {
+            List<Double> data = stat.getPerProcessorUsage();
+            for (int i = 0 ; i < data.size(); i++) {
                 if (results.size() == i) {
                     results.add(new ArrayList<DiscreteTimeData<Double>>());
                 }
-                results.get(i).add(new DiscreteTimeData<Double>(stat.getTimeStamp(), stat.getPerProcessorUsage()[i]));
+                results.get(i).add(new DiscreteTimeData<Double>(stat.getTimeStamp(), data.get(i)));
             }
         }
 
--- a/client/core/src/test/java/com/redhat/thermostat/client/ui/HostCpuControllerTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/client/core/src/test/java/com/redhat/thermostat/client/ui/HostCpuControllerTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -55,12 +55,10 @@
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
-import com.redhat.thermostat.client.ui.HostCpuController;
-import com.redhat.thermostat.client.ui.HostCpuView;
 import com.redhat.thermostat.common.ActionEvent;
+import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.Timer;
 import com.redhat.thermostat.common.Timer.SchedulingType;
-import com.redhat.thermostat.common.ActionListener;
 import com.redhat.thermostat.common.TimerFactory;
 import com.redhat.thermostat.common.ViewFactory;
 import com.redhat.thermostat.common.appctx.ApplicationContext;
@@ -72,6 +70,7 @@
 import com.redhat.thermostat.common.model.CpuStat;
 import com.redhat.thermostat.common.model.DiscreteTimeData;
 import com.redhat.thermostat.common.model.HostInfo;
+import com.redhat.thermostat.common.utils.ArrayUtils;
 
 public class HostCpuControllerTest {
 
@@ -101,8 +100,8 @@
         HostInfoDAO hostInfoDAO = mock(HostInfoDAO.class);
         when(hostInfoDAO.getHostInfo(any(HostRef.class))).thenReturn(hostInfo);
 
-        CpuStat cpuStat1 = new CpuStat(1l, new double[] {10.0, 20.0, 30.0});
-        CpuStat cpuStat2 = new CpuStat(2l, new double[] {15.0, 25.0, 35.0});
+        CpuStat cpuStat1 = new CpuStat(1l, ArrayUtils.toDoubleList(new double[] {10.0, 20.0, 30.0}));
+        CpuStat cpuStat2 = new CpuStat(2l, ArrayUtils.toDoubleList(new double[] {15.0, 25.0, 35.0}));
         CpuStatDAO cpuStatDAO = mock(CpuStatDAO.class);
         when(cpuStatDAO.getLatestCpuStats(any(HostRef.class))).thenReturn(Arrays.asList(cpuStat1, cpuStat2));
 
--- a/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/client/heapdumper/src/main/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommand.java	Tue Sep 11 17:56:15 2012 +0200
@@ -121,7 +121,7 @@
             renderer.printLine(hostRef.getStringID(),
                                vmRef.getStringID(),
                                info.getHeapId(),
-                               new Date(info.getTimestamp()).toString());
+                               new Date(info.getTimeStamp()).toString());
         }
     }
 
--- a/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommandTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/client/heapdumper/src/test/java/com/redhat/thermostat/client/heap/cli/ListHeapDumpsCommandTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -38,12 +38,8 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.isA;
-import static org.mockito.Mockito.eq;
+import static org.mockito.Matchers.isA;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Matchers.argThat;
 import static org.mockito.Mockito.when;
 
 import java.util.ArrayList;
@@ -57,10 +53,7 @@
 import org.junit.Before;
 import org.junit.BeforeClass;
 import org.junit.Test;
-import org.mockito.ArgumentMatcher;
-import org.mockito.Matchers;
 
-import com.redhat.thermostat.client.heap.cli.ListHeapDumpsCommand;
 import com.redhat.thermostat.common.appctx.ApplicationContext;
 import com.redhat.thermostat.common.appctx.ApplicationContextUtil;
 import com.redhat.thermostat.common.cli.ArgumentSpec;
@@ -145,7 +138,7 @@
         HeapInfo heapInfo = mock(HeapInfo.class);
         Calendar timestamp = Calendar.getInstance();
         timestamp.set(2012, 5, 7, 15, 32, 0);
-        when(heapInfo.getTimestamp()).thenReturn(timestamp.getTimeInMillis());
+        when(heapInfo.getTimeStamp()).thenReturn(timestamp.getTimeInMillis());
         when(heapInfo.getHeapId()).thenReturn("0001");
 
         HeapDAO heapDao = mock(HeapDAO.class);
@@ -190,7 +183,7 @@
         HeapInfo heapInfo = mock(HeapInfo.class);
         Calendar timestamp = Calendar.getInstance();
         timestamp.set(2012, 5, 7, 15, 32, 0);
-        when(heapInfo.getTimestamp()).thenReturn(timestamp.getTimeInMillis());
+        when(heapInfo.getTimeStamp()).thenReturn(timestamp.getTimeInMillis());
         when(heapInfo.getHeapId()).thenReturn("0001");
 
         HeapDAO heapDao = mock(HeapDAO.class);
@@ -241,7 +234,7 @@
         HeapInfo heapInfo = mock(HeapInfo.class);
         Calendar timestamp = Calendar.getInstance();
         timestamp.set(2012, 5, 7, 15, 32, 0);
-        when(heapInfo.getTimestamp()).thenReturn(timestamp.getTimeInMillis());
+        when(heapInfo.getTimeStamp()).thenReturn(timestamp.getTimeInMillis());
         when(heapInfo.getHeapDumpId()).thenReturn("0001");
 
         HeapDAO heapDao = mock(HeapDAO.class);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -44,10 +44,10 @@
 
 public interface AgentInfoDAO extends Countable {
 
-    static final Key<Long> START_TIME_KEY = new Key<>("start-time", false);
-    static final Key<Long> STOP_TIME_KEY = new Key<>("stop-time", false);
+    static final Key<Long> START_TIME_KEY = new Key<>("startTime", false);
+    static final Key<Long> STOP_TIME_KEY = new Key<>("stopTime", false);
     static final Key<Boolean> ALIVE_KEY = new Key<>("alive", false);
-    static final Key<String> CONFIG_LISTEN_ADDRESS = new Key<>("config-listen-address", false);
+    static final Key<String> CONFIG_LISTEN_ADDRESS = new Key<>("configListenAddress", false);
 
     static final Category CATEGORY = new Category("agent-config",
             Key.AGENT_ID,
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/AgentInfoDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -40,13 +40,12 @@
 import java.util.List;
 
 import com.redhat.thermostat.common.model.AgentInformation;
-import com.redhat.thermostat.common.storage.Category;
 import com.redhat.thermostat.common.storage.Chunk;
 import com.redhat.thermostat.common.storage.Cursor;
 import com.redhat.thermostat.common.storage.Key;
 import com.redhat.thermostat.common.storage.Query;
+import com.redhat.thermostat.common.storage.Query.Criteria;
 import com.redhat.thermostat.common.storage.Storage;
-import com.redhat.thermostat.common.storage.Query.Criteria;
 
 public class AgentInfoDAOImpl implements AgentInfoDAO {
 
@@ -105,7 +104,7 @@
 
     @Override
     public void addAgentInformation(AgentInformation agentInfo) {
-        storage.putChunk(converter.toChunk(agentInfo));
+        storage.putPojo(AgentInfoDAO.CATEGORY, true, agentInfo);
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoConverter.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoConverter.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,7 +36,6 @@
 
 package com.redhat.thermostat.common.dao;
 
-import java.util.Arrays;
 import java.util.List;
 
 import com.redhat.thermostat.common.model.BackendInformation;
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -47,7 +47,7 @@
     static final Key<String> BACKEND_NAME = new Key<>("name", true);
     static final Key<String> BACKEND_DESCRIPTION = new Key<>("description", false);
     static final Key<Boolean> IS_ACTIVE = new Key<>("active", false);
-    static final Key<Boolean> SHOULD_MONITOR_NEW_PROCESSES = new Key<>("new", false);
+    static final Key<Boolean> SHOULD_MONITOR_NEW_PROCESSES = new Key<>("observeNewJvm", false);
     static final Key<List<Integer>> PIDS_TO_MONITOR = new Key<>("pids", false);
 
     static final Category CATEGORY = new Category("backend-info",
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/BackendInfoDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -74,8 +74,7 @@
 
     @Override
     public void addBackendInformation(BackendInformation info) {
-        Chunk chunk = converter.toChunk(info);
-        storage.putChunk(chunk);
+        storage.putPojo(BackendInfoDAO.CATEGORY, false, info);
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/Converter.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/Converter.java	Tue Sep 11 17:56:15 2012 +0200
@@ -39,7 +39,7 @@
 import com.redhat.thermostat.common.model.Pojo;
 import com.redhat.thermostat.common.storage.Chunk;
 
-interface Converter<T extends Pojo> {
+public interface Converter<T extends Pojo> {
 
     Chunk toChunk(T pojo);
 
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatConverter.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatConverter.java	Tue Sep 11 17:56:15 2012 +0200
@@ -41,7 +41,6 @@
 import com.redhat.thermostat.common.model.CpuStat;
 import com.redhat.thermostat.common.storage.Chunk;
 import com.redhat.thermostat.common.storage.Key;
-import com.redhat.thermostat.common.utils.ArrayUtils;
 
 public class CpuStatConverter implements Converter<CpuStat> {
 
@@ -49,7 +48,7 @@
     public Chunk toChunk(CpuStat cpuStat) {
         Chunk chunk = new Chunk(CpuStatDAO.cpuStatCategory, false);
         chunk.put(Key.TIMESTAMP, cpuStat.getTimeStamp());
-        List<Double> objectArray = ArrayUtils.toDoubleList(cpuStat.getPerProcessorUsage());
+        List<Double> objectArray = cpuStat.getPerProcessorUsage();
         chunk.put(CpuStatDAO.cpuLoadKey, objectArray);
         return chunk;
     }
@@ -58,7 +57,6 @@
     public CpuStat fromChunk(Chunk chunk) {
         long timestamp = chunk.get(Key.TIMESTAMP);
         List<Double> loads = chunk.get(CpuStatDAO.cpuLoadKey);
-        double[] load = ArrayUtils.toPrimitiveDoubleArray(loads);
-        return new CpuStat(timestamp, load);
+        return new CpuStat(timestamp, loads);
     }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -44,7 +44,7 @@
 
 public interface CpuStatDAO extends Countable {
 
-    static Key<List<Double>> cpuLoadKey = new Key<>("processor-usage", false);
+    static Key<List<Double>> cpuLoadKey = new Key<>("perProcessorUsage", false);
 
     static final Category cpuStatCategory = new Category("cpu-stats",
             Key.AGENT_ID, Key.TIMESTAMP, cpuLoadKey);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/CpuStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -67,7 +67,7 @@
 
     @Override
     public void putCpuStat(CpuStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(cpuStatCategory, false, stat);
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -49,10 +49,11 @@
 
 public interface HeapDAO {
 
-    static final Key<String> heapDumpIdKey = new Key<String>("heap-dump-id", false);
-    static final Key<String> histogramIdKey = new Key<String>("histogram-id", false);
+    static final Key<String> heapIdKey = new Key<String>("heapId", false);
+    static final Key<String> heapDumpIdKey = new Key<String>("heapDumpId", false);
+    static final Key<String> histogramIdKey = new Key<String>("histogramId", false);
 
-    public static final Category heapInfoCategory = new Category("vm-heap-info", Key.ID, Key.AGENT_ID, Key.VM_ID, Key.TIMESTAMP, heapDumpIdKey, histogramIdKey);
+    public static final Category heapInfoCategory = new Category("vm-heap-info", Key.AGENT_ID, Key.VM_ID, Key.TIMESTAMP, heapIdKey, heapDumpIdKey, histogramIdKey);
 
     void putHeapInfo(HeapInfo heapInfo, File heapDumpFile, ObjectHistogram histogramData) throws IOException;
 
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/HeapDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -72,25 +72,19 @@
 
     @Override
     public void putHeapInfo(HeapInfo heapInfo, File heapDumpData, ObjectHistogram histogramData) throws IOException {
-        int vmId = heapInfo.getVmId();
-        Chunk chunk = new Chunk(heapInfoCategory, false);
-
-        // We dont add a Key.AGENT_ID here explicitly. Storage takes care of that.
-
-        chunk.put(Key.VM_ID, vmId);
-        chunk.put(Key.TIMESTAMP, heapInfo.getTimestamp());
-        String id = heapInfo.getHeapId();
-        String heapDumpId = "heapdump-" + id;
-        String histogramId = "histogram-" + id;
+        heapInfo.setAgentId(storage.getAgentId());
+        String heapId = heapInfo.getAgentId() + "-" + heapInfo.getVmId() + "-" + heapInfo.getTimeStamp();
+        System.err.println("assigning heapId: " + heapId);
+        heapInfo.setHeapId(heapId);
+        String heapDumpId = "heapdump-" + heapId;
+        String histogramId = "histogram-" + heapId;
         if (heapDumpData != null) {
-            chunk.put(heapDumpIdKey, heapDumpId);
             heapInfo.setHeapDumpId(heapDumpId);
         }
         if (histogramData != null) {
-            chunk.put(histogramIdKey, histogramId);
             heapInfo.setHistogramId(histogramId);
         }
-        storage.putChunk(chunk);
+        storage.putPojo(heapInfoCategory, false, heapInfo);
         if (heapDumpData != null) {
             storage.saveFile(heapDumpId, new FileInputStream(heapDumpData));
         }
@@ -106,20 +100,6 @@
                 log.log(Level.SEVERE, "Unexpected error while writing histogram", e);
             }
         }
-
-        Query justInsertedHeap = storage.createQuery()
-                .from(heapInfoCategory)
-                .where(Key.VM_ID, Criteria.EQUALS, vmId)
-                .where(Key.TIMESTAMP, Criteria.EQUALS, heapInfo.getTimestamp());
-        if (heapDumpData != null) {
-            justInsertedHeap.where(heapDumpIdKey, Criteria.EQUALS, heapDumpId);
-        }
-        if (histogramData != null) {
-            justInsertedHeap.where(histogramIdKey, Criteria.EQUALS, histogramId);
-        }
-
-        Chunk entry = storage.find(justInsertedHeap);
-        heapInfo.setHeapId(entry.get(Key.ID));
     }
 
     @Override
@@ -138,8 +118,10 @@
 
     private HeapInfo convertChunkToHeapInfo(VmRef vm, Chunk chunk) {
         int vmId = chunk.get(Key.VM_ID);
+        String agentId = chunk.get(Key.AGENT_ID);
         HeapInfo info = new HeapInfo(vmId, chunk.get(Key.TIMESTAMP));
-        info.setHeapId(chunk.get(Key.ID));
+        info.setAgentId(agentId);
+        info.setHeapId(chunk.get(HeapDAO.heapIdKey));
         info.setHeapDumpId(chunk.get(HeapDAO.heapDumpIdKey));
         info.setHistogramId(chunk.get(HeapDAO.histogramIdKey));
         return info;
@@ -166,7 +148,7 @@
     public HeapInfo getHeapInfo(String heapId) {
         Query query = storage.createQuery()
                 .from(heapInfoCategory)
-                .where(Key.ID, Criteria.EQUALS, heapId);
+                .where(heapIdKey, Criteria.EQUALS, heapId);
         Chunk found = null;
         try {
             found = storage.find(query);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoConverter.java	Tue Sep 11 12:41:35 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,66 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.dao;
-
-import com.redhat.thermostat.common.model.HostInfo;
-import com.redhat.thermostat.common.storage.Chunk;
-
-public class HostInfoConverter implements Converter<HostInfo> {
-
-    @Override
-    public Chunk toChunk(HostInfo hostInfo) {
-        Chunk chunk = new Chunk(HostInfoDAO.hostInfoCategory, false);
-        chunk.put(HostInfoDAO.hostNameKey, hostInfo.getHostname());
-        chunk.put(HostInfoDAO.osNameKey, hostInfo.getOsName());
-        chunk.put(HostInfoDAO.osKernelKey, hostInfo.getOsKernel());
-        chunk.put(HostInfoDAO.cpuModelKey, hostInfo.getCpuModel());
-        chunk.put(HostInfoDAO.cpuCountKey, hostInfo.getCpuCount());
-        chunk.put(HostInfoDAO.hostMemoryTotalKey, hostInfo.getTotalMemory());
-        return chunk;
-    }
-
-    @Override
-    public HostInfo fromChunk(Chunk chunk) {
-        String hostName = chunk.get(HostInfoDAO.hostNameKey);
-        String osName = chunk.get(HostInfoDAO.osNameKey);
-        String osKernel = chunk.get(HostInfoDAO.osKernelKey);
-        String cpuModel = chunk.get(HostInfoDAO.cpuModelKey);
-        int cpuCount = chunk.get(HostInfoDAO.cpuCountKey);
-        long totalMemory = chunk.get(HostInfoDAO.hostMemoryTotalKey);
-        return new HostInfo(hostName, osName, osKernel, cpuModel, cpuCount, totalMemory);
-    }
-}
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -45,11 +45,11 @@
 public interface HostInfoDAO extends Countable {
 
     static Key<String> hostNameKey = new Key<>("hostname", true);
-    static Key<String> osNameKey = new Key<>("os_name", false);
-    static Key<String> osKernelKey = new Key<>("os_kernel", false);
-    static Key<Integer> cpuCountKey = new Key<>("cpu_num", false);
-    static Key<String> cpuModelKey = new Key<>("cpu_model", false);
-    static Key<Long> hostMemoryTotalKey = new Key<>("memory_total", false);
+    static Key<String> osNameKey = new Key<>("osName", false);
+    static Key<String> osKernelKey = new Key<>("osKernel", false);
+    static Key<Integer> cpuCountKey = new Key<>("cpuCount", false);
+    static Key<String> cpuModelKey = new Key<>("cpuModel", false);
+    static Key<Long> hostMemoryTotalKey = new Key<>("totalMemory", false);
 
     static final Category hostInfoCategory = new Category("host-info",
             Key.AGENT_ID, hostNameKey, osNameKey, osKernelKey,
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/HostInfoDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -53,12 +53,10 @@
     private Storage storage;
     private AgentInfoDAO agentInfoDao;
 
-    private HostInfoConverter converter;
 
     public HostInfoDAOImpl(Storage storage, AgentInfoDAO agentInfo) {
         this.storage = storage;
         this.agentInfoDao = agentInfo;
-        converter = new HostInfoConverter();
     }
 
     @Override
@@ -66,15 +64,15 @@
         Query query = storage.createQuery()
                 .from(hostInfoCategory)
                 .where(Key.AGENT_ID, Criteria.EQUALS, ref.getAgentId());
-        Chunk result = storage.find(query);
-        return result == null ? null : converter.fromChunk(result);
+        HostInfo result = storage.findPojo(query, HostInfo.class);
+        return result;
     }
 
     @Override
     public void putHostInfo(HostInfo info) {
-        storage.putChunk(converter.toChunk(info));
+        storage.putPojo(hostInfoCategory, false, info);
     }
-    
+
     @Override
     public Collection<HostRef> getHosts() {
         Query allHosts = storage.createQuery().from(hostInfoCategory);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -48,9 +48,9 @@
     static Key<Long> memoryFreeKey = new Key<>("free", false);
     static Key<Long> memoryBuffersKey = new Key<>("buffers", false);
     static Key<Long> memoryCachedKey = new Key<>("cached", false);
-    static Key<Long> memorySwapTotalKey = new Key<>("swap-total", false);
-    static Key<Long> memorySwapFreeKey = new Key<>("swap-free", false);
-    static Key<Long> memoryCommitLimitKey = new Key<>("commit-limit", false);
+    static Key<Long> memorySwapTotalKey = new Key<>("swapTotal", false);
+    static Key<Long> memorySwapFreeKey = new Key<>("swapFree", false);
+    static Key<Long> memoryCommitLimitKey = new Key<>("commitLimit", false);
 
     static final Category memoryStatCategory = new Category("memory-stats",
             Key.AGENT_ID, Key.TIMESTAMP, memoryTotalKey, memoryFreeKey, memoryBuffersKey,
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/MemoryStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -67,7 +67,7 @@
 
     @Override
     public void putMemoryStat(MemoryStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(memoryStatCategory, false, stat);
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -44,12 +44,12 @@
 
 public interface NetworkInterfaceInfoDAO {
 
-    static Key<String> ifaceKey = new Key<>("iface", true);
-    static Key<String> ip4AddrKey = new Key<>("ipv4addr", false);
-    static Key<String> ip6AddrKey = new Key<>("ipv6addr", false);
+    static Key<String> ifaceKey = new Key<>("interfaceName", true);
+    static Key<String> ip4AddrKey = new Key<>("ip4Addr", false);
+    static Key<String> ip6AddrKey = new Key<>("ip6Addr", false);
 
     static final Category networkInfoCategory = new Category("network-info",
-            Key.AGENT_ID, Key.TIMESTAMP, ifaceKey, ip4AddrKey, ip6AddrKey);
+            Key.AGENT_ID, ifaceKey, ip4AddrKey, ip6AddrKey);
 
     public List<NetworkInterfaceInfo> getNetworkInterfaces(HostRef ref);
 
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -75,7 +75,7 @@
 
     @Override
     public void putNetworkInterfaceInfo(NetworkInterfaceInfo info) {
-        storage.putChunk(converter.toChunk(info));
+        storage.putPojo(networkInfoCategory, true, info);
     }
 
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmClassStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmClassStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -67,6 +67,6 @@
 
     @Override
     public void putVmClassStat(VmClassStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(vmClassStatsCategory, false, stat);
     }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -44,7 +44,7 @@
 
 public interface VmCpuStatDAO {
 
-    static final Key<Double> vmCpuLoadKey = new Key<>("processor-usage", false);
+    static final Key<Double> vmCpuLoadKey = new Key<>("cpuLoad", false);
 
     static final Category vmCpuStatCategory = new Category("vm-cpu-stats",
             Key.AGENT_ID, Key.VM_ID, Key.TIMESTAMP, vmCpuLoadKey);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmCpuStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -67,6 +67,6 @@
 
     @Override
     public void putVmCpuStat(VmCpuStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(vmCpuStatCategory, false, stat);
     }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -44,10 +44,10 @@
 
 public interface VmGcStatDAO {
 
-    static final Key<String> collectorKey = new Key<>("collector", false);
-    static final Key<Long> runCountKey = new Key<>("runtime-count", false);
+    static final Key<String> collectorKey = new Key<>("collectorName", false);
+    static final Key<Long> runCountKey = new Key<>("runCount", false);
     /** time in microseconds */
-    static final Key<Long> wallTimeKey = new Key<>("wall-time", false);
+    static final Key<Long> wallTimeKey = new Key<>("wallTime", false);
 
     static final Category vmGcStatCategory = new Category("vm-gc-stats",
             Key.AGENT_ID, Key.VM_ID, Key.TIMESTAMP, collectorKey,
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmGcStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -67,7 +67,7 @@
 
     @Override
     public void putVmGcStat(VmGcStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(vmGcStatCategory, false, stat);
     }
 
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoConverter.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoConverter.java	Tue Sep 11 17:56:15 2012 +0200
@@ -41,6 +41,7 @@
 
 import com.redhat.thermostat.common.model.VmInfo;
 import com.redhat.thermostat.common.storage.Chunk;
+import com.redhat.thermostat.common.storage.Key;
 
 public class VmInfoConverter implements Converter<VmInfo> {
 
@@ -48,7 +49,7 @@
     public Chunk toChunk(VmInfo info) {
         Chunk chunk = new Chunk(VmInfoDAO.vmInfoCategory, true);
 
-        chunk.put(VmInfoDAO.vmIdKey, info.getVmId());
+        chunk.put(Key.VM_ID, info.getVmId());
         chunk.put(VmInfoDAO.vmPidKey, info.getVmPid());
         chunk.put(VmInfoDAO.startTimeKey, info.getStartTimeStamp());
         chunk.put(VmInfoDAO.stopTimeKey, info.getStopTimeStamp());
@@ -68,7 +69,7 @@
 
     @Override
     public VmInfo fromChunk(Chunk chunk) {
-        int vmId = chunk.get(VmInfoDAO.vmIdKey);
+        int vmId = chunk.get(Key.VM_ID);
         long startTime = chunk.get(VmInfoDAO.startTimeKey);
         long stopTime = chunk.get(VmInfoDAO.stopTimeKey);
         String jVersion = chunk.get(VmInfoDAO.runtimeVersionKey);
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAO.java	Tue Sep 11 17:56:15 2012 +0200
@@ -46,24 +46,23 @@
 
 public interface VmInfoDAO extends Countable {
 
-    static final Key<Integer> vmIdKey = new Key<>("vm-id", true);
-    static final Key<Integer> vmPidKey = new Key<>("vm-pid", false);
-    static final Key<String> runtimeVersionKey = new Key<>("runtime-version", false);
-    static final Key<String> javaHomeKey = new Key<>("java-home", false);
-    static final Key<String> mainClassKey = new Key<>("main-class", false);
-    static final Key<String> commandLineKey = new Key<>("command-line", false);
-    static final Key<String> vmArgumentsKey = new Key<>("vm-arguments", false);
-    static final Key<String> vmNameKey = new Key<>("vm-name", false);
-    static final Key<String> vmInfoKey = new Key<>("vm-info", false);
-    static final Key<String> vmVersionKey = new Key<>("vm-version", false);
+    static final Key<Integer> vmPidKey = new Key<>("vmPid", false);
+    static final Key<String> runtimeVersionKey = new Key<>("javaVersion", false);
+    static final Key<String> javaHomeKey = new Key<>("javaHome", false);
+    static final Key<String> mainClassKey = new Key<>("mainClass", false);
+    static final Key<String> commandLineKey = new Key<>("javaCommandLine", false);
+    static final Key<String> vmArgumentsKey = new Key<>("vmArguments", false);
+    static final Key<String> vmNameKey = new Key<>("vmName", false);
+    static final Key<String> vmInfoKey = new Key<>("vmInfo", false);
+    static final Key<String> vmVersionKey = new Key<>("vmVersion", false);
     static final Key<Map<String, String>> propertiesKey = new Key<>("properties", false);
     static final Key<Map<String, String>> environmentKey = new Key<>("environment", false);
-    static final Key<List<String>> librariesKey = new Key<>("libraries", false);
-    static final Key<Long> startTimeKey = new Key<>("start-time", false);
-    static final Key<Long> stopTimeKey = new Key<>("stop-time", false);
+    static final Key<List<String>> librariesKey = new Key<>("loadedNativeLibraries", false);
+    static final Key<Long> startTimeKey = new Key<>("startTimeStamp", false);
+    static final Key<Long> stopTimeKey = new Key<>("stopTimeStamp", false);
 
     static final Category vmInfoCategory = new Category("vm-info",
-            Key.AGENT_ID, vmIdKey, vmPidKey, runtimeVersionKey, javaHomeKey,
+            Key.AGENT_ID, Key.VM_ID, vmPidKey, runtimeVersionKey, javaHomeKey,
             mainClassKey, commandLineKey,
             vmArgumentsKey, vmNameKey, vmInfoKey, vmVersionKey,
             propertiesKey, environmentKey, librariesKey,
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmInfoDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -63,7 +63,7 @@
         Query findMatchingVm = storage.createQuery()
                 .from(vmInfoCategory)
                 .where(Key.AGENT_ID, Criteria.EQUALS, ref.getAgent().getAgentId())
-                .where(vmIdKey, Criteria.EQUALS, ref.getId());
+                .where(Key.VM_ID, Criteria.EQUALS, ref.getId());
         Chunk result = storage.find(findMatchingVm);
         if (result == null) {
             throw new DAOException("Unknown VM: host:" + ref.getAgent().getAgentId() + ";vm:" + ref.getId());
@@ -98,7 +98,7 @@
     }
 
     private VmRef buildVmRefFromChunk(Chunk vmChunk, HostRef host) {
-        Integer id = vmChunk.get(vmIdKey);
+        Integer id = vmChunk.get(Key.VM_ID);
         // TODO can we do better than the main class?
         String mainClass = vmChunk.get(mainClassKey);
         VmRef ref = new VmRef(host, id, mainClass);
@@ -112,7 +112,7 @@
 
     @Override
     public void putVmInfo(VmInfo info) {
-        storage.putChunk(converter.toChunk(info));
+        storage.putPojo(vmInfoCategory, true, info);
     }
 
     @Override
@@ -122,7 +122,7 @@
 
     private Chunk makeStoppedChunk(int vmId, long stopTimeStamp) {
         Chunk chunk = new Chunk(VmInfoDAO.vmInfoCategory, false);
-        chunk.put(VmInfoDAO.vmIdKey, vmId);
+        chunk.put(Key.VM_ID, vmId);
         chunk.put(VmInfoDAO.stopTimeKey, stopTimeStamp);
         return chunk;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -74,7 +74,7 @@
 
     @Override
     public void putVmMemoryStat(VmMemoryStat stat) {
-        storage.putChunk(converter.toChunk(stat));
+        storage.putPojo(vmMemoryStatsCategory, false, stat);
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/heap/HeapDump.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/heap/HeapDump.java	Tue Sep 11 17:56:15 2012 +0200
@@ -97,7 +97,7 @@
     }
 
     public long getTimestamp() {
-        return heapInfo.getTimestamp();
+        return heapInfo.getTimeStamp();
     }
 
     @Override
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/AgentInformation.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/AgentInformation.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,11 +37,14 @@
 package com.redhat.thermostat.common.model;
 
 import java.util.ArrayList;
-import java.util.Collections;
 import java.util.List;
 import java.util.Objects;
 
-public class AgentInformation {
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
+public class AgentInformation implements Pojo {
 
     private String agentId;
     private long startTime;
@@ -52,42 +55,52 @@
 
     private List<BackendInformation> backends = new ArrayList<BackendInformation>();
 
+    @Persist
     public String getAgentId() {
         return agentId;
     }
 
+    @Persist
     public void setAgentId(String agentId) {
         this.agentId = agentId;
     }
 
+    @Persist
     public long getStartTime() {
         return startTime;
     }
 
+    @Persist
     public void setStartTime(long startTime) {
         this.startTime = startTime;
     }
 
+    @Persist
     public void setStopTime(long stopTime) {
         this.stopTime = stopTime;
     }
     
+    @Persist
     public long getStopTime() {
         return stopTime;
     }
 
+    @Persist
     public boolean isAlive() {
         return alive;
     }
     
+    @Persist
     public void setAlive(boolean alive) {
         this.alive = alive;
     }
 
+    @Persist
     public String getConfigListenAddress() {
         return address;
     }
 
+    @Persist
     public void setConfigListenAddress(String address) {
         this.address = address;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/BackendInformation.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/BackendInformation.java	Tue Sep 11 17:56:15 2012 +0200
@@ -41,7 +41,11 @@
 import java.util.Map;
 import java.util.Objects;
 
-public class BackendInformation {
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
+public class BackendInformation implements Pojo {
 
     private String name;
     private String description;
@@ -50,34 +54,42 @@
     private List<Integer> pids;
     private Map<String, String> configuration = new HashMap<String,String>();
 
+    @Persist
     public String getName() {
         return name;
     }
 
+    @Persist
     public void setName(String name) {
         this.name = name;
     }
 
+    @Persist
     public String getDescription() {
         return description;
     }
 
+    @Persist
     public void setDescription(String description) {
         this.description = description;
     }
 
+    @Persist
     public boolean isObserveNewJvm() {
         return observeNewJvm;
     }
 
+    @Persist
     public void setObserveNewJvm(boolean observeNewJvm) {
         this.observeNewJvm = observeNewJvm;
     }
 
+    @Persist
     public List<Integer> getPids() {
         return pids;
     }
 
+    @Persist
     public void setPids(List<Integer> pids) {
         this.pids = pids;
     }
@@ -86,10 +98,12 @@
         return configuration;
     }
 
+    @Persist
     public boolean isActive() {
         return isActive;
     }
 
+    @Persist
     public void setActive(boolean active) {
         this.isActive = active;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/CpuStat.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/CpuStat.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,24 +36,42 @@
 
 package com.redhat.thermostat.common.model;
 
+import java.util.List;
+
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class CpuStat implements TimeStampedPojo {
 
     public static final double INVALID_LOAD = Double.MIN_VALUE;
 
-    private final long timeStamp;
-    private final double[] perProcessorUsage;
+    private long timeStamp;
+    private List<Double> perProcessorUsage;
 
-    public CpuStat(long timestamp, double[] perProcessorUsage) {
+    public CpuStat(long timestamp, List<Double> perProcessorUsage) {
         this.timeStamp = timestamp;
         this.perProcessorUsage = perProcessorUsage;
     }
 
-    public double[] getPerProcessorUsage() {
+    @Persist
+    public List<Double> getPerProcessorUsage() {
         return perProcessorUsage;
     }
 
+    @Persist
+    public void setPerProcessorUsage(List<Double> perProcessorUsage) {
+        this.perProcessorUsage = perProcessorUsage;
+    }
+
+    @Persist
     @Override
     public long getTimeStamp() {
         return timeStamp;
     }
+
+    @Persist
+    public void setTimeStamp(long timeStamp) {
+        this.timeStamp = timeStamp;
+    }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/HeapInfo.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/HeapInfo.java	Tue Sep 11 17:56:15 2012 +0200
@@ -38,39 +38,75 @@
 
 import java.util.Objects;
 
-public class HeapInfo {
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
 
+@Entity
+public class HeapInfo implements TimeStampedPojo {
+
+    private String agentId;
     private int vmId;
-    private long timestamp;
+    private long timeStamp;
+
     private String heapId;
     private String heapDumpId;
     private String histogramId;
 
+    public HeapInfo() {
+        this(-1, -1);
+    }
+
     public HeapInfo(int vmId, long timestamp) {
         this.vmId = vmId;
-        this.timestamp = timestamp;
+        this.timeStamp = timestamp;
+    }
+
+    @Persist
+    public String getAgentId() {
+        return agentId;
     }
 
+    @Persist
+    public void setAgentId(String agentId) {
+        this.agentId = agentId;
+    }
+
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
+    @Persist
     public int getVmId() {
         return vmId;
     }
 
-    public long getTimestamp() {
-        return timestamp;
+    @Persist
+    public long getTimeStamp() {
+        return timeStamp;
     }
 
+    @Persist
+    public void setTimeStamp(long timestamp) {
+        this.timeStamp = timestamp;
+    }
+
+    @Persist
     public void setHeapId(String heapId) {
         this.heapId = heapId;
     }
 
+    @Persist
     public String getHeapId() {
         return heapId;
     }
 
+    @Persist
     public void setHeapDumpId(String heapDumpId) {
         this.heapDumpId = heapDumpId;
     }
 
+    @Persist
     public String getHeapDumpId() {
         return heapDumpId;
     }
@@ -82,18 +118,20 @@
         }
         HeapInfo other = (HeapInfo) o;
         return vmId == other.vmId && Objects.equals(heapDumpId, other.heapDumpId)
-               && Objects.equals(histogramId, other.histogramId) && timestamp == other.timestamp;
+               && Objects.equals(histogramId, other.histogramId) && timeStamp == other.timeStamp;
     }
 
     @Override
     public int hashCode() {
-        return Objects.hash(vmId, heapDumpId, histogramId, timestamp);
+        return Objects.hash(vmId, heapDumpId, histogramId, timeStamp);
     }
 
+    @Persist
     public String getHistogramId() {
         return histogramId;
     }
 
+    @Persist
     public void setHistogramId(String histogramId) {
         this.histogramId = histogramId;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/HostInfo.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/HostInfo.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,14 +36,22 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class HostInfo implements Pojo {
 
-    private final String hostname;
-    private final String osName;
-    private final String osKernel;
-    private final String cpuModel;
-    private final int cpuCount;
-    private final long totalMemory;
+    private String hostname;
+    private String osName;
+    private String osKernel;
+    private String cpuModel;
+    private int cpuCount;
+    private long totalMemory;
+
+    public HostInfo() {
+        this(null, null, null, null, -1, -1);
+    }
 
     public HostInfo(String hostname, String osName, String osKernel, String cpuModel, int cpuCount, long totalMemory) {
         this.hostname = hostname;
@@ -54,22 +62,57 @@
         this.totalMemory = totalMemory;
     }
 
+    @Persist
+    public void setHostname(String hostname) {
+        this.hostname = hostname;
+    }
+
+    @Persist
+    public void setOsName(String osName) {
+        this.osName = osName;
+    }
+
+    @Persist
+    public void setOsKernel(String osKernel) {
+        this.osKernel = osKernel;
+    }
+
+    @Persist
+    public void setCpuModel(String cpuModel) {
+        this.cpuModel = cpuModel;
+    }
+
+    @Persist
+    public void setCpuCount(int cpuCount) {
+        this.cpuCount = cpuCount;
+    }
+
+    @Persist
+    public void setTotalMemory(long totalMemory) {
+        this.totalMemory = totalMemory;
+    }
+
+    @Persist
     public String getHostname() {
         return hostname;
     }
 
+    @Persist
     public String getOsName() {
         return osName;
     }
 
+    @Persist
     public String getOsKernel() {
         return osKernel;
     }
 
+    @Persist
     public String getCpuModel() {
         return cpuModel;
     }
 
+    @Persist
     public int getCpuCount() {
         return cpuCount;
     }
@@ -77,6 +120,7 @@
     /**
      * Total memory in bytes
      */
+    @Persist
     public long getTotalMemory() {
         return totalMemory;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/MemoryStat.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/MemoryStat.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,18 +36,27 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class MemoryStat implements TimeStampedPojo {
-    private final long timestamp;
-    private final long total;
-    private final long free;
-    private final long buffers;
-    private final long cached;
-    private final long swapTotal;
-    private final long swapFree;
-    private final long commitLimit;
 
-    public MemoryStat(long timestamp, long total, long free, long buffers, long cached, long swapTotal, long swapFree, long commitLimit) {
-        this.timestamp = timestamp;
+    private long timeStamp;
+    private long total;
+    private long free;
+    private long buffers;
+    private long cached;
+    private long swapTotal;
+    private long swapFree;
+    private long commitLimit;
+
+    public MemoryStat() {
+        super();
+    }
+
+    public MemoryStat(long timeStamp, long total, long free, long buffers, long cached, long swapTotal, long swapFree, long commitLimit) {
+        this.timeStamp = timeStamp;
         this.total = total;
         this.free = free;
         this.buffers = buffers;
@@ -58,36 +67,84 @@
     }
 
     @Override
+    @Persist
     public long getTimeStamp() {
-        return timestamp;
+        return timeStamp;
     }
 
+    @Persist
+    public void setTimeStamp(long timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
+    @Persist
     public long getTotal() {
         return total;
     }
 
+    @Persist
+    public void setTotal(long total) {
+        this.total = total;
+    }
+
+    @Persist
     public long getFree() {
         return free;
     }
 
+    @Persist
+    public void setFree(long free) {
+        this.free = free;
+    }
+
+    @Persist
     public long getBuffers() {
         return buffers;
     }
 
+    @Persist
+    public void setBuffers(long buffers) {
+        this.buffers = buffers;
+    }
+
+    @Persist
     public long getCached() {
         return cached;
     }
 
+    @Persist
+    public void setCached(long cached) {
+        this.cached = cached;
+    }
+
+    @Persist
     public long getSwapTotal() {
         return swapTotal;
     }
 
+    @Persist
+    public void setSwapTotal(long swapTotal) {
+        this.swapTotal = swapTotal;
+    }
+
+    @Persist
     public long getSwapFree() {
         return swapFree;
     }
 
+    @Persist
+    public void setSwapFree(long swapFree) {
+        this.swapFree = swapFree;
+    }
+
+    @Persist
     public long getCommitLimit() {
         return commitLimit;
     }
 
+    @Persist
+    public void setCommitLimit(long commitLimit) {
+        this.commitLimit = commitLimit;
+    }
+
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/NetworkInterfaceInfo.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/NetworkInterfaceInfo.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,26 +36,42 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class NetworkInterfaceInfo implements Pojo {
 
     private String iFace;
     private String ip4Addr;
     private String ip6Addr;
 
+    public NetworkInterfaceInfo() {
+        super();
+    }
+
     public NetworkInterfaceInfo(String iFace) {
         this.iFace = iFace;
         this.ip4Addr = null;
         this.ip6Addr = null;
     }
 
+    @Persist
     public String getInterfaceName() {
         return iFace;
     }
 
+    @Persist
+    public void setInterfaceName(String iFace) {
+        this.iFace = iFace;
+    }
+
+    @Persist
     public String getIp4Addr() {
         return ip4Addr;
     }
 
+    @Persist
     public void setIp4Addr(String newAddr) {
         ip4Addr = newAddr;
     }
@@ -64,10 +80,12 @@
         ip4Addr = null;
     }
 
+    @Persist
     public String getIp6Addr() {
         return ip6Addr;
     }
 
+    @Persist
     public void setIp6Addr(String newAddr) {
         ip6Addr = newAddr;
     }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/VmClassStat.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/VmClassStat.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,6 +36,10 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class VmClassStat implements TimeStampedPojo {
 
     private int vmId;
@@ -48,16 +52,34 @@
         this.loadedClasses = loadedClasses;
     }
 
+    @Persist
     public int getVmId() {
         return vmId;
     }
 
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
+    @Persist
     @Override
     public long getTimeStamp() {
         return timestamp;
     }
 
+    @Persist
+    public void setTimeStamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    @Persist
     public long getLoadedClasses() {
         return loadedClasses;
     }
+
+    @Persist
+    public void setLoadedClasses(long loadedClasses) {
+        this.loadedClasses = loadedClasses;
+    }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/VmCpuStat.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/VmCpuStat.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,32 +36,59 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class VmCpuStat implements TimeStampedPojo {
 
-    private final long timestamp;
-    private final int vmId;
-    private final double cpuLoad;
+    private long timeStamp;
+    private int vmId;
+    private double cpuLoad;
 
-    public VmCpuStat(long timestamp, int vmId, double cpuLoad) {
-        this.timestamp = timestamp;
+    public VmCpuStat() {
+        super();
+    }
+
+    public VmCpuStat(long timeStamp, int vmId, double cpuLoad) {
+        this.timeStamp = timeStamp;
         this.vmId = vmId;
         this.cpuLoad = cpuLoad;
     }
 
     @Override
+    @Persist
     public long getTimeStamp() {
-        return timestamp;
+        return timeStamp;
     }
 
+    @Persist
+    public void setTimeStamp(long timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
+    @Persist
     public int getVmId() {
         return vmId;
     }
 
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
     /**
      * The cpu load in percent (as in 100.0 for 100%). This value should be
      * normalized to be in the range [0, 100]
      */
+    @Persist
     public double getCpuLoad() {
         return cpuLoad;
     }
+
+    @Persist
+    public void setCpuLoad(double cpuLoad) {
+        this.cpuLoad = cpuLoad;
+    }
+
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/VmGcStat.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/VmGcStat.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,36 +36,68 @@
 
 package com.redhat.thermostat.common.model;
 
+import com.redhat.thermostat.common.storage.Entity;
+
+@Entity
 public class VmGcStat implements TimeStampedPojo {
 
-    private final long timestamp;
-    private final int vmId;
-    private final String collectorName;
-    private final long runCount;
-    private final long wallTime;
+    private long timeStamp;
+    private int vmId;
+    private String collectorName;
+    private long runCount;
+    private long wallTime;
+
+    public VmGcStat() {
+        super();
+    }
 
     public VmGcStat(int vmId, long timestamp, String collectorName, long runCount, long wallTime) {
-        this.timestamp = timestamp;
+        this.timeStamp = timestamp;
         this.vmId = vmId;
         this.collectorName = collectorName;
         this.runCount = runCount;
         this.wallTime = wallTime;
     }
+
     public int getVmId() {
         return vmId;
     }
+
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
     public String getCollectorName() {
         return collectorName;
     }
+
+    public void setCollectorName(String collectorName) {
+        this.collectorName = collectorName;
+    }
+
     public long getRunCount() {
         return runCount;
     }
+
+    public void setRunCount(long runCount) {
+        this.runCount = runCount;
+    }
+
     public long getWallTime() {
         return wallTime;
     }
 
+    public void setWallTime(long wallTime) {
+        this.wallTime = wallTime;
+    }
+
     @Override
     public long getTimeStamp() {
-        return timestamp;
+        return timeStamp;
     }
+
+    public void setTimeStamp(long timeStamp) {
+        this.timeStamp = timeStamp;
+    }
+
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/model/VmInfo.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/model/VmInfo.java	Tue Sep 11 17:56:15 2012 +0200
@@ -40,6 +40,10 @@
 import java.util.List;
 import java.util.Map;
 
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
+
+@Entity
 public class VmInfo implements Pojo {
 
     private int vmPid = 0;
@@ -82,68 +86,147 @@
         this.loadedNativeLibraries = loadedNativeLibraries;
     }
 
+    @Persist
     public int getVmId() {
         return vmPid;
     }
 
+    @Persist
     public int getVmPid() {
         return vmPid;
     }
 
+    @Persist
     public long getStartTimeStamp() {
         return startTime;
     }
 
+    @Persist
+    public void setStartTimeStamp(long startTime) {
+        this.startTime = startTime;
+    }
+
+    @Persist
     public long getStopTimeStamp() {
         return stopTime;
     }
 
+    @Persist
+    public void setStopTimeStamp(long stopTime) {
+        this.stopTime = stopTime;
+    }
+
+    @Persist
     public String getJavaVersion() {
         return javaVersion;
     }
 
+    @Persist
+    public void setJavaVersion(String javaVersion) {
+        this.javaVersion = javaVersion;
+    }
+
+    @Persist
     public String getJavaHome() {
         return javaHome;
     }
 
+    @Persist
+    public void setJavaHome(String javaHome) {
+        this.javaHome = javaHome;
+    }
+
+    @Persist
     public String getMainClass() {
         return mainClass;
     }
 
+    @Persist
+    public void setMainClass(String mainClass) {
+        this.mainClass = mainClass;
+    }
+
+    @Persist
     public String getJavaCommandLine() {
         return javaCommandLine;
     }
 
+    @Persist
+    public void setJavaCommandLine(String javaCommandLine) {
+        this.javaCommandLine = javaCommandLine;
+    }
+
+    @Persist
     public String getVmName() {
         return vmName;
     }
 
+    @Persist
+    public void setVmName(String vmName) {
+        this.vmName = vmName;
+    }
+
+    @Persist
     public String getVmArguments() {
         return vmArguments;
     }
 
+    @Persist
+    public void setVmArguments(String vmArguments) {
+        this.vmArguments = vmArguments;
+    }
+
+    @Persist
     public String getVmInfo() {
         return vmInfo;
     }
 
+    @Persist
+    public void setVmInfo(String vmInfo) {
+        this.vmInfo = vmInfo;
+    }
+
+    @Persist
     public String getVmVersion() {
         return vmVersion;
     }
 
+    @Persist
+    public void setVmVersion(String vmVersion) {
+        this.vmVersion = vmVersion;
+    }
+
     public boolean isAlive() {
         return getStartTimeStamp() > getStopTimeStamp();
     }
     
+    @Persist
     public Map<String, String> getProperties() {
         return properties;
     }
 
+    @Persist
+    public void setProperties(Map<String, String> properties) {
+        this.properties = properties;
+    }
+
+    @Persist
     public Map<String, String> getEnvironment() {
         return environment;
     }
 
+    @Persist
+    public void setEnvironment(Map<String, String> environment) {
+        this.environment = environment;
+    }
+
+    @Persist
     public List<String> getLoadedNativeLibraries() {
         return loadedNativeLibraries;
     }
 
+    @Persist
+    public void setLoadedNativeLibraries(List<String> loadedNativeLibraries) {
+        this.loadedNativeLibraries = loadedNativeLibraries;
+    }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/storage/Chunk.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/storage/Chunk.java	Tue Sep 11 17:56:15 2012 +0200
@@ -46,9 +46,10 @@
  * that exists behind the storage layer.
  */
 public class Chunk {
-    private final boolean replace;
+    protected final boolean replace;
 
     protected Category category;
+
     private Map<Key<?>, Object> values = new LinkedHashMap<Key<?>, Object>();
 
     protected Chunk() {
--- a/common/core/src/main/java/com/redhat/thermostat/common/storage/ChunkAdapter.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/storage/ChunkAdapter.java	Tue Sep 11 17:56:15 2012 +0200
@@ -54,14 +54,21 @@
     private final Object adaptee;
 
     public ChunkAdapter(Object obj) {
-        super();
-
-        checkForAnnotation(obj);
+        this(obj, null, false);
         Set<Key<?>> keys = identifyKeys(obj);
         category = createCategory(obj, keys);
+    }
+
+    public ChunkAdapter(Object obj, Category category, boolean replace) {
+        super(category, replace);
+        checkForAnnotation(obj);
         adaptee = obj;
     }
 
+    public Object getAdaptee() {
+        return adaptee;
+    }
+
     private void checkForAnnotation(Object toCheck) {
         if (!toCheck.getClass().isAnnotationPresent(Entity.class)) {
             throw new IllegalArgumentException("object to adapt must be annotated with Entity");
--- a/common/core/src/main/java/com/redhat/thermostat/common/storage/Key.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/storage/Key.java	Tue Sep 11 17:56:15 2012 +0200
@@ -43,9 +43,9 @@
 public class Key<T> {
 
     // Keys used by most Categories.
-    public static final Key<Long> TIMESTAMP = new Key<>("timestamp", false);
-    public static final Key<String> AGENT_ID = new Key<>("agent-id", true);
-    public static final Key<Integer> VM_ID = new Key<>("vm-id", true);
+    public static final Key<Long> TIMESTAMP = new Key<>("timeStamp", false);
+    public static final Key<String> AGENT_ID = new Key<>("agentId", true);
+    public static final Key<Integer> VM_ID = new Key<>("vmId", true);
     public static final Key<String> ID = new Key<>("_id", false);
 
     private String name;
--- a/common/core/src/main/java/com/redhat/thermostat/common/storage/MongoStorage.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/storage/MongoStorage.java	Tue Sep 11 17:56:15 2012 +0200
@@ -51,6 +51,10 @@
 import com.mongodb.gridfs.GridFSDBFile;
 import com.mongodb.gridfs.GridFSInputFile;
 import com.redhat.thermostat.common.config.StartupConfiguration;
+import com.redhat.thermostat.common.dao.Converter;
+import com.redhat.thermostat.common.dao.VmMemoryStatConverter;
+import com.redhat.thermostat.common.model.Pojo;
+import com.redhat.thermostat.common.model.VmMemoryStat;
 import com.redhat.thermostat.common.storage.Connection.ConnectionListener;
 import com.redhat.thermostat.common.storage.Connection.ConnectionStatus;
 
@@ -61,7 +65,6 @@
  */
 public class MongoStorage extends Storage {
 
-    public static final String KEY_AGENT_ID = "agent-id";
     public static final String SET_MODIFIER = "$set";
 
     private MongoConnection conn;
@@ -70,7 +73,10 @@
 
     private UUID agentId = null;
 
+    private Map<Class<?>, Converter<?>> converters;
+
     public MongoStorage(StartupConfiguration conf) {
+        setupConverters();
         conn = new MongoConnection(conf);
         conn.addListener(new ConnectionListener() {
             @Override
@@ -87,6 +93,11 @@
         });
     }
 
+    private void setupConverters() {
+        converters = new HashMap<>();
+        addConverter(VmMemoryStat.class, new VmMemoryStatConverter());
+    }
+
     @Override
     public Connection getConnection() {
         return conn;
@@ -97,9 +108,14 @@
         this.agentId = agentId;
     }
 
+    @Override
+    public String getAgentId() {
+        return agentId.toString();
+    }
+
     private BasicDBObject getAgentQueryKeyFromGlobalAgent() {
         if (agentId != null) {
-            return new BasicDBObject(KEY_AGENT_ID, agentId.toString());
+            return new BasicDBObject(Key.AGENT_ID.getName(), agentId.toString());
         } else {
             return null;
         }
@@ -110,14 +126,14 @@
         if (queryKey != null) {
             return queryKey;
         } else if (chunk.get(Key.AGENT_ID) != null) {
-            return new BasicDBObject(KEY_AGENT_ID, chunk.get(Key.AGENT_ID));
+            return new BasicDBObject(Key.AGENT_ID.getName(), chunk.get(Key.AGENT_ID));
         } else {
             return null;
         }
     }
 
-    @Override
-    public void putChunk(Chunk chunk) {
+    // TODO: Make this private, and change the testcase to test putPojo() instead.
+    void putChunk(Chunk chunk) {
         Category cat = chunk.getCategory();
         DBCollection coll = getCachedCollection(cat.getName());
         BasicDBObject toInsert = getAgentQueryKeyFromChunkOrGlobalAgent(chunk);
@@ -357,4 +373,20 @@
             return file.getInputStream();
         }
     }
+
+    public void putPojo(Category category, boolean replace, Pojo pojo) {
+        Converter customConverter = converters.get(pojo.getClass());
+        Chunk chunk;
+        if (customConverter != null) {
+            chunk = customConverter.toChunk(pojo);
+        } else {
+            chunk = new ChunkAdapter(pojo, category, replace);
+        }
+        putChunk(chunk);
+    }
+
+
+    void addConverter(Class<?> type, Converter<?> converter) {
+        converters.put(type, converter);
+    }
 }
--- a/common/core/src/main/java/com/redhat/thermostat/common/storage/Storage.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/main/java/com/redhat/thermostat/common/storage/Storage.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,12 +37,17 @@
 package com.redhat.thermostat.common.storage;
 
 import java.io.InputStream;
+import java.util.Set;
 import java.util.UUID;
 
+import com.redhat.thermostat.common.model.Pojo;
+
 public abstract class Storage {
 
     public abstract void setAgentId(UUID id);
 
+    public abstract String getAgentId();
+
     public final void registerCategory(Category category) {
         if (category.hasBeenRegistered()) {
             throw new IllegalStateException("Category may only be associated with one backend.");
@@ -55,7 +60,7 @@
 
     public abstract ConnectionKey createConnectionKey(Category category);
 
-    public abstract void putChunk(Chunk chunk);
+    public abstract void putPojo(Category category, boolean replace, Pojo pojo);
 
     public abstract void updateChunk(Chunk chunk);
 
@@ -70,6 +75,26 @@
 
     public abstract Chunk find(Query query);
 
+    // TODO: Move implementation to MongoStorage and remve find(Query) and make this abstract.
+    public <T> T findPojo(Query query, Class<T> resultClass) {
+        Chunk resultChunk = find(query);
+        try {
+            Object pojo = resultClass.newInstance();
+            ChunkAdapter chunk = new ChunkAdapter(pojo);
+            Set<Key<?>> keys = resultChunk.getKeys();
+            for (Key key : keys) {
+                if (key == null) {
+                    System.err.println("WARNING: null key in result: " + resultChunk);
+                    continue;
+                 }
+                 chunk.put(key, resultChunk.get(key));
+            }
+            return (T) chunk.getAdaptee();
+        } catch (InstantiationException | IllegalAccessException e) {
+            throw new RuntimeException(e);
+        }
+    }
+
     public abstract Cursor findAllFromCategory(Category category);
     
     public abstract long getCount(Category category);
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/AgentInfoDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/AgentInfoDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -83,11 +83,11 @@
 
     @Test
     public void verifyKeyNames() {
-        assertEquals("agent-id", Key.AGENT_ID.getName());
+        assertEquals("agentId", Key.AGENT_ID.getName());
         assertEquals("alive", AgentInfoDAO.ALIVE_KEY.getName());
-        assertEquals("start-time", AgentInfoDAO.START_TIME_KEY.getName());
-        assertEquals("stop-time", AgentInfoDAO.STOP_TIME_KEY.getName());
-        assertEquals("config-listen-address", AgentInfoDAO.CONFIG_LISTEN_ADDRESS.getName());
+        assertEquals("startTime", AgentInfoDAO.START_TIME_KEY.getName());
+        assertEquals("stopTime", AgentInfoDAO.STOP_TIME_KEY.getName());
+        assertEquals("configListenAddress", AgentInfoDAO.CONFIG_LISTEN_ADDRESS.getName());
     }
 
     @Test
@@ -187,13 +187,8 @@
 
         dao.addAgentInformation(agentInfo1);
 
-        ArgumentCaptor<Chunk> chunkCaptor = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(chunkCaptor.capture());
+        verify(storage).putPojo(AgentInfoDAO.CATEGORY, true, agentInfo1);
 
-        Chunk insertedChunk = chunkCaptor.getValue();
-        Chunk expectedChunk = agentChunk1;
-
-        assertEquals(expectedChunk, insertedChunk);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/BackendInfoDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/BackendInfoDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -48,7 +48,6 @@
 
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 
 import com.redhat.thermostat.common.model.BackendInformation;
 import com.redhat.thermostat.common.storage.Category;
@@ -106,11 +105,7 @@
 
         dao.addBackendInformation(backendInfo1);
 
-        ArgumentCaptor<Chunk> chunkCaptor = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(chunkCaptor.capture());
-
-        BackendInformation inserted = converter.fromChunk(chunkCaptor.getValue());
-        assertEquals(backendInfo1, inserted);
+        verify(storage).putPojo(BackendInfoDAO.CATEGORY, false, backendInfo1);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -51,7 +51,7 @@
 
     @Test
     public void testToChunk() {
-        CpuStat stat = new CpuStat(10, new double[]{ 5, 10, 15} );
+        CpuStat stat = new CpuStat(10, ArrayUtils.toDoubleList(new double[]{ 5, 10, 15} ));
         Chunk chunk = new CpuStatConverter().toChunk(stat);
         assertNotNull(chunk);
         assertEquals("cpu-stats", chunk.getCategory().getName());
@@ -68,6 +68,6 @@
         CpuStat stat = new CpuStatConverter().fromChunk(chunk);
         assertNotNull(stat);
         assertEquals(10L, stat.getTimeStamp());
-        assertArrayEquals(new double[] {5.0, 10.0, 15.0} , stat.getPerProcessorUsage(), 0.001);
+        assertArrayEquals(new double[] {5.0, 10.0, 15.0} , ArrayUtils.toPrimitiveDoubleArray(stat.getPerProcessorUsage()), 0.001);
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/CpuStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -39,11 +39,8 @@
 import static org.junit.Assert.assertArrayEquals;
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.eq;
-import static org.mockito.Mockito.isA;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
@@ -54,7 +51,6 @@
 import java.util.List;
 
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 
 import com.redhat.thermostat.common.model.CpuStat;
 import com.redhat.thermostat.common.storage.Category;
@@ -72,9 +68,9 @@
     public void testCategory() {
         assertEquals("cpu-stats", CpuStatDAO.cpuStatCategory.getName());
         Collection<Key<?>> keys = CpuStatDAO.cpuStatCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
-        assertTrue(keys.contains(new Key<Double>("processor-usage", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
+        assertTrue(keys.contains(new Key<Double>("perProcessorUsage", false)));
 
         assertEquals(3, keys.size());
     }
@@ -107,7 +103,7 @@
         assertEquals(1, cpuStats.size());
         CpuStat stat = cpuStats.get(0);
         assertEquals(1234L, stat.getTimeStamp());
-        assertArrayEquals(new double[] { LOAD }, stat.getPerProcessorUsage(), 0.001);
+        assertArrayEquals(new double[] { LOAD }, ArrayUtils.toPrimitiveDoubleArray(stat.getPerProcessorUsage()), 0.001);
 
     }
 
@@ -142,18 +138,11 @@
     @Test
     public void testPutCpuStat() {
         Storage storage = mock(Storage.class);
-        CpuStat stat = new CpuStat(1, new double[] {5.0, 10.0, 15.0});
+        CpuStat stat = new CpuStat(1,  ArrayUtils.toDoubleList(new double[] {5.0, 10.0, 15.0}));
         CpuStatDAO dao = new CpuStatDAOImpl(storage);
         dao.putCpuStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(CpuStatDAO.cpuStatCategory, chunk.getCategory());
-        assertEquals((Long) 1L, chunk.get(Key.TIMESTAMP));
-        double[] result = ArrayUtils.toPrimitiveDoubleArray(chunk.get(CpuStatDAO.cpuLoadKey));
-        assertArrayEquals(new double[] {5.0, 10.0, 15.0}, result, 0.01);
+        verify(storage).putPojo(CpuStatDAO.cpuStatCategory, false, stat);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/HeapDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/HeapDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -91,6 +91,7 @@
     @Before
     public void setUp() throws IOException {
         storage = mock(Storage.class);
+        when(storage.getAgentId()).thenReturn("test");
         when(storage.createQuery()).then(new Answer<Query>() {
             @Override
             public Query answer(InvocationOnMock invocation) throws Throwable {
@@ -101,7 +102,6 @@
         dao = new HeapDAOImpl(storage);
         
         heapInfo = new HeapInfo(123, 12345);
-        heapInfo.setHeapId("987-123-12345");
         byte[] data = new byte[] { 1, 2, 3 };
         heapDumpData = File.createTempFile("test", "test");
         FileOutputStream out = new FileOutputStream(heapDumpData);
@@ -140,26 +140,6 @@
 
         // We dont check for AGENT_ID. That's enforced/added/checked by Storage
 
-        // Prepare queries for read-back of _id in putHeapInfo() tests.
-        MockQuery heap1query = new MockQuery()
-            .from(HeapDAO.heapInfoCategory)
-            .where(Key.VM_ID, Criteria.EQUALS, 123)
-            .where(Key.TIMESTAMP, Criteria.EQUALS, 12345l)
-            .where(HeapDAO.heapDumpIdKey, Criteria.EQUALS, "heapdump-987-123-12345")
-            .where(HeapDAO.histogramIdKey, Criteria.EQUALS, "histogram-987-123-12345");
-        Chunk heap1 = new Chunk(HeapDAO.heapInfoCategory, false);
-        heap1.put(Key.ID, "id1");
-        when(storage.find(heap1query)).thenReturn(heap1);
-
-        MockQuery heap2query = new MockQuery()
-            .from(HeapDAO.heapInfoCategory)
-            .where(Key.VM_ID, Criteria.EQUALS, 123)
-            .where(Key.TIMESTAMP, Criteria.EQUALS, 12345l);
-
-        Chunk heap2 = new Chunk(HeapDAO.heapInfoCategory, false);
-        heap2.put(Key.ID, "id2");
-        when(storage.find(heap2query)).thenReturn(heap2);
-
     }
 
     private InputStream createHistogramData() throws IOException {
@@ -207,34 +187,30 @@
         assertEquals("vm-heap-info", category.getName());
         Collection<Key<?>> keys = category.getKeys();
         assertEquals(6, keys.size());
-        assertTrue(keys.contains(new Key<>("_id", false)));
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<>("vm-id", true)));
-        assertTrue(keys.contains(new Key<>("timestamp", false)));
-        assertTrue(keys.contains(new Key<>("heap-dump-id", false)));
-        assertTrue(keys.contains(new Key<>("histogram-id", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<>("vmId", true)));
+        assertTrue(keys.contains(new Key<>("timeStamp", false)));
+        assertTrue(keys.contains(new Key<>("heapId", false)));
+        assertTrue(keys.contains(new Key<>("heapDumpId", false)));
+        assertTrue(keys.contains(new Key<>("histogramId", false)));
     }
 
     @Test
     public void testPutHeapInfo() throws IOException {
         dao.putHeapInfo(heapInfo, heapDumpData, histogram);
 
-        Chunk expectedChunk = new Chunk(HeapDAO.heapInfoCategory, false);
-        expectedChunk.put(Key.VM_ID, 123);
-        expectedChunk.put(Key.TIMESTAMP, 12345L);
-        expectedChunk.put(HeapDAO.heapDumpIdKey, "heapdump-987-123-12345");
-        expectedChunk.put(HeapDAO.histogramIdKey, "histogram-987-123-12345");
-        verify(storage).putChunk(expectedChunk);
+        verify(storage).putPojo(HeapDAO.heapInfoCategory, false, heapInfo);
+
         ArgumentCaptor<InputStream> data = ArgumentCaptor.forClass(InputStream.class);
-        verify(storage).saveFile(eq("heapdump-987-123-12345"), data.capture());
+        verify(storage).saveFile(eq("heapdump-test-123-12345"), data.capture());
         InputStream in = data.getValue();
         assertEquals(1, in.read());
         assertEquals(2, in.read());
         assertEquals(3, in.read());
         assertEquals(-1, in.read());
-        assertEquals("id1", heapInfo.getHeapId());
+        assertEquals("test-123-12345", heapInfo.getHeapId());
         ArgumentCaptor<InputStream> histoStream = ArgumentCaptor.forClass(InputStream.class);
-        verify(storage).saveFile(eq("histogram-987-123-12345"), histoStream.capture());
+        verify(storage).saveFile(eq("histogram-test-123-12345"), histoStream.capture());
         InputStream histoActual = histoStream.getValue();
         int expected;
         int actual;
@@ -249,13 +225,10 @@
     public void testPutHeapInfoWithoutDump() throws IOException {
         dao.putHeapInfo(heapInfo, null, null);
 
-        Chunk expectedChunk = new Chunk(HeapDAO.heapInfoCategory, false);
-        expectedChunk.put(Key.VM_ID, 123);
-        expectedChunk.put(Key.TIMESTAMP, 12345L);
+        verify(storage).putPojo(HeapDAO.heapInfoCategory, false, heapInfo);
 
-        verify(storage).putChunk(expectedChunk);
         verify(storage, never()).saveFile(anyString(), any(InputStream.class));
-        assertEquals("id2", heapInfo.getHeapId());
+        assertEquals("test-123-12345", heapInfo.getHeapId());
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/HostInfoConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,94 +0,0 @@
-/*
- * Copyright 2012 Red Hat, Inc.
- *
- * This file is part of Thermostat.
- *
- * Thermostat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2, or (at your
- * option) any later version.
- *
- * Thermostat is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with Thermostat; see the file COPYING.  If not see
- * <http://www.gnu.org/licenses/>.
- *
- * Linking this code with other modules is making a combined work
- * based on this code.  Thus, the terms and conditions of the GNU
- * General Public License cover the whole combination.
- *
- * As a special exception, the copyright holders of this code give
- * you permission to link this code with independent modules to
- * produce an executable, regardless of the license terms of these
- * independent modules, and to copy and distribute the resulting
- * executable under terms of your choice, provided that you also
- * meet, for each linked independent module, the terms and conditions
- * of the license of that module.  An independent module is a module
- * which is not derived from or based on this code.  If you modify
- * this code, you may extend this exception to your version of the
- * library, but you are not obligated to do so.  If you do not wish
- * to do so, delete this exception statement from your version.
- */
-
-package com.redhat.thermostat.common.dao;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.common.model.HostInfo;
-import com.redhat.thermostat.common.storage.Chunk;
-import com.redhat.thermostat.common.storage.Key;
-
-public class HostInfoConverterTest {
-
-    @Test
-    public void testHostInfoToChunk() {
-        HostInfo info = new HostInfo("a-host", "an-os", "a-kernel", "a-cpu", 9, 99);
-
-        Chunk chunk = new HostInfoConverter().toChunk(info);
-
-        assertEquals("host-info", chunk.getCategory().getName());
-        assertEquals("a-host", chunk.get(new Key<String>("hostname", true)));
-        assertEquals("an-os", chunk.get(new Key<String>("os_name", false)));
-        assertEquals("a-kernel", chunk.get(new Key<String>("os_kernel", false)));
-        assertEquals("a-cpu", chunk.get(new Key<String>("cpu_model", false)));
-        assertEquals((Integer)9, chunk.get(new Key<Integer>("cpu_num", false)));
-        assertEquals((Long) 99L, chunk.get(new Key<Long>("memory_total", false)));
-    }
-
-    @Test
-    public void testChunktoHostInfo() {
-        final String HOST_NAME = "a host name";
-        final String OS_NAME = "some os";
-        final String OS_KERNEL = "some kernel";
-        final String CPU_MODEL = "some cpu that runs fast";
-        final int CPU_NUM = -1;
-        final long MEMORY_TOTAL = 0xCAFEBABEl;
-
-
-        Chunk chunk = new Chunk(HostInfoDAO.hostInfoCategory, false);
-        chunk.put(HostInfoDAO.hostNameKey, HOST_NAME);
-        chunk.put(HostInfoDAO.osNameKey, OS_NAME);
-        chunk.put(HostInfoDAO.osKernelKey, OS_KERNEL);
-        chunk.put(HostInfoDAO.cpuModelKey, CPU_MODEL);
-        chunk.put(HostInfoDAO.cpuCountKey, CPU_NUM);
-        chunk.put(HostInfoDAO.hostMemoryTotalKey, MEMORY_TOTAL);
-
-        HostInfo info = new HostInfoConverter().fromChunk(chunk);
-        assertNotNull(info);
-        assertEquals(HOST_NAME, info.getHostname());
-        assertEquals(OS_NAME, info.getOsName());
-        assertEquals(OS_KERNEL, info.getOsKernel());
-        assertEquals(CPU_MODEL, info.getCpuModel());
-        assertEquals(CPU_NUM, info.getCpuCount());
-        assertEquals(MEMORY_TOTAL, info.getTotalMemory());
-
-    }
-
-}
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/HostInfoDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/HostInfoDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,23 +37,22 @@
 package com.redhat.thermostat.common.dao;
 
 import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertSame;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.same;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
 
 import java.util.Arrays;
 import java.util.Collection;
 
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 import org.mockito.invocation.InvocationOnMock;
 import org.mockito.stubbing.Answer;
 
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.times;
-
 import com.redhat.thermostat.common.model.AgentInformation;
 import com.redhat.thermostat.common.model.HostInfo;
 import com.redhat.thermostat.common.storage.Category;
@@ -87,13 +86,13 @@
     public void testCategory() {
         assertEquals("host-info", HostInfoDAO.hostInfoCategory.getName());
         Collection<Key<?>> keys = HostInfoDAO.hostInfoCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
         assertTrue(keys.contains(new Key<String>("hostname", true)));
-        assertTrue(keys.contains(new Key<String>("os_name", false)));
-        assertTrue(keys.contains(new Key<String>("os_kernel", false)));
-        assertTrue(keys.contains(new Key<String>("cpu_model", false)));
-        assertTrue(keys.contains(new Key<Integer>("cpu_num", false)));
-        assertTrue(keys.contains(new Key<Long>("memory_total", false)));
+        assertTrue(keys.contains(new Key<String>("osName", false)));
+        assertTrue(keys.contains(new Key<String>("osKernel", false)));
+        assertTrue(keys.contains(new Key<String>("cpuModel", false)));
+        assertTrue(keys.contains(new Key<Integer>("cpuCount", false)));
+        assertTrue(keys.contains(new Key<Long>("totalMemory", false)));
         assertEquals(7, keys.size());
     }
 
@@ -110,20 +109,12 @@
 
         Storage storage = mock(Storage.class);
         when(storage.createQuery()).thenReturn(new MockQuery());
-        when(storage.find(any(Query.class))).thenReturn(chunk);
-
+        HostInfo info = new HostInfo(HOST_NAME, OS_NAME, OS_KERNEL, CPU_MODEL, CPU_NUM, MEMORY_TOTAL);
+        when(storage.findPojo(any(Query.class), same(HostInfo.class))).thenReturn(info);
         AgentInfoDAO agentInfoDao = mock(AgentInfoDAO.class);
 
-        HostInfo info = new HostInfoDAOImpl(storage, agentInfoDao)
-            .getHostInfo(new HostRef("some uid", HOST_NAME));
-
-        assertNotNull(info);
-        assertEquals(HOST_NAME, info.getHostname());
-        assertEquals(OS_NAME, info.getOsName());
-        assertEquals(OS_KERNEL, info.getOsKernel());
-        assertEquals(CPU_MODEL, info.getCpuModel());
-        assertEquals(CPU_NUM, info.getCpuCount());
-        assertEquals(MEMORY_TOTAL, info.getTotalMemory());
+        HostInfo result = new HostInfoDAOImpl(storage, agentInfoDao).getHostInfo(new HostRef("some uid", HOST_NAME));
+        assertSame(result, info);
     }
 
     @Test
@@ -215,17 +206,7 @@
         HostInfoDAO dao = new HostInfoDAOImpl(storage, agentInfo);
         dao.putHostInfo(info);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(HostInfoDAO.hostInfoCategory, chunk.getCategory());
-        assertEquals(HOST_NAME, chunk.get(HostInfoDAO.hostNameKey));
-        assertEquals(OS_NAME, chunk.get(HostInfoDAO.osNameKey));
-        assertEquals(OS_KERNEL, chunk.get(HostInfoDAO.osKernelKey));
-        assertEquals(CPU_MODEL, chunk.get(HostInfoDAO.cpuModelKey));
-        assertEquals((Integer) CPU_NUM, chunk.get(HostInfoDAO.cpuCountKey));
-        assertEquals((Long) MEMORY_TOTAL, chunk.get(HostInfoDAO.hostMemoryTotalKey));
+        verify(storage).putPojo(HostInfoDAO.hostInfoCategory, false, info);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/HostLatestPojoListGetterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/HostLatestPojoListGetterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,13 +36,23 @@
 
 package com.redhat.thermostat.common.dao;
 
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import java.util.Arrays;
 import java.util.List;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 
 import com.redhat.thermostat.common.model.CpuStat;
 import com.redhat.thermostat.common.storage.Category;
@@ -50,22 +60,11 @@
 import com.redhat.thermostat.common.storage.Cursor;
 import com.redhat.thermostat.common.storage.Key;
 import com.redhat.thermostat.common.storage.Query;
+import com.redhat.thermostat.common.storage.Query.Criteria;
 import com.redhat.thermostat.common.storage.Storage;
-import com.redhat.thermostat.common.storage.Query.Criteria;
+import com.redhat.thermostat.common.utils.ArrayUtils;
 import com.redhat.thermostat.test.MockQuery;
 
-import static org.junit.Assert.assertArrayEquals;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.isA;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 public class HostLatestPojoListGetterTest {
     private static final String AGENT_ID = "agentid";
     private static final String HOSTNAME = "host.example.com";
@@ -182,10 +181,10 @@
         assertEquals(2, stats.size());
         CpuStat stat1 = stats.get(0);
         assertEquals(t1, stat1.getTimeStamp());
-        assertArrayEquals(new double[] {load5_1, load10_1, load15_1}, stat1.getPerProcessorUsage(), 0.001);
+        assertArrayEquals(new double[] {load5_1, load10_1, load15_1}, ArrayUtils.toPrimitiveDoubleArray(stat1.getPerProcessorUsage()), 0.001);
         CpuStat stat2 = stats.get(1);
         assertEquals(t2, stat2.getTimeStamp());
-        assertArrayEquals(new double[] {load5_2, load10_2, load15_2}, stat2.getPerProcessorUsage(), 0.001);
+        assertArrayEquals(new double[] {load5_2, load10_2, load15_2}, ArrayUtils.toPrimitiveDoubleArray(stat2.getPerProcessorUsage()), 0.001);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -57,9 +57,9 @@
         assertEquals((Long) 2l, chunk.get(new Key<Long>("free", false)));
         assertEquals((Long) 3l, chunk.get(new Key<Long>("buffers", false)));
         assertEquals((Long) 4l, chunk.get(new Key<Long>("cached", false)));
-        assertEquals((Long) 5l, chunk.get(new Key<Long>("swap-total", false)));
-        assertEquals((Long) 6l, chunk.get(new Key<Long>("swap-free", false)));
-        assertEquals((Long) 7l, chunk.get(new Key<Long>("commit-limit", false)));
+        assertEquals((Long) 5l, chunk.get(new Key<Long>("swapTotal", false)));
+        assertEquals((Long) 6l, chunk.get(new Key<Long>("swapFree", false)));
+        assertEquals((Long) 7l, chunk.get(new Key<Long>("commitLimit", false)));
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/MemoryStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -38,14 +38,13 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
-
-import static org.mockito.Mockito.any;
+import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
+
 import java.util.Collection;
 import java.util.List;
 
@@ -80,15 +79,15 @@
     public void testCategory() {
         assertEquals("memory-stats", MemoryStatDAO.memoryStatCategory.getName());
         Collection<Key<?>> keys = MemoryStatDAO.memoryStatCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
         assertTrue(keys.contains(new Key<Long>("total", false)));
         assertTrue(keys.contains(new Key<Long>("free", false)));
         assertTrue(keys.contains(new Key<Long>("buffers", false)));
         assertTrue(keys.contains(new Key<Long>("cached", false)));
-        assertTrue(keys.contains(new Key<Long>("swap-total", false)));
-        assertTrue(keys.contains(new Key<Long>("swap-free", false)));
-        assertTrue(keys.contains(new Key<Long>("commit-limit", false)));
+        assertTrue(keys.contains(new Key<Long>("swapTotal", false)));
+        assertTrue(keys.contains(new Key<Long>("swapFree", false)));
+        assertTrue(keys.contains(new Key<Long>("commitLimit", false)));
         assertEquals(9, keys.size());
 
     }
@@ -181,25 +180,13 @@
     }
 
     @Test
-    public void testPutHostInfo() {
+    public void testPutMemoryStat() {
         Storage storage = mock(Storage.class);
         MemoryStat stat = new MemoryStat(TIMESTAMP, TOTAL, FREE, BUFFERS, CACHED, SWAP_TOTAL, SWAP_FREE, COMMIT_LIMIT);
         MemoryStatDAO dao = new MemoryStatDAOImpl(storage);
         dao.putMemoryStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(MemoryStatDAO.memoryStatCategory, chunk.getCategory());
-        assertEquals((Long) TIMESTAMP, chunk.get(Key.TIMESTAMP));
-        assertEquals((Long) TOTAL, chunk.get(MemoryStatDAO.memoryTotalKey));
-        assertEquals((Long) FREE, chunk.get(MemoryStatDAO.memoryFreeKey));
-        assertEquals((Long) BUFFERS, chunk.get(MemoryStatDAO.memoryBuffersKey));
-        assertEquals((Long) CACHED, chunk.get(MemoryStatDAO.memoryCachedKey));
-        assertEquals((Long) SWAP_TOTAL, chunk.get(MemoryStatDAO.memorySwapTotalKey));
-        assertEquals((Long) SWAP_FREE, chunk.get(MemoryStatDAO.memorySwapFreeKey));
-        assertEquals((Long) COMMIT_LIMIT, chunk.get(MemoryStatDAO.memoryCommitLimitKey));
+        verify(storage).putPojo(MemoryStatDAO.memoryStatCategory, false, stat);
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -56,9 +56,9 @@
         Chunk chunk = new NetworkInterfaceInfoConverter().toChunk(info);
 
         assertEquals("network-info", chunk.getCategory().getName());
-        assertEquals("eth0", chunk.get(new Key<String>("iface", true)));
-        assertEquals("4", chunk.get(new Key<String>("ipv4addr", false)));
-        assertEquals("6", chunk.get(new Key<String>("ipv6addr", false)));
+        assertEquals("eth0", chunk.get(new Key<String>("interfaceName", true)));
+        assertEquals("4", chunk.get(new Key<String>("ip4Addr", false)));
+        assertEquals("6", chunk.get(new Key<String>("ip6Addr", false)));
 
     }
 
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/NetworkInterfaceInfoDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -71,12 +71,11 @@
 
         assertEquals("network-info", NetworkInterfaceInfoDAO.networkInfoCategory.getName());
         keys = NetworkInterfaceInfoDAO.networkInfoCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
-        assertTrue(keys.contains(new Key<String>("iface", true)));
-        assertTrue(keys.contains(new Key<String>("ipv4addr", false)));
-        assertTrue(keys.contains(new Key<String>("ipv6addr", false)));
-        assertEquals(5, keys.size());
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<String>("interfaceName", true)));
+        assertTrue(keys.contains(new Key<String>("ip4Addr", false)));
+        assertTrue(keys.contains(new Key<String>("ip6Addr", false)));
+        assertEquals(4, keys.size());
     }
 
     @Test
@@ -122,13 +121,6 @@
         NetworkInterfaceInfoDAO dao = new NetworkInterfaceInfoDAOImpl(storage);
         dao.putNetworkInterfaceInfo(info);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(NetworkInterfaceInfoDAO.networkInfoCategory, chunk.getCategory());
-        assertEquals(INTERFACE_NAME, chunk.get(NetworkInterfaceInfoDAO.ifaceKey));
-        assertEquals(IPV4_ADDR, chunk.get(NetworkInterfaceInfoDAO.ip4AddrKey));
-        assertEquals(IPV6_ADDR, chunk.get(NetworkInterfaceInfoDAO.ip6AddrKey));
+        verify(storage).putPojo(NetworkInterfaceInfoDAO.networkInfoCategory, true, info);
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -55,7 +55,7 @@
 
         assertEquals("vm-class-stats", chunk.getCategory().getName());
         assertEquals((Long) 1234L, chunk.get(Key.TIMESTAMP));
-        assertEquals((Integer) 123, chunk.get(new Key<Integer>("vm-id", true)));
+        assertEquals((Integer) 123, chunk.get(new Key<Integer>("vmId", true)));
         assertEquals((Long) 12345L, chunk.get(new Key<Long>("loadedClasses", false)));
     }
 
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmClassStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -38,7 +38,6 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Matchers.any;
 import static org.mockito.Mockito.mock;
@@ -73,9 +72,9 @@
     public void testCategory() {
         assertEquals("vm-class-stats", VmClassStatDAO.vmClassStatsCategory.getName());
         Collection<Key<?>> keys = VmClassStatDAO.vmClassStatsCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("vm-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Integer>("vmId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
         assertTrue(keys.contains(new Key<Long>("loadedClasses", false)));
         assertEquals(4, keys.size());
 
@@ -172,13 +171,6 @@
         VmClassStatDAO dao = new VmClassStatDAOImpl(storage);
         dao.putVmClassStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(VmClassStatDAO.vmClassStatsCategory, chunk.getCategory());
-        assertEquals(TIMESTAMP, chunk.get(Key.TIMESTAMP));
-        assertEquals(VM_ID, chunk.get(Key.VM_ID));
-        assertEquals(LOADED_CLASSES, chunk.get(VmClassStatDAO.loadedClassesKey));
+        verify(storage).putPojo(VmClassStatDAO.vmClassStatsCategory, false, stat);
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -58,8 +58,8 @@
         assertNotNull(chunk);
         assertEquals("vm-cpu-stats", chunk.getCategory().getName());
         assertEquals((Long)TIMESTAMP, chunk.get(Key.TIMESTAMP));
-        assertEquals((Integer) VM_ID, chunk.get(new Key<Long>("vm-id", true)));
-        assertEquals(PROCESSOR_USAGE, chunk.get(new Key<Double>("processor-usage", false)), 0.001);
+        assertEquals((Integer) VM_ID, chunk.get(new Key<Long>("vmId", true)));
+        assertEquals(PROCESSOR_USAGE, chunk.get(new Key<Double>("cpuLoad", false)), 0.001);
 
     }
 
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmCpuStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -86,10 +86,10 @@
     public void testCategory() {
         assertEquals("vm-cpu-stats", VmCpuStatDAO.vmCpuStatCategory.getName());
         Collection<Key<?>> keys = VmCpuStatDAO.vmCpuStatCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
-        assertTrue(keys.contains(new Key<Integer>("vm-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("processor-usage", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
+        assertTrue(keys.contains(new Key<Integer>("vmId", true)));
+        assertTrue(keys.contains(new Key<Integer>("cpuLoad", false)));
         assertEquals(4, keys.size());
     }
 
@@ -170,13 +170,7 @@
         VmCpuStatDAO dao = new VmCpuStatDAOImpl(storage);
         dao.putVmCpuStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
+        verify(storage).putPojo(VmCpuStatDAO.vmCpuStatCategory, false, stat);
 
-        assertEquals(VmCpuStatDAO.vmCpuStatCategory, chunk.getCategory());
-        assertEquals(TIMESTAMP, chunk.get(Key.TIMESTAMP));
-        assertEquals(VM_ID, chunk.get(Key.VM_ID));
-        assertEquals(CPU_LOAD, chunk.get(VmCpuStatDAO.vmCpuLoadKey));
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -59,11 +59,11 @@
 
         assertNotNull(chunk);
         assertEquals("vm-gc-stats", chunk.getCategory().getName());
-        assertEquals(TIMESTAMP, chunk.get(new Key<Long>("timestamp", false)));
-        assertEquals(VM_ID, chunk.get(new Key<Integer>("vm-id", true)));
-        assertEquals(COLLECTOR, chunk.get(new Key<String>("collector", false)));
-        assertEquals(RUN_COUNT, chunk.get(new Key<Long>("runtime-count", false)));
-        assertEquals(WALL_TIME, chunk.get(new Key<Long>("wall-time", false)));
+        assertEquals(TIMESTAMP, chunk.get(new Key<Long>("timeStamp", false)));
+        assertEquals(VM_ID, chunk.get(new Key<Integer>("vmId", true)));
+        assertEquals(COLLECTOR, chunk.get(new Key<String>("collectorName", false)));
+        assertEquals(RUN_COUNT, chunk.get(new Key<Long>("runCount", false)));
+        assertEquals(WALL_TIME, chunk.get(new Key<Long>("wallTime", false)));
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmGcStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -76,12 +76,12 @@
     public void testCategory() {
         assertEquals("vm-gc-stats", VmGcStatDAO.vmGcStatCategory.getName());
         Collection<Key<?>> keys = VmGcStatDAO.vmGcStatCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("vm-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
-        assertTrue(keys.contains(new Key<String>("collector", false)));
-        assertTrue(keys.contains(new Key<Long>("runtime-count", false)));
-        assertTrue(keys.contains(new Key<Long>("wall-time", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Integer>("vmId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
+        assertTrue(keys.contains(new Key<String>("collectorName", false)));
+        assertTrue(keys.contains(new Key<Long>("runCount", false)));
+        assertTrue(keys.contains(new Key<Long>("wallTime", false)));
         assertEquals(6, keys.size());
     }
 
@@ -175,15 +175,6 @@
         VmGcStatDAO dao = new VmGcStatDAOImpl(storage);
         dao.putVmGcStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(VmGcStatDAO.vmGcStatCategory, chunk.getCategory());
-        assertEquals(TIMESTAMP, chunk.get(Key.TIMESTAMP));
-        assertEquals(VM_ID, chunk.get(Key.VM_ID));
-        assertEquals(COLLECTOR, chunk.get(VmGcStatDAO.collectorKey));
-        assertEquals(RUN_COUNT, chunk.get(VmGcStatDAO.runCountKey));
-        assertEquals(WALL_TIME, chunk.get(VmGcStatDAO.wallTimeKey));
+        verify(storage).putPojo(VmGcStatDAO.vmGcStatCategory, false, stat);
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -48,6 +48,7 @@
 
 import com.redhat.thermostat.common.model.VmInfo;
 import com.redhat.thermostat.common.storage.Chunk;
+import com.redhat.thermostat.common.storage.Key;
 
 public class VmInfoConverterTest {
 
@@ -94,8 +95,7 @@
         Chunk chunk = new VmInfoConverter().toChunk(info);
 
         assertNotNull(chunk);
-        assertEquals((Integer) vmId, chunk.get(VmInfoDAO.vmIdKey));
-        assertEquals((Integer) vmId, chunk.get(VmInfoDAO.vmIdKey));
+        assertEquals((Integer) vmId, chunk.get(Key.VM_ID));
         assertEquals((Long) startTime, chunk.get(VmInfoDAO.startTimeKey));
         assertEquals((Long) stopTime, chunk.get(VmInfoDAO.stopTimeKey));
         assertEquals(jVersion, chunk.get(VmInfoDAO.runtimeVersionKey));
@@ -114,7 +114,7 @@
     public void testChunkToVmInfo() {
         Chunk chunk = new Chunk(VmInfoDAO.vmInfoCategory, true);
 
-        chunk.put(VmInfoDAO.vmIdKey, vmId);
+        chunk.put(Key.VM_ID, vmId);
         chunk.put(VmInfoDAO.vmPidKey, vmId);
         chunk.put(VmInfoDAO.startTimeKey, startTime);
         chunk.put(VmInfoDAO.stopTimeKey, stopTime);
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmInfoDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -101,29 +101,29 @@
     public void testCategory() {
         assertEquals("vm-info", VmInfoDAO.vmInfoCategory.getName());
         Collection<Key<?>> keys = VmInfoDAO.vmInfoCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("vm-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("vm-pid", false)));
-        assertTrue(keys.contains(new Key<String>("runtime-version", false)));
-        assertTrue(keys.contains(new Key<String>("java-home", false)));
-        assertTrue(keys.contains(new Key<String>("main-class", false)));
-        assertTrue(keys.contains(new Key<String>("command-line", false)));
-        assertTrue(keys.contains(new Key<String>("vm-arguments", false)));
-        assertTrue(keys.contains(new Key<String>("vm-name", false)));
-        assertTrue(keys.contains(new Key<String>("vm-info", false)));
-        assertTrue(keys.contains(new Key<String>("vm-version", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Integer>("vmId", true)));
+        assertTrue(keys.contains(new Key<Integer>("vmPid", false)));
+        assertTrue(keys.contains(new Key<String>("javaVersion", false)));
+        assertTrue(keys.contains(new Key<String>("javaHome", false)));
+        assertTrue(keys.contains(new Key<String>("mainClass", false)));
+        assertTrue(keys.contains(new Key<String>("javaCommandLine", false)));
+        assertTrue(keys.contains(new Key<String>("vmArguments", false)));
+        assertTrue(keys.contains(new Key<String>("vmName", false)));
+        assertTrue(keys.contains(new Key<String>("vmInfo", false)));
+        assertTrue(keys.contains(new Key<String>("vmVersion", false)));
         assertTrue(keys.contains(new Key<Map<String, String>>("properties", false)));
         assertTrue(keys.contains(new Key<Map<String, String>>("environment", false)));
-        assertTrue(keys.contains(new Key<List<String>>("libraries", false)));
-        assertTrue(keys.contains(new Key<Long>("start-time", false)));
-        assertTrue(keys.contains(new Key<Long>("stop-time", false)));
+        assertTrue(keys.contains(new Key<List<String>>("loadedNativeLibraries", false)));
+        assertTrue(keys.contains(new Key<Long>("startTimeStamp", false)));
+        assertTrue(keys.contains(new Key<Long>("stopTimeStamp", false)));
         assertEquals(16, keys.size());
     }
 
     @Test
     public void testGetVmInfo() {
         Chunk chunk = new Chunk(VmInfoDAO.vmInfoCategory, true);
-        chunk.put(VmInfoDAO.vmIdKey, vmId);
+        chunk.put(Key.VM_ID, vmId);
         chunk.put(VmInfoDAO.vmPidKey, vmId);
         chunk.put(VmInfoDAO.startTimeKey, startTime);
         chunk.put(VmInfoDAO.stopTimeKey, stopTime);
@@ -212,7 +212,7 @@
           .where(Key.AGENT_ID, Criteria.EQUALS, "123");
 
       Chunk vm1 = new Chunk(VmInfoDAO.vmInfoCategory, false);
-      vm1.put(VmInfoDAO.vmIdKey, 123);
+      vm1.put(Key.VM_ID, 123);
       vm1.put(VmInfoDAO.mainClassKey, "mainClass1");
 
       Cursor singleVMCursor = mock(Cursor.class);
@@ -243,11 +243,11 @@
           .where(Key.AGENT_ID, Criteria.EQUALS, "456");
 
       Chunk vm1 = new Chunk(VmInfoDAO.vmInfoCategory, false);
-      vm1.put(VmInfoDAO.vmIdKey, 123);
+      vm1.put(Key.VM_ID, 123);
       vm1.put(VmInfoDAO.mainClassKey, "mainClass1");
 
       Chunk vm2 = new Chunk(VmInfoDAO.vmInfoCategory, false);
-      vm2.put(VmInfoDAO.vmIdKey, 456);
+      vm2.put(Key.VM_ID, 456);
       vm2.put(VmInfoDAO.mainClassKey, "mainClass2");
 
       Cursor multiVMsCursor = mock(Cursor.class);
@@ -286,25 +286,7 @@
         VmInfoDAO dao = new VmInfoDAOImpl(storage);
         dao.putVmInfo(info);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(VmInfoDAO.vmInfoCategory, chunk.getCategory());
-        assertEquals((Integer) vmId, chunk.get(VmInfoDAO.vmIdKey));
-        assertEquals((Long) startTime, chunk.get(VmInfoDAO.startTimeKey));
-        assertEquals((Long) stopTime, chunk.get(VmInfoDAO.stopTimeKey));
-        assertEquals(jVersion, chunk.get(VmInfoDAO.runtimeVersionKey));
-        assertEquals(jHome, chunk.get(VmInfoDAO.javaHomeKey));
-        assertEquals(mainClass, chunk.get(VmInfoDAO.mainClassKey));
-        assertEquals(commandLine, chunk.get(VmInfoDAO.commandLineKey));
-        assertEquals(vmName, chunk.get(VmInfoDAO.vmNameKey));
-        assertEquals(vmInfo, chunk.get(VmInfoDAO.vmInfoKey));
-        assertEquals(vmVersion, chunk.get(VmInfoDAO.vmVersionKey));
-        assertEquals(vmArgs, chunk.get(VmInfoDAO.vmArgumentsKey));
-        assertEquals(props, chunk.get(VmInfoDAO.propertiesKey));
-        assertEquals(env, chunk.get(VmInfoDAO.environmentKey));
-        assertEquals(libs, chunk.get(VmInfoDAO.librariesKey));
+        verify(storage).putPojo(VmInfoDAO.vmInfoCategory, true, info);
     }
 
     @Test
@@ -318,7 +300,7 @@
         Chunk chunk = arg.getValue();
 
         assertEquals(VmInfoDAO.vmInfoCategory, chunk.getCategory());
-        assertEquals((Integer) vmId, chunk.get(VmInfoDAO.vmIdKey));
+        assertEquals((Integer) vmId, chunk.get(Key.VM_ID));
         assertEquals((Long) stopTime, chunk.get(VmInfoDAO.stopTimeKey));
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmLatestPojoListGetterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmLatestPojoListGetterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -36,11 +36,20 @@
 
 package com.redhat.thermostat.common.dao;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.isA;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
 import java.util.List;
 
 import org.junit.Before;
 import org.junit.Test;
-import org.mockito.ArgumentCaptor;
 
 import com.redhat.thermostat.common.model.VmClassStat;
 import com.redhat.thermostat.common.storage.Category;
@@ -52,17 +61,6 @@
 import com.redhat.thermostat.common.storage.Storage;
 import com.redhat.thermostat.test.MockQuery;
 
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.isA;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.when;
-
 public class VmLatestPojoListGetterTest {
     private static final String AGENT_ID = "agentid";
     private static final String HOSTNAME = "host.example.com";
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatConverterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatConverterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -87,8 +87,8 @@
         Chunk chunk = new VmMemoryStatConverter().toChunk(stat);
 
         assertNotNull(chunk);
-        assertEquals((Long) 1l, chunk.get(new Key<Long>("timestamp", false)));
-        assertEquals((Integer) 2, chunk.get(new Key<Integer>("vm-id", true)));
+        assertEquals((Long) 1l, chunk.get(new Key<Long>("timeStamp", false)));
+        assertEquals((Integer) 2, chunk.get(new Key<Integer>("vmId", true)));
         assertEquals("new", chunk.get(new Key<String>("eden.gen", false)));
         assertEquals("new", chunk.get(new Key<String>("eden.collector", false)));
         assertEquals((Long) 0l, chunk.get(new Key<Long>("eden.used", false)));
--- a/common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/dao/VmMemoryStatDAOTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -113,9 +113,9 @@
 
         assertEquals("vm-memory-stats", VmMemoryStatDAO.vmMemoryStatsCategory.getName());
         keys = VmMemoryStatDAO.vmMemoryStatsCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agent-id", true)));
-        assertTrue(keys.contains(new Key<Integer>("vm-id", true)));
-        assertTrue(keys.contains(new Key<Long>("timestamp", false)));
+        assertTrue(keys.contains(new Key<>("agentId", true)));
+        assertTrue(keys.contains(new Key<Integer>("vmId", true)));
+        assertTrue(keys.contains(new Key<Long>("timeStamp", false)));
         assertTrue(keys.contains(new Key<String>("eden.gen", false)));
         assertTrue(keys.contains(new Key<String>("eden.collector", false)));
         assertTrue(keys.contains(new Key<Long>("eden.capacity", false)));
@@ -226,37 +226,6 @@
         VmMemoryStatDAO dao = new VmMemoryStatDAOImpl(storage);
         dao.putVmMemoryStat(stat);
 
-        ArgumentCaptor<Chunk> arg = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(arg.capture());
-        Chunk chunk = arg.getValue();
-
-        assertEquals(VmMemoryStatDAO.vmMemoryStatsCategory, chunk.getCategory());
-        assertEquals((Long) 1l, chunk.get(new Key<Long>("timestamp", false)));
-        assertEquals((Integer) 2, chunk.get(new Key<Integer>("vm-id", true)));
-        assertEquals("new", chunk.get(new Key<String>("eden.gen", false)));
-        assertEquals("new", chunk.get(new Key<String>("eden.collector", false)));
-        assertEquals((Long) 0l, chunk.get(new Key<Long>("eden.used", false)));
-        assertEquals((Long) 1l, chunk.get(new Key<Long>("eden.capacity", false)));
-        assertEquals((Long) 2l, chunk.get(new Key<Long>("eden.max-capacity", false)));
-        assertEquals("new", chunk.get(new Key<String>("s0.gen", false)));
-        assertEquals("new", chunk.get(new Key<String>("s0.collector", false)));
-        assertEquals((Long) 3l, chunk.get(new Key<Long>("s0.used", false)));
-        assertEquals((Long) 4l, chunk.get(new Key<Long>("s0.capacity", false)));
-        assertEquals((Long) 5l, chunk.get(new Key<Long>("s0.max-capacity", false)));
-        assertEquals("new", chunk.get(new Key<String>("s1.gen", false)));
-        assertEquals("new", chunk.get(new Key<String>("s1.collector", false)));
-        assertEquals((Long) 6l, chunk.get(new Key<Long>("s1.used", false)));
-        assertEquals((Long) 7l, chunk.get(new Key<Long>("s1.capacity", false)));
-        assertEquals((Long) 8l, chunk.get(new Key<Long>("s1.max-capacity", false)));
-        assertEquals("old", chunk.get(new Key<String>("old.gen", false)));
-        assertEquals("old", chunk.get(new Key<String>("old.collector", false)));
-        assertEquals((Long) 9l, chunk.get(new Key<Long>("old.used", false)));
-        assertEquals((Long) 10l, chunk.get(new Key<Long>("old.capacity", false)));
-        assertEquals((Long) 11l, chunk.get(new Key<Long>("old.max-capacity", false)));
-        assertEquals("perm", chunk.get(new Key<String>("perm.gen", false)));
-        assertEquals("perm", chunk.get(new Key<String>("perm.collector", false)));
-        assertEquals((Long) 12l, chunk.get(new Key<Long>("perm.used", false)));
-        assertEquals((Long) 13l, chunk.get(new Key<Long>("perm.capacity", false)));
-        assertEquals((Long) 14l, chunk.get(new Key<Long>("perm.max-capacity", false)));
+        verify(storage).putPojo(VmMemoryStatDAO.vmMemoryStatsCategory, false, stat);
     }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/model/HeapInfoTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/model/HeapInfoTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -38,14 +38,10 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
-import static org.junit.Assert.assertSame;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import com.redhat.thermostat.common.dao.HostRef;
-import com.redhat.thermostat.common.dao.VmRef;
-
 public class HeapInfoTest {
 
     private HeapInfo heapInfo;
@@ -53,12 +49,14 @@
     @Before
     public void setUp() {
         heapInfo = new HeapInfo(321, 12345);
+        heapInfo.setAgentId("test-agent");
     }
 
     @Test
     public void testProperties() {
+        assertEquals("test-agent", heapInfo.getAgentId());
         assertEquals(321, heapInfo.getVmId());
-        assertEquals(12345, heapInfo.getTimestamp());
+        assertEquals(12345, heapInfo.getTimeStamp());
     }
 
     @Test
--- a/common/core/src/test/java/com/redhat/thermostat/common/storage/ChunkAdapterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/storage/ChunkAdapterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -57,6 +57,7 @@
         private List<String> listData;
         private long longData;
         private String stringData;
+        private NestedData nestedData;
 
         @Persist
         public long[] getArrayData() {
@@ -92,6 +93,23 @@
             return stringData;
         }
 
+        public NestedData getNestedData() {
+            return nestedData;
+        }
+
+        public void setNestedData(NestedData nestedData) {
+            this.nestedData = nestedData;
+        }
+    }
+
+    public static class NestedData {
+        private String data;
+        public void setData(String data) {
+            this.data = data;
+        }
+        public String getData() {
+            return data;
+        }
     }
 
     // the expected keys for each 'property' in the SomeData bean
@@ -99,6 +117,7 @@
     private static final Key<List<String>> listData = new Key<>("listData", false);
     private static final Key<Long> longData = new Key<>("longData", false);
     private static final Key<String> stringData = new Key<>("stringData", false);
+    private static final Key<String> nestedData = new Key<>("nestedData.data", false);
 
     @Test
     public void verifyAdapaterCanBeUsedInPlaceOfChunk() {
@@ -282,4 +301,19 @@
         new ChunkAdapter(new DataWithCustomAttributeNameMismatch());
     }
 
+    @Test
+    public void verifyGetAndPutNestedValue() {
+        NestedData nested = new NestedData();
+        nested.setData("stringData");
+        SomeData testObject = new SomeData();
+        testObject.setNestedData(nested);
+        Chunk chunk = new ChunkAdapter(testObject);
+
+        assertEquals("stringData", chunk.get(nestedData));
+
+        chunk.put(nestedData, "some-new-data");
+
+        assertEquals("some-new-data", chunk.get(nestedData));
+        assertEquals("some-new-data", testObject.getNestedData().getData());
+    }
 }
--- a/common/core/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/common/core/src/test/java/com/redhat/thermostat/common/storage/MongoStorageTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -362,7 +362,7 @@
         ArgumentCaptor<DBObject> dbobj = ArgumentCaptor.forClass(DBObject.class);
         verify(testCollection).insert(dbobj.capture());
         DBObject val = dbobj.getValue();
-        assertEquals("123", val.get("agent-id"));
+        assertEquals("123", val.get("agentId"));
     }
 
     @Test
@@ -376,7 +376,7 @@
         ArgumentCaptor<DBObject> dbobj = ArgumentCaptor.forClass(DBObject.class);
         verify(testCollection).insert(dbobj.capture());
         DBObject val = dbobj.getValue();
-        assertEquals(new UUID(1, 2).toString(), val.get("agent-id"));
+        assertEquals(new UUID(1, 2).toString(), val.get("agentId"));
     }
 
     @Test
--- a/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadMXBeanCollector.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/client-common/src/main/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadMXBeanCollector.java	Tue Sep 11 17:56:15 2012 +0200
@@ -94,7 +94,6 @@
         Request harvester = createRequest();
         harvester.setParameter(HarvesterCommand.class.getName(), HarvesterCommand.START.name());
         harvester.setParameter(HarvesterCommand.VM_ID.name(), ref.getIdString());
-        harvester.setParameter(HarvesterCommand.AGENT_ID.name(), ref.getAgent().getAgentId());
         
         final CountDownLatch latch = new CountDownLatch(1);
         final boolean[] result = new boolean[1];
@@ -227,7 +226,6 @@
             Request harvester = createRequest();
             harvester.setParameter(HarvesterCommand.class.getName(), HarvesterCommand.VM_CAPS.name());
             harvester.setParameter(HarvesterCommand.VM_ID.name(), ref.getIdString());
-            harvester.setParameter(HarvesterCommand.AGENT_ID.name(), ref.getAgent().getAgentId());
             
             final CountDownLatch latch = new CountDownLatch(1);
             harvester.addListener(new RequestResponseListener() {
--- a/thread/client-common/src/test/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadCollectorTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/client-common/src/test/java/com/redhat/thermostat/thread/client/common/collector/impl/ThreadCollectorTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -121,7 +121,6 @@
 
         verify(request).setParameter(HarvesterCommand.class.getName(), HarvesterCommand.VM_CAPS.name());
         verify(request).setParameter(HarvesterCommand.VM_ID.name(), "00101010");
-        verify(request).setParameter(HarvesterCommand.AGENT_ID.name(), "42");
         
         verify(requestQueue).putRequest(request);
         
@@ -212,7 +211,6 @@
         
         verify(request).setParameter(HarvesterCommand.class.getName(), HarvesterCommand.START.name());
         verify(request).setParameter(HarvesterCommand.VM_ID.name(), "00101010");
-        verify(request).setParameter(HarvesterCommand.AGENT_ID.name(), "42");
         
         verify(requestQueue).putRequest(request);
     }
--- a/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadInformationController.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadInformationController.java	Tue Sep 11 17:56:15 2012 +0200
@@ -143,15 +143,15 @@
             // load the very latest thread summary
             ThreadSummary latestSummary = collector.getLatestThreadSummary();
             if (latestSummary.getTimeStamp() != 0) {
-                view.setLiveThreads(Long.toString(latestSummary.currentLiveThreads()));
-                view.setDaemonThreads(Long.toString(latestSummary.currentDaemonThreads()));
+                view.setLiveThreads(Long.toString(latestSummary.getCurrentLiveThreads()));
+                view.setDaemonThreads(Long.toString(latestSummary.getCurrentDaemonThreads()));
             }
             
             long lastHour = System.currentTimeMillis() - TimeUnit.HOURS.toMillis(1);
             List<ThreadSummary> summaries = collector.getThreadSummary(lastHour);
             if (summaries.size() != 0) {
                 for (ThreadSummary summary : summaries) {
-                    model.addData(summary.getTimeStamp(), summary.currentLiveThreads(), summary.currentDaemonThreads());
+                    model.addData(summary.getTimeStamp(), summary.getCurrentLiveThreads(), summary.getCurrentDaemonThreads());
                 }
                 view.updateLivingDaemonTimeline(model);
             }
--- a/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTableController.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/client-controllers/src/main/java/com/redhat/thermostat/thread/client/controller/impl/ThreadTableController.java	Tue Sep 11 17:56:15 2012 +0200
@@ -126,11 +126,11 @@
                 for (ThreadInfoData key : stats.keySet()) {
                     ThreadTableBean bean = new ThreadTableBean();
                     
-                    bean.setName(key.getName());
-                    bean.setId(key.getThreadID());
+                    bean.setName(key.getThreadName());
+                    bean.setId(key.getThreadId());
                     
-                    bean.setWaitedCount(key.getWaitedCount());
-                    bean.setBlockedCount(key.getBlockedCount());
+                    bean.setWaitedCount(key.getThreadWaitCount());
+                    bean.setBlockedCount(key.getThreadBlockedCount());
                     
                     // get start time and stop time, if any
                     List<ThreadInfoData> beanList = stats.get(key);
@@ -149,7 +149,7 @@
                     double monitor = 0;
                     double sleeping = 0;
                     for (ThreadInfoData info : beanList) {
-                        State state = info.getState();
+                        State state = info.getThreadState();
                         switch (state) {
                         case RUNNABLE:
                             running++;
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/collector/HarvesterCommand.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/collector/HarvesterCommand.java	Tue Sep 11 17:56:15 2012 +0200
@@ -7,7 +7,6 @@
     VM_CAPS,
     IS_COLLECTING,
     
-    AGENT_ID,
     VM_ID;
 
     public static final String RECEIVER = "com.redhat.thermostat.thread.harvester.ThreadHarvester";
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/ThreadDao.java	Tue Sep 11 17:56:15 2012 +0200
@@ -51,23 +51,24 @@
     static final String CPU_TIME = "thread-cpu-time";
     static final String CONTENTION_MONITOR = "thread-contention-monitor";
     static final String THREAD_ALLOCATED_MEMORY = "thread-allocated-memory";
+    static final String SUPPORTED_FEATURES_LIST = "supportedFeaturesList";
 
     static final Key<Boolean> CPU_TIME_KEY = new Key<Boolean>(CPU_TIME, false);
     static final Key<Boolean> CONTENTION_MONITOR_KEY = new Key<Boolean>(CONTENTION_MONITOR, false);
     static final Key<Boolean> THREAD_ALLOCATED_MEMORY_KEY = new Key<Boolean>(THREAD_ALLOCATED_MEMORY, false);
+    static final Key<List<String>> SUPPORTED_FEATURES_LIST_KEY = new Key<List<String>>(SUPPORTED_FEATURES_LIST, false);
 
     static final Category THREAD_CAPABILITIES =
             new Category("vm-thread-capabilities", Key.AGENT_ID, Key.VM_ID,
-                         CPU_TIME_KEY, CONTENTION_MONITOR_KEY,
-                         THREAD_ALLOCATED_MEMORY_KEY);
+                         SUPPORTED_FEATURES_LIST_KEY);
 
 
     VMThreadCapabilities loadCapabilities(VmRef ref);
-    void saveCapabilities(String vmId, String agentId, VMThreadCapabilities caps);
+    void saveCapabilities(VMThreadCapabilities caps);
 
-    static final String LIVE_THREADS = "thread-living";
+    static final String LIVE_THREADS = "currentLiveThreads";
     static final Key<Long> LIVE_THREADS_KEY = new Key<Long>(LIVE_THREADS, false);
-    static final String DAEMON_THREADS = "thread-daemons";
+    static final String DAEMON_THREADS = "currentDaemonThreads";
     static final Key<Long> DAEMON_THREADS_KEY = new Key<Long>(DAEMON_THREADS, false);
     
     static final Category THREAD_SUMMARY =
@@ -75,37 +76,33 @@
                          Key.TIMESTAMP,
                          LIVE_THREADS_KEY, DAEMON_THREADS_KEY);
     
-    void saveSummary(String vmId, String agentId, ThreadSummary summary);
+    void saveSummary(ThreadSummary summary);
     ThreadSummary loadLastestSummary(VmRef ref);
     List<ThreadSummary> loadSummary(VmRef ref, long since);
 
-    static final String THREAD_STATE = "thread-state";
+    static final String THREAD_STATE = "threadState";
     static final Key<String> THREAD_STATE_KEY = new Key<String>(THREAD_STATE, false);
-    static final String THREAD_ID = "thread-id";
+    static final String THREAD_ID = "threadId";
     static final Key<Long> THREAD_ID_KEY = new Key<Long>(THREAD_ID, false);
-    static final String THREAD_NAME = "thread-name";
+    static final String THREAD_NAME = "threadName";
     static final Key<String> THREAD_NAME_KEY = new Key<String>(THREAD_NAME, false);
-    static final String THREAD_HEAP = "thread-id";
-    static final Key<Long> THREAD_HEAP_KEY = new Key<Long>(THREAD_HEAP, false);
-    static final String THREAD_CPU_TIME = "thread-cpu-time";
+    static final String THREAD_CPU_TIME = "threadCpuTime";
     static final Key<Long> THREAD_CPU_TIME_KEY = new Key<Long>(THREAD_CPU_TIME, false);
-    static final String THREAD_USER_TIME = "thread-user-time";
+    static final String THREAD_USER_TIME = "threadUserTime";
     static final Key<Long> THREAD_USER_TIME_KEY = new Key<Long>(THREAD_USER_TIME, false);
-    static final String THREAD_BLOCKED_COUNT = "thread-blocked-count";
+    static final String THREAD_BLOCKED_COUNT = "threadBlockedCount";
     static final Key<Long> THREAD_BLOCKED_COUNT_KEY = new Key<Long>(THREAD_BLOCKED_COUNT, false);
-    static final String THREAD_WAIT_COUNT = "thread-wait-count";
+    static final String THREAD_WAIT_COUNT = "threadWaitCount";
     static final Key<Long> THREAD_WAIT_COUNT_KEY = new Key<Long>(THREAD_WAIT_COUNT, false);
-    static final String THREAD_STACK_TRACE_ID = "thread-stacktrace-id";
-    static final Key<Long> THREAD_STACK_TRACE_ID_KEY = new Key<Long>(THREAD_STACK_TRACE_ID, false);
             
     static final Category THREAD_INFO =
             new Category("vm-thread-info", Key.AGENT_ID, Key.VM_ID,
                          Key.TIMESTAMP, THREAD_NAME_KEY, THREAD_ID_KEY,
-                         THREAD_STATE_KEY, THREAD_HEAP_KEY, THREAD_CPU_TIME_KEY,
+                         THREAD_CPU_TIME_KEY,
                          THREAD_USER_TIME_KEY, THREAD_BLOCKED_COUNT_KEY,
-                         THREAD_WAIT_COUNT_KEY, THREAD_STACK_TRACE_ID_KEY);
+                         THREAD_WAIT_COUNT_KEY);
     
-    void saveThreadInfo(String vmId, String agentId, ThreadInfoData info);
+    void saveThreadInfo(ThreadInfoData info);
     List<ThreadInfoData> loadThreadInfo(VmRef ref, long since);
     
     Storage getStorage();
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImpl.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImpl.java	Tue Sep 11 17:56:15 2012 +0200
@@ -75,34 +75,20 @@
         Chunk found = storage.find(query);
         if (found != null) {
             caps = new VMThreadCapabilities();
-            if (found.get(CONTENTION_MONITOR_KEY)) caps.addFeature(CONTENTION_MONITOR);
-            if (found.get(CPU_TIME_KEY)) caps.addFeature(CPU_TIME);
-            if (found.get(THREAD_ALLOCATED_MEMORY_KEY)) caps.addFeature(THREAD_ALLOCATED_MEMORY);
+            caps.setSupportedFeaturesList(found.get(SUPPORTED_FEATURES_LIST_KEY));
         }
         
         return caps;
     }
     
     @Override
-    public void saveCapabilities(String vmId, String agentId, VMThreadCapabilities caps) {
-        Chunk chunk = prepareChunk(THREAD_CAPABILITIES, true, vmId, agentId);
-        
-        chunk.put(CONTENTION_MONITOR_KEY, caps.supportContentionMonitor());
-        chunk.put(CPU_TIME_KEY, caps.supportCPUTime());
-        chunk.put(THREAD_ALLOCATED_MEMORY_KEY, caps.supportThreadAllocatedMemory());
-        
-        storage.putChunk(chunk);
+    public void saveCapabilities(VMThreadCapabilities caps) {
+        storage.putPojo(THREAD_CAPABILITIES, true, caps);
     }
     
     @Override
-    public void saveSummary(String vmId, String agentId, ThreadSummary summary) {
-        Chunk chunk = prepareChunk(THREAD_SUMMARY, false, vmId, agentId);
-        
-        chunk.put(LIVE_THREADS_KEY, summary.currentLiveThreads());
-        chunk.put(DAEMON_THREADS_KEY, summary.currentDaemonThreads());
-        chunk.put(Key.TIMESTAMP, summary.getTimeStamp());
-        
-        storage.putChunk(chunk);
+    public void saveSummary(ThreadSummary summary) {
+        storage.putPojo(THREAD_SUMMARY, false, summary);
     }
     
     @Override
@@ -114,9 +100,9 @@
         if (cursor.hasNext()) {
             Chunk found = cursor.next();
             summary = new ThreadSummary();
-            summary.setTimestamp(found.get(Key.TIMESTAMP));
+            summary.setTimeStamp(found.get(Key.TIMESTAMP));
             summary.setCurrentLiveThreads(found.get(LIVE_THREADS_KEY));
-            summary.setDaemonThreads(found.get(DAEMON_THREADS_KEY));
+            summary.setCurrentDaemonThreads(found.get(DAEMON_THREADS_KEY));
         }
         
         return summary;
@@ -135,9 +121,9 @@
             ThreadSummary summary = new ThreadSummary();
             
             Chunk found = cursor.next();
-            summary.setTimestamp(found.get(Key.TIMESTAMP));
+            summary.setTimeStamp(found.get(Key.TIMESTAMP));
             summary.setCurrentLiveThreads(found.get(LIVE_THREADS_KEY));
-            summary.setDaemonThreads(found.get(DAEMON_THREADS_KEY));
+            summary.setCurrentDaemonThreads(found.get(DAEMON_THREADS_KEY));
             result.add(summary);
         }
         
@@ -145,21 +131,8 @@
     }
     
     @Override
-    public void saveThreadInfo(String vmId, String agentId, ThreadInfoData info) {
-        Chunk chunk = prepareChunk(THREAD_INFO, false, vmId, agentId);
-        
-        chunk.put(Key.TIMESTAMP, info.getTimeStamp());
-
-        chunk.put(THREAD_ID_KEY, info.getThreadID());
-        chunk.put(THREAD_NAME_KEY, info.getName());
-        chunk.put(THREAD_STATE_KEY, info.getState().name());
-        
-        chunk.put(THREAD_BLOCKED_COUNT_KEY, info.getBlockedCount());
-        chunk.put(THREAD_WAIT_COUNT_KEY, info.getWaitedCount());
-        chunk.put(THREAD_CPU_TIME_KEY, info.getCpuTime());
-        chunk.put(THREAD_USER_TIME_KEY, info.getUserTime());
-
-        storage.putChunk(chunk);
+    public void saveThreadInfo(ThreadInfoData info) {
+        storage.putPojo(THREAD_INFO, false, info);
     }
 
     @Override
@@ -176,14 +149,14 @@
             Chunk found = cursor.next();
             info.setTimeStamp(found.get(Key.TIMESTAMP));
             
-            info.setID(found.get(THREAD_ID_KEY));
-            info.setName(found.get(THREAD_NAME_KEY));
-            info.setState(Thread.State.valueOf(found.get(THREAD_STATE_KEY)));
+            info.setThreadId(found.get(THREAD_ID_KEY));
+            info.setThreadName(found.get(THREAD_NAME_KEY));
+            info.setThreadState(Thread.State.valueOf(found.get(THREAD_STATE_KEY)));
 
-            info.setBlockedCount(found.get(THREAD_BLOCKED_COUNT_KEY));
-            info.setWaitedCount(found.get(THREAD_WAIT_COUNT_KEY));
-            info.setCPUTime(found.get(THREAD_CPU_TIME_KEY));
-            info.setUserTime(found.get(THREAD_USER_TIME_KEY));
+            info.setThreadBlockedCount(found.get(THREAD_BLOCKED_COUNT_KEY));
+            info.setThreadWaitCount(found.get(THREAD_WAIT_COUNT_KEY));
+            info.setThreadCpuTime(found.get(THREAD_CPU_TIME_KEY));
+            info.setThreadUserTime(found.get(THREAD_USER_TIME_KEY));
 
             result.add(info);
         }
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadInfoData.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadInfoData.java	Tue Sep 11 17:56:15 2012 +0200
@@ -40,10 +40,14 @@
 import java.util.Arrays;
 
 import com.redhat.thermostat.common.model.TimeStampedPojo;
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
 
 
+@Entity
 public class ThreadInfoData implements TimeStampedPojo {
 
+    private int vmId;
     private StackTraceElement[] stackTrace;
     private long threadID;
     private State threadState;
@@ -56,7 +60,7 @@
     private long waitedCount;
     
     private long timestamp;
-    
+
     public void setStackTrace(StackTraceElement[] stackTrace) {
         this.stackTrace = stackTrace;
     }
@@ -77,75 +81,101 @@
                 + "]";
     }
 
-    public void setName(String threadName) {
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
+    @Persist
+    public int getVmId() {
+        return vmId;
+    }
+
+    @Persist
+    public void setThreadName(String threadName) {
         this.name = threadName;
     }
 
-    public void setID(long threadID) {
+    @Persist
+    public void setThreadId(long threadID) {
         this.threadID = threadID;
     }
 
-    public void setState(State threadState) {
+    public void setThreadState(State threadState) {
         this.threadState = threadState;
     }
 
+    @Persist
     public void setAllocatedBytes(long allocatedBytes) {
         this.allocatedBytes = allocatedBytes;
     }
 
-    public String getName() {
+    @Persist
+    public String getThreadName() {
         return name;
     }
 
+    @Persist
     public long getAllocatedBytes() {
         return allocatedBytes;
     }
 
-    public long getThreadID() {
+    @Persist
+    public long getThreadId() {
         return threadID;
     }
 
-    public State getState() {
+    public State getThreadState() {
         return threadState;
     }
 
+    @Persist
     public long getTimeStamp() {
         return timestamp;
     }
     
+    @Persist
     public void setTimeStamp(long timestamp) {
         this.timestamp = timestamp;
     }
 
-    public void setCPUTime(long threadCpuTime) {
+    @Persist
+    public void setThreadCpuTime(long threadCpuTime) {
         this.threadCpuTime = threadCpuTime;
     }
 
-    public void setUserTime(long threadUserTime) {
+    @Persist
+    public void setThreadUserTime(long threadUserTime) {
        this.threadUserTime = threadUserTime;
     }
 
-    public void setBlockedCount(long blockedCount) {
+    @Persist
+    public void setThreadBlockedCount(long blockedCount) {
         this.blockedCount = blockedCount;
     }
 
-    public void setWaitedCount(long waitedCount) {
+    @Persist
+    public void setThreadWaitCount(long waitedCount) {
         this.waitedCount = waitedCount;
     }
 
-    public long getBlockedCount() {
+    @Persist
+    public long getThreadBlockedCount() {
         return blockedCount;
     }
 
-    public long getWaitedCount() {
+    @Persist
+    public long getThreadWaitCount() {
         return waitedCount;
     }
 
-    public long getCpuTime() {
+    @Persist
+    public long getThreadCpuTime() {
         return threadCpuTime;
     }
 
-    public long getUserTime() {
+    @Persist
+    public long getThreadUserTime() {
         return threadUserTime;
     }
 
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadSummary.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/model/ThreadSummary.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,36 +37,56 @@
 package com.redhat.thermostat.thread.model;
 
 import com.redhat.thermostat.common.model.TimeStampedPojo;
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
 
 
+@Entity
 public class ThreadSummary implements TimeStampedPojo {
 
+    private int vmId;
     private long currentLiveThreads;
     private long daemonThreads;
     
     private long timestamp;
 
-    public long currentLiveThreads() {
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
+    @Persist
+    public int getVmId() {
+        return vmId;
+    }
+
+    @Persist
+    public long getCurrentLiveThreads() {
         return currentLiveThreads;
     }
     
+    @Persist
     public void setCurrentLiveThreads(long currentLiveThreads) {
         this.currentLiveThreads = currentLiveThreads;
     }
 
-    public long currentDaemonThreads() {
+    @Persist
+    public long getCurrentDaemonThreads() {
         return daemonThreads;
     }
     
-    public void setDaemonThreads(long daemonThreads) {
+    @Persist
+    public void setCurrentDaemonThreads(long daemonThreads) {
         this.daemonThreads = daemonThreads;
     }
 
+    @Persist
     public long getTimeStamp() {
         return timestamp;
     }
-    
-    public void setTimestamp(long timestamp) {
+
+    @Persist
+    public void setTimeStamp(long timestamp) {
         this.timestamp = timestamp;
     }
     
--- a/thread/collector/src/main/java/com/redhat/thermostat/thread/model/VMThreadCapabilities.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/main/java/com/redhat/thermostat/thread/model/VMThreadCapabilities.java	Tue Sep 11 17:56:15 2012 +0200
@@ -41,12 +41,28 @@
 import java.util.List;
 import java.util.Set;
 
+import com.redhat.thermostat.common.model.Pojo;
+import com.redhat.thermostat.common.storage.Entity;
+import com.redhat.thermostat.common.storage.Persist;
 import com.redhat.thermostat.thread.dao.ThreadDao;
 
-public class VMThreadCapabilities {
+@Entity
+public class VMThreadCapabilities implements Pojo {
     
     private Set<String> features = new HashSet<>();
 
+    private int vmId;
+
+    @Persist
+    public void setVmId(int vmId) {
+        this.vmId = vmId;
+    }
+
+    @Persist
+    public int getVmId() {
+        return vmId;
+    }
+
     public boolean supportCPUTime() {
         return features.contains(ThreadDao.CPU_TIME);
     }
@@ -64,10 +80,16 @@
         return features.contains(ThreadDao.THREAD_ALLOCATED_MEMORY);
     }
 
+    @Persist
     public List<String> getSupportedFeaturesList() {
         return new ArrayList<>(features);
     }
-    
+
+    @Persist
+    public void setSupportedFeaturesList(List<String> featuresList) {
+        features = new HashSet<>(featuresList);
+    }
+
     public void addFeature(String feature) {
         features.add(feature);
     }
--- a/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImplTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/collector/src/test/java/com/redhat/thermostat/thread/dao/impl/ThreadDaoImplTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -39,11 +39,12 @@
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertFalse;
 import static org.junit.Assert.assertTrue;
-
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
+import java.util.Arrays;
+
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
@@ -86,9 +87,7 @@
         when(ref.getAgent()).thenReturn(agent);
         
         Chunk answer = mock(Chunk.class);
-        when(answer.get(ThreadDao.CONTENTION_MONITOR_KEY)).thenReturn(false);
-        when(answer.get(ThreadDao.CPU_TIME_KEY)).thenReturn(true);
-        when(answer.get(ThreadDao.THREAD_ALLOCATED_MEMORY_KEY)).thenReturn(true);
+        when(answer.get(ThreadDao.SUPPORTED_FEATURES_LIST_KEY)).thenReturn(Arrays.asList(ThreadDao.CPU_TIME, ThreadDao.THREAD_ALLOCATED_MEMORY));
         
         when(storage.find(query)).thenReturn(answer);
         
@@ -115,18 +114,11 @@
         when(caps.supportContentionMonitor()).thenReturn(true);
         when(caps.supportCPUTime()).thenReturn(true);
         when(caps.supportThreadAllocatedMemory()).thenReturn(true);
-        
+        when(caps.getVmId()).thenReturn(42);
         ThreadDaoImpl dao = new ThreadDaoImpl(storage);
-        dao.saveCapabilities("42", "0xcafe", caps);
-
-        ArgumentCaptor<Chunk> queryCaptor = ArgumentCaptor.forClass(Chunk.class);
-        verify(storage).putChunk(queryCaptor.capture());
+        dao.saveCapabilities(caps);
 
-        Chunk query = queryCaptor.getValue();
-        assertEquals(42, (int) query.get(Key.VM_ID));
-        assertEquals("0xcafe", query.get(Key.AGENT_ID));
-        assertTrue((boolean) query.get(ThreadDao.CONTENTION_MONITOR_KEY));
-        assertTrue((boolean) query.get(ThreadDao.CPU_TIME_KEY));
-        assertTrue((boolean) query.get(ThreadDao.THREAD_ALLOCATED_MEMORY_KEY));
+        verify(storage).putPojo(ThreadDao.THREAD_CAPABILITIES, true, caps);
+
     }
 }
--- a/thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/Harvester.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/Harvester.java	Tue Sep 11 17:56:15 2012 +0200
@@ -70,13 +70,11 @@
     private ThreadMXBean collectorBean;
     private ThreadDao threadDao;
     private String vmId;
-    private String agentId;
     
-    Harvester(ThreadDao threadDao, ScheduledExecutorService threadPool, String vmId, String agentId) {
+    Harvester(ThreadDao threadDao, ScheduledExecutorService threadPool, String vmId) {
         this.connector = new MXBeanConnector(vmId);
         this.threadDao = threadDao;
         this.vmId = vmId;
-        this.agentId = agentId;
         this.threadPool = threadPool;
     }
     
@@ -167,10 +165,10 @@
           collectorBean = getDataCollectorBean(connection);
           
           summary.setCurrentLiveThreads(collectorBean.getThreadCount());
-          summary.setDaemonThreads(collectorBean.getDaemonThreadCount());
-          summary.setTimestamp(timestamp);
-          
-          threadDao.saveSummary(vmId, agentId, summary);
+          summary.setCurrentDaemonThreads(collectorBean.getDaemonThreadCount());
+          summary.setTimeStamp(timestamp);
+          summary.setVmId(Integer.parseInt(vmId));
+          threadDao.saveSummary(summary);
           
           long [] ids = collectorBean.getAllThreadIds();
           long[] allocatedBytes = null;
@@ -197,22 +195,23 @@
 
               info.setTimeStamp(timestamp);
 
-              info.setName(beanInfo.getThreadName());
-              info.setID(beanInfo.getThreadId());
-              info.setState(beanInfo.getThreadState());
+              info.setThreadName(beanInfo.getThreadName());
+              info.setThreadId(beanInfo.getThreadId());
+              info.setThreadState(beanInfo.getThreadState());
               info.setStackTrace(beanInfo.getStackTrace());
 
-              info.setCPUTime(collectorBean.getThreadCpuTime(info.getThreadID()));
-              info.setUserTime(collectorBean.getThreadUserTime(info.getThreadID()));
+              info.setThreadCpuTime(collectorBean.getThreadCpuTime(info.getThreadId()));
+              info.setThreadUserTime(collectorBean.getThreadUserTime(info.getThreadId()));
               
-              info.setBlockedCount(beanInfo.getBlockedCount());
-              info.setWaitedCount(beanInfo.getWaitedCount());
+              info.setThreadBlockedCount(beanInfo.getBlockedCount());
+              info.setThreadWaitCount(beanInfo.getWaitedCount());
               
               if (allocatedBytes != null) {
                   info.setAllocatedBytes(allocatedBytes[i]);
               }
 
-              threadDao.saveThreadInfo(vmId, agentId, info);
+              info.setVmId(Integer.parseInt(vmId));
+              threadDao.saveThreadInfo(info);
           }
           
       } catch (MalformedObjectNameException e) {
@@ -262,8 +261,8 @@
                     }
                 } catch (Exception ignore) {};
             }
-
-            threadDao.saveCapabilities(vmId, agentId, caps);
+            caps.setVmId(Integer.parseInt(vmId));
+            threadDao.saveCapabilities(caps);
 
         } catch (Exception ex) {
             logger.log(Level.SEVERE, "can't get MXBeanConnection connection", ex);
--- a/thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/ThreadHarvester.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/harvester/src/main/java/com/redhat/thermostat/thread/harvester/ThreadHarvester.java	Tue Sep 11 17:56:15 2012 +0200
@@ -81,8 +81,7 @@
         switch (HarvesterCommand.valueOf(command)) {
         case START: {
             String vmId = request.getParameter(HarvesterCommand.VM_ID.name());
-            String agentId = request.getParameter(HarvesterCommand.AGENT_ID.name());
-            result = startHarvester(vmId, agentId);
+            result = startHarvester(vmId);
             break;
         }   
         case STOP: {
@@ -93,8 +92,7 @@
         case VM_CAPS: {
             // this is blocking
             String vmId = request.getParameter(HarvesterCommand.VM_ID.name());
-            String agentId = request.getParameter(HarvesterCommand.AGENT_ID.name());
-            result = saveVmCaps(vmId, agentId);
+            result = saveVmCaps(vmId);
             break;
         }
         case IS_COLLECTING: {
@@ -123,13 +121,13 @@
         return harvester.isConnected();
     }
     
-    private boolean startHarvester(String vmId, String agentId) {
-        Harvester harvester = getHarvester(vmId, agentId);
+    private boolean startHarvester(String vmId) {
+        Harvester harvester = getHarvester(vmId);
         return harvester.start();
     }
     
-    private boolean saveVmCaps(String vmId, String agentId) {
-        Harvester harvester = getHarvester(vmId, agentId);
+    private boolean saveVmCaps(String vmId) {
+        Harvester harvester = getHarvester(vmId);
         return harvester.saveVmCaps();
     }
     
@@ -141,10 +139,10 @@
         return true;
     }
     
-    Harvester getHarvester(String vmId, String agentId) {
+    Harvester getHarvester(String vmId) {
         Harvester harvester = connectors.get(vmId);
         if (harvester == null) {
-            harvester = new Harvester(dao, executor, vmId, agentId);
+            harvester = new Harvester(dao, executor, vmId);
             connectors.put(vmId, harvester);
         }
         
--- a/thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/HarvesterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/HarvesterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -37,17 +37,16 @@
 package com.redhat.thermostat.thread.harvester;
 
 import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyLong;
+import static org.mockito.Mockito.doNothing;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.times;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
-import static org.mockito.Mockito.times;
-import static org.mockito.Mockito.any;
-import static org.mockito.Mockito.anyLong;
-import static org.mockito.Mockito.anyString;
-import static org.mockito.Mockito.doNothing;
-
-import static org.junit.Assert.*;
 
 import java.lang.management.ThreadInfo;
 import java.lang.management.ThreadMXBean;
@@ -86,7 +85,7 @@
         
         when(executor.scheduleAtFixedRate(arg0.capture(), arg1.capture(), arg2.capture(), arg3.capture())).thenReturn(null);
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe") {
+        Harvester harvester = new Harvester(dao, executor, "42") {
             { connector = mockedConnector; }
             @Override
             synchronized void harvestData() {
@@ -132,7 +131,7 @@
         
         when(executor.scheduleAtFixedRate(arg0.capture(), arg1.capture(), arg2.capture(), arg3.capture())).thenReturn(null);
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe") {
+        Harvester harvester = new Harvester(dao, executor, "42") {
             { connector = mockedConnector; }
             @Override
             synchronized void harvestData() {
@@ -179,7 +178,7 @@
         
         when(executor.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(future);
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe")
+        Harvester harvester = new Harvester(dao, executor, "42")
         {{ connector = mockedConnector; }};
         
         harvester.start();
@@ -220,7 +219,7 @@
         
         when(executor.scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class))).thenReturn(future);
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe")
+        Harvester harvester = new Harvester(dao, executor, "42")
         {{ connector = mockedConnector; }};
         
         harvester.start();
@@ -255,7 +254,7 @@
         when(mockedConnector.connect()).thenReturn(connection);
         when(mockedConnector.isAttached()).thenReturn(true);
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe")
+        Harvester harvester = new Harvester(dao, executor, "42")
         {{ connector = mockedConnector; }};
         
         verify(executor, times(0)).scheduleAtFixedRate(any(Runnable.class), anyLong(), anyLong(), any(TimeUnit.class));
@@ -292,17 +291,13 @@
                 
         ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
 
-        ArgumentCaptor<String> vmCapture = ArgumentCaptor.forClass(String.class);
-        ArgumentCaptor<String> agentCapture = ArgumentCaptor.forClass(String.class);
         ArgumentCaptor<ThreadSummary> summaryCapture = ArgumentCaptor.forClass(ThreadSummary.class);
 
         ThreadDao dao = mock(ThreadDao.class);
-        doNothing().when(dao).saveSummary(vmCapture.capture(), agentCapture.capture(), summaryCapture.capture());
-        
-        ArgumentCaptor<String> vmCapture2 = ArgumentCaptor.forClass(String.class);
-        ArgumentCaptor<String> agentCapture2 = ArgumentCaptor.forClass(String.class);
+        doNothing().when(dao).saveSummary(summaryCapture.capture());
+
         ArgumentCaptor<ThreadInfoData> threadInfoCapture = ArgumentCaptor.forClass(ThreadInfoData.class);        
-        doNothing().when(dao).saveThreadInfo(vmCapture2.capture(), agentCapture2.capture(), threadInfoCapture.capture());
+        doNothing().when(dao).saveThreadInfo(threadInfoCapture.capture());
 
         final ThreadMXBean collectorBean = mock(ThreadMXBean.class);
 
@@ -312,7 +307,7 @@
 
         final boolean [] getDataCollectorBeanCalled = new boolean[1];
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe") {
+        Harvester harvester = new Harvester(dao, executor, "42") {
             @Override
             ThreadMXBean getDataCollectorBean(MXBeanConnection connection)
                     throws MalformedObjectNameException {
@@ -327,27 +322,22 @@
         
         verify(collectorBean).getThreadInfo(ids, true, true);
         
-        verify(dao).saveSummary(anyString(), anyString(), any(ThreadSummary.class));
+        verify(dao).saveSummary(any(ThreadSummary.class));
         
         // once for each thread info
-        verify(dao, times(2)).saveThreadInfo(anyString(), anyString(), any(ThreadInfoData.class));
-        
-        assertEquals(42, summaryCapture.getValue().currentLiveThreads());
-        assertEquals("42", vmCapture.getValue());
-        assertEquals("0xcafe", agentCapture.getValue());
+        verify(dao, times(2)).saveThreadInfo(any(ThreadInfoData.class));
         
-        assertEquals(42, summaryCapture.getValue().currentLiveThreads());
-        assertEquals("42", vmCapture2.getAllValues().get(0));
-        assertEquals("42", vmCapture2.getAllValues().get(1));
+        assertEquals(42, summaryCapture.getValue().getCurrentLiveThreads());
+        assertEquals(42, summaryCapture.getValue().getVmId());
+        
+        assertEquals(42, summaryCapture.getValue().getCurrentLiveThreads());
+        assertEquals(42, summaryCapture.getValue().getVmId());
 
-        assertEquals("0xcafe", agentCapture2.getAllValues().get(0));
-        assertEquals("0xcafe", agentCapture2.getAllValues().get(1));
-        
         List<ThreadInfoData> threadInfos = threadInfoCapture.getAllValues();
         assertEquals(2, threadInfos.size());
         
-        assertEquals("fluff1", threadInfos.get(0).getName());
-        assertEquals("fluff2", threadInfos.get(1).getName());
+        assertEquals("fluff1", threadInfos.get(0).getThreadName());
+        assertEquals("fluff2", threadInfos.get(1).getThreadName());
         
         verify(collectorBean, times(1)).getThreadCpuTime(1l);
         verify(collectorBean, times(1)).getThreadCpuTime(2l);
@@ -361,12 +351,10 @@
         
         ScheduledExecutorService executor = mock(ScheduledExecutorService.class);
 
-        ArgumentCaptor<String> vmCapture = ArgumentCaptor.forClass(String.class);
-        ArgumentCaptor<String> agentCapture = ArgumentCaptor.forClass(String.class);
         ArgumentCaptor<VMThreadCapabilities> capsCapture = ArgumentCaptor.forClass(VMThreadCapabilities.class);
 
         ThreadDao dao = mock(ThreadDao.class);
-        doNothing().when(dao).saveCapabilities(vmCapture.capture(), agentCapture.capture(), capsCapture.capture());
+        doNothing().when(dao).saveCapabilities(capsCapture.capture());
       
         final ThreadMXBean collectorBean = mock(ThreadMXBean.class);
         when(collectorBean.isThreadCpuTimeSupported()).thenReturn(true);
@@ -374,7 +362,7 @@
 
         final boolean [] getDataCollectorBeanCalled = new boolean[1];
         
-        Harvester harvester = new Harvester(dao, executor, "42", "0xcafe") {
+        Harvester harvester = new Harvester(dao, executor, "42") {
             { connector = mockedConnector; }
             @Override
             ThreadMXBean getDataCollectorBean(MXBeanConnection connection)
@@ -387,9 +375,8 @@
         harvester.saveVmCaps();
         assertTrue(getDataCollectorBeanCalled[0]);
         
-        verify(dao, times(1)).saveCapabilities(anyString(), anyString(), any(VMThreadCapabilities.class));
-        assertEquals("42", vmCapture.getValue());
-        assertEquals("0xcafe", agentCapture.getValue());
+        verify(dao, times(1)).saveCapabilities(any(VMThreadCapabilities.class));
+        assertEquals(42, capsCapture.getValue().getVmId());
 
         List<String> features = capsCapture.getValue().getSupportedFeaturesList();
         assertEquals(2, features.size());
--- a/thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/ThreadHarvesterTest.java	Tue Sep 11 12:41:35 2012 +0200
+++ b/thread/harvester/src/test/java/com/redhat/thermostat/thread/harvester/ThreadHarvesterTest.java	Tue Sep 11 17:56:15 2012 +0200
@@ -74,11 +74,10 @@
         
         ThreadHarvester threadHarvester = new ThreadHarvester(executor) {
             @Override
-            Harvester getHarvester(String vmId, String agentId) {
+            Harvester getHarvester(String vmId) {
                 
                 getHarvesterCalled[0] = true;
                 assertEquals("42", vmId);
-                assertEquals("0xcafe", agentId);
                 
                 return harverster;
             }
@@ -87,11 +86,10 @@
         threadHarvester.receive(request);
         
         List<String> values = captor.getAllValues();
-        assertEquals(3, values.size());
+        assertEquals(2, values.size());
         
         assertEquals(HarvesterCommand.class.getName(), values.get(0));
         assertEquals(HarvesterCommand.VM_ID.name(), values.get(1));
-        assertEquals(HarvesterCommand.AGENT_ID.name(), values.get(2));
         
         assertTrue(getHarvesterCalled[0]);
         
@@ -145,11 +143,10 @@
         
         ThreadHarvester threadHarvester = new ThreadHarvester(executor) {
             @Override
-            Harvester getHarvester(String vmId, String agentId) {
+            Harvester getHarvester(String vmId) {
                 
                 getHarvesterCalled[0] = true;
                 assertEquals("42", vmId);
-                assertEquals("0xcafe", agentId);
                 
                 return harverster;
             }
@@ -158,11 +155,10 @@
         threadHarvester.receive(request);
         
         List<String> values = captor.getAllValues();
-        assertEquals(3, values.size());
+        assertEquals(2, values.size());
         
         assertEquals(HarvesterCommand.class.getName(), values.get(0));
         assertEquals(HarvesterCommand.VM_ID.name(), values.get(1));
-        assertEquals(HarvesterCommand.AGENT_ID.name(), values.get(2));
         
         assertTrue(getHarvesterCalled[0]);