changeset 2773:4f12f8ffdc9b

Resurrect Jvm ClassStat plugin This patch brings back the agent side of the Vm Classtat plugin. Reviewed-by: neugens Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2017-October/025330.html
author Simon Tooke <stooke@redhat.com>
date Wed, 18 Oct 2017 15:15:19 -0400
parents 9e3d6eedbbee
children 4592c11860e4
files distribution/assembly/plugin-assembly.xml distribution/pom.xml plugins/pom.xml plugins/vm-classstat/agent/pom.xml plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/Activator.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAO.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOImpl.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractor.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/model/VmClassStat.java plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTypeAdapter.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/ActivatorTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractorTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTest.java plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTypeAdapterTest.java plugins/vm-classstat/common/pom.xml plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/Activator.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatCategoryRegistration.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImpl.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImplStatementDescriptorRegistration.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatTypeAdapter.java plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java plugins/vm-classstat/common/src/main/resources/META-INF/services/com.redhat.thermostat.storage.core.auth.CategoryRegistration plugins/vm-classstat/common/src/main/resources/META-INF/services/com.redhat.thermostat.storage.core.auth.StatementDescriptorRegistration plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/ActivatorTest.java plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatCategoryRegistrationTest.java plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImplStatementDescriptorRegistrationTest.java plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatTypeAdapterTest.java plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStatTest.java plugins/vm-classstat/distribution/assemblies/plugin-assembly.xml plugins/vm-classstat/distribution/configFiles/gateway.properties plugins/vm-classstat/distribution/thermostat-plugin.xml plugins/vm-classstat/pom.xml
diffstat 39 files changed, 894 insertions(+), 1621 deletions(-) [+]
line wrap: on
line diff
--- a/distribution/assembly/plugin-assembly.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/distribution/assembly/plugin-assembly.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -62,10 +62,10 @@
         <include>com.redhat.thermostat.agent:thermostat-killvm-distribution</include>
         <include>com.redhat.thermostat.agent:thermostat-vm-compiler-distribution</include>
 	    <include>com.redhat.thermostat.agent:thermostat-jcmd-stats-collector-distribution</include>
-        <!--        <include>com.redhat.thermostat.agent:thermostat-numa-distribution</include>-->
+        <include>com.redhat.thermostat.agent:thermostat-vm-classstat-distribution</include>
+        <include>com.redhat.thermostat.agent:thermostat-vm-cpu-distribution</include>
+<!--        <include>com.redhat.thermostat.agent:thermostat-numa-distribution</include>-->
 <!--        <include>com.redhat.thermostat.agent:thermostat-thread-distribution</include>-->
-<!--        <include>com.redhat.thermostat.agent:thermostat-vm-classstat-distribution</include>-->
-        <include>com.redhat.thermostat.agent:thermostat-vm-cpu-distribution</include>
 <!--        <include>com.redhat.thermostat.agent:thermostat-vm-heap-analysis-distribution</include>-->
 <!--        <include>com.redhat.thermostat.agent:thermostat-vm-jmx-distribution</include>-->
 <!--        <include>com.redhat.thermostat.agent:thermostat-vm-profiler-distribution</include>-->
--- a/distribution/pom.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/distribution/pom.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -557,12 +557,12 @@
       <!--<version>${project.version}</version>-->
       <!--<type>zip</type>-->
     <!--</dependency>-->
-    <!--<dependency>-->
-      <!--<groupId>com.redhat.thermostat.agent</groupId>-->
-      <!--<artifactId>thermostat-vm-classstat-distribution</artifactId>-->
-      <!--<version>${project.version}</version>-->
-      <!--<type>zip</type>-->
-    <!--</dependency>-->
+    <dependency>
+      <groupId>com.redhat.thermostat.agent</groupId>
+      <artifactId>thermostat-vm-classstat-distribution</artifactId>
+      <version>${project.version}</version>
+      <type>zip</type>
+    </dependency>
     <dependency>
       <groupId>com.redhat.thermostat.agent</groupId>
       <artifactId>thermostat-vm-compiler-distribution</artifactId>
--- a/plugins/pom.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/pom.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -57,16 +57,18 @@
     <module>host-cpu</module>
     <module>host-memory</module>
     <module>host-network</module>
+    <module>commands</module>
+    <module>jcmd-stats-collector</module>
     <module>jvm-overview</module>
+    <module>vm-classstat</module>
     <module>vm-gc</module>
     <module>vm-io</module>
     <module>vm-memory</module>
-    <module>commands</module>
     <module>vm-byteman</module>
     <module>vm-compiler</module>
-    <module>jcmd-stats-collector</module>
     <module>vm-cpu</module>
     <!--<module>vm-classstat</module>-->
+    <!--<module>vm-cpu</module>-->
     <!--<module>vm-heap-analysis</module>-->
     <!--<module>vm-jmx</module>-->
     <!--<module>vm-profiler</module>-->
--- a/plugins/vm-classstat/agent/pom.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/pom.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -56,8 +56,9 @@
           <instructions>
             <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor>
             <Bundle-SymbolicName>com.redhat.thermostat.vm.classstat.agent</Bundle-SymbolicName>
-            <Bundle-Activator>com.redhat.thermostat.vm.classstat.agent.internal.Activator</Bundle-Activator>
-            <Export-Package />
+            <Export-Package>
+              com.redhat.thermostat.vm.classstat.model
+            </Export-Package>
             <Private-Package>
               com.redhat.thermostat.vm.classstat.agent.internal
             </Private-Package>
@@ -66,8 +67,21 @@
           </instructions>
         </configuration>
       </plugin>
+      <plugin>
+        <groupId>org.apache.felix</groupId>
+        <artifactId>maven-scr-plugin</artifactId>
+        <executions>
+          <execution>
+            <id>generate-scr-scrdescriptor</id>
+            <goals>
+              <goal>scr</goal>
+            </goals>
+          </execution>
+        </executions>
+      </plugin>
     </plugins>
   </build>
+
   <dependencies>
     <dependency>
       <groupId>junit</groupId>
@@ -96,11 +110,6 @@
     </dependency>
     <dependency>
       <groupId>com.redhat.thermostat.agent</groupId>
-      <artifactId>thermostat-vm-classstat-common</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.redhat.thermostat.agent</groupId>
       <artifactId>thermostat-agent-core</artifactId>
       <version>${project.version}</version>
     </dependency>
@@ -115,5 +124,20 @@
       <version>${project.version}</version>
       <scope>test</scope>
     </dependency>
+    <dependency>
+      <groupId>com.google.code.gson</groupId>
+      <artifactId>gson</artifactId>
+      <version>${gson.version}</version>
+    </dependency>
+      <dependency>
+          <groupId>com.redhat.thermostat.agent</groupId>
+          <artifactId>thermostat-common-plugin</artifactId>
+          <version>${project.version}</version>
+      </dependency>
+      <dependency>
+          <groupId>com.redhat.thermostat.agent</groupId>
+          <artifactId>thermostat-jvm-overview-agent</artifactId>
+          <version>${project.version}</version>
+      </dependency>
   </dependencies>
 </project>
--- a/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/Activator.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,103 +0,0 @@
-/*
- * Copyright 2012-2017 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.agent.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceRegistration;
-
-import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
-import com.redhat.thermostat.backend.Backend;
-import com.redhat.thermostat.backend.BackendService;
-import com.redhat.thermostat.common.MultipleServiceTracker;
-import com.redhat.thermostat.common.MultipleServiceTracker.Action;
-import com.redhat.thermostat.common.MultipleServiceTracker.DependencyProvider;
-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<Backend> reg;
-    
-    @Override
-    public void start(final BundleContext context) throws Exception {
-
-        final VmStatusListenerRegistrar registrar = new VmStatusListenerRegistrar(context);
-
-        Class<?>[] deps = new Class<?>[] {
-                BackendService.class,
-                VmClassStatDAO.class,
-                WriterID.class, // vm class stat backend uses it
-        };
-        tracker = new MultipleServiceTracker(context, deps, new Action() {
-
-            @Override
-            public void dependenciesAvailable(DependencyProvider services) {
-                VmClassStatDAO vmClassStatDao = services.get(VmClassStatDAO.class);
-                Version version = new Version(context.getBundle());
-                WriterID id = services.get(WriterID.class);
-                backend = new VmClassStatBackend(vmClassStatDao, version, registrar, id);
-                reg = context.registerService(Backend.class, backend, null);
-            }
-
-            @Override
-            public void dependenciesUnavailable() {
-                if (backend.isActive()) {
-                    backend.deactivate();
-                }
-                reg.unregister();
-            }
-        });
-        tracker.open();
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        tracker.close();
-    }
-    
-    /*
-     * For testing purposes only.
-     */
-    VmClassStatBackend getBackend() {
-        return backend;
-    }
-}
-
--- a/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackend.java	Wed Oct 18 15:15:19 2017 -0400
@@ -36,28 +36,76 @@
 
 package com.redhat.thermostat.vm.classstat.agent.internal;
 
