changeset 1248:84ea87a65eda

Use WriterID service over Storage.get/setAgentId() (Part 3). Reviewed-by: vanaltj Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-September/008099.html PR1509
author Severin Gehwolf <sgehwolf@redhat.com>
date Mon, 02 Sep 2013 11:32:11 +0200
parents 352dd55544d0
children ec60b0403fb0
files vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/Activator.java vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/ActivatorTest.java vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java vm-classstat/client-core/src/test/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatControllerTest.java vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStatTest.java vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/Activator.java vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilder.java vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/ActivatorTest.java vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackendTest.java vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilderTest.java vm-cpu/client-cli/src/test/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegateTest.java vm-cpu/client-core/src/test/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuControllerTest.java vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/model/VmCpuStat.java vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOTest.java vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/model/MemoryStatTest.java vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/Activator.java vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackend.java vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListener.java vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/ActivatorTest.java vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackendTest.java vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListenerTest.java vm-gc/client-core/src/test/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcControllerTest.java vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/model/VmGcStat.java vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/model/VmGcStatTest.java vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/Activator.java vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiver.java vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/ActivatorTest.java vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiverTest.java vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOImpl.java vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfo.java vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOTest.java vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfoTest.java vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/Activator.java vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackend.java vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/ActivatorTest.java vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackendTest.java vm-jmx/client-swing/src/main/java/com/redhat/thermostat/vm/jmx/client/swing/internal/JmxNotificationsSwingView.java vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotification.java vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotificationStatus.java vm-jmx/common/src/test/java/com/redhat/thermostat/vm/jmx/common/JmxPojosInstantiationTest.java vm-jmx/common/src/test/java/com/redhat/thermostat/vm/jmx/common/internal/JmxNotificationDAOImplTest.java vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/Activator.java vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackend.java vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListener.java vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/ActivatorTest.java vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackendTest.java vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListenerTest.java vm-memory/client-cli/src/test/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegateTest.java vm-memory/client-core/src/test/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsControllerTest.java vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStat.java vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStatTest.java vm-overview/client-core/src/test/java/com/redhat/thermostat/vm/overview/client/core/internal/VmOverviewControllerTest.java
diffstat 60 files changed, 557 insertions(+), 156 deletions(-) [+]
line wrap: on
line diff
--- a/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -48,13 +48,14 @@
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
 
 public class Activator implements BundleActivator {
     
     private MultipleServiceTracker tracker;
     private VmClassStatBackend backend;
-    private ServiceRegistration reg;
+    private ServiceRegistration<Backend> reg;
     
     @Override
     public void start(final BundleContext context) throws Exception {
@@ -63,7 +64,8 @@
 
         Class<?>[] deps = new Class<?>[] {
                 BackendService.class,
-                VmClassStatDAO.class
+                VmClassStatDAO.class,
+                WriterID.class, // vm class stat backend uses it
         };
         tracker = new MultipleServiceTracker(context, deps, new Action() {
 
@@ -71,8 +73,9 @@
             public void dependenciesAvailable(Map<String, Object> services) {
                 VmClassStatDAO vmClassStatDao = (VmClassStatDAO) services.get(VmClassStatDAO.class.getName());
                 Version version = new Version(context.getBundle());
-                backend = new VmClassStatBackend(vmClassStatDao, version, registrar);
-                reg = context.registerService(Backend.class.getName(), backend, null);
+                WriterID id = (WriterID) services.get(WriterID.class.getName());
+                backend = new VmClassStatBackend(vmClassStatDao, version, registrar, id);
+                reg = context.registerService(Backend.class, backend, null);
             }
 
             @Override
--- a/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java	Mon Sep 02 11:32:11 2013 +0200
@@ -40,16 +40,18 @@
 import com.redhat.thermostat.backend.VmListenerBackend;
 import com.redhat.thermostat.backend.VmUpdateListener;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
 
 public class VmClassStatBackend extends VmListenerBackend {
 
     private final VmClassStatDAO vmClassStats;
 
-    public VmClassStatBackend(VmClassStatDAO vmClassStatDAO, Version version, VmStatusListenerRegistrar registrar) {
+    public VmClassStatBackend(VmClassStatDAO vmClassStatDAO, Version version,
+            VmStatusListenerRegistrar registrar, WriterID writerId) {
         super("VM Classes Backend",
                 "Gathers class loading statistics about a JVM",
-                "Red Hat, Inc.", version.getVersionNumber(), true, registrar);
+                "Red Hat, Inc.", version.getVersionNumber(), true, registrar, writerId);
         this.vmClassStats = vmClassStatDAO;
     }
 
@@ -59,8 +61,8 @@
     }
 
     @Override
-    protected VmUpdateListener createVmListener(String vmId, int pid) {
-        return new VmClassStatVmListener(vmClassStats, vmId);
+    protected VmUpdateListener createVmListener(String writerId, String vmId, int pid) {
+        return new VmClassStatVmListener(writerId, vmClassStats, vmId);
     }
 
 }
--- a/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java	Mon Sep 02 11:32:11 2013 +0200
@@ -50,12 +50,14 @@
     
     private static final Logger logger = LoggingUtils.getLogger(VmClassStatVmListener.class);
 
-    private VmClassStatDAO dao;
-    private String vmId;
+    private final VmClassStatDAO dao;
+    private final String vmId;
+    private final String writerId;
 
-    VmClassStatVmListener(VmClassStatDAO dao, String vmId) {
+    VmClassStatVmListener(String writerId, VmClassStatDAO dao, String vmId) {
         this.dao = dao;
         this.vmId = vmId;
+        this.writerId = writerId;
     }
 
     @Override
@@ -64,7 +66,7 @@
         try {
             long loadedClasses = extractor.getLoadedClasses();
             long timestamp = System.currentTimeMillis();
-            VmClassStat stat = new VmClassStat(vmId, timestamp, loadedClasses);
+            VmClassStat stat = new VmClassStat(writerId, vmId, timestamp, loadedClasses);
             dao.putVmClassStat(stat);
         } catch (VmUpdateException e) {
             logger.log(Level.WARNING, "error gathering class info for vm " + vmId, e);
--- a/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,6 +49,7 @@
 
 import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.backend.BackendService;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
 
@@ -63,7 +64,7 @@
         activator.start(context);
 
         assertEquals(0, context.getAllServices().size());
-        assertEquals(2, context.getServiceListeners().size());
+        assertEquals(3, context.getServiceListeners().size());
 
         activator.stop(context);
     }
@@ -80,9 +81,11 @@
         };
         BackendService service = mock(BackendService.class);
         VmClassStatDAO vmClassStatDAO = mock(VmClassStatDAO.class);
+        WriterID idService = mock(WriterID.class);
 
         context.registerService(BackendService.class, service, null);
         context.registerService(VmClassStatDAO.class, vmClassStatDAO, null);
+        context.registerService(WriterID.class, idService, null);
 
         Activator activator = new Activator();
 
@@ -100,7 +103,7 @@
         assertFalse(backend.isActive());
 
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(2, context.getAllServices().size());
+        assertEquals(3, context.getAllServices().size());
     }
 
 }
--- a/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -46,6 +46,7 @@
 import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
 
 public class VmClassStatBackendTest {
@@ -61,7 +62,8 @@
         
         VmStatusListenerRegistrar registrar = mock(VmStatusListenerRegistrar.class);
 
-        backend = new VmClassStatBackend(vmClassStatDao, version, registrar);
+        WriterID id = mock(WriterID.class);
+        backend = new VmClassStatBackend(vmClassStatDao, version, registrar, id);
     }
 
     @Test
--- a/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -64,7 +64,7 @@
     @Before
     public void setUp() {
         dao = mock(VmClassStatDAO.class);
-        listener = new VmClassStatVmListener(dao, VM_ID);
+        listener = new VmClassStatVmListener("foo-agent", dao, VM_ID);
     }
 
     @Test
--- a/vm-classstat/client-core/src/test/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatControllerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/client-core/src/test/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatControllerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -66,7 +66,7 @@
     @Test
     public void testChartUpdate() {
 
-        VmClassStat stat1 = new VmClassStat("vmId", 12345, 1234);
+        VmClassStat stat1 = new VmClassStat("foo-agent", "vmId", 12345, 1234);
         List<VmClassStat> stats = new ArrayList<VmClassStat>();
         stats.add(stat1);
 
--- a/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,10 +49,11 @@
     private long loadedClasses;
 
     public VmClassStat() {
-        this(null, -1, -1);
+        this(null, null, -1, -1);
     }
 
-    public VmClassStat(String vmId, long timestamp, long loadedClasses) {
+    public VmClassStat(String writerId, String vmId, long timestamp, long loadedClasses) {
+        super(writerId);
         this.vmId = vmId;
         this.timestamp = timestamp;
         this.loadedClasses = loadedClasses;
--- a/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -126,7 +126,7 @@
     }
 
     private VmClassStat getClassStat() {
-        return new VmClassStat(VM_ID, TIMESTAMP, LOADED_CLASSES);
+        return new VmClassStat("foo-agent", VM_ID, TIMESTAMP, LOADED_CLASSES);
     }
 
     @Test
@@ -137,7 +137,7 @@
         Add<VmClassStat> add = mock(Add.class);
         when(storage.createAdd(eq(VmClassStatDAO.vmClassStatsCategory))).thenReturn(add);
 
-        VmClassStat stat = new VmClassStat(VM_ID, TIMESTAMP, LOADED_CLASSES);
+        VmClassStat stat = new VmClassStat("foo-agent", VM_ID, TIMESTAMP, LOADED_CLASSES);
         VmClassStatDAO dao = new VmClassStatDAOImpl(storage);
         dao.putVmClassStat(stat);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStatTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, 2013 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.vm.classstat.common.model;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class VmClassStatTest {
+
+    @Test
+    public void testBasicInstantiation() {
+        try {
+            // pojo converters use this
+            VmClassStat.class.newInstance();
+        } catch (Exception e) {
+            fail("should be able to instantiate using no-arg constructor");
+        }
+    }
+}
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -50,6 +50,7 @@
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO;
 
 public class Activator implements BundleActivator {
@@ -57,7 +58,7 @@
     private ScheduledExecutorService executor;
     private MultipleServiceTracker tracker;
     private VmCpuBackend backend;
-    private ServiceRegistration reg;
+    private ServiceRegistration<Backend> reg;
     
     @Override
     public void start(final BundleContext context) throws Exception {
@@ -67,7 +68,8 @@
 
         Class<?>[] deps = new Class<?>[] {
                 BackendService.class,
-                VmCpuStatDAO.class
+                VmCpuStatDAO.class,
+                WriterID.class, // vm cpu backend uses it
         };
         tracker = new MultipleServiceTracker(context, deps, new Action() {
             
@@ -75,8 +77,9 @@
             public void dependenciesAvailable(Map<String, Object> services) {
                 VmCpuStatDAO vmCpuStatDao = (VmCpuStatDAO) services.get(VmCpuStatDAO.class.getName());
                 Version version = new Version(context.getBundle());
-                backend = new VmCpuBackend(executor, vmCpuStatDao, version, registrar);
-                reg = context.registerService(Backend.class.getName(), backend, null);
+                WriterID writerId = (WriterID) services.get(WriterID.class.getName());
+                backend = new VmCpuBackend(executor, vmCpuStatDao, version, registrar, writerId);
+                reg = context.registerService(Backend.class, backend, null);
             }
 
             @Override
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java	Mon Sep 02 11:32:11 2013 +0200
@@ -53,6 +53,7 @@
 import com.redhat.thermostat.common.SystemClock;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.utils.ProcDataSource;
 import com.redhat.thermostat.utils.SysConf;
 import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO;
@@ -63,16 +64,16 @@
     private static final Logger LOGGER = LoggingUtils.getLogger(VmCpuBackend.class);
     static final long PROC_CHECK_INTERVAL = 1000; // TODO make this configurable.
 
+    private final VmCpuStatDAO vmCpuStats;
+    private final ScheduledExecutorService executor;
+    private final VmStatusListenerRegistrar registrar;
     private VmCpuStatBuilder vmCpuStatBuilder;
-    private VmCpuStatDAO vmCpuStats;
-    private ScheduledExecutorService executor;
-    private VmStatusListenerRegistrar registrar;
     private boolean started;
 
     private final Map<Integer, String> pidsToMonitor = new ConcurrentHashMap<>();
 
     public VmCpuBackend(ScheduledExecutorService executor, VmCpuStatDAO vmCpuStatDao, Version version,
-            VmStatusListenerRegistrar registrar) {
+            VmStatusListenerRegistrar registrar, WriterID writerId) {
         super("VM CPU Backend",
                 "Gathers CPU statistics about a JVM",
                 "Red Hat, Inc.",
@@ -86,7 +87,8 @@
         ProcDataSource source = new ProcDataSource();
         ProcessStatusInfoBuilder builder = new ProcessStatusInfoBuilder(new ProcDataSource());
         int numCpus = getCpuCount(source);
-        vmCpuStatBuilder = new VmCpuStatBuilder(clock, numCpus, ticksPerSecond, builder);
+        vmCpuStatBuilder = new VmCpuStatBuilder(clock, numCpus, ticksPerSecond,
+                                                builder, writerId);
     }
 
     @Override
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilder.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilder.java	Mon Sep 02 11:32:11 2013 +0200
@@ -43,6 +43,7 @@
 
 import com.redhat.thermostat.common.Clock;
 import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat;
 
 public class VmCpuStatBuilder {
@@ -58,12 +59,15 @@
     private final int cpuCount;
     private final long ticksPerSecond;
     private final ProcessStatusInfoBuilder statusBuilder;
+    private final WriterID context;
 
-    public VmCpuStatBuilder(Clock clock, int cpuCount, long ticksPerSecond, ProcessStatusInfoBuilder statusBuilder) {
+    public VmCpuStatBuilder(Clock clock, int cpuCount, long ticksPerSecond,
+            ProcessStatusInfoBuilder statusBuilder, WriterID writerId) {
         this.clock = clock;
         this.cpuCount = cpuCount;
         this.ticksPerSecond = ticksPerSecond;
         this.statusBuilder = statusBuilder;
+        this.context = writerId;
     }
 
     /**
@@ -103,8 +107,9 @@
 
         lastProcessTicks.put(pid, programTicks);
         lastProcessTickTime.put(pid, time);
-
-        return new VmCpuStat(miliTime, vmId, cpuLoad);
+        
+        String wId = context.getWriterID();
+        return new VmCpuStat(wId, miliTime, vmId, cpuLoad);
     }
 
     public synchronized boolean knowsAbout(int pid) {
--- a/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,6 +49,7 @@
 
 import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.backend.BackendService;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO;
 
@@ -63,7 +64,7 @@
         activator.start(context);
 
         assertEquals(0, context.getAllServices().size());
-        assertEquals(2, context.getServiceListeners().size());
+        assertEquals(3, context.getServiceListeners().size());
 
         activator.stop(context);
     }
@@ -78,12 +79,13 @@
                 return result;
             }
         };
-        
         BackendService service = mock(BackendService.class);
         VmCpuStatDAO vmCpuStatDAO = mock(VmCpuStatDAO.class);
+        WriterID idService = mock(WriterID.class);
 
         context.registerService(BackendService.class.getName(), service, null);
         context.registerService(VmCpuStatDAO.class, vmCpuStatDAO, null);
+        context.registerService(WriterID.class, idService, null);
 
         Activator activator = new Activator();
 
@@ -101,7 +103,7 @@
         assertFalse(backend.isActive());
 
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(2, context.getAllServices().size());
+        assertEquals(3, context.getAllServices().size());
     }
 
 }
--- a/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackendTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackendTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -60,6 +60,7 @@
 import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO;
 import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat;
 
@@ -80,7 +81,8 @@
         
         registrar = mock(VmStatusListenerRegistrar.class);
         
-        backend = new VmCpuBackend(executor, vmCpuStatDao, version, registrar);
+        WriterID id = mock(WriterID.class);
+        backend = new VmCpuBackend(executor, vmCpuStatDao, version, registrar, id);
     }
 
     @Test
--- a/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilderTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilderTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -44,16 +44,22 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import org.junit.Before;
 import org.junit.Test;
 
 import com.redhat.thermostat.common.Clock;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.test.Bug;
-import com.redhat.thermostat.vm.cpu.agent.internal.ProcessStatusInfo;
-import com.redhat.thermostat.vm.cpu.agent.internal.ProcessStatusInfoBuilder;
-import com.redhat.thermostat.vm.cpu.agent.internal.VmCpuStatBuilder;
 import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat;
 
 public class VmCpuStatBuilderTest {
+    
+    private WriterID writerID;
+    
+    @Before
+    public void setup() {
+        writerID = mock(WriterID.class);
+    }
 
     @Test
     public void testBuilderKnowsNothing() {
@@ -61,7 +67,7 @@
         ProcessStatusInfoBuilder statusBuilder = mock(ProcessStatusInfoBuilder.class);
         int cpuCount = 0;
         long ticksPerSecond = 0;
-        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder);
+        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder, writerID);
 
         assertFalse(builder.knowsAbout(0));
         assertFalse(builder.knowsAbout(1));
@@ -76,7 +82,7 @@
         int cpuCount = 0;
         long ticksPerSecond = 0;
         ProcessStatusInfoBuilder statusBuilder = mock(ProcessStatusInfoBuilder.class);
-        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder);
+        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder, writerID);
         builder.build("vmId", 0);
     }
 
@@ -96,7 +102,7 @@
         ProcessStatusInfoBuilder statusBuilder = mock(ProcessStatusInfoBuilder.class);
         when(statusBuilder.build(any(Integer.class))).thenReturn(initialInfo).thenReturn(laterInfo).thenReturn(null);
 
-        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder);
+        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, cpuCount, ticksPerSecond, statusBuilder, writerID);
 
         builder.learnAbout(PID);
         assertEquals(null, builder.build("vmId", PID));
@@ -137,7 +143,7 @@
         ProcessStatusInfoBuilder statusBuilder = mock(ProcessStatusInfoBuilder.class);
         when(statusBuilder.build(any(Integer.class))).thenReturn(initialInfo).thenReturn(laterInfo).thenReturn(null);
 
-        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, CPU_COUNT, TICKS_PER_SECOND, statusBuilder);
+        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, CPU_COUNT, TICKS_PER_SECOND, statusBuilder, writerID);
 
         builder.learnAbout(PID);
         VmCpuStat stat = builder.build(VM_ID, PID);
@@ -159,7 +165,7 @@
         // This thing returns null if the /proc entry goes away.  Rather than try to
         // 'guess' at a pid that will not be present during test, just mock this.
         when(procBuilder.build(any(Integer.class))).thenReturn(null);
-        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, 3, 100, procBuilder);
+        VmCpuStatBuilder builder = new VmCpuStatBuilder(clock, 3, 100, procBuilder, writerID);
         // If we can't handle a process' /proc entry disappearing, the next line
         // will throw exception.  If it does not, then we are okay.
         try {
--- a/vm-cpu/client-cli/src/test/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegateTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/client-cli/src/test/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegateTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -93,8 +93,8 @@
         String vmId = "vmId";
         HostRef host = new HostRef("123", "dummy");
         vm = new VmRef(host, vmId, 234, "dummy");
-        VmCpuStat cpustat1 = new VmCpuStat(2, vmId, 65);
-        VmCpuStat cpustat2 = new VmCpuStat(3, vmId, 70);
+        VmCpuStat cpustat1 = new VmCpuStat("foo-agent", 2, vmId, 65);
+        VmCpuStat cpustat2 = new VmCpuStat("foo-agent", 3, vmId, 70);
         cpuStats = Arrays.asList(cpustat1, cpustat2);
         when(vmCpuStatDAO.getLatestVmCpuStats(vm, Long.MIN_VALUE)).thenReturn(cpuStats);
     }
--- a/vm-cpu/client-core/src/test/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuControllerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/client-core/src/test/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuControllerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -68,7 +68,7 @@
     @Test
     public void testChartUpdate() {
 
-        VmCpuStat stat1 = new VmCpuStat(123, "vmId", 50.5);
+        VmCpuStat stat1 = new VmCpuStat("foo-agent", 123, "vmId", 50.5);
         List<VmCpuStat> stats = new ArrayList<VmCpuStat>();
         stats.add(stat1);
 
--- a/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/model/VmCpuStat.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/model/VmCpuStat.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,10 +49,11 @@
     private double cpuLoad;
 
     public VmCpuStat() {
-        super();
+        super(null);
     }
 
-    public VmCpuStat(long timeStamp, String vmId, double cpuLoad) {
+    public VmCpuStat(String writerId, long timeStamp, String vmId, double cpuLoad) {
+        super(writerId);
         this.timeStamp = timeStamp;
         this.vmId = vmId;
         this.cpuLoad = cpuLoad;
--- a/vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -74,7 +74,7 @@
 
     @Before
     public void setUp() {
-        cpuStat = new VmCpuStat(TIMESTAMP, VM_ID, CPU_LOAD);
+        cpuStat = new VmCpuStat("foo-agent", TIMESTAMP, VM_ID, CPU_LOAD);
     }
 
     @Test
@@ -138,7 +138,7 @@
         Add<VmCpuStat> add = mock(Add.class);
         when(storage.createAdd(eq(VmCpuStatDAO.vmCpuStatCategory))).thenReturn(add);
         
-        VmCpuStat stat = new VmCpuStat(TIMESTAMP, VM_ID, CPU_LOAD);
+        VmCpuStat stat = new VmCpuStat("foo-agent", TIMESTAMP, VM_ID, CPU_LOAD);
         VmCpuStatDAO dao = new VmCpuStatDAOImpl(storage);
         dao.putVmCpuStat(stat);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/model/MemoryStatTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, 2013 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.vm.cpu.common.model;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class MemoryStatTest {
+
+    @Test
+    public void testBasicInstantiation() {
+        try {
+            // pojo converters use this
+            VmCpuStat.class.newInstance();
+        } catch (Exception e) {
+            fail("should be able to instantiate using no-arg constructor");
+        }
+    }
+}
--- a/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -48,19 +48,21 @@
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
 
 public class Activator implements BundleActivator {
     
     private MultipleServiceTracker tracker;
     private VmGcBackend backend;
-    private ServiceRegistration reg;
+    private ServiceRegistration<Backend> reg;
     
     @Override
     public void start(final BundleContext context) throws Exception {
         Class<?>[] deps = new Class<?>[] {
                 BackendService.class,
-                VmGcStatDAO.class
+                VmGcStatDAO.class,
+                WriterID.class, // vm gc backend uses it.
         };
 
         final VmStatusListenerRegistrar registerer = new VmStatusListenerRegistrar(context);
@@ -71,8 +73,9 @@
             public void dependenciesAvailable(Map<String, Object> services) {
                 VmGcStatDAO vmGcStatDao = (VmGcStatDAO) services.get(VmGcStatDAO.class.getName());
                 Version version = new Version(context.getBundle());
-                backend = new VmGcBackend(vmGcStatDao, version, registerer);
-                reg = context.registerService(Backend.class.getName(), backend, null);
+                WriterID writerId = (WriterID) services.get(WriterID.class.getName());
+                backend = new VmGcBackend(vmGcStatDao, version, registerer, writerId);
+                reg = context.registerService(Backend.class, backend, null);
             }
 
             @Override
--- a/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackend.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackend.java	Mon Sep 02 11:32:11 2013 +0200
@@ -40,16 +40,18 @@
 import com.redhat.thermostat.backend.VmListenerBackend;
 import com.redhat.thermostat.backend.VmUpdateListener;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
 
 public class VmGcBackend extends VmListenerBackend {
 
     private final VmGcStatDAO vmGcStats;
 
-    public VmGcBackend(VmGcStatDAO vmGcStatDAO, Version version, VmStatusListenerRegistrar registrar) {
+    public VmGcBackend(VmGcStatDAO vmGcStatDAO, Version version,
+            VmStatusListenerRegistrar registrar, WriterID writerId) {
         super("VM GC Backend",
                 "Gathers garbage collection statistics about a JVM",
-                "Red Hat, Inc.", version.getVersionNumber(), true, registrar);
+                "Red Hat, Inc.", version.getVersionNumber(), true, registrar, writerId);
         this.vmGcStats = vmGcStatDAO;
     }
 
@@ -59,8 +61,8 @@
     }
 
     @Override
-    protected VmUpdateListener createVmListener(String vmId, int pid) {
-        return new VmGcVmListener(vmGcStats, vmId);
+    protected VmUpdateListener createVmListener(String writerId, String vmId, int pid) {
+        return new VmGcVmListener(writerId, vmGcStats, vmId);
     }
 
 }
--- a/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListener.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListener.java	Mon Sep 02 11:32:11 2013 +0200
@@ -52,10 +52,12 @@
 
     private final String vmId;
     private final VmGcStatDAO gcDAO;
+    private final String writerId;
 
-    public VmGcVmListener(VmGcStatDAO vmGcStatDao, String vmId) {
+    public VmGcVmListener(String writerId, VmGcStatDAO vmGcStatDao, String vmId) {
         gcDAO = vmGcStatDao;
         this.vmId = vmId;
+        this.writerId = writerId;
     }
 
     @Override
@@ -69,7 +71,7 @@
             long collectors = extractor.getTotalCollectors();
             for (int i = 0; i < collectors; i++) {
                 long timestamp = System.currentTimeMillis();
-                VmGcStat stat = new VmGcStat(vmId, timestamp,
+                VmGcStat stat = new VmGcStat(writerId, vmId, timestamp,
                         extractor.getCollectorName(i),
                         extractor.getCollectorInvocations(i),
                         extractor.getCollectorTime(i));
--- a/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,6 +49,7 @@
 
 import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.backend.BackendService;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
 
@@ -63,7 +64,7 @@
         activator.start(context);
 
         assertEquals(0, context.getAllServices().size());
-        assertEquals(2, context.getServiceListeners().size());
+        assertEquals(3, context.getServiceListeners().size());
 
         activator.stop(context);
     }
@@ -81,9 +82,11 @@
         
         BackendService service = mock(BackendService.class);
         VmGcStatDAO vmGcStatDAO = mock(VmGcStatDAO.class);
+        WriterID writerID = mock(WriterID.class);
 
         context.registerService(BackendService.class, service, null);
         context.registerService(VmGcStatDAO.class, vmGcStatDAO, null);
+        context.registerService(WriterID.class, writerID, null);
 
         Activator activator = new Activator();
 
@@ -98,7 +101,7 @@
         assertFalse(backend.isActive());
 
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(2, context.getAllServices().size());
+        assertEquals(3, context.getAllServices().size());
     }
 
 }
--- a/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackendTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcBackendTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -46,6 +46,7 @@
 import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.gc.common.VmGcStatDAO;
 
 public class VmGcBackendTest {
@@ -60,8 +61,9 @@
         when(version.getVersionNumber()).thenReturn("0.0.0");
 
         VmStatusListenerRegistrar registrar = mock(VmStatusListenerRegistrar.class);
-
-        backend = new VmGcBackend(vmGcStatDao, version, registrar);
+        
+        WriterID id = mock(WriterID.class);
+        backend = new VmGcBackend(vmGcStatDao, version, registrar, id);
     }
 
     @Test
--- a/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListenerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListenerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -65,7 +65,7 @@
     public void setup() throws VmUpdateException {
         final int numGCs = 2;
         vmGcStatDAO = mock(VmGcStatDAO.class);
-        vmListener = new VmGcVmListener(vmGcStatDAO, "vmId");
+        vmListener = new VmGcVmListener("foo-agent", vmGcStatDAO, "vmId");
         
         extractor = mock(VmGcDataExtractor.class);
         
--- a/vm-gc/client-core/src/test/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcControllerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/client-core/src/test/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcControllerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -90,8 +90,8 @@
 
         // Set up fake data
         List<VmGcStat> stats = new ArrayList<>();
-        VmGcStat stat1 = new VmGcStat("vmId", 1, "collector1", 1, 10);
-        VmGcStat stat2 = new VmGcStat("vmId", 2, "collector1", 5, 20);
+        VmGcStat stat1 = new VmGcStat("foo-agent", "vmId", 1, "collector1", 1, 10);
+        VmGcStat stat2 = new VmGcStat("foo-agent", "vmId", 2, "collector1", 5, 20);
         stats.add(stat1);
         stats.add(stat2);
 
@@ -99,7 +99,7 @@
         gen = new Generation();
         gen.setName("generation 1");
         gen.setCollector("collector1");
-        VmMemoryStat memoryStat = new VmMemoryStat(1, "vmId", new Generation[] { gen });
+        VmMemoryStat memoryStat = new VmMemoryStat("foo-agent", 1, "vmId", new Generation[] { gen });
 
         // Setup DAO
         VmGcStatDAO vmGcStatDAO = mock(VmGcStatDAO.class);
--- a/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/model/VmGcStat.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/model/VmGcStat.java	Mon Sep 02 11:32:11 2013 +0200
@@ -51,10 +51,11 @@
     private long wallTime;
 
     public VmGcStat() {
-        super();
+        super(null);
     }
 
-    public VmGcStat(String vmId, long timestamp, String collectorName, long runCount, long wallTime) {
+    public VmGcStat(String writerId, String vmId, long timestamp, String collectorName, long runCount, long wallTime) {
+        super(writerId);
         this.timeStamp = timestamp;
         this.vmId = vmId;
         this.collectorName = collectorName;
--- a/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -87,7 +87,7 @@
     @Test
     public void testGetLatestVmGcStatsBasic() throws DescriptorParsingException, StatementExecutionException {
 
-        VmGcStat vmGcStat = new VmGcStat(VM_ID, TIMESTAMP, COLLECTOR, RUN_COUNT, WALL_TIME);
+        VmGcStat vmGcStat = new VmGcStat("foo-agent", VM_ID, TIMESTAMP, COLLECTOR, RUN_COUNT, WALL_TIME);
 
         @SuppressWarnings("unchecked")
         Cursor<VmGcStat> cursor = (Cursor<VmGcStat>) mock(Cursor.class);
@@ -137,7 +137,7 @@
         Add add = mock(Add.class);
         when(storage.createAdd(any(Category.class))).thenReturn(add);
         
-        VmGcStat stat = new VmGcStat(VM_ID, TIMESTAMP, COLLECTOR, RUN_COUNT, WALL_TIME);
+        VmGcStat stat = new VmGcStat("foo-agent", VM_ID, TIMESTAMP, COLLECTOR, RUN_COUNT, WALL_TIME);
         VmGcStatDAO dao = new VmGcStatDAOImpl(storage);
         dao.putVmGcStat(stat);
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/model/VmGcStatTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, 2013 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.vm.gc.common.model;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class VmGcStatTest {
+
+    @Test
+    public void testBasicInstantiation() {
+        try {
+            // pojo converters use this
+            VmGcStat.class.newInstance();
+        } catch (Exception e) {
+            fail("should be able to instantiate using no-arg constructor");
+        }
+    }
+}
--- a/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -36,12 +36,15 @@
 
 package com.redhat.thermostat.vm.heap.analysis.agent.internal;
 
+import java.util.Map;
+
 import org.osgi.framework.BundleActivator;
 import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.util.tracker.ServiceTracker;
 
 import com.redhat.thermostat.agent.command.ReceiverRegistry;
+import com.redhat.thermostat.common.MultipleServiceTracker;
+import com.redhat.thermostat.common.MultipleServiceTracker.Action;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO;
 
 public class Activator implements BundleActivator {
@@ -50,36 +53,40 @@
 
     private HeapDumpReceiver receiver = null;
 
-    private ServiceTracker heapDumpCommandReceiverTracker;
+    private MultipleServiceTracker tracker;
 
     @Override
     public void start(BundleContext context) {
         receivers = new ReceiverRegistry(context);
+        
+        Class<?>[] deps = new Class<?>[] {
+                HeapDAO.class,
+                WriterID.class // heap dump receiver uses it.
+        };
 
-        heapDumpCommandReceiverTracker = new ServiceTracker(context, HeapDAO.class.getName(), null) {
+        tracker = new MultipleServiceTracker(context, deps, new Action() {
+
             @Override
-            public Object addingService(ServiceReference reference) {
-                HeapDAO service = (HeapDAO) super.addingService(reference);
-                receiver = new HeapDumpReceiver(service);
+            public void dependenciesAvailable(Map<String, Object> services) {
+                HeapDAO service = (HeapDAO) services.get(HeapDAO.class.getName());
+                WriterID writerId = (WriterID) services.get(WriterID.class.getName());
+                receiver = new HeapDumpReceiver(service, writerId);
                 receivers.registerReceiver(receiver);
-                return service;
             }
 
             @Override
-            public void removedService(ServiceReference reference, Object service) {
+            public void dependenciesUnavailable() {
                 receivers.unregisterReceivers();
-                super.removedService(reference, service);
             }
-        };
-        heapDumpCommandReceiverTracker.open();
-
+            
+        });
+        tracker.open();
     }
 
     @Override
     public void stop(BundleContext context) {
-        heapDumpCommandReceiverTracker.close();
-
         receivers.unregisterReceivers();
+        tracker.close();
     }
 
 }
--- a/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiver.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiver.java	Mon Sep 02 11:32:11 2013 +0200
@@ -47,6 +47,7 @@
 import com.redhat.thermostat.common.command.Response;
 import com.redhat.thermostat.common.command.Response.ResponseType;
 import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO;
 import com.redhat.thermostat.vm.heap.analysis.common.HistogramLoader;
 import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram;
@@ -62,16 +63,20 @@
     private final JMapHeapDumper jmapHeapDumper;
 
     private final HistogramLoader histogramLoader;
+    private final WriterID writerId;
 
-    public HeapDumpReceiver(HeapDAO heapDao) {
-        this(heapDao, new JMXHeapDumper(), new JMapHeapDumper(), new HistogramLoader());
+    public HeapDumpReceiver(HeapDAO heapDao, WriterID writerId) {
+        this(heapDao, new JMXHeapDumper(), new JMapHeapDumper(), new HistogramLoader(), writerId);
     }
 
-    HeapDumpReceiver(HeapDAO heapDao, JMXHeapDumper jmxHeapDumper, JMapHeapDumper jmapHeapDumper, HistogramLoader histogramLoader) {
+    HeapDumpReceiver(HeapDAO heapDao, JMXHeapDumper jmxHeapDumper,
+                     JMapHeapDumper jmapHeapDumper, HistogramLoader histogramLoader,
+                     WriterID writerId) {
         this.heapDao = heapDao;
         this.jmxHeapDumper = jmxHeapDumper;
         this.jmapHeapDumper = jmapHeapDumper;
         this.histogramLoader = histogramLoader;
+        this.writerId = writerId;
     }
 
     @Override
@@ -123,7 +128,8 @@
     }
 
     private void saveHeapDumpInfo(String vmId, File tempFile, ObjectHistogram histogram) throws IOException {
-        HeapInfo heapInfo = new HeapInfo(vmId, System.currentTimeMillis());
+        String wId = writerId.getWriterID();
+        HeapInfo heapInfo = new HeapInfo(wId, vmId, System.currentTimeMillis());
         heapDao.putHeapInfo(heapInfo, tempFile, histogram);
     }
 
--- a/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -39,16 +39,13 @@
 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 org.junit.Test;
-import org.osgi.framework.ServiceRegistration;
 
 import com.redhat.thermostat.agent.command.RequestReceiver;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
-import com.redhat.thermostat.vm.heap.analysis.agent.internal.Activator;
-import com.redhat.thermostat.vm.heap.analysis.agent.internal.HeapDumpReceiver;
 import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO;
 
 public class ActivatorTest {
@@ -74,7 +71,9 @@
         StubBundleContext ctx = new StubBundleContext();
 
         HeapDAO heapDao = mock(HeapDAO.class);
-        ServiceRegistration registration = ctx.registerService(HeapDAO.class, heapDao, null);
+        WriterID writerId = mock(WriterID.class);
+        ctx.registerService(HeapDAO.class, heapDao, null);
+        ctx.registerService(WriterID.class, writerId, null);
 
         Activator activator = new Activator();
 
@@ -82,15 +81,13 @@
 
         assertTrue(ctx.isServiceRegistered(RequestReceiver.class.getName(), HeapDumpReceiver.class));
 
-        assertEquals(1, ctx.getServiceListeners().size());
+        assertEquals(2, ctx.getServiceListeners().size());
 
         activator.stop(ctx);
 
         assertFalse(ctx.isServiceRegistered(RequestReceiver.class.getName(), HeapDumpReceiver.class));
 
         assertEquals(0, ctx.getServiceListeners().size());
-
-        assertEquals(0, ctx.getExportedServiceCount(registration));
     }
 
 }
--- a/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiverTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiverTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -57,6 +57,7 @@
 import com.redhat.thermostat.common.command.Request;
 import com.redhat.thermostat.common.command.Response;
 import com.redhat.thermostat.common.command.Response.ResponseType;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO;
 import com.redhat.thermostat.vm.heap.analysis.common.HistogramLoader;
 import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram;
@@ -82,7 +83,8 @@
         jmxDumper = mock(JMXHeapDumper.class);
         jmapDumper = mock(JMapHeapDumper.class);
         histogramLoader = mock(HistogramLoader.class);
-        receiver = new HeapDumpReceiver(heapDAO, jmxDumper, jmapDumper, histogramLoader);
+        WriterID id = mock(WriterID.class);
+        receiver = new HeapDumpReceiver(heapDAO, jmxDumper, jmapDumper, histogramLoader, id);
     }
 
     @After
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOImpl.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOImpl.java	Mon Sep 02 11:32:11 2013 +0200
@@ -85,7 +85,6 @@
 
     @Override
     public void putHeapInfo(HeapInfo heapInfo, File heapDumpData, ObjectHistogram histogramData) throws IOException {
-        heapInfo.setAgentId(storage.getAgentId());
         String heapId = heapInfo.getAgentId() + "-" + heapInfo.getVmId() + "-" + heapInfo.getTimeStamp();
         System.err.println("assigning heapId: " + heapId);
         heapInfo.setHeapId(heapId);
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfo.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfo.java	Mon Sep 02 11:32:11 2013 +0200
@@ -54,10 +54,11 @@
     private String histogramId;
 
     public HeapInfo() {
-        this(null, -1);
+        this(null, null, -1);
     }
 
-    public HeapInfo(String vmId, long timestamp) {
+    public HeapInfo(String writerId, String vmId, long timestamp) {
+        super(writerId);
         this.vmId = vmId;
         this.timeStamp = timestamp;
     }
--- a/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -100,13 +100,13 @@
         add = mock(Add.class);
         when(storage.createAdd(any(Category.class))).thenReturn(add);
 
-        when(storage.getAgentId()).thenReturn("test");
         stmt = (PreparedStatement<HeapInfo>) mock(PreparedStatement.class); 
         when(storage.prepareStatement(anyDescriptor())).thenReturn(stmt);
 
         dao = new HeapDAOImpl(storage);
         
-        heapInfo = new HeapInfo("vm1", 12345);
+        String writerId = "test";
+        heapInfo = new HeapInfo(writerId, "vm1", 12345);
         byte[] data = new byte[] { 1, 2, 3 };
         heapDumpData = File.createTempFile("test", "test");
         FileOutputStream out = new FileOutputStream(heapDumpData);
@@ -115,13 +115,13 @@
         histogramData = createHistogramData();
 
         Cursor<HeapInfo> cursor = (Cursor<HeapInfo>) mock(Cursor.class);
-        HeapInfo info1 = new HeapInfo("vm2", 12345L);
+        HeapInfo info1 = new HeapInfo(writerId, "vm2", 12345L);
         info1.setAgentId("123");
         info1.setHeapId("testheap1");
         info1.setHeapDumpId("test1");
         info1.setHistogramId("histotest1");
 
-        HeapInfo info2 = new HeapInfo("vm2", 23456L);
+        HeapInfo info2 = new HeapInfo(writerId, "vm2", 23456L);
         info2.setAgentId("123");
         info2.setHeapId("testheap2");
         info2.setHeapDumpId("test2");
@@ -263,12 +263,12 @@
         verify(stmt).executeQuery();
         verifyNoMoreInteractions(stmt);
         
-        HeapInfo info1 = new HeapInfo("vm2", 12345);
+        HeapInfo info1 = new HeapInfo("foo-agent", "vm2", 12345);
         info1.setHeapDumpId("test1");
         info1.setHeapId("testheap1");
         info1.setHistogramId("histotest1");
         
-        HeapInfo info2 = new HeapInfo("vm2", 23456);
+        HeapInfo info2 = new HeapInfo("foo-agent", "vm2", 23456);
         info2.setHeapDumpId("test2");
         info2.setHeapId("testheap2");
         info2.setHistogramId("histotest2");
@@ -289,7 +289,7 @@
         verify(stmt).executeQuery();
         verifyNoMoreInteractions(stmt);
         
-        HeapInfo info = new HeapInfo("vm2", 12345);
+        HeapInfo info = new HeapInfo("foo-agent", "vm2", 12345);
         info.setHeapDumpId("test1");
         info.setHeapId("testheap1");
         info.setHistogramId("histotest1");
--- a/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfoTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfoTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -38,20 +38,19 @@
 
 import static org.junit.Assert.assertEquals;
 import static org.junit.Assert.assertNull;
+import static org.junit.Assert.fail;
 
 import org.junit.Before;
 import org.junit.Test;
 
-import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo;
-
 public class HeapInfoTest {
 
     private HeapInfo heapInfo;
 
     @Before
     public void setUp() {
-        heapInfo = new HeapInfo("vmId", 12345);
-        heapInfo.setAgentId("test-agent");
+        String agentId = "test-agent";
+        heapInfo = new HeapInfo(agentId, "vmId", 12345);
     }
 
     @Test
@@ -74,5 +73,15 @@
         heapInfo.setHistogramId("test");
         assertEquals("test", heapInfo.getHistogramId());
     }
+    
+    @Test
+    public void testBasicInstantiation() {
+        try {
+            // pojo converters use this
+            HeapInfo.class.newInstance();
+        } catch (Exception e) {
+            fail("should be able to instantiate using no-arg constructor");
+        }
+    }
 }
 
--- a/vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -46,19 +46,24 @@
 import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.utils.management.MXBeanConnectionPool;
 import com.redhat.thermostat.vm.jmx.common.JmxNotificationDAO;
 
 public class Activator implements BundleActivator {
 
-    private ServiceRegistration registration;
+    private ServiceRegistration<Backend> registration;
     private JmxBackend jmxBackend;
     private MultipleServiceTracker tracker;
 
     @Override
     public void start(final BundleContext context) throws Exception {
 
-        Class<?>[] deps = new Class<?>[] { JmxNotificationDAO.class, MXBeanConnectionPool.class };
+        Class<?>[] deps = new Class<?>[] {
+                JmxNotificationDAO.class,
+                MXBeanConnectionPool.class,
+                WriterID.class, // jmx backend uses it
+        };
         tracker = new MultipleServiceTracker(context, deps, new MultipleServiceTracker.Action() {
 
             @Override
@@ -68,9 +73,10 @@
                 Version version = new Version(context.getBundle());
                 ReceiverRegistry registry = new ReceiverRegistry(context);
                 JmxRequestListener receiver = new JmxRequestListener();
-                jmxBackend = new JmxBackend(version, registry, dao, pool, receiver);
+                WriterID writerId = (WriterID) services.get(WriterID.class.getName());
+                jmxBackend = new JmxBackend(version, registry, dao, pool, receiver, writerId);
                 receiver.setBackend(jmxBackend);
-                registration = context.registerService(Backend.class.getName(), jmxBackend, null);
+                registration = context.registerService(Backend.class, jmxBackend, null);
             }
 
             @Override
--- a/vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackend.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/agent/src/main/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackend.java	Mon Sep 02 11:32:11 2013 +0200
@@ -60,6 +60,7 @@
 import com.redhat.thermostat.common.SystemClock;
 import com.redhat.thermostat.common.Version;
 import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.utils.management.MXBeanConnection;
 import com.redhat.thermostat.utils.management.MXBeanConnectionPool;
 import com.redhat.thermostat.vm.jmx.common.JmxNotification;
@@ -80,6 +81,7 @@
     private final NotificationListener notificationWriter;
 
     private final Map<Integer, MXBeanConnection> connections = new HashMap<>();
+    private final WriterID writerId;
 
     private boolean isActive = false;
 
@@ -94,17 +96,22 @@
         }
     }
 
-    public JmxBackend(Version version, ReceiverRegistry registry, JmxNotificationDAO dao, MXBeanConnectionPool pool, RequestReceiver receiver) {
-        this(version, registry, dao, pool, receiver, new SystemClock());
+    public JmxBackend(Version version, ReceiverRegistry registry,
+            JmxNotificationDAO dao, MXBeanConnectionPool pool,
+            RequestReceiver receiver, WriterID writerId) {
+        this(version, registry, dao, pool, receiver, new SystemClock(), writerId);
     }
 
-    public JmxBackend(Version version, ReceiverRegistry registry, JmxNotificationDAO dao, MXBeanConnectionPool pool, RequestReceiver receiver, Clock clock) {
+    public JmxBackend(Version version, ReceiverRegistry registry,
+            JmxNotificationDAO dao, MXBeanConnectionPool pool,
+            RequestReceiver receiver, Clock clock, WriterID writerId) {
         super("VM JMX Backend", "gathers JMX information using JMX", "Red Hat, Inc.", version.getVersionNumber());
 
         this.registry = registry;
         this.pool = pool;
         this.dao = dao;
         this.clock = clock;
+        this.writerId = writerId;
 
         this.registrationNotificationListener = new RegistrationNotificationListener();
         this.notificationWriter = new NotificationWriter();
@@ -160,7 +167,8 @@
                     addNotificationListenerToMBean(idAndPid, server, name);
                 }
             }
-            JmxNotificationStatus update = new JmxNotificationStatus();
+            String wId = writerId.getWriterID();
+            JmxNotificationStatus update = new JmxNotificationStatus(wId);
             update.setVmId(vmId);
             update.setEnabled(true);
             update.setTimeStamp(clock.getRealTimeMillis());
@@ -173,7 +181,8 @@
     public void disableNotificationsFor(String vmId, int pid) {
         MXBeanConnection connection = connections.get(pid);
 
-        JmxNotificationStatus update = new JmxNotificationStatus();
+        String wId = writerId.getWriterID();
+        JmxNotificationStatus update = new JmxNotificationStatus(wId);
         update.setVmId(vmId);
         update.setEnabled(false);
         update.setTimeStamp(clock.getRealTimeMillis());
@@ -218,7 +227,8 @@
         public void handleNotification(Notification notification, Object handback) {
             VmIdAndPid idAndPid = (VmIdAndPid) handback;
 
-            JmxNotification data = new JmxNotification();
+            String wId = writerId.getWriterID();
+            JmxNotification data = new JmxNotification(wId);
             data.setVmId(idAndPid.vmId);
             data.setTimeStamp(notification.getTimeStamp());
             data.setSourceBackend(JmxBackend.class.getName());
@@ -235,4 +245,5 @@
             server.addNotificationListener(name, JmxBackend.this.notificationWriter, null, idAndPid);
         }
     }
+
 }
--- a/vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -46,6 +46,7 @@
 import org.osgi.framework.Version;
 
 import com.redhat.thermostat.backend.Backend;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.utils.management.MXBeanConnectionPool;
 import com.redhat.thermostat.vm.jmx.agent.internal.Activator;
@@ -65,19 +66,20 @@
 
         bundleContext.registerService(JmxNotificationDAO.class, mock(JmxNotificationDAO.class), null);
         bundleContext.registerService(MXBeanConnectionPool.class, mock(MXBeanConnectionPool.class), null);
+        bundleContext.registerService(WriterID.class, mock(WriterID.class), null);
 
         Activator activator = new Activator();
 
         activator.start(bundleContext);
 
         assertTrue(bundleContext.isServiceRegistered(Backend.class.getName(), JmxBackend.class));
-        assertEquals(3, bundleContext.getAllServices().size());
+        assertEquals(4, bundleContext.getAllServices().size());
 
         // thermostat will activate the backend; simulate that
         activator.getBackend().activate();
 
         activator.stop(bundleContext);
 
-        assertEquals(2, bundleContext.getAllServices().size());
+        assertEquals(3, bundleContext.getAllServices().size());
     }
 }
--- a/vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackendTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/agent/src/test/java/com/redhat/thermostat/vm/jmx/agent/internal/JmxBackendTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -67,6 +67,7 @@
 import com.redhat.thermostat.agent.command.RequestReceiver;
 import com.redhat.thermostat.common.Ordered;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.utils.management.MXBeanConnection;
 import com.redhat.thermostat.utils.management.MXBeanConnectionPool;
 import com.redhat.thermostat.vm.jmx.common.JmxNotification;
@@ -91,7 +92,8 @@
         dao = mock(JmxNotificationDAO.class);
         pool = mock(MXBeanConnectionPool.class);
 
-        backend = new JmxBackend(version, registry, dao, pool, receiver);
+        WriterID id = mock(WriterID.class);
+        backend = new JmxBackend(version, registry, dao, pool, receiver, id);
     }
 
     @Test
--- a/vm-jmx/client-swing/src/main/java/com/redhat/thermostat/vm/jmx/client/swing/internal/JmxNotificationsSwingView.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/client-swing/src/main/java/com/redhat/thermostat/vm/jmx/client/swing/internal/JmxNotificationsSwingView.java	Mon Sep 02 11:32:11 2013 +0200
@@ -366,7 +366,7 @@
             @Override
             public void run() {
                 int c = i.incrementAndGet();
-                JmxNotification data = new JmxNotification();
+                JmxNotification data = new JmxNotification("foo-agent");
                 data.setTimeStamp(time + (c * TimeUnit.MINUTES.toMillis(1)));
                 data.setSourceBackend("foo");
                 data.setSourceDetails("GarbageCollection " + c);
--- a/vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotification.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotification.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,6 +49,14 @@
     private String sourceBackend;
     private String sourceDetails;
     private String contents;
+    
+    public JmxNotification() {
+        this(null);
+    }
+    
+    public JmxNotification(String writerId) {
+        super(writerId);
+    }
 
     @Persist
     public String getVmId() {
--- a/vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotificationStatus.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/common/src/main/java/com/redhat/thermostat/vm/jmx/common/JmxNotificationStatus.java	Mon Sep 02 11:32:11 2013 +0200
@@ -47,6 +47,14 @@
     private long timeStamp = 0;
     private String vmId = null;
     private boolean enabled = false;
+    
+    public JmxNotificationStatus() {
+        this(null);
+    }
+    
+    public JmxNotificationStatus(String writerId) {
+        super(writerId);
+    }
 
     @Persist
     public String getVmId() {
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vm-jmx/common/src/test/java/com/redhat/thermostat/vm/jmx/common/JmxPojosInstantiationTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -0,0 +1,68 @@
+/*
+ * Copyright 2012, 2013 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.vm.jmx.common;
+
+import static org.junit.Assert.assertEquals;
+
+import java.util.ArrayList;
+
+import org.junit.Test;
+
+public class JmxPojosInstantiationTest {
+
+    private static final Class<?>[] CLASSES_LIST = new Class[] {
+        JmxNotification.class,
+        JmxNotificationStatus.class
+    };
+
+    @Test
+    public void testBasicInstantiation() {
+        ArrayList<Class<?>> failureClasses = new ArrayList<>();
+        for (Class<?> clazz : CLASSES_LIST) {
+            try {
+                // pojo converters use this
+                clazz.newInstance();
+                // pass
+            } catch (InstantiationException | IllegalAccessException e) {
+                failureClasses.add(clazz);
+            }
+        }
+        String msg = "Should be able to instantiate class using no-arg constructor: "
+                + failureClasses;
+        assertEquals(msg, 0, failureClasses.size());
+    }
+}
--- a/vm-jmx/common/src/test/java/com/redhat/thermostat/vm/jmx/common/internal/JmxNotificationDAOImplTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-jmx/common/src/test/java/com/redhat/thermostat/vm/jmx/common/internal/JmxNotificationDAOImplTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -113,7 +113,7 @@
 
     @Test
     public void verifyGetLatestNotificationStatus() throws DescriptorParsingException, StatementExecutionException {
-        JmxNotificationStatus data = new JmxNotificationStatus();
+        JmxNotificationStatus data = new JmxNotificationStatus("foo-agent");
 
         @SuppressWarnings("unchecked")
         PreparedStatement<JmxNotificationStatus> stmt = (PreparedStatement<JmxNotificationStatus>) mock(PreparedStatement.class);
--- a/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/Activator.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/Activator.java	Mon Sep 02 11:32:11 2013 +0200
@@ -49,13 +49,14 @@
 import com.redhat.thermostat.common.MultipleServiceTracker;
 import com.redhat.thermostat.common.MultipleServiceTracker.Action;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
 
 public class Activator implements BundleActivator {
     
     private MultipleServiceTracker tracker;
     private VmListenerBackend backend;
-    private ServiceRegistration reg;
+    private ServiceRegistration<Backend> reg;
     
     @Override
     public void start(final BundleContext context) throws Exception {
@@ -64,7 +65,8 @@
 
         Class<?>[] deps = new Class<?>[] {
                 BackendService.class,
-                VmMemoryStatDAO.class
+                VmMemoryStatDAO.class,
+                WriterID.class, // vm memory backend uses it
         };
         tracker = new MultipleServiceTracker(context, deps, new Action() {
             
@@ -72,8 +74,9 @@
             public void dependenciesAvailable(Map<String, Object> services) {
                 VmMemoryStatDAO vmMemoryStatDao = (VmMemoryStatDAO) services.get(VmMemoryStatDAO.class.getName());
                 Version version = new Version(context.getBundle());
-                backend = new VmMemoryBackend(vmMemoryStatDao, version, registrar);
-                reg = context.registerService(Backend.class.getName(), backend, null);
+                WriterID writerId = (WriterID) services.get(WriterID.class.getName());
+                backend = new VmMemoryBackend(vmMemoryStatDao, version, registrar, writerId);
+                reg = context.registerService(Backend.class, backend, null);
             }
 
             @Override
--- a/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackend.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackend.java	Mon Sep 02 11:32:11 2013 +0200
@@ -40,16 +40,19 @@
 import com.redhat.thermostat.backend.VmListenerBackend;
 import com.redhat.thermostat.backend.VmUpdateListener;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
 
 public class VmMemoryBackend extends VmListenerBackend {
 
     private VmMemoryStatDAO vmMemoryStats;
     
-    public VmMemoryBackend(VmMemoryStatDAO vmMemoryStatDAO, Version version, VmStatusListenerRegistrar registrar) {
+    public VmMemoryBackend(VmMemoryStatDAO vmMemoryStatDAO, Version version,
+            VmStatusListenerRegistrar registrar, WriterID writerId) {
         super("VM Memory Backend",
                 "Gathers memory statistics about a JVM",
-                "Red Hat, Inc.", version.getVersionNumber(), true, registrar);
+                "Red Hat, Inc.", version.getVersionNumber(),
+                true, registrar, writerId);
         this.vmMemoryStats = vmMemoryStatDAO;
     }
 
@@ -59,8 +62,8 @@
     }
 
     @Override
-    protected VmUpdateListener createVmListener(String vmId, int pid) {
-        return new VmMemoryVmListener(vmMemoryStats, vmId);
+    protected VmUpdateListener createVmListener(String writerId, String vmId, int pid) {
+        return new VmMemoryVmListener(writerId, vmMemoryStats, vmId);
     }
     
 }
--- a/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListener.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListener.java	Mon Sep 02 11:32:11 2013 +0200
@@ -54,10 +54,12 @@
 
     private final String vmId;
     private final VmMemoryStatDAO memDAO;
+    private final String writerId;
 
-    public VmMemoryVmListener(VmMemoryStatDAO vmMemoryStatDao, String vmId) {
+    public VmMemoryVmListener(String writerId, VmMemoryStatDAO vmMemoryStatDao, String vmId) {
         memDAO = vmMemoryStatDao;
         this.vmId = vmId;
+        this.writerId = writerId;
     }
 
     @Override
@@ -91,7 +93,7 @@
                 }
                 g.setSpaces(spaces);
             }
-            VmMemoryStat stat = new VmMemoryStat(timestamp, vmId, generations);
+            VmMemoryStat stat = new VmMemoryStat(writerId, timestamp, vmId, generations);
             memDAO.putVmMemoryStat(stat);
         } catch (VmUpdateException e) {
             logger.log(Level.WARNING, "error gathering memory info for vm " + vmId, e);
--- a/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/ActivatorTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/ActivatorTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -50,6 +50,7 @@
 import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.backend.BackendService;
 import com.redhat.thermostat.backend.VmListenerBackend;
+import com.redhat.thermostat.storage.core.WriterID;
 import com.redhat.thermostat.testutils.StubBundleContext;
 import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO;
 
@@ -64,7 +65,7 @@
         activator.start(context);
 
         assertEquals(0, context.getAllServices().size());
-        assertEquals(2, context.getServiceListeners().size());
+        assertEquals(3, context.getServiceListeners().size());
 
         activator.stop(context);
     }
@@ -82,9 +83,11 @@
         
         BackendService service = mock(BackendService.class);
         VmMemoryStatDAO vmMemoryStatDAO = mock(VmMemoryStatDAO.class);
+        WriterID id = mock(WriterID.class);
 
         context.registerService(BackendService.class, service, null);
         context.registerService(VmMemoryStatDAO.class, vmMemoryStatDAO, null);
+        context.registerService(WriterID.class, id, null);
 
         Activator activator = new Activator();
 
@@ -103,7 +106,7 @@
         assertFalse(backend.isActive());
 
         assertEquals(0, context.getServiceListeners().size());
-        assertEquals(2, context.getAllServices().size());
+        assertEquals(3, context.getAllServices().size());
     }
 
 }
--- a/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackendTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryBackendTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -60,8 +60,8 @@
         when(version.getVersionNumber()).thenReturn("0.0.0");
 
         VmStatusListenerRegistrar registrar = mock(VmStatusListenerRegistrar.class);
-
-        backend = new VmMemoryBackend(vmMemoryStatDao, version, registrar);
+        
+        backend = new VmMemoryBackend(vmMemoryStatDao, version, registrar, null);
     }
 
     @Test
--- a/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListenerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListenerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -85,7 +85,7 @@
     public void setup() throws VmUpdateException {
         final int numGens = 2;
         vmMemoryStatDAO = mock(VmMemoryStatDAO.class);
-        vmListener = new VmMemoryVmListener(vmMemoryStatDAO, "vmId");
+        vmListener = new VmMemoryVmListener("foo-agent", vmMemoryStatDAO, "vmId");
         extractor = mock(VmMemoryDataExtractor.class);
 
         mockTotalGenerations(numGens);
--- a/vm-memory/client-cli/src/test/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegateTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/client-cli/src/test/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegateTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -92,7 +92,7 @@
 
         VmMemoryStat.Generation[] gens1 = new VmMemoryStat.Generation[] { gen1_1, gen1_2 };
 
-        VmMemoryStat memStat1 = new VmMemoryStat(1, vmId, gens1);
+        VmMemoryStat memStat1 = new VmMemoryStat("foo-agent", 1, vmId, gens1);
 
         VmMemoryStat.Space space2_1_1 = newSpace("space1", 123456, 12345, 2, 0);
         VmMemoryStat.Space space2_1_2 = newSpace("space2", 123456, 12345, 2, 0);
@@ -106,7 +106,7 @@
 
         VmMemoryStat.Generation[] gens2 = new VmMemoryStat.Generation[] { gen2_1, gen2_2 };
 
-        VmMemoryStat memStat2 = new VmMemoryStat(2, vmId, gens2);
+        VmMemoryStat memStat2 = new VmMemoryStat("foo-agent", 2, vmId, gens2);
 
         VmMemoryStat.Space space3_1_1 = newSpace("space1", 123456, 12345, 4, 0);
         VmMemoryStat.Space space3_1_2 = newSpace("space2", 123456, 12345, 5, 0);
@@ -120,7 +120,7 @@
 
         VmMemoryStat.Generation[] gens3 = new VmMemoryStat.Generation[] { gen3_1, gen3_2 };
 
-        VmMemoryStat memStat3 = new VmMemoryStat(3, vmId, gens3);
+        VmMemoryStat memStat3 = new VmMemoryStat("foo-agent", 3, vmId, gens3);
 
         vmMemoryStatDAO = mock(VmMemoryStatDAO.class);
         memoryStats = Arrays.asList(memStat1, memStat2, memStat3);
--- a/vm-memory/client-core/src/test/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsControllerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/client-core/src/test/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsControllerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -153,7 +153,7 @@
         long timestamp = 1;
         String vmID = "vmId";
         for (int i = 0; i < 5; i++) {
-            VmMemoryStat vmMemory = new VmMemoryStat(timestamp++, vmID, generations);
+            VmMemoryStat vmMemory = new VmMemoryStat("foo-agent", timestamp++, vmID, generations);
             vmInfo.add(vmMemory);
         }
         
--- a/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStat.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStat.java	Mon Sep 02 11:32:11 2013 +0200
@@ -180,10 +180,11 @@
     private String vmId;
 
     public VmMemoryStat() {
-        this(-1, null, null);
+        this(null, -1, null, null);
     }
 
-    public VmMemoryStat(long timestamp, String vmId, Generation[] generations) {
+    public VmMemoryStat(String writerId, long timestamp, String vmId, Generation[] generations) {
+        super(writerId);
         this.timestamp = timestamp;
         this.vmId = vmId;
         if (generations != null) {
--- a/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -202,7 +202,7 @@
             }
             gen.setSpaces(spaces.toArray(new Space[spaces.size()]));
         }
-        VmMemoryStat stat = new VmMemoryStat(1, "vmId", generations.toArray(new Generation[generations.size()]));
+        VmMemoryStat stat = new VmMemoryStat("foo-agent", 1, "vmId", generations.toArray(new Generation[generations.size()]));
 
         Storage storage = mock(Storage.class);
         @SuppressWarnings("unchecked")
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStatTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2012, 2013 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.vm.memory.common.model;
+
+import static org.junit.Assert.fail;
+
+import org.junit.Test;
+
+public class VmMemoryStatTest {
+
+    @Test
+    public void testBasicInstantiation() {
+        try {
+            // pojo converters use this
+            VmMemoryStat.class.newInstance();
+        } catch (Exception e) {
+            fail("should be able to instantiate using no-arg constructor");
+        }
+    }
+}
--- a/vm-overview/client-core/src/test/java/com/redhat/thermostat/vm/overview/client/core/internal/VmOverviewControllerTest.java	Mon Sep 02 11:28:59 2013 +0200
+++ b/vm-overview/client-core/src/test/java/com/redhat/thermostat/vm/overview/client/core/internal/VmOverviewControllerTest.java	Mon Sep 02 11:32:11 2013 +0200
@@ -129,7 +129,7 @@
     }
 
     private VmInfo createVmInfo() {
-        VmInfo vmInfo = new VmInfo(VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
+        VmInfo vmInfo = new VmInfo("foo-agent", VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
                 JAVA_HOME, MAIN_CLASS, COMMAND_LINE, VM_NAME, VM_INFO,
                 VM_VERSION, VM_ARGS, PROPS, ENV, LIBS, UID, USERNAME);
         return vmInfo;
@@ -158,7 +158,7 @@
     
     @Test
     public void verifyViewIsUpdatedWithDataNoUid() {
-        VmInfo vmInfo = new VmInfo(VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
+        VmInfo vmInfo = new VmInfo("foo-agent", VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
                 JAVA_HOME, MAIN_CLASS, COMMAND_LINE, VM_NAME, VM_INFO,
                 VM_VERSION, VM_ARGS, PROPS, ENV, LIBS, -1, null);
         createController(vmInfo);
@@ -184,7 +184,7 @@
     
     @Test
     public void verifyViewIsUpdatedWithDataNoUsername() {
-        VmInfo vmInfo = new VmInfo(VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
+        VmInfo vmInfo = new VmInfo("foo-agent", VM_ID, VM_PID, START_TIME, STOP_TIME, JAVA_VERSION,
                 JAVA_HOME, MAIN_CLASS, COMMAND_LINE, VM_NAME, VM_INFO,
                 VM_VERSION, VM_ARGS, PROPS, ENV, LIBS, UID, null);
         createController(vmInfo);