-import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
-import com.redhat.thermostat.backend.VmListenerBackend;
-import com.redhat.thermostat.backend.VmUpdateListener;
+import com.redhat.thermostat.backend.Backend;
 import com.redhat.thermostat.common.Version;
+import com.redhat.thermostat.jvm.overview.agent.VmListenerBackend;
+import com.redhat.thermostat.jvm.overview.agent.VmStatusListenerRegistrar;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateListener;
 import com.redhat.thermostat.storage.core.WriterID;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+import org.osgi.framework.BundleContext;
 
+@Component
+@Service(value = Backend.class)
 public class VmClassStatBackend extends VmListenerBackend {
 
-    private final VmClassStatDAO vmClassStats;
+    private final ListenerCreator listenerCreator;
+
+    @Reference
+    private VmClassStatDAO vmClassStatDao;
 
-    public VmClassStatBackend(VmClassStatDAO vmClassStatDAO, Version version,
-            VmStatusListenerRegistrar registrar, WriterID writerId) {
+    @Reference
+    private WriterID writerID;
+
+    public VmClassStatBackend() {
+        this(new ListenerCreator());
+    }
+
+    VmClassStatBackend(ListenerCreator lc) {
         super("VM Classes Backend",
                 "Gathers class loading statistics about a JVM",
-                "Red Hat, Inc.", version.getVersionNumber(), true, registrar, writerId);
-        this.vmClassStats = vmClassStatDAO;
+                "Red Hat, Inc.",true);
+        this.listenerCreator = lc;
+
+    }
+
+    @Activate
+    public void componentActivated(BundleContext ctx) {
+        VmStatusListenerRegistrar registrar = new VmStatusListenerRegistrar(ctx);
+        Version version = new Version(ctx.getBundle());
+        initialize(writerID, registrar, version.getVersionNumber());
+    }
+
+    @Deactivate
+    protected void componentDeactivated() {
+        if (isActive()) {
+            deactivate();
+        }
     }
 
     @Override
-    protected VmUpdateListener createVmListener(String writerId, String vmId, int pid) {
-        return new VmClassStatVmListener(writerId, vmClassStats, vmId);
+    protected VmUpdateListener createVmListener(String writerId, String jvmId, int pid) {
+        return listenerCreator.create(writerId, vmClassStatDao, jvmId);
+    }
+
+    // DS bind method
+    protected void bindVmClassStatDao(VmClassStatDAO dao) {
+        this.vmClassStatDao = dao;
+    }
+
+    // DS bind method
+    protected void bindWriterId(WriterID id) {
+        this.writerID = id;
+    }
+
+    static class ListenerCreator {
+        protected VmUpdateListener create(String writerId, VmClassStatDAO dao, String jvmId) {
+            return new VmClassStatVmListener(writerId, dao, jvmId);
+        }
     }
 
 }
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAO.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,46 @@
+/*
+ * Copyright 2012-2017 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.agent.internal;
+
+import com.redhat.thermostat.annotations.Service;
+import com.redhat.thermostat.vm.classstat.model.VmClassStat;
+
+@Service
+public interface VmClassStatDAO {
+    void put(VmClassStat stat);
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOImpl.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,162 @@
+/*
+ * Copyright 2012-2017 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.agent.internal;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import com.redhat.thermostat.agent.http.HttpRequestService;
+import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugin.PluginConfiguration;
+import com.redhat.thermostat.common.plugin.PluginDAOBase;
+import com.redhat.thermostat.common.plugin.SystemID;
+import com.redhat.thermostat.common.utils.LoggingUtils;
+import com.redhat.thermostat.vm.classstat.model.VmClassStat;
+import com.redhat.thermostat.vm.classstat.model.VmClassStatTypeAdapter;
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Reference;
+import org.apache.felix.scr.annotations.Service;
+
+@Component
+@Service(value = VmClassStatDAO.class)
+public class VmClassStatDAOImpl extends PluginDAOBase<VmClassStat> implements VmClassStatDAO {
+    
+    private static final Logger logger = LoggingUtils.getLogger(VmClassStatDAOImpl.class);
+
+    private static final String PLUGIN_ID = "vm-classstat";
+
+    private final JsonHelper jsonHelper;
+    private final ConfigurationCreator configCreator;
+    private URI gatewayURL;
+    private PluginConfiguration config;
+
+    @Reference
+    private ConfigurationInfoSource configurationInfoSource;
+
+    @Reference
+    private HttpRequestService httpRequestService;
+
+    @Reference
+    private SystemID systemID;
+
+    public VmClassStatDAOImpl() {
+        this(new JsonHelper(new VmClassStatTypeAdapter()), new ConfigurationCreator());
+    }
+
+    VmClassStatDAOImpl(JsonHelper jsonHelper, ConfigurationCreator creator) {
+        this.jsonHelper = jsonHelper;
+        this.configCreator = creator;
+    }
+
+    @Activate
+    public void activate() throws Exception {
+        config = configCreator.create(configurationInfoSource);
+        this.gatewayURL = config.getGatewayURL();
+    }
+
+    @Override
+    protected String toJsonString(VmClassStat obj) throws IOException {
+        return jsonHelper.toJson(Arrays.asList(obj));
+    }
+
+    @Override
+    protected HttpRequestService getHttpRequestService() {
+        return httpRequestService;
+    }
+
+    @Override
+    protected PluginConfiguration getConfig() {
+        return config;
+    }
+
+    @Override
+    protected URI getPostURI(URI basepath, VmClassStat obj) {
+        return basepath.resolve("systems/" + systemID.getSystemID() + "/jvms/" + obj.getJvmId());
+    }
+
+    @Override
+    protected Logger getLogger() {
+        return logger;
+    }
+
+    public String getPluginId() {
+        return PLUGIN_ID;
+    }
+
+    protected void bindSystemID(final SystemID id) {
+        this.systemID = id;
+    }
+
+    protected void bindConfigurationInfoSource(ConfigurationInfoSource cfg) {
+        this.configurationInfoSource = cfg;
+    }
+
+    protected void bindHttpRequestService(HttpRequestService httpRequestService) {
+        this.httpRequestService = httpRequestService;
+    }
+
+    protected void unbindHttpRequestService(HttpRequestService httpRequestService) {
+        this.httpRequestService = null;
+        logger.log(Level.INFO, "Unbound HTTP service. Further attempts to store data will fail until bound again.");
+    }
+
+    // For testing purposes
+    static class JsonHelper {
+        private final VmClassStatTypeAdapter typeAdapter;
+
+        public JsonHelper(VmClassStatTypeAdapter typeAdapter) {
+            this.typeAdapter = typeAdapter;
+        }
+
+        public String toJson(List<VmClassStat> info) throws IOException {
+            return typeAdapter.toJson(info);
+        }
+    }
+
+    // For Testing purposes
+    static class ConfigurationCreator {
+        PluginConfiguration create(ConfigurationInfoSource source) {
+            return new PluginConfiguration(source, PLUGIN_ID);
+        }
+    }
+}
+
--- a/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractor.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractor.java	Wed Oct 18 15:15:19 2017 -0400
@@ -36,8 +36,8 @@
 
 package com.redhat.thermostat.vm.classstat.agent.internal;
 
-import com.redhat.thermostat.backend.VmUpdate;
-import com.redhat.thermostat.backend.VmUpdateException;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdate;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateException;
 
 /**
  * A helper class to provide type-safe access to commonly used jvmstat monitors
--- a/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java	Wed Oct 18 15:15:19 2017 -0400
@@ -39,12 +39,11 @@
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
-import com.redhat.thermostat.backend.VmUpdate;
-import com.redhat.thermostat.backend.VmUpdateException;
-import com.redhat.thermostat.backend.VmUpdateListener;
 import com.redhat.thermostat.common.utils.LoggingUtils;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdate;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateException;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateListener;
+import com.redhat.thermostat.vm.classstat.model.VmClassStat;
 
 class VmClassStatVmListener implements VmUpdateListener {
     
@@ -78,7 +77,7 @@
                     unloadedClasses, unloadedBytes,
                     classLoadTime);
 
-            dao.putVmClassStat(stat);
+            dao.put(stat);
 
         } catch (VmUpdateException e) {
             logger.log(Level.WARNING, "Error gathering class info for VM " + vmId, e);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/model/VmClassStat.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,142 @@
+/*
+ * Copyright 2012-2017 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.model;
+
+import com.redhat.thermostat.storage.core.Entity;
+import com.redhat.thermostat.storage.model.BasePojo;
+import com.redhat.thermostat.storage.model.TimeStampedPojo;
+
+@Entity
+public class VmClassStat extends BasePojo implements TimeStampedPojo {
+
+    // See the jdk sources for more information:
+    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
+    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options
+
+    public static final int UNKNOWN = -1;
+
+    private String jvmId;
+    private long timestamp;
+    private long loadedClasses;
+    private long loadedBytes;
+    private long unloadedClasses;
+    private long unloadedBytes;
+    private long classLoadTime;
+
+    public VmClassStat() {
+        this(null, null, UNKNOWN,
+                UNKNOWN, UNKNOWN,
+                UNKNOWN, UNKNOWN,
+                UNKNOWN);
+    }
+
+    public VmClassStat(String writerId, String jvmId, long timestamp,
+            long loadedClasses, long loadedBytes,
+            long unloadedClasses, long unloadedBytes,
+            long classLoadTime) {
+        super(writerId);
+        this.jvmId = jvmId;
+        this.timestamp = timestamp;
+        this.loadedClasses = loadedClasses;
+        this.loadedBytes = loadedBytes;
+        this.unloadedClasses = unloadedClasses;
+        this.unloadedBytes = unloadedBytes;
+        this.classLoadTime = classLoadTime;
+    }
+
+    public String getJvmId() {
+        return jvmId;
+    }
+
+    public void setJvmId(String jvmId) {
+        this.jvmId = jvmId;
+    }
+
+    @Override
+    public long getTimeStamp() {
+        return timestamp;
+    }
+
+    public void setTimeStamp(long timestamp) {
+        this.timestamp = timestamp;
+    }
+
+    /** Number of classes loaded */
+    public long getLoadedClasses() {
+        return loadedClasses;
+    }
+
+    public void setLoadedClasses(long loadedClasses) {
+        this.loadedClasses = loadedClasses;
+    }
+
+    /** Accumulated Size of classes loaded */
+    public long getLoadedBytes() {
+        return loadedBytes;
+    }
+
+    public void setLoadedBytes(long bytes) {
+        this.loadedBytes = bytes;
+    }
+
+    /** Number of classes unloaded */
+    public long getUnloadedClasses() {
+        return unloadedClasses;
+    }
+
+    public void setUnloadedClasses(long classes) {
+        this.unloadedClasses = classes;
+    }
+
+    /** Accumulated size of classes unloaded */
+    public long getUnloadedBytes() {
+        return unloadedBytes;
+    }
+
+    public void setUnloadedBytes(long bytes) {
+        this.unloadedBytes = bytes;
+    }
+
+    /** Accumulated time for class loading. In seconds */
+    public long getClassLoadTime() {
+        return classLoadTime;
+    }
+
+    public void setClassLoadTime(long seconds) {
+        this.classLoadTime = seconds;
+    }
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTypeAdapter.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,101 @@
+/*
+ * Copyright 2012-2017 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.model;
+
+import com.google.gson.stream.JsonReader;
+import com.google.gson.stream.JsonWriter;
+
+import com.google.gson.TypeAdapter;
+
+import java.io.IOException;
+import java.util.List;
+
+public class VmClassStatTypeAdapter extends TypeAdapter<List<VmClassStat>> {
+
+    private static final String TYPE_LONG = "$numberLong";
+    private static final String JVM_ID = "jvmId";
+    private static final String AGENT_ID = "agentId";
+    private static final String LOADED_CLASSES = "loadedClasses";
+    private static final String LOADED_BYTES = "loadedBytes";
+    private static final String UNLOADED_CLASSES = "unloadedClasses";
+    private static final String UNLOADED_BYTES = "unloadedBytes";
+    private static final String CLASS_LOAD_TIME = "classLoadTime";
+    private static final String TIMESTAMP = "timeStamp";
+
+    @Override
+    public List<VmClassStat> read(JsonReader in) throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    @Override
+    public void write(JsonWriter out, List<VmClassStat> stats) throws IOException {
+        out.beginArray();
+        for (VmClassStat stat : stats) {
+            write(out, stat);
+        }
+        out.endArray();
+    }
+
+    private void write(JsonWriter out, VmClassStat stat) throws IOException {
+        out.beginObject();
+        out.name(JVM_ID);
+        out.value(stat.getJvmId());
+        out.name(AGENT_ID);
+        out.value(stat.getAgentId());
+        out.name(LOADED_CLASSES);
+        writeLong(out, stat.getLoadedClasses());
+        out.name(LOADED_BYTES);
+        writeLong(out, stat.getLoadedBytes());
+        out.name(UNLOADED_CLASSES);
+        writeLong(out, stat.getUnloadedClasses());
+        out.name(UNLOADED_BYTES);
+        writeLong(out, stat.getUnloadedBytes());
+        out.name(CLASS_LOAD_TIME);
+        writeLong(out, stat.getClassLoadTime());
+        out.name(TIMESTAMP);
+        writeLong(out, stat.getTimeStamp());
+        out.endObject();
+    }
+
+    private void writeLong(JsonWriter out, long timestamp) throws IOException {
+        // Write MongoDB representation of a Long
+        out.beginObject();
+        out.name(TYPE_LONG);
+        out.value(String.valueOf(timestamp));
+        out.endObject();
+    }
+}
--- a/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/ActivatorTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright 2012-2017 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.agent.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-import org.junit.Test;
-import org.osgi.framework.Bundle;
-import org.osgi.framework.Version;
-
-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;
-
-public class ActivatorTest {
-    
-    @Test
-    public void verifyActivatorDoesNotRegisterServiceOnMissingDeps() throws Exception {
-        StubBundleContext context = new StubBundleContext();
-
-        Activator activator = new Activator();
-
-        activator.start(context);
-
-        assertEquals(0, context.getAllServices().size());
-        assertEquals(3, context.getServiceListeners().size());
-
-        activator.stop(context);
-    }
-
-    @Test
-    public void verifyActivatorRegistersServices() throws Exception {
-        StubBundleContext context = new StubBundleContext() {
-            @Override
-            public Bundle getBundle() {
-                Bundle result = mock(Bundle.class);
-                when(result.getVersion()).thenReturn(Version.emptyVersion);
-                return result;
-            }
-        };
-        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();
-
-        activator.start(context);
-
-        assertTrue(context.isServiceRegistered(Backend.class.getName(), VmClassStatBackend.class));
-        VmClassStatBackend backend = activator.getBackend();
-        assertNotNull(backend);
-
-        // something in core thermostat activates the backend; do it manually here
-        backend.activate();
-
-        activator.stop(context);
-        
-        assertFalse(backend.isActive());
-
-        assertEquals(0, context.getServiceListeners().size());
-        assertEquals(3, context.getAllServices().size());
-    }
-
-}
-
--- a/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatBackendTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -36,34 +36,104 @@
 
 package com.redhat.thermostat.vm.classstat.agent.internal;
 
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
-import org.junit.Before;
-import org.junit.Test;
+import com.redhat.thermostat.jvm.overview.agent.VmStatusListenerRegistrar;
 
-import com.redhat.thermostat.agent.VmStatusListenerRegistrar;
-import com.redhat.thermostat.common.Ordered;
-import com.redhat.thermostat.common.Version;
+import org.junit.Test;
+import org.junit.Before;
+
 import com.redhat.thermostat.storage.core.WriterID;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
+import org.osgi.framework.Bundle;
+import org.osgi.framework.BundleContext;
 
 public class VmClassStatBackendTest {
-    
-    private VmClassStatBackend backend;
+
+    private TestVmClassBackend backend;
+    private VmClassStatBackend.ListenerCreator listenerCreator;
 
     @Before
     public void setup() {
-        VmClassStatDAO vmClassStatDao = mock(VmClassStatDAO.class);
-        
-        Version version = mock(Version.class);
-        when(version.getVersionNumber()).thenReturn("0.0.0");
-        
-        VmStatusListenerRegistrar registrar = mock(VmStatusListenerRegistrar.class);
+        listenerCreator = mock(VmClassStatBackend.ListenerCreator.class);
+        backend = new TestVmClassBackend(listenerCreator);
+    }
+
+    @Test
+    public void testComponentActivated() {
+        BundleContext context = mock(BundleContext.class);
+        Bundle bundle = mock(Bundle.class);
+        org.osgi.framework.Version version = new org.osgi.framework.Version(1, 2, 3);
+        when(bundle.getVersion()).thenReturn(version);
+        when(context.getBundle()).thenReturn(bundle);
 
         WriterID id = mock(WriterID.class);
-        backend = new VmClassStatBackend(vmClassStatDao, version, registrar, id);
+        backend.bindWriterId(id);
+        backend.componentActivated(context);
+
+        assertEquals(id, backend.writerId);
+        assertEquals("1.2.3", backend.version);
+        assertNotNull(backend.registrar);
+    }
+
+    @Test
+    public void testComponentDeactivated() {
+        // Begin with backend appearing active for this test
+        backend.active = true;
+
+        assertTrue(backend.isActive());
+        backend.componentDeactivated();
+        assertFalse(backend.isActive());
+    }
+
+    @Test
+    public void testCreateVmListener() {
+        final String writerId = "myAgent";
+        final String jvmId = "mhJVM";
+        final int pid = 1234;
+
+        VmClassStatDAO dao = mock(VmClassStatDAO.class);
+        backend.bindVmClassStatDao(dao);
+        backend.createVmListener(writerId, jvmId, pid);
+
+        verify(listenerCreator).create(writerId, dao, jvmId);
     }
+
+    static class TestVmClassBackend extends VmClassStatBackend {
+        WriterID writerId;
+        VmStatusListenerRegistrar registrar;
+        String version;
+        boolean active;
+
+        TestVmClassBackend(ListenerCreator creator) {
+            super(creator);
+        }
+
+        // Override to capture values
+        @Override
+        protected void initialize(WriterID writerId, VmStatusListenerRegistrar registrar, String version) {
+            this.writerId = writerId;
+            this.registrar = registrar;
+            this.version = version;
+        }
+
+        // Override the following to test backend is deactivated when dependencies are lost
+        @Override
+        public boolean isActive() {
+            return active;
+        }
+
+        @Override
+        public boolean deactivate() {
+            active = false;
+            return true;
+        }
+    }
+
 }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDAOTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,125 @@
+/*
+ * Copyright 2012-2017 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.agent.internal;
+
+
+import static org.mockito.Matchers.anyListOf;
+import static org.mockito.Matchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.Arrays;
+
+
+import com.redhat.thermostat.agent.http.HttpRequestService;
+import com.redhat.thermostat.common.config.experimental.ConfigurationInfoSource;
+import com.redhat.thermostat.common.plugin.PluginConfiguration;
+import com.redhat.thermostat.common.plugin.SystemID;
+import com.redhat.thermostat.vm.classstat.model.VmClassStat;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class VmClassStatDAOTest {
+
+    private static final String VM_ID = "jvmId";
+    private static final Long LOADED_CLASSES = 12345L;
+    private static final Long LOADED_BYTES = 2345L;
+    private static final Long UNLOADED_CLASSES = 3456L;
+    private static final Long UNLOADED_BYTES = 4567L;
+    private static final Long CLASS_LOAD_TIME = 5678L;
+
+    private static final String WRITER_ID = "writerId";
+    private static final long TIMESTAMP = 123455667L;
+    private static final String SOME_SYSTEM_ID = "somesystemid";
+    private static final String AGENT_ID = "some-agent";
+    private static final String JSON = "{\"this\":\"is\",\"also\":\"JSON\"}";
+
+    private static final URI GATEWAY_URI;
+
+    static {
+        GATEWAY_URI = URI.create("http://example.com/jvm-classtat/");
+    }
+
+    private VmClassStat classStat;
+    private VmClassStatDAOImpl.JsonHelper jsonHelper;
+    private VmClassStatDAOImpl dao;
+    private HttpRequestService httpRequestService;
+
+    @Before
+    public void setUp() throws IOException {
+        this.classStat = new VmClassStat(WRITER_ID,
+                VM_ID,
+                TIMESTAMP,
+                LOADED_CLASSES,
+                LOADED_BYTES,
+                UNLOADED_CLASSES,
+                UNLOADED_BYTES,
+                CLASS_LOAD_TIME
+        );
+
+        jsonHelper = mock(VmClassStatDAOImpl.JsonHelper.class);
+        when(jsonHelper.toJson(anyListOf(VmClassStat.class))).thenReturn(JSON);
+
+        ConfigurationInfoSource source = mock(ConfigurationInfoSource.class);
+        PluginConfiguration config = mock(PluginConfiguration.class);
+        when(config.getGatewayURL()).thenReturn(GATEWAY_URI);
+        VmClassStatDAOImpl.ConfigurationCreator creator = mock(VmClassStatDAOImpl.ConfigurationCreator.class);
+        when(creator.create(source)).thenReturn(config);
+
+        httpRequestService = mock(HttpRequestService.class);
+        dao = new VmClassStatDAOImpl(jsonHelper, creator);
+        dao.bindHttpRequestService(httpRequestService);
+        dao.bindConfigurationInfoSource(source);
+    }
+
+    @Test
+    public void verifyPut() throws Exception {
+        SystemID id = mock(SystemID.class);
+        when(id.getSystemID()).thenReturn(SOME_SYSTEM_ID);
+        dao.bindSystemID(id);
+        dao.activate();
+        dao.put(classStat);
+
+        verify(jsonHelper).toJson(eq(Arrays.asList(classStat)));
+        String s = verify(httpRequestService).sendHttpRequest(JSON, GATEWAY_URI.resolve("systems/" + SOME_SYSTEM_ID + "/jvms/" + VM_ID), HttpRequestService.Method.POST);
+    }
+}
+
--- a/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractorTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatDataExtractorTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -41,11 +41,10 @@
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
+import com.redhat.thermostat.jvm.overview.agent.VmUpdate;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateException;
 import org.junit.Test;
 
-import com.redhat.thermostat.backend.VmUpdate;
-import com.redhat.thermostat.backend.VmUpdateException;
-
 public class VmClassStatDataExtractorTest {
 
     @Test
--- a/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -37,23 +37,19 @@
 package com.redhat.thermostat.vm.classstat.agent.internal;
 
 import static org.junit.Assert.assertEquals;
-import static org.mockito.Matchers.any;
 import static org.mockito.Matchers.anyString;
-import static org.mockito.Matchers.eq;
 import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.never;
 import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.verifyNoMoreInteractions;
 import static org.mockito.Mockito.when;
 
+import com.redhat.thermostat.jvm.overview.agent.VmUpdate;
+import com.redhat.thermostat.jvm.overview.agent.VmUpdateException;
 import org.junit.Before;
 import org.junit.Test;
 import org.mockito.ArgumentCaptor;
 
-import com.redhat.thermostat.backend.VmUpdate;
-import com.redhat.thermostat.backend.VmUpdateException;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
+import com.redhat.thermostat.vm.classstat.model.VmClassStat;
 
 public class VmClassStatVmListenerTest {
 
@@ -106,10 +102,10 @@
         listener.countersUpdated(update);
 
         ArgumentCaptor<VmClassStat> arg = ArgumentCaptor.forClass(VmClassStat.class);
-        verify(dao).putVmClassStat(arg.capture());
+        verify(dao).put(arg.capture());
         VmClassStat stat = arg.getValue();
         assertEquals(LOADED_CLASSES, (Long) stat.getLoadedClasses());
-        assertEquals(VM_ID, stat.getVmId());
+        assertEquals(VM_ID, stat.getJvmId());
     }
 
     @Test
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012-2017 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.model;
+
+import com.redhat.thermostat.testutils.DataObjectTest;
+
+public class VmClassStatTest extends DataObjectTest {
+
+    @Override
+    public Class<?>[] getDataClasses() {
+        return new Class[] { VmClassStat.class };
+    }
+}
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/model/VmClassStatTypeAdapterTest.java	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,48 @@
+/*
+ * Copyright 2012-2017 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.model;
+
+import com.google.gson.GsonBuilder;
+import com.google.gson.Gson;
+import org.junit.Test;
+
+
+import static com.redhat.thermostat.testutils.JsonUtils.assertJsonEquals;
+
+public class VmClassStatTypeAdapterTest {
+
+}
--- a/plugins/vm-classstat/common/pom.xml	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,133 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--
-
- Copyright 2012-2017 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.
-
--->
-<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-  <modelVersion>4.0.0</modelVersion>
-  <parent>
-    <artifactId>thermostat-vm-classstat</artifactId>
-    <groupId>com.redhat.thermostat.agent</groupId>
-    <version>2.99.0-SNAPSHOT</version>
-  </parent>
-  <artifactId>thermostat-vm-classstat-common</artifactId>
-  <packaging>bundle</packaging>
-  <name>Thermostat VM ClassStat Common plugin</name>
-  <build>
-    <resources>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>true</filtering>
-        <excludes>
-          <exclude>**/*.png</exclude>
-        </excludes>
-      </resource>
-      <resource>
-        <directory>src/main/resources</directory>
-        <filtering>false</filtering>
-        <includes>
-          <include>**/*.png</include>
-        </includes>
-      </resource>
-    </resources>
-    <plugins>
-      <plugin>
-        <groupId>org.apache.felix</groupId>
-        <artifactId>maven-bundle-plugin</artifactId>
-        <extensions>true</extensions>
-        <configuration>
-          <instructions>
-            <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor>
-            <Bundle-SymbolicName>com.redhat.thermostat.vm.classstat.common</Bundle-SymbolicName>
-            <Bundle-Activator>com.redhat.thermostat.vm.classstat.common.internal.Activator</Bundle-Activator>
-            <Export-Package>
-              com.redhat.thermostat.vm.classstat.common,
-              com.redhat.thermostat.vm.classstat.common.model
-            </Export-Package>
-            <Private-Package>
-              com.redhat.thermostat.vm.classstat.common.internal
-            </Private-Package>
-            <!-- Do not autogenerate uses clauses in Manifests -->
-            <_nouses>true</_nouses>
-          </instructions>
-        </configuration>
-      </plugin>
-    </plugins>
-  </build>
-  <dependencies>
-    <dependency>
-      <groupId>junit</groupId>
-      <artifactId>junit</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.mockito</groupId>
-      <artifactId>mockito-core</artifactId>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.core</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>org.osgi</groupId>
-      <artifactId>org.osgi.compendium</artifactId>
-      <scope>provided</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.redhat.thermostat.agent</groupId>
-      <artifactId>thermostat-common-core</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.redhat.thermostat.agent</groupId>
-      <artifactId>thermostat-storage-core</artifactId>
-      <version>${project.version}</version>
-    </dependency>
-    <dependency>
-      <groupId>com.redhat.thermostat.agent</groupId>
-      <artifactId>thermostat-common-test</artifactId>
-      <version>${project.version}</version>
-      <scope>test</scope>
-    </dependency>
-    <dependency>
-      <groupId>com.google.code.gson</groupId>
-      <artifactId>gson</artifactId>
-      <version>${gson.version}</version>
-    </dependency>
-  </dependencies>
-</project>
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright 2012-2017 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;
-
-import java.util.Arrays;
-import java.util.List;
-
-import com.redhat.thermostat.annotations.Service;
-import com.redhat.thermostat.storage.core.Category;
-import com.redhat.thermostat.storage.core.Key;
-import com.redhat.thermostat.storage.core.VmRef;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
-
-@Service
-public interface VmClassStatDAO {
-
-    static final Key<Long> loadedClassesKey = new Key<>("loadedClasses");
-    static final Key<Long> loadedBytesKey = new Key<>("loadedBytes");
-    static final Key<Long> unloadedClassesKey = new Key<>("unloadedClasses");
-    static final Key<Long> unloadedBytesKey = new Key<>("unloadedBytes");
-    static final Key<Long> classLoadTimeKey = new Key<>("classLoadTime");
-
-    static final Category<VmClassStat> vmClassStatsCategory = new Category<>(
-            "vm-class-stats", VmClassStat.class,
-            Arrays.<Key<?>>asList(
-                    Key.AGENT_ID, Key.VM_ID, Key.TIMESTAMP,
-                    loadedClassesKey, loadedBytesKey,
-                    unloadedClassesKey, unloadedBytesKey,
-                    classLoadTimeKey),
-            Arrays.<Key<?>>asList(Key.TIMESTAMP));
-
-    public List<VmClassStat> getLatestClassStats(VmRef ref, long since);
-
-    public List<VmClassStat> getClassStats(VmRef ref, long since, long to);
-
-    public void putVmClassStat(VmClassStat stat);
-
-    public abstract VmClassStat getOldest(VmRef ref);
-
-    public abstract VmClassStat getNewest(VmRef ref);
-
-}
-
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/Activator.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,80 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import org.osgi.framework.BundleActivator;
-import org.osgi.framework.BundleContext;
-import org.osgi.framework.ServiceReference;
-import org.osgi.framework.ServiceRegistration;
-import org.osgi.util.tracker.ServiceTracker;
-
-import com.redhat.thermostat.storage.core.Storage;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-
-public class Activator implements BundleActivator {
-    
-    private ServiceTracker tracker;
-    private ServiceRegistration reg;
-
-    @Override
-    public void start(BundleContext context) throws Exception {
-        tracker = new ServiceTracker(context, Storage.class.getName(), null) {
-            @Override
-            public Object addingService(ServiceReference reference) {
-                Storage storage = (Storage) context.getService(reference);
-                VmClassStatDAO vmClassStatDao = new VmClassStatDAOImpl(storage);
-                reg = context.registerService(VmClassStatDAO.class.getName(), vmClassStatDao, null);
-                return super.addingService(reference);
-            }
-            
-            @Override
-            public void removedService(ServiceReference reference,
-                    Object service) {
-                reg.unregister();
-                super.removedService(reference, service);
-            }
-        };
-        tracker.open();
-    }
-
-    @Override
-    public void stop(BundleContext context) throws Exception {
-        tracker.close();
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatCategoryRegistration.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.redhat.thermostat.storage.core.auth.CategoryRegistration;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-
-/**
- * Registers the category used by this maven module. The web storage
- * endpoint only allows categories to be registered which it knows of
- * ahead of time.
- *
- */
-public class VmClassStatCategoryRegistration implements CategoryRegistration {
-
-    @Override
-    public Set<String> getCategoryNames() {
-        Set<String> categories = new HashSet<>(1);
-        categories.add(VmClassStatDAO.vmClassStatsCategory.getName());
-        return categories;
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImpl.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,132 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import java.util.List;
-import java.util.logging.Logger;
-
-import com.redhat.thermostat.common.utils.LoggingUtils;
-import com.redhat.thermostat.storage.core.Key;
-import com.redhat.thermostat.storage.core.PreparedStatement;
-import com.redhat.thermostat.storage.core.Storage;
-import com.redhat.thermostat.storage.core.VmBoundaryPojoGetter;
-import com.redhat.thermostat.storage.core.VmLatestPojoListGetter;
-import com.redhat.thermostat.storage.core.VmRef;
-import com.redhat.thermostat.storage.core.VmTimeIntervalPojoListGetter;
-import com.redhat.thermostat.storage.dao.AbstractDao;
-import com.redhat.thermostat.storage.dao.AbstractDaoStatement;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
-
-class VmClassStatDAOImpl extends AbstractDao implements VmClassStatDAO {
-    
-    private static final Logger logger = LoggingUtils.getLogger(VmClassStatDAOImpl.class);
-    // ADD vm-class-stats SET 'agentId' = ?s , \
-    //                        'vmId' = ?s , \
-    //                        'timeStamp' = ?l , \ 
-    //                        'loadedClasses' = ?l , \
-    //                        'loadedBytes' = ?l , \
-    //                        'unloadedClasses' = ?l , \
-    //                        'unloadedBytes' = ?l , \
-    //                        'classLoadTime' = ?l
-    static final String DESC_ADD_VM_CLASS_STAT = "ADD " + vmClassStatsCategory.getName() +
-            " SET '" + Key.AGENT_ID.getName() + "' = ?s , " +
-                 "'" + Key.VM_ID.getName() + "' = ?s , " +
-                 "'" + Key.TIMESTAMP.getName() + "' = ?l , " +
-                 "'" + loadedClassesKey.getName() + "' = ?l , " +
-                 "'" + loadedBytesKey.getName() + "' = ?l , " +
-                 "'" + unloadedClassesKey.getName() + "' = ?l , " +
-                 "'" + unloadedBytesKey.getName() + "' = ?l , " +
-                 "'" + classLoadTimeKey.getName() + "' = ?l";
-
-    private final Storage storage;
-    private final VmLatestPojoListGetter<VmClassStat> latestGetter;
-    private final VmTimeIntervalPojoListGetter<VmClassStat> intervalGetter;
-    private final VmBoundaryPojoGetter<VmClassStat> boundaryGetter;
-
-    VmClassStatDAOImpl(Storage storage) {
-        this.storage = storage;
-        storage.registerCategory(vmClassStatsCategory);
-        this.latestGetter = new VmLatestPojoListGetter<>(storage, vmClassStatsCategory);
-        this.intervalGetter = new VmTimeIntervalPojoListGetter<>(storage, vmClassStatsCategory);
-        this.boundaryGetter = new VmBoundaryPojoGetter<>(storage, vmClassStatsCategory);
-    }
-
-    @Override
-    public List<VmClassStat> getLatestClassStats(VmRef ref, long lastUpdateTime) {
-        return latestGetter.getLatest(ref, lastUpdateTime);
-    }
-
-    @Override
-    public List<VmClassStat> getClassStats(VmRef ref, long since, long to) {
-        return intervalGetter.getLatest(ref, since, to);
-    }
-
-    @Override
-    public void putVmClassStat(final VmClassStat stat) {
-        executeStatement(new AbstractDaoStatement<VmClassStat>(storage, vmClassStatsCategory, DESC_ADD_VM_CLASS_STAT) {
-            @Override
-            public PreparedStatement<VmClassStat> customize(PreparedStatement<VmClassStat> preparedStatement) {
-                preparedStatement.setString(0, stat.getAgentId());
-                preparedStatement.setString(1, stat.getVmId());
-                preparedStatement.setLong(2, stat.getTimeStamp());
-                preparedStatement.setLong(3, stat.getLoadedClasses());
-                preparedStatement.setLong(4, stat.getLoadedBytes());
-                preparedStatement.setLong(5, stat.getUnloadedClasses());
-                preparedStatement.setLong(6, stat.getUnloadedBytes());
-                preparedStatement.setLong(7, stat.getClassLoadTime());
-                return preparedStatement;
-            }
-        });
-    }
-
-    @Override
-    public VmClassStat getOldest(final VmRef ref) {
-        return boundaryGetter.getOldestStat(ref);
-    }
-
-    @Override
-    public VmClassStat getNewest(final VmRef ref) {
-        return boundaryGetter.getNewestStat(ref);
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return logger;
-    }
-}
-
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImplStatementDescriptorRegistration.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,77 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import java.util.HashSet;
-import java.util.Set;
-
-import com.redhat.thermostat.storage.core.VmBoundaryPojoGetter;
-import com.redhat.thermostat.storage.core.VmLatestPojoListGetter;
-import com.redhat.thermostat.storage.core.VmTimeIntervalPojoListGetter;
-import com.redhat.thermostat.storage.core.auth.StatementDescriptorRegistration;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-
-/**
- * Registers the prepared query issued by this maven module via
- * {@link VmLatestPojoListGetter}.
- *
- */
-public class VmClassStatDAOImplStatementDescriptorRegistration implements
-        StatementDescriptorRegistration {
-    
-    static final String LATEST = String.format(VmLatestPojoListGetter.VM_LATEST_QUERY_FORMAT,
-            VmClassStatDAO.vmClassStatsCategory.getName());
-    static final String RANGE = String.format(VmTimeIntervalPojoListGetter.VM_INTERVAL_QUERY_FORMAT,
-            VmClassStatDAO.vmClassStatsCategory.getName());
-    static final String LATEST_STAT = String.format(VmBoundaryPojoGetter.DESC_NEWEST_VM_STAT,
-            VmClassStatDAO.vmClassStatsCategory.getName());
-    static final String OLDEST_STAT = String.format(VmBoundaryPojoGetter.DESC_OLDEST_VM_STAT,
-            VmClassStatDAO.vmClassStatsCategory.getName());
-
-    @Override
-    public Set<String> getStatementDescriptors() {
-        Set<String> descs = new HashSet<>(1);
-        descs.add(LATEST);
-        descs.add(RANGE);
-        descs.add(LATEST_STAT);
-        descs.add(OLDEST_STAT);
-        descs.add(VmClassStatDAOImpl.DESC_ADD_VM_CLASS_STAT);
-        return descs;
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatTypeAdapter.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,93 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import com.google.gson.stream.JsonReader;
-import com.google.gson.stream.JsonWriter;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
-
-import com.google.gson.TypeAdapter;
-
-import java.io.IOException;
-
-public class VmClassStatTypeAdapter extends TypeAdapter<VmClassStat> {
-
-    private static final String TYPE_LONG = "$numberLong";
-    private static final String VM_ID = "vmId";
-    private static final String AGENT_ID = "agentId";
-    private static final String LOADED_CLASSES = "loadedClasses";
-    private static final String LOADED_BYTES = "loadedBytes";
-    private static final String UNLOADED_CLASSES = "unloadedClasses";
-    private static final String UNLOADED_BYTES = "unloadedBytes";
-    private static final String CLASS_LOAD_TIME = "classLoadTime";
-    private static final String TIMESTAMP = "timeStamp";
-
-    @Override
-    public VmClassStat read(JsonReader in) throws IOException {
-        throw new UnsupportedOperationException();
-    }
-
-    @Override
-    public void write(JsonWriter out, VmClassStat stat) throws IOException {
-        out.beginObject();
-        out.name(VM_ID);
-        out.value(stat.getVmId());
-        out.name(AGENT_ID);
-        out.value(stat.getAgentId());
-        out.name(LOADED_CLASSES);
-        writeLong(out, stat.getLoadedClasses());
-        out.name(LOADED_BYTES);
-        writeLong(out, stat.getLoadedBytes());
-        out.name(UNLOADED_CLASSES);
-        writeLong(out, stat.getUnloadedClasses());
-        out.name(UNLOADED_BYTES);
-        writeLong(out, stat.getUnloadedBytes());
-        out.name(CLASS_LOAD_TIME);
-        writeLong(out, stat.getClassLoadTime());
-        out.name(TIMESTAMP);
-        writeLong(out, stat.getTimeStamp());
-        out.endObject();
-    }
-
-    private void writeLong(JsonWriter out, long timestamp) throws IOException {
-        // Write MongoDB representation of a Long
-        out.beginObject();
-        out.name(TYPE_LONG);
-        out.value(String.valueOf(timestamp));
-        out.endObject();
-    }
-}
--- a/plugins/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-/*
- * Copyright 2012-2017 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 com.redhat.thermostat.storage.core.Entity;
-import com.redhat.thermostat.storage.core.Persist;
-import com.redhat.thermostat.storage.model.BasePojo;
-import com.redhat.thermostat.storage.model.TimeStampedPojo;
-
-@Entity
-public class VmClassStat extends BasePojo implements TimeStampedPojo {
-
-    // See the jdk sources for more information:
-    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_options
-    // - jdk/src/share/classes/sun/tools/jstat/resources/jstat_unsupported_options
-
-    public static final int UNKNOWN = -1;
-
-    private String vmId;
-    private long timestamp;
-    private long loadedClasses;
-    private long loadedBytes;
-    private long unloadedClasses;
-    private long unloadedBytes;
-    private long classLoadTime;
-
-    public VmClassStat() {
-        this(null, null, UNKNOWN,
-                UNKNOWN, UNKNOWN,
-                UNKNOWN, UNKNOWN,
-                UNKNOWN);
-    }
-
-    public VmClassStat(String writerId, String vmId, long timestamp,
-            long loadedClasses, long loadedBytes,
-            long unloadedClasses, long unloadedBytes,
-            long classLoadTime) {
-        super(writerId);
-        this.vmId = vmId;
-        this.timestamp = timestamp;
-        this.loadedClasses = loadedClasses;
-        this.loadedBytes = loadedBytes;
-        this.unloadedClasses = unloadedClasses;
-        this.unloadedBytes = unloadedBytes;
-        this.classLoadTime = classLoadTime;
-    }
-
-    @Persist
-    public String getVmId() {
-        return vmId;
-    }
-
-    @Persist
-    public void setVmId(String vmId) {
-        this.vmId = vmId;
-    }
-
-    @Persist
-    @Override
-    public long getTimeStamp() {
-        return timestamp;
-    }
-
-    @Persist
-    public void setTimeStamp(long timestamp) {
-        this.timestamp = timestamp;
-    }
-
-    /** Number of classes loaded */
-    @Persist
-    public long getLoadedClasses() {
-        return loadedClasses;
-    }
-
-    @Persist
-    public void setLoadedClasses(long loadedClasses) {
-        this.loadedClasses = loadedClasses;
-    }
-
-    /** Accumulated Size of classes loaded */
-    @Persist
-    public long getLoadedBytes() {
-        return loadedBytes;
-    }
-
-    @Persist
-    public void setLoadedBytes(long bytes) {
-        this.loadedBytes = bytes;
-    }
-
-    /** Number of classes unloaded */
-    @Persist
-    public long getUnloadedClasses() {
-        return unloadedClasses;
-    }
-
-    @Persist
-    public void setUnloadedClasses(long classes) {
-        this.unloadedClasses = classes;
-    }
-
-    /** Accumulated size of classes unloaded */
-    @Persist
-    public long getUnloadedBytes() {
-        return unloadedBytes;
-    }
-
-    @Persist
-    public void setUnloadedBytes(long bytes) {
-        this.unloadedBytes = bytes;
-    }
-
-    /** Accumulated time for class loading. In seconds */
-    @Persist
-    public long getClassLoadTime() {
-        return classLoadTime;
-    }
-
-    @Persist
-    public void setClassLoadTime(long seconds) {
-        this.classLoadTime = seconds;
-    }
-
-}
--- a/plugins/vm-classstat/common/src/main/resources/META-INF/services/com.redhat.thermostat.storage.core.auth.CategoryRegistration	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.redhat.thermostat.vm.classstat.common.internal.VmClassStatCategoryRegistration
\ No newline at end of file
--- a/plugins/vm-classstat/common/src/main/resources/META-INF/services/com.redhat.thermostat.storage.core.auth.StatementDescriptorRegistration	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,1 +0,0 @@
-com.redhat.thermostat.vm.classstat.common.internal.VmClassStatDAOImplStatementDescriptorRegistration
\ No newline at end of file
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/ActivatorTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,85 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Mockito.mock;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.storage.core.Storage;
-import com.redhat.thermostat.testutils.StubBundleContext;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-
-public class ActivatorTest {
-    
-    @Test
-    public void verifyActivatorDoesNotRegisterServiceOnMissingDeps() throws Exception {
-        StubBundleContext context = new StubBundleContext();
-
-        Activator activator = new Activator();
-
-        activator.start(context);
-
-        assertEquals(0, context.getAllServices().size());
-        assertEquals(1, context.getServiceListeners().size());
-
-        activator.stop(context);
-    }
-
-    @Test
-    public void verifyActivatorRegistersServices() throws Exception {
-        StubBundleContext context = new StubBundleContext();
-        Storage storage = mock(Storage.class);
-
-        context.registerService(Storage.class, storage, null);
-
-        Activator activator = new Activator();
-
-        activator.start(context);
-
-        assertTrue(context.isServiceRegistered(VmClassStatDAO.class.getName(), VmClassStatDAOImpl.class));
-
-        activator.stop(context);
-
-        assertEquals(0, context.getServiceListeners().size());
-        assertEquals(1, context.getAllServices().size());
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatCategoryRegistrationTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,67 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import java.util.Set;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.storage.core.auth.CategoryRegistration;
-import com.redhat.thermostat.testutils.ServiceLoaderTest;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-
-public class VmClassStatCategoryRegistrationTest extends ServiceLoaderTest<CategoryRegistration> {
-
-    public VmClassStatCategoryRegistrationTest() {
-        super(CategoryRegistration.class, STORAGE_SERVICES, VmClassStatCategoryRegistration.class);
-    }
-
-    @Test
-    public void registersAllCategories() {
-        VmClassStatCategoryRegistration reg = new VmClassStatCategoryRegistration();
-        Set<String> categories = reg.getCategoryNames();
-        assertEquals(1, categories.size());
-        assertFalse("null descriptor not allowed", categories.contains(null));
-        assertTrue(categories.contains(VmClassStatDAO.vmClassStatsCategory.getName()));
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImplStatementDescriptorRegistrationTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,64 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-
-import java.util.Set;
-
-import org.junit.Test;
-
-import com.redhat.thermostat.storage.core.auth.StatementDescriptorRegistration;
-import com.redhat.thermostat.testutils.ServiceLoaderTest;
-
-public class VmClassStatDAOImplStatementDescriptorRegistrationTest extends ServiceLoaderTest<StatementDescriptorRegistration> {
-
-    public VmClassStatDAOImplStatementDescriptorRegistrationTest() {
-        super(StatementDescriptorRegistration.class, STORAGE_SERVICES, VmClassStatDAOImplStatementDescriptorRegistration.class);
-    }
-
-    @Test
-    public void registersAllDescriptors() {
-        VmClassStatDAOImplStatementDescriptorRegistration reg = new VmClassStatDAOImplStatementDescriptorRegistration();
-        Set<String> descriptors = reg.getStatementDescriptors();
-        assertEquals(5, descriptors.size());
-        assertFalse("null descriptor not allowed", descriptors.contains(null));
-    }
-
-}
-
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,188 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.verify;
-import static org.mockito.Mockito.verifyNoMoreInteractions;
-import static org.mockito.Mockito.when;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.junit.Test;
-import org.mockito.ArgumentCaptor;
-
-import com.redhat.thermostat.storage.core.Cursor;
-import com.redhat.thermostat.storage.core.DescriptorParsingException;
-import com.redhat.thermostat.storage.core.HostRef;
-import com.redhat.thermostat.storage.core.Key;
-import com.redhat.thermostat.storage.core.PreparedStatement;
-import com.redhat.thermostat.storage.core.StatementDescriptor;
-import com.redhat.thermostat.storage.core.StatementExecutionException;
-import com.redhat.thermostat.storage.core.Storage;
-import com.redhat.thermostat.storage.core.VmRef;
-import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO;
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
-
-public class VmClassStatDAOTest {
-
-    private static final Long TIMESTAMP = 1234L;
-    private static final String VM_ID = "vmId";
-    private static final Long LOADED_CLASSES = 12345L;
-    private static final Long LOADED_BYTES = 2345L;
-    private static final Long UNLOADED_CLASSES = 3456L;
-    private static final Long UNLOADED_BYTES = 4567L;
-    private static final Long CLASS_LOAD_TIME = 5678L;
-
-    @Test
-    public void testStatementDescriptorsAreSane() {
-        String addVmClassStat = "ADD vm-class-stats SET 'agentId' = ?s , " +
-                                                "'vmId' = ?s , " +
-                                                "'timeStamp' = ?l , " +
-                                                "'loadedClasses' = ?l , " +
-                                                "'loadedBytes' = ?l , " +
-                                                "'unloadedClasses' = ?l , " +
-                                                "'unloadedBytes' = ?l , " +
-                                                "'classLoadTime' = ?l";
-
-        assertEquals(addVmClassStat, VmClassStatDAOImpl.DESC_ADD_VM_CLASS_STAT);
-    }
-    
-    @Test
-    public void testCategory() {
-        assertEquals("vm-class-stats", VmClassStatDAO.vmClassStatsCategory.getName());
-        Collection<Key<?>> keys = VmClassStatDAO.vmClassStatsCategory.getKeys();
-        assertTrue(keys.contains(new Key<>("agentId")));
-        assertTrue(keys.contains(new Key<Integer>("vmId")));
-        assertTrue(keys.contains(new Key<Long>("timeStamp")));
-        assertTrue(keys.contains(new Key<Long>("loadedClasses")));
-        assertTrue(keys.contains(new Key<Long>("loadedBytes")));
-        assertTrue(keys.contains(new Key<Long>("unloadedClasses")));
-        assertTrue(keys.contains(new Key<Long>("unloadedBytes")));
-        assertTrue(keys.contains(new Key<Long>("classLoadTime")));
-        assertEquals(8, keys.size());
-    }
-
-    @Test
-    public void testGetLatestClassStatsBasic() throws DescriptorParsingException, StatementExecutionException {
-
-        VmClassStat vmClassStat = getClassStat();
-
-        @SuppressWarnings("unchecked")
-        Cursor<VmClassStat> cursor = mock(Cursor.class);
-        when(cursor.hasNext()).thenReturn(true).thenReturn(false);
-        when(cursor.next()).thenReturn(vmClassStat);
-
-        Storage storage = mock(Storage.class);
-        @SuppressWarnings("unchecked")
-        PreparedStatement<VmClassStat> stmt = (PreparedStatement<VmClassStat>) mock(PreparedStatement.class);
-        when(storage.prepareStatement(anyDescriptor())).thenReturn(stmt);
-        when(stmt.executeQuery()).thenReturn(cursor);
-
-        HostRef hostRef = mock(HostRef.class);
-        when(hostRef.getAgentId()).thenReturn("system");
-
-        VmRef vmRef = mock(VmRef.class);
-        when(vmRef.getHostRef()).thenReturn(hostRef);
-        when(vmRef.getVmId()).thenReturn(VM_ID);
-
-        VmClassStatDAO dao = new VmClassStatDAOImpl(storage);
-        List<VmClassStat> vmClassStats = dao.getLatestClassStats(vmRef, Long.MIN_VALUE);
-
-        verify(storage).prepareStatement(anyDescriptor());
-        verify(stmt).setString(0, "system");
-        verify(stmt).setString(1, VM_ID);
-        verify(stmt).setLong(2, Long.MIN_VALUE);
-        verify(stmt).executeQuery();
-        verifyNoMoreInteractions(stmt);
-
-        assertEquals(1, vmClassStats.size());
-        VmClassStat stat = vmClassStats.get(0);
-        assertEquals(TIMESTAMP, (Long) stat.getTimeStamp());
-        assertEquals(LOADED_CLASSES, (Long) stat.getLoadedClasses());
-        assertEquals(VM_ID, stat.getVmId());
-    }
-
-    @SuppressWarnings("unchecked")
-    private StatementDescriptor<VmClassStat> anyDescriptor() {
-        return (StatementDescriptor<VmClassStat>) any(StatementDescriptor.class);
-    }
-
-    private VmClassStat getClassStat() {
-        return new VmClassStat("foo-agent", VM_ID, TIMESTAMP,
-                LOADED_CLASSES, LOADED_BYTES,
-                UNLOADED_CLASSES, UNLOADED_BYTES,
-                CLASS_LOAD_TIME);
-    }
-
-    @SuppressWarnings("unchecked")
-    @Test
-    public void testPutVmClassStat() throws DescriptorParsingException, StatementExecutionException {
-
-        Storage storage = mock(Storage.class);
-        PreparedStatement<VmClassStat> add = mock(PreparedStatement.class);
-        when(storage.prepareStatement(any(StatementDescriptor.class))).thenReturn(add);
-
-        VmClassStat stat = new VmClassStat("foo-agent", VM_ID, TIMESTAMP,
-                LOADED_CLASSES, LOADED_BYTES, UNLOADED_CLASSES, UNLOADED_BYTES, CLASS_LOAD_TIME);
-        VmClassStatDAO dao = new VmClassStatDAOImpl(storage);
-        dao.putVmClassStat(stat);
-        
-        @SuppressWarnings("rawtypes")
-        ArgumentCaptor<StatementDescriptor> captor = ArgumentCaptor.forClass(StatementDescriptor.class);
-        
-        verify(storage).prepareStatement(captor.capture());
-        StatementDescriptor<?> desc = captor.getValue();
-        assertEquals(VmClassStatDAOImpl.DESC_ADD_VM_CLASS_STAT, desc.getDescriptor());
-
-        verify(add).setString(0, stat.getAgentId());
-        verify(add).setString(1, stat.getVmId());
-        verify(add).setLong(2, stat.getTimeStamp());
-        verify(add).setLong(3, stat.getLoadedClasses());
-        verify(add).setLong(4, stat.getLoadedBytes());
-        verify(add).setLong(5, stat.getUnloadedClasses());
-        verify(add).setLong(6, stat.getUnloadedBytes());
-        verify(add).setLong(7, stat.getClassLoadTime());
-        verify(add).execute();
-        verifyNoMoreInteractions(add);
-    }
-}
-
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatTypeAdapterTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,65 +0,0 @@
-/*
- * Copyright 2012-2017 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.internal;
-
-import com.google.gson.GsonBuilder;
-import com.google.gson.Gson;
-import org.junit.Test;
-
-import com.redhat.thermostat.vm.classstat.common.model.VmClassStat;
-
-import static com.redhat.thermostat.testutils.JsonUtils.assertJsonEquals;
-
-public class VmClassStatTypeAdapterTest {
-
-    @Test
-    public void testRead() {
-        GsonBuilder builder = new GsonBuilder();
-        builder.registerTypeAdapter(VmClassStat.class, new VmClassStatTypeAdapter());
-        Gson gson = builder.create();
-        VmClassStat stat = new VmClassStat();
-        stat.setVmId("1");
-        stat.setAgentId("2");
-        stat.setTimeStamp(100l);
-        stat.setClassLoadTime(2000l);
-        stat.setLoadedBytes(10l);
-        stat.setLoadedClasses(1l);
-        stat.setUnloadedBytes(10l);
-        stat.setUnloadedClasses(1l);
-        assertJsonEquals("{\"vmId\":\"1\",\"agentId\":\"2\",\"loadedClasses\":{\"$numberLong\":\"1\"},\"loadedBytes\":{\"$numberLong\":\"10\"},\"unloadedClasses\":{\"$numberLong\":\"1\"},\"unloadedBytes\":{\"$numberLong\":\"10\"},\"classLoadTime\":{\"$numberLong\":\"2000\"},\"timeStamp\":{\"$numberLong\":\"100\"}}", gson.toJson(stat));
-    }
-}
--- a/plugins/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStatTest.java	Tue Oct 10 12:29:18 2017 -0400
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-/*
- * Copyright 2012-2017 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 com.redhat.thermostat.testutils.DataObjectTest;
-
-public class VmClassStatTest extends DataObjectTest {
-
-    @Override
-    public Class<?>[] getDataClasses() {
-        return new Class[] { VmClassStat.class };
-    }
-}
-
--- a/plugins/vm-classstat/distribution/assemblies/plugin-assembly.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/distribution/assemblies/plugin-assembly.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -37,32 +37,38 @@
 
 -->
 <assembly xmlns="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
+          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+          xsi:schemaLocation="http://maven.apache.org/plugins/maven-assembly-plugin/assembly/1.1.2 http://maven.apache.org/xsd/assembly-1.1.2.xsd">
   <id>plugin-assembly</id>
   <formats>
     <format>zip</format>
   </formats>
-  <baseDirectory>${thermostat.plugin}</baseDirectory>
-  <includeBaseDirectory>true</includeBaseDirectory>
+  <includeBaseDirectory>false</includeBaseDirectory>
   
   <dependencySets>
     <dependencySet>
       <includes>
-        <include>com.redhat.thermostat.agent:thermostat-vm-classstat-common</include>
         <include>com.redhat.thermostat.agent:thermostat-vm-classstat-agent</include>
       </includes>
       <useProjectArtifact>false</useProjectArtifact>
       <useStrictFiltering>true</useStrictFiltering>
+      <outputDirectory>plugins/${thermostat.plugin}</outputDirectory>
     </dependencySet>
   </dependencySets>
-  
-  <files>
-    <file>
-      <source>thermostat-plugin.xml</source>
-      <outputDirectory>/</outputDirectory>
+
+  <fileSets>
+    <fileSet>
+      <includes>
+        <include>thermostat-plugin.xml</include>
+      </includes>
+      <outputDirectory>plugins/${thermostat.plugin}</outputDirectory>
       <filtered>true</filtered>
-    </file>
-  </files>
+    </fileSet>
+    <fileSet>
+      <directory>configFiles</directory>
+      <outputDirectory>etc/plugins.d/${thermostat.plugin}</outputDirectory>
+      <filtered>true</filtered>
+    </fileSet>
+  </fileSets>
 </assembly>
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/vm-classstat/distribution/configFiles/gateway.properties	Wed Oct 18 15:15:19 2017 -0400
@@ -0,0 +1,2 @@
+# URL to the microservice provided by the Thermostat web gateway
+gatewayURL=https://localhost:30000/jvm-classstat/0.0.1
\ No newline at end of file
--- a/plugins/vm-classstat/distribution/thermostat-plugin.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/distribution/thermostat-plugin.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -43,7 +43,6 @@
     <extension>
       <name>agent</name>
       <bundles>
-        <bundle><symbolic-name>com.redhat.thermostat.vm.classstat.common</symbolic-name><version>${project.version}</version></bundle>
         <bundle><symbolic-name>com.redhat.thermostat.vm.classstat.agent</symbolic-name><version>${project.version}</version></bundle>
       </bundles>
     </extension>
--- a/plugins/vm-classstat/pom.xml	Tue Oct 10 12:29:18 2017 -0400
+++ b/plugins/vm-classstat/pom.xml	Wed Oct 18 15:15:19 2017 -0400
@@ -52,7 +52,6 @@
 
   <modules>
     <module>agent</module>
-    <module>common</module>
     <module>distribution</module>
   </modules>