Mercurial > hg > release > thermostat-0.7
changeset 946:e765c145d124
Move Pojos to respective plugins
This commit moves plugin-related pojos out of storage-core and into their
associated plugin's common bundle under a new model package. As far as I
can tell this is the final remaining plugin code to be moved.
Reviewed-by: vanaltj, rkennke, neugens
Review-thread: http://icedtea.classpath.org/pipermail/thermostat/2013-January/005167.html
line wrap: on
line diff
--- a/client/cli/src/test/java/com/redhat/thermostat/client/cli/internal/VmStatCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/client/cli/src/test/java/com/redhat/thermostat/client/cli/internal/VmStatCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -68,17 +68,12 @@ import com.redhat.thermostat.common.Timer; import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; -import com.redhat.thermostat.storage.model.TimeStampedPojo; -import com.redhat.thermostat.testutils.StubBundleContext; -import com.redhat.thermostat.common.utils.OSGIUtils; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmCpuStat; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; +import com.redhat.thermostat.storage.model.TimeStampedPojo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.test.TestTimerFactory; +import com.redhat.thermostat.testutils.StubBundleContext; public class VmStatCommandTest { private static Locale defaultLocale;
--- a/distribution/config/commands/webservice.properties Thu Jan 31 10:56:26 2013 +0100 +++ b/distribution/config/commands/webservice.properties Thu Jan 31 14:35:34 2013 -0500 @@ -4,6 +4,13 @@ thermostat-web-server-@project.version@.jar, \ thermostat-web-common-@project.version@.jar, \ thermostat-storage-mongodb-${project.version}.jar, \ + thermostat-host-cpu-common-${project.version}.jar, \ + thermostat-host-memory-common-${project.version}.jar, \ + thermostat-vm-cpu-common-${project.version}.jar, \ + thermostat-vm-memory-common-${project.version}.jar, \ + thermostat-vm-gc-common-${project.version}.jar, \ + thermostat-vm-classstat-common-${project.version}.jar, \ + thermostat-vm-heap-analysis-common-${project.version}.jar, \ thermostat-thread-collector-@project.version@.jar, \ thermostat-numa-common-@project.version@.jar, \ mongo.jar, \
--- a/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatBuilder.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/agent/src/main/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatBuilder.java Thu Jan 31 14:35:34 2013 -0500 @@ -43,7 +43,7 @@ import com.redhat.thermostat.common.Clock; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.CpuStat; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.utils.ProcDataSource; public class CpuStatBuilder {
--- a/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatBuilderTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/CpuStatBuilderTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -51,7 +51,7 @@ import com.redhat.thermostat.common.Clock; import com.redhat.thermostat.common.SystemClock; -import com.redhat.thermostat.storage.model.CpuStat; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.utils.ProcDataSource; public class CpuStatBuilderTest {
--- a/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/HostCpuBackendTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/agent/src/test/java/com/redhat/thermostat/host/cpu/agent/internal/HostCpuBackendTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -53,7 +53,7 @@ import com.redhat.thermostat.common.Version; import com.redhat.thermostat.host.cpu.common.CpuStatDAO; -import com.redhat.thermostat.storage.model.CpuStat; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; public class HostCpuBackendTest {
--- a/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/client-core/src/main/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuController.java Thu Jan 31 14:35:34 2013 -0500 @@ -54,9 +54,9 @@ import com.redhat.thermostat.host.cpu.client.core.HostCpuViewProvider; import com.redhat.thermostat.host.cpu.client.locale.LocaleResources; import com.redhat.thermostat.host.cpu.common.CpuStatDAO; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; -import com.redhat.thermostat.storage.model.CpuStat; import com.redhat.thermostat.storage.model.DiscreteTimeData; import com.redhat.thermostat.storage.model.HostInfo;
--- a/host-cpu/client-core/src/test/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/client-core/src/test/java/com/redhat/thermostat/host/cpu/client/core/internal/HostCpuControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -66,9 +66,9 @@ import com.redhat.thermostat.host.cpu.client.core.HostCpuViewProvider; import com.redhat.thermostat.host.cpu.client.core.internal.HostCpuController; import com.redhat.thermostat.host.cpu.common.CpuStatDAO; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; -import com.redhat.thermostat.storage.model.CpuStat; import com.redhat.thermostat.storage.model.DiscreteTimeData; import com.redhat.thermostat.storage.model.HostInfo;
--- a/host-cpu/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <Bundle-SymbolicName>com.redhat.thermostat.host.cpu.common</Bundle-SymbolicName> <Bundle-Activator>com.redhat.thermostat.host.cpu.common.internal.Activator</Bundle-Activator> <Export-Package> - com.redhat.thermostat.host.cpu.common + com.redhat.thermostat.host.cpu.common, + com.redhat.thermostat.host.cpu.common.model </Export-Package> <Private-Package> com.redhat.thermostat.host.cpu.common.internal
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/CpuStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -39,11 +39,11 @@ import java.util.List; import com.redhat.thermostat.annotations.Service; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.storage.core.Countable; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.Category; import com.redhat.thermostat.storage.core.Key; -import com.redhat.thermostat.storage.model.CpuStat; @Service public interface CpuStatDAO extends Countable {
--- a/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -41,9 +41,9 @@ import com.redhat.thermostat.storage.core.HostLatestPojoListGetter; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.host.cpu.common.CpuStatDAO; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.storage.core.Put; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.CpuStat; class CpuStatDAOImpl implements CpuStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/host-cpu/common/src/main/java/com/redhat/thermostat/host/cpu/common/model/CpuStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,82 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.host.cpu.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 CpuStat extends BasePojo implements TimeStampedPojo { + + public static final double INVALID_LOAD = Double.MIN_VALUE; + + private long timeStamp; + private double[] perProcessorUsage; + + public CpuStat() { + this(-1, null); + } + + public CpuStat(long timestamp, double[] perProcessorUsage) { + this.timeStamp = timestamp; + this.perProcessorUsage = perProcessorUsage; + } + + @Persist + public double[] getPerProcessorUsage() { + return perProcessorUsage; + } + + @Persist + public void setPerProcessorUsage(double[] perProcessorUsage) { + this.perProcessorUsage = perProcessorUsage; + } + + @Persist + @Override + public long getTimeStamp() { + return timeStamp; + } + + @Persist + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } +} +
--- a/host-cpu/common/src/test/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-cpu/common/src/test/java/com/redhat/thermostat/host/cpu/common/internal/CpuStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -55,6 +55,7 @@ import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.host.cpu.common.CpuStatDAO; +import com.redhat.thermostat.host.cpu.common.model.CpuStat; import com.redhat.thermostat.storage.core.Add; import com.redhat.thermostat.storage.core.Category; import com.redhat.thermostat.storage.core.Cursor; @@ -62,7 +63,6 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.CpuStat; public class CpuStatDAOTest {
--- a/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilder.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/agent/src/main/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilder.java Thu Jan 31 14:35:34 2013 -0500 @@ -44,7 +44,7 @@ import com.redhat.thermostat.common.NotImplementedException; import com.redhat.thermostat.common.Size; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.MemoryStat; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.utils.ProcDataSource; /**
--- a/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/HostMemoryBackendTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/HostMemoryBackendTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -52,7 +52,7 @@ import com.redhat.thermostat.common.Version; import com.redhat.thermostat.host.memory.common.MemoryStatDAO; -import com.redhat.thermostat.storage.model.MemoryStat; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; public class HostMemoryBackendTest {
--- a/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilderTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/agent/src/test/java/com/redhat/thermostat/host/memory/agent/internal/MemoryStatBuilderTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -48,7 +48,7 @@ import org.junit.Test; -import com.redhat.thermostat.storage.model.MemoryStat; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.utils.ProcDataSource; public class MemoryStatBuilderTest {
--- a/host-memory/client-core/src/main/java/com/redhat/thermostat/host/memory/client/core/internal/HostMemoryController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/client-core/src/main/java/com/redhat/thermostat/host/memory/client/core/internal/HostMemoryController.java Thu Jan 31 14:35:34 2013 -0500 @@ -56,11 +56,11 @@ import com.redhat.thermostat.host.memory.client.core.HostMemoryView.GraphVisibilityChangeListener; import com.redhat.thermostat.host.memory.client.locale.LocaleResources; import com.redhat.thermostat.host.memory.common.MemoryStatDAO; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; +import com.redhat.thermostat.host.memory.common.model.MemoryType; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; import com.redhat.thermostat.storage.model.DiscreteTimeData; -import com.redhat.thermostat.storage.model.MemoryStat; -import com.redhat.thermostat.storage.model.MemoryType; public class HostMemoryController implements InformationServiceController<HostRef> {
--- a/host-memory/client-core/src/test/java/com/redhat/thermostat/host/memory/client/core/internal/HostMemoryControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/client-core/src/test/java/com/redhat/thermostat/host/memory/client/core/internal/HostMemoryControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -60,10 +60,10 @@ import com.redhat.thermostat.host.memory.client.core.HostMemoryViewProvider; import com.redhat.thermostat.host.memory.client.core.internal.HostMemoryController; import com.redhat.thermostat.host.memory.common.MemoryStatDAO; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; import com.redhat.thermostat.storage.model.HostInfo; -import com.redhat.thermostat.storage.model.MemoryStat; public class HostMemoryControllerTest {
--- a/host-memory/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <Bundle-SymbolicName>com.redhat.thermostat.host.memory.common</Bundle-SymbolicName> <Bundle-Activator>com.redhat.thermostat.host.memory.common.internal.Activator</Bundle-Activator> <Export-Package> - com.redhat.thermostat.host.memory.common + com.redhat.thermostat.host.memory.common, + com.redhat.thermostat.host.memory.common.model </Export-Package> <Private-Package> com.redhat.thermostat.host.memory.common.internal
--- a/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/MemoryStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/MemoryStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -39,11 +39,11 @@ import java.util.List; import com.redhat.thermostat.annotations.Service; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.storage.core.Countable; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.Category; import com.redhat.thermostat.storage.core.Key; -import com.redhat.thermostat.storage.model.MemoryStat; @Service public interface MemoryStatDAO extends Countable {
--- a/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/internal/MemoryStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/internal/MemoryStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -41,9 +41,9 @@ import com.redhat.thermostat.storage.core.HostLatestPojoListGetter; import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.host.memory.common.MemoryStatDAO; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.storage.core.Put; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.MemoryStat; public class MemoryStatDAOImpl implements MemoryStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/model/MemoryStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,153 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.host.memory.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 MemoryStat extends BasePojo implements TimeStampedPojo { + + private long timeStamp; + private long total; + private long free; + private long buffers; + private long cached; + private long swapTotal; + private long swapFree; + private long commitLimit; + + public MemoryStat() { + super(); + } + + public MemoryStat(long timeStamp, long total, long free, long buffers, long cached, long swapTotal, long swapFree, long commitLimit) { + this.timeStamp = timeStamp; + this.total = total; + this.free = free; + this.buffers = buffers; + this.cached = cached; + this.swapTotal = swapTotal; + this.swapFree = swapFree; + this.commitLimit = commitLimit; + } + + @Override + @Persist + public long getTimeStamp() { + return timeStamp; + } + + @Persist + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } + + @Persist + public long getTotal() { + return total; + } + + @Persist + public void setTotal(long total) { + this.total = total; + } + + @Persist + public long getFree() { + return free; + } + + @Persist + public void setFree(long free) { + this.free = free; + } + + @Persist + public long getBuffers() { + return buffers; + } + + @Persist + public void setBuffers(long buffers) { + this.buffers = buffers; + } + + @Persist + public long getCached() { + return cached; + } + + @Persist + public void setCached(long cached) { + this.cached = cached; + } + + @Persist + public long getSwapTotal() { + return swapTotal; + } + + @Persist + public void setSwapTotal(long swapTotal) { + this.swapTotal = swapTotal; + } + + @Persist + public long getSwapFree() { + return swapFree; + } + + @Persist + public void setSwapFree(long swapFree) { + this.swapFree = swapFree; + } + + @Persist + public long getCommitLimit() { + return commitLimit; + } + + @Persist + public void setCommitLimit(long commitLimit) { + this.commitLimit = commitLimit; + } + +} +
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/host-memory/common/src/main/java/com/redhat/thermostat/host/memory/common/model/MemoryType.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,47 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.host.memory.common.model; + +public enum MemoryType { + MEMORY_TOTAL, + MEMORY_FREE, + MEMORY_USED, + SWAP_TOTAL, + SWAP_FREE, + BUFFERS; +} +
--- a/host-memory/common/src/test/java/com/redhat/thermostat/host/memory/common/internal/MemoryStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/host-memory/common/src/test/java/com/redhat/thermostat/host/memory/common/internal/MemoryStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -51,6 +51,7 @@ import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.host.memory.common.MemoryStatDAO; +import com.redhat.thermostat.host.memory.common.model.MemoryStat; import com.redhat.thermostat.storage.core.Add; import com.redhat.thermostat.storage.core.Category; import com.redhat.thermostat.storage.core.Cursor; @@ -58,7 +59,6 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.MemoryStat; public class MemoryStatDAOTest {
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/CpuStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class CpuStat extends BasePojo implements TimeStampedPojo { - - public static final double INVALID_LOAD = Double.MIN_VALUE; - - private long timeStamp; - private double[] perProcessorUsage; - - public CpuStat() { - this(-1, null); - } - - public CpuStat(long timestamp, double[] perProcessorUsage) { - this.timeStamp = timestamp; - this.perProcessorUsage = perProcessorUsage; - } - - @Persist - public double[] getPerProcessorUsage() { - return perProcessorUsage; - } - - @Persist - public void setPerProcessorUsage(double[] perProcessorUsage) { - this.perProcessorUsage = perProcessorUsage; - } - - @Persist - @Override - public long getTimeStamp() { - return timeStamp; - } - - @Persist - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/HeapInfo.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,128 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import java.util.Objects; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class HeapInfo extends BasePojo implements TimeStampedPojo { - - private int vmId; - private long timeStamp; - - private String heapId; - private String heapDumpId; - private String histogramId; - - public HeapInfo() { - this(-1, -1); - } - - public HeapInfo(int vmId, long timestamp) { - this.vmId = vmId; - this.timeStamp = timestamp; - } - - @Persist - public void setVmId(int vmId) { - this.vmId = vmId; - } - - @Persist - public int getVmId() { - return vmId; - } - - @Persist - public long getTimeStamp() { - return timeStamp; - } - - @Persist - public void setTimeStamp(long timestamp) { - this.timeStamp = timestamp; - } - - @Persist - public void setHeapId(String heapId) { - this.heapId = heapId; - } - - @Persist - public String getHeapId() { - return heapId; - } - - @Persist - public void setHeapDumpId(String heapDumpId) { - this.heapDumpId = heapDumpId; - } - - @Persist - public String getHeapDumpId() { - return heapDumpId; - } - - @Override - public boolean equals(Object o) { - if (! (o instanceof HeapInfo)) { - return false; - } - HeapInfo other = (HeapInfo) o; - return vmId == other.vmId && Objects.equals(heapDumpId, other.heapDumpId) - && Objects.equals(histogramId, other.histogramId) && timeStamp == other.timeStamp; - } - - @Override - public int hashCode() { - return Objects.hash(vmId, heapDumpId, histogramId, timeStamp); - } - - @Persist - public String getHistogramId() { - return histogramId; - } - - @Persist - public void setHistogramId(String histogramId) { - this.histogramId = histogramId; - } -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/MemoryStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,151 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class MemoryStat extends BasePojo implements TimeStampedPojo { - - private long timeStamp; - private long total; - private long free; - private long buffers; - private long cached; - private long swapTotal; - private long swapFree; - private long commitLimit; - - public MemoryStat() { - super(); - } - - public MemoryStat(long timeStamp, long total, long free, long buffers, long cached, long swapTotal, long swapFree, long commitLimit) { - this.timeStamp = timeStamp; - this.total = total; - this.free = free; - this.buffers = buffers; - this.cached = cached; - this.swapTotal = swapTotal; - this.swapFree = swapFree; - this.commitLimit = commitLimit; - } - - @Override - @Persist - public long getTimeStamp() { - return timeStamp; - } - - @Persist - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } - - @Persist - public long getTotal() { - return total; - } - - @Persist - public void setTotal(long total) { - this.total = total; - } - - @Persist - public long getFree() { - return free; - } - - @Persist - public void setFree(long free) { - this.free = free; - } - - @Persist - public long getBuffers() { - return buffers; - } - - @Persist - public void setBuffers(long buffers) { - this.buffers = buffers; - } - - @Persist - public long getCached() { - return cached; - } - - @Persist - public void setCached(long cached) { - this.cached = cached; - } - - @Persist - public long getSwapTotal() { - return swapTotal; - } - - @Persist - public void setSwapTotal(long swapTotal) { - this.swapTotal = swapTotal; - } - - @Persist - public long getSwapFree() { - return swapFree; - } - - @Persist - public void setSwapFree(long swapFree) { - this.swapFree = swapFree; - } - - @Persist - public long getCommitLimit() { - return commitLimit; - } - - @Persist - public void setCommitLimit(long commitLimit) { - this.commitLimit = commitLimit; - } - -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/MemoryType.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,47 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -public enum MemoryType { - MEMORY_TOTAL, - MEMORY_FREE, - MEMORY_USED, - SWAP_TOTAL, - SWAP_FREE, - BUFFERS; -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/VmClassStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,90 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class VmClassStat extends BasePojo implements TimeStampedPojo { - - private int vmId; - private long timestamp; - private long loadedClasses; - - public VmClassStat() { - this(-1, -1, -1); - } - - public VmClassStat(int vmId, long timestamp, long loadedClasses) { - this.vmId = vmId; - this.timestamp = timestamp; - this.loadedClasses = loadedClasses; - } - - @Persist - public int getVmId() { - return vmId; - } - - @Persist - public void setVmId(int vmId) { - this.vmId = vmId; - } - - @Persist - @Override - public long getTimeStamp() { - return timestamp; - } - - @Persist - public void setTimeStamp(long timestamp) { - this.timestamp = timestamp; - } - - @Persist - public long getLoadedClasses() { - return loadedClasses; - } - - @Persist - public void setLoadedClasses(long loadedClasses) { - this.loadedClasses = loadedClasses; - } -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/VmCpuStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class VmCpuStat extends BasePojo implements TimeStampedPojo { - - private long timeStamp; - private int vmId; - private double cpuLoad; - - public VmCpuStat() { - super(); - } - - public VmCpuStat(long timeStamp, int vmId, double cpuLoad) { - this.timeStamp = timeStamp; - this.vmId = vmId; - this.cpuLoad = cpuLoad; - } - - @Override - @Persist - public long getTimeStamp() { - return timeStamp; - } - - @Persist - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } - - @Persist - public int getVmId() { - return vmId; - } - - @Persist - public void setVmId(int vmId) { - this.vmId = vmId; - } - - /** - * The cpu load in percent (as in 100.0 for 100%). This value should be - * normalized to be in the range [0, 100] - */ - @Persist - public double getCpuLoad() { - return cpuLoad; - } - - @Persist - public void setCpuLoad(double cpuLoad) { - this.cpuLoad = cpuLoad; - } - -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/VmGcStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,115 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class VmGcStat extends BasePojo implements TimeStampedPojo { - - private long timeStamp; - private int vmId; - private String collectorName; - private long runCount; - private long wallTime; - - public VmGcStat() { - super(); - } - - public VmGcStat(int vmId, long timestamp, String collectorName, long runCount, long wallTime) { - this.timeStamp = timestamp; - this.vmId = vmId; - this.collectorName = collectorName; - this.runCount = runCount; - this.wallTime = wallTime; - } - - @Persist - public int getVmId() { - return vmId; - } - - @Persist - public void setVmId(int vmId) { - this.vmId = vmId; - } - - @Persist - public String getCollectorName() { - return collectorName; - } - - @Persist - public void setCollectorName(String collectorName) { - this.collectorName = collectorName; - } - - @Persist - public long getRunCount() { - return runCount; - } - - @Persist - public void setRunCount(long runCount) { - this.runCount = runCount; - } - - @Persist - public long getWallTime() { - return wallTime; - } - - @Persist - public void setWallTime(long wallTime) { - this.wallTime = wallTime; - } - - @Override - @Persist - public long getTimeStamp() { - return timeStamp; - } - - @Persist - public void setTimeStamp(long timeStamp) { - this.timeStamp = timeStamp; - } - -} -
--- a/storage/core/src/main/java/com/redhat/thermostat/storage/model/VmMemoryStat.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,232 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import com.redhat.thermostat.storage.core.Entity; -import com.redhat.thermostat.storage.core.Persist; - -@Entity -public class VmMemoryStat extends BasePojo implements TimeStampedPojo { - - @Entity - public static class Generation implements Pojo { - public static final String COLLECTOR_NONE = "none"; - private String name; - private long capacity; - private long maxCapacity; - private Space[] spaces; - private String collector; - - @Persist - public String getName() { - return name; - } - - @Persist - public void setName(String name) { - this.name = name; - } - - @Persist - public long getCapacity() { - return capacity; - } - - @Persist - public void setCapacity(long capacity) { - this.capacity = capacity; - } - - @Persist - public long getMaxCapacity() { - return maxCapacity; - } - - @Persist - public void setMaxCapacity(long maxCapacity) { - this.maxCapacity = maxCapacity; - } - - @Persist - public Space[] getSpaces() { - return spaces; - } - - @Persist - public void setSpaces(Space[] spaces) { - this.spaces = spaces; - } - - @Persist - public String getCollector() { - return collector; - } - - @Persist - public void setCollector(String collector) { - this.collector = collector; - } - - public Space getSpace(String string) { - for (Space s : spaces) { - if (s.name.equals(string)) { - return s; - } - } - return null; - } - } - - @Entity - public static class Space implements Pojo { - - private int index; - private String name; - private long capacity; - private long maxCapacity; - private long used; - - @Persist - public int getIndex() { - return index; - } - - @Persist - public void setIndex(int index) { - this.index = index; - } - - @Persist - public String getName() { - return name; - } - - @Persist - public void setName(String name) { - this.name = name; - } - - @Persist - public long getCapacity() { - return capacity; - } - - @Persist - public void setCapacity(long capacity) { - this.capacity = capacity; - } - - @Persist - public long getMaxCapacity() { - return maxCapacity; - } - - @Persist - public void setMaxCapacity(long maxCapacity) { - this.maxCapacity = maxCapacity; - } - - @Persist - public long getUsed() { - return used; - } - - @Persist - public void setUsed(long used) { - this.used = used; - } - - } - - private Generation[] generations; - private long timestamp; - private int vmId; - - public VmMemoryStat() { - this(-1, -1, null); - } - - public VmMemoryStat(long timestamp, int vmId, Generation[] generations) { - this.timestamp = timestamp; - this.vmId = vmId; - if (generations != null) { - this.generations = generations; - } - } - - @Persist - public int getVmId() { - return vmId; - } - - @Persist - public void setVmId(int vmId) { - this.vmId = vmId; - } - - @Persist - @Override - public long getTimeStamp() { - return timestamp; - } - - @Persist - public void setTimeStamp(long timeStamp) { - this.timestamp = timeStamp; - } - - @Persist - public Generation[] getGenerations() { - return generations; - } - - @Persist - public void setGenerations(Generation[] generations) { - this.generations = generations; - } - - public Generation getGeneration(String name) { - for (Generation g : generations) { - if (g.name.equals(name)) { - return g; - } - } - return null; - } - -} -
--- a/storage/core/src/test/java/com/redhat/thermostat/storage/core/HostLatestPojoListGetterTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/storage/core/src/test/java/com/redhat/thermostat/storage/core/HostLatestPojoListGetterTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -58,7 +58,7 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.CpuStat; +import com.redhat.thermostat.storage.model.TimeStampedPojo; public class HostLatestPojoListGetterTest { private static final String AGENT_ID = "agentid"; @@ -66,7 +66,7 @@ private static final String CATEGORY_NAME = "hostcategory"; // Make this one static so we don't get IllegalStateException from trying // to make category of same name while running tests in same classloader. - private static final Category<CpuStat> cat = new Category<>(CATEGORY_NAME, CpuStat.class); + private static final Category<TestPojo> cat = new Category<>(CATEGORY_NAME, TestPojo.class); private static long t1 = 1; private static long t2 = 5; @@ -85,14 +85,23 @@ private static Double load15_3 = 13.0; private HostRef ref; - private CpuStat result1, result2, result3; + private TestPojo result1, result2, result3; @Before public void setUp() { + final double[] d1 = new double[] { load5_1, load10_1, load15_1 }; + final double[] d2 = new double[] { load5_2, load10_2, load15_2 }; + final double[] d3 = new double[] { load5_3, load10_3, load15_3 }; ref = new HostRef(AGENT_ID, HOSTNAME); - result1 = new CpuStat(t1, new double[] { load5_1, load10_1, load15_1 } ); - result2 = new CpuStat(t2, new double[] { load5_2, load10_2, load15_2 } ); - result3 = new CpuStat(t3, new double[] { load5_3, load10_3, load15_3 } ); + result1 = mock(TestPojo.class); + when(result1.getTimeStamp()).thenReturn(t1); + when(result1.getData()).thenReturn(d1); + result2 = mock(TestPojo.class); + when(result2.getTimeStamp()).thenReturn(t2); + when(result2.getData()).thenReturn(d2); + result3 = mock(TestPojo.class); + when(result3.getTimeStamp()).thenReturn(t3); + when(result3.getData()).thenReturn(d3); } @Test @@ -101,7 +110,7 @@ Query query = mock(Query.class); when (storage.createQuery(any(Category.class))).thenReturn(query); - HostLatestPojoListGetter<CpuStat> getter = new HostLatestPojoListGetter<>(storage, cat); + HostLatestPojoListGetter<TestPojo> getter = new HostLatestPojoListGetter<>(storage, cat); query = getter.buildQuery(ref, 123); assertNotNull(query); @@ -119,7 +128,7 @@ Query query = mock(Query.class); when(storage.createQuery(any(Category.class))).thenReturn(ignored).thenReturn(query); - HostLatestPojoListGetter<CpuStat> getter = new HostLatestPojoListGetter<>(storage, cat); + HostLatestPojoListGetter<TestPojo> getter = new HostLatestPojoListGetter<>(storage, cat); ignored = getter.buildQuery(ref,Long.MIN_VALUE); // Ignore first return value. query = getter.buildQuery(ref, Long.MIN_VALUE); @@ -135,7 +144,7 @@ @Test public void testGetLatest() { @SuppressWarnings("unchecked") - Cursor<CpuStat> cursor = mock(Cursor.class); + Cursor<TestPojo> cursor = mock(Cursor.class); when(cursor.hasNext()).thenReturn(true).thenReturn(true).thenReturn(false); when(cursor.next()).thenReturn(result1).thenReturn(result2).thenReturn(null); @@ -144,21 +153,21 @@ when(storage.createQuery(any(Category.class))).thenReturn(query); when(query.execute()).thenReturn(cursor); - HostLatestPojoListGetter<CpuStat> getter = new HostLatestPojoListGetter<>(storage, cat); + HostLatestPojoListGetter<TestPojo> getter = new HostLatestPojoListGetter<>(storage, cat); - List<CpuStat> stats = getter.getLatest(ref, Long.MIN_VALUE); + List<TestPojo> stats = getter.getLatest(ref, Long.MIN_VALUE); verify(query).where(Key.AGENT_ID, Criteria.EQUALS, AGENT_ID); verify(query).where(Key.TIMESTAMP, Criteria.GREATER_THAN, Long.MIN_VALUE); assertNotNull(stats); assertEquals(2, stats.size()); - CpuStat stat1 = stats.get(0); + TestPojo stat1 = stats.get(0); assertEquals(t1, stat1.getTimeStamp()); - assertArrayEquals(new double[] {load5_1, load10_1, load15_1}, stat1.getPerProcessorUsage(), 0.001); - CpuStat stat2 = stats.get(1); + assertArrayEquals(new double[] {load5_1, load10_1, load15_1}, stat1.getData(), 0.001); + TestPojo stat2 = stats.get(1); assertEquals(t2, stat2.getTimeStamp()); - assertArrayEquals(new double[] {load5_2, load10_2, load15_2}, stat2.getPerProcessorUsage(), 0.001); + assertArrayEquals(new double[] {load5_2, load10_2, load15_2}, stat2.getData(), 0.001); } @After @@ -168,5 +177,12 @@ result2 = null; result3 = null; } + + private static interface TestPojo extends TimeStampedPojo { + + double[] getData(); + + } + }
--- a/storage/core/src/test/java/com/redhat/thermostat/storage/core/VmLatestPojoListGetterTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/storage/core/src/test/java/com/redhat/thermostat/storage/core/VmLatestPojoListGetterTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -56,7 +56,7 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmClassStat; +import com.redhat.thermostat.storage.model.TimeStampedPojo; public class VmLatestPojoListGetterTest { private static final String AGENT_ID = "agentid"; @@ -66,7 +66,7 @@ private static final String CATEGORY_NAME = "vmcategory"; // Make this one static so we don't get IllegalStateException from trying // to make category of same name while running tests in same classloader. - private static final Category<VmClassStat> cat = new Category<>(CATEGORY_NAME, VmClassStat.class); + private static final Category<TestPojo> cat = new Category<>(CATEGORY_NAME, TestPojo.class); private static long t1 = 1; private static long t2 = 5; @@ -78,15 +78,24 @@ private HostRef hostRef; private VmRef vmRef; - private VmClassStat result1, result2, result3; + private TestPojo result1, result2, result3; @Before public void setUp() { hostRef = new HostRef(AGENT_ID, HOSTNAME); vmRef = new VmRef(hostRef, VM_PID, MAIN_CLASS); - result1 = new VmClassStat(VM_PID, t1, lc1); - result2 = new VmClassStat(VM_PID, t2, lc2); - result3 = new VmClassStat(VM_PID, t3, lc3); + //result1 = new VmClassStat(VM_PID, t1, lc1); + //result2 = new VmClassStat(VM_PID, t2, lc2); + //result3 = new VmClassStat(VM_PID, t3, lc3); + result1 = mock(TestPojo.class); + when(result1.getTimeStamp()).thenReturn(t1); + when(result1.getData()).thenReturn(lc1); + result2 = mock(TestPojo.class); + when(result2.getTimeStamp()).thenReturn(t2); + when(result2.getData()).thenReturn(lc2); + result3 = mock(TestPojo.class); + when(result3.getTimeStamp()).thenReturn(t3); + when(result3.getData()).thenReturn(lc3); } @Test @@ -95,7 +104,7 @@ Query query = mock(Query.class); when(storage.createQuery(any(Category.class))).thenReturn(query); - VmLatestPojoListGetter<VmClassStat> getter = new VmLatestPojoListGetter<>(storage, cat); + VmLatestPojoListGetter<TestPojo> getter = new VmLatestPojoListGetter<>(storage, cat); query = getter.buildQuery(vmRef, 123l); assertNotNull(query); @@ -114,7 +123,7 @@ Query query = mock(Query.class); when(storage.createQuery(any(Category.class))).thenReturn(ignored).thenReturn(query); - VmLatestPojoListGetter<VmClassStat> getter = new VmLatestPojoListGetter<>(storage, cat); + VmLatestPojoListGetter<TestPojo> getter = new VmLatestPojoListGetter<>(storage, cat); getter.buildQuery(vmRef, Long.MIN_VALUE); // Ignore first return value. query = getter.buildQuery(vmRef, Long.MIN_VALUE); @@ -130,7 +139,7 @@ @Test public void testGetLatest() { @SuppressWarnings("unchecked") - Cursor<VmClassStat> cursor = mock(Cursor.class); + Cursor<TestPojo> cursor = mock(Cursor.class); when(cursor.hasNext()).thenReturn(true).thenReturn(true).thenReturn(false); when(cursor.next()).thenReturn(result1).thenReturn(result2).thenReturn(null); @@ -139,9 +148,9 @@ when(storage.createQuery(any(Category.class))).thenReturn(query); when(query.execute()).thenReturn(cursor); - VmLatestPojoListGetter<VmClassStat> getter = new VmLatestPojoListGetter<>(storage, cat); + VmLatestPojoListGetter<TestPojo> getter = new VmLatestPojoListGetter<>(storage, cat); - List<VmClassStat> stats = getter.getLatest(vmRef, t2); + List<TestPojo> stats = getter.getLatest(vmRef, t2); verify(storage).createQuery(cat); verify(query).where(Key.AGENT_ID, Criteria.EQUALS, AGENT_ID); @@ -153,12 +162,18 @@ assertNotNull(stats); assertEquals(2, stats.size()); - VmClassStat stat1 = stats.get(0); + TestPojo stat1 = stats.get(0); assertEquals(t1, stat1.getTimeStamp()); - assertEquals(lc1, stat1.getLoadedClasses()); - VmClassStat stat2 = stats.get(1); + assertEquals(lc1, stat1.getData()); + TestPojo stat2 = stats.get(1); assertEquals(t2, stat2.getTimeStamp()); - assertEquals(lc2, stat2.getLoadedClasses()); + assertEquals(lc2, stat2.getData()); + } + + private static interface TestPojo extends TimeStampedPojo { + + long getData(); + } }
--- a/storage/core/src/test/java/com/redhat/thermostat/storage/model/HeapInfoTest.java Thu Jan 31 10:56:26 2013 +0100 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright 2012, 2013 Red Hat, Inc. - * - * This file is part of Thermostat. - * - * Thermostat is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published - * by the Free Software Foundation; either version 2, or (at your - * option) any later version. - * - * Thermostat is distributed in the hope that it will be useful, but - * WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with Thermostat; see the file COPYING. If not see - * <http://www.gnu.org/licenses/>. - * - * Linking this code with other modules is making a combined work - * based on this code. Thus, the terms and conditions of the GNU - * General Public License cover the whole combination. - * - * As a special exception, the copyright holders of this code give - * you permission to link this code with independent modules to - * produce an executable, regardless of the license terms of these - * independent modules, and to copy and distribute the resulting - * executable under terms of your choice, provided that you also - * meet, for each linked independent module, the terms and conditions - * of the license of that module. An independent module is a module - * which is not derived from or based on this code. If you modify - * this code, you may extend this exception to your version of the - * library, but you are not obligated to do so. If you do not wish - * to do so, delete this exception statement from your version. - */ - -package com.redhat.thermostat.storage.model; - -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertNull; - -import org.junit.Before; -import org.junit.Test; - -import com.redhat.thermostat.storage.model.HeapInfo; - -public class HeapInfoTest { - - private HeapInfo heapInfo; - - @Before - public void setUp() { - heapInfo = new HeapInfo(321, 12345); - heapInfo.setAgentId("test-agent"); - } - - @Test - public void testProperties() { - assertEquals("test-agent", heapInfo.getAgentId()); - assertEquals(321, heapInfo.getVmId()); - assertEquals(12345, heapInfo.getTimeStamp()); - } - - @Test - public void testHeapDumpId() { - assertNull(heapInfo.getHeapDumpId()); - heapInfo.setHeapDumpId("test"); - assertEquals("test", heapInfo.getHeapDumpId()); - } - - @Test - public void testHistogramId() { - assertNull(heapInfo.getHistogramId()); - heapInfo.setHistogramId("test"); - assertEquals("test", heapInfo.getHistogramId()); - } -} -
--- a/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/agent/src/main/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListener.java Thu Jan 31 14:35:34 2013 -0500 @@ -46,8 +46,8 @@ import sun.jvmstat.monitor.event.VmListener; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; class VmClassStatVmListener implements VmListener {
--- a/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/agent/src/test/java/com/redhat/thermostat/vm/classstat/agent/internal/VmClassStatVmListenerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -53,9 +53,9 @@ import sun.jvmstat.monitor.event.MonitorStatusChangeEvent; import sun.jvmstat.monitor.event.VmEvent; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.agent.internal.VmClassStatVmListener; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; public class VmClassStatVmListenerTest {
--- a/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/client-core/src/main/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatController.java Thu Jan 31 14:35:34 2013 -0500 @@ -52,11 +52,11 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.DiscreteTimeData; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.client.core.VmClassStatView; import com.redhat.thermostat.vm.classstat.client.core.VmClassStatViewProvider; import com.redhat.thermostat.vm.classstat.client.locale.LocaleResources; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; public class VmClassStatController implements InformationServiceController<VmRef> {
--- a/vm-classstat/client-core/src/test/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/client-core/src/test/java/com/redhat/thermostat/vm/classstat/client/core/internal/VmClassStatControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -55,10 +55,10 @@ import com.redhat.thermostat.common.Timer; import com.redhat.thermostat.common.TimerFactory; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.client.core.VmClassStatView; import com.redhat.thermostat.vm.classstat.client.core.VmClassStatViewProvider; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; public class VmClassStatControllerTest {
--- a/vm-classstat/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <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, + com.redhat.thermostat.vm.classstat.common.model </Export-Package> <Private-Package> com.redhat.thermostat.vm.classstat.common.internal
--- a/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/VmClassStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,7 +42,7 @@ 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.storage.model.VmClassStat; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; @Service public interface VmClassStatDAO {
--- a/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,8 +42,8 @@ import com.redhat.thermostat.storage.core.Storage; import com.redhat.thermostat.storage.core.VmLatestPojoListGetter; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; class VmClassStatDAOImpl implements VmClassStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-classstat/common/src/main/java/com/redhat/thermostat/vm/classstat/common/model/VmClassStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,92 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.classstat.common.model; + +import 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 { + + private int vmId; + private long timestamp; + private long loadedClasses; + + public VmClassStat() { + this(-1, -1, -1); + } + + public VmClassStat(int vmId, long timestamp, long loadedClasses) { + this.vmId = vmId; + this.timestamp = timestamp; + this.loadedClasses = loadedClasses; + } + + @Persist + public int getVmId() { + return vmId; + } + + @Persist + public void setVmId(int vmId) { + this.vmId = vmId; + } + + @Persist + @Override + public long getTimeStamp() { + return timestamp; + } + + @Persist + public void setTimeStamp(long timestamp) { + this.timestamp = timestamp; + } + + @Persist + public long getLoadedClasses() { + return loadedClasses; + } + + @Persist + public void setLoadedClasses(long loadedClasses) { + this.loadedClasses = loadedClasses; + } +} +
--- a/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-classstat/common/src/test/java/com/redhat/thermostat/vm/classstat/common/internal/VmClassStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -58,8 +58,8 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmClassStat; import com.redhat.thermostat.vm.classstat.common.VmClassStatDAO; +import com.redhat.thermostat.vm.classstat.common.model.VmClassStat; public class VmClassStatDAOTest {
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackend.java Thu Jan 31 14:35:34 2013 -0500 @@ -54,10 +54,10 @@ import com.redhat.thermostat.common.SystemClock; import com.redhat.thermostat.common.Version; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.utils.ProcDataSource; import com.redhat.thermostat.utils.SysConf; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuBackend extends Backend implements VmStatusListener {
--- a/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilder.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/agent/src/main/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilder.java Thu Jan 31 14:35:34 2013 -0500 @@ -43,7 +43,7 @@ import com.redhat.thermostat.common.Clock; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.VmCpuStat; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatBuilder {
--- a/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackendTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuBackendTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -60,8 +60,8 @@ import com.redhat.thermostat.agent.VmStatusListenerRegistrar; import com.redhat.thermostat.common.Ordered; import com.redhat.thermostat.common.Version; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuBackendTest {
--- a/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilderTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/agent/src/test/java/com/redhat/thermostat/vm/cpu/agent/internal/VmCpuStatBuilderTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -47,11 +47,11 @@ import org.junit.Test; import com.redhat.thermostat.common.Clock; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.test.Bug; import com.redhat.thermostat.vm.cpu.agent.internal.ProcessStatusInfo; import com.redhat.thermostat.vm.cpu.agent.internal.ProcessStatusInfoBuilder; import com.redhat.thermostat.vm.cpu.agent.internal.VmCpuStatBuilder; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatBuilderTest {
--- a/vm-cpu/client-cli/src/main/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegate.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/client-cli/src/main/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegate.java Thu Jan 31 14:35:34 2013 -0500 @@ -44,8 +44,8 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.TimeStampedPojo; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatPrintDelegate implements VMStatPrintDelegate {
--- a/vm-cpu/client-cli/src/test/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegateTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/client-cli/src/test/java/com/redhat/thermostat/vm/cpu/client/cli/internal/VmCpuStatPrintDelegateTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -54,8 +54,8 @@ import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.TimeStampedPojo; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatPrintDelegateTest {
--- a/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/client-core/src/main/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuController.java Thu Jan 31 14:35:34 2013 -0500 @@ -52,11 +52,11 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.DiscreteTimeData; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.client.core.VmCpuView; import com.redhat.thermostat.vm.cpu.client.core.VmCpuViewProvider; import com.redhat.thermostat.vm.cpu.client.locale.LocaleResources; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuController implements InformationServiceController<VmRef> { private static final Translate<LocaleResources> translator = LocaleResources.createLocalizer();
--- a/vm-cpu/client-core/src/test/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/client-core/src/test/java/com/redhat/thermostat/vm/cpu/client/core/internal/VmCpuControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -55,11 +55,11 @@ import com.redhat.thermostat.common.Timer; import com.redhat.thermostat.common.TimerFactory; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.client.core.VmCpuView; import com.redhat.thermostat.vm.cpu.client.core.VmCpuViewProvider; import com.redhat.thermostat.vm.cpu.client.core.internal.VmCpuController; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuControllerTest {
--- a/vm-cpu/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <Bundle-SymbolicName>com.redhat.thermostat.vm.cpu.common</Bundle-SymbolicName> <Bundle-Activator>com.redhat.thermostat.vm.cpu.common.internal.Activator</Bundle-Activator> <Export-Package> - com.redhat.thermostat.vm.cpu.common + com.redhat.thermostat.vm.cpu.common, + com.redhat.thermostat.vm.cpu.common.model </Export-Package> <Private-Package> com.redhat.thermostat.vm.cpu.common.internal
--- a/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/VmCpuStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/VmCpuStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,7 +42,7 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.core.Category; import com.redhat.thermostat.storage.core.Key; -import com.redhat.thermostat.storage.model.VmCpuStat; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; @Service public interface VmCpuStatDAO {
--- a/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,8 +42,8 @@ import com.redhat.thermostat.storage.core.VmLatestPojoListGetter; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatDAOImpl implements VmCpuStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-cpu/common/src/main/java/com/redhat/thermostat/vm/cpu/common/model/VmCpuStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,97 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.cpu.common.model; + +import 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 VmCpuStat extends BasePojo implements TimeStampedPojo { + + private long timeStamp; + private int vmId; + private double cpuLoad; + + public VmCpuStat() { + super(); + } + + public VmCpuStat(long timeStamp, int vmId, double cpuLoad) { + this.timeStamp = timeStamp; + this.vmId = vmId; + this.cpuLoad = cpuLoad; + } + + @Override + @Persist + public long getTimeStamp() { + return timeStamp; + } + + @Persist + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } + + @Persist + public int getVmId() { + return vmId; + } + + @Persist + public void setVmId(int vmId) { + this.vmId = vmId; + } + + /** + * The cpu load in percent (as in 100.0 for 100%). This value should be + * normalized to be in the range [0, 100] + */ + @Persist + public double getCpuLoad() { + return cpuLoad; + } + + @Persist + public void setCpuLoad(double cpuLoad) { + this.cpuLoad = cpuLoad; + } + +} +
--- a/vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-cpu/common/src/test/java/com/redhat/thermostat/vm/cpu/common/internal/VmCpuStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -59,8 +59,8 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmCpuStat; import com.redhat.thermostat.vm.cpu.common.VmCpuStatDAO; +import com.redhat.thermostat.vm.cpu.common.model.VmCpuStat; public class VmCpuStatDAOTest {
--- a/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListener.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/agent/src/main/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListener.java Thu Jan 31 14:35:34 2013 -0500 @@ -46,8 +46,8 @@ import sun.jvmstat.monitor.event.VmListener; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.VmGcStat; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; public class VmGcVmListener implements VmListener {
--- a/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListenerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/agent/src/test/java/com/redhat/thermostat/vm/gc/agent/internal/VmGcVmListenerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -51,8 +51,8 @@ import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitoredVm; -import com.redhat.thermostat.storage.model.VmGcStat; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; public class VmGcVmListenerTest { private static final String[] GC_NAMES = new String[] { "GC1", "GC2" };
--- a/vm-gc/client-core/src/main/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/client-core/src/main/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcController.java Thu Jan 31 14:35:34 2013 -0500 @@ -59,14 +59,14 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.IntervalTimeData; import com.redhat.thermostat.storage.model.TimeStampedPojoComparator; -import com.redhat.thermostat.storage.model.VmGcStat; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; import com.redhat.thermostat.vm.gc.client.core.VmGcView; import com.redhat.thermostat.vm.gc.client.core.VmGcViewProvider; import com.redhat.thermostat.vm.gc.client.locale.LocaleResources; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; public class VmGcController implements InformationServiceController<VmRef> {
--- a/vm-gc/client-core/src/test/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/client-core/src/test/java/com/redhat/thermostat/vm/gc/client/core/internal/VmGcControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -59,13 +59,13 @@ import com.redhat.thermostat.common.Timer.SchedulingType; import com.redhat.thermostat.common.TimerFactory; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmGcStat; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; import com.redhat.thermostat.vm.gc.client.core.VmGcView; import com.redhat.thermostat.vm.gc.client.core.VmGcViewProvider; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; public class VmGcControllerTest {
--- a/vm-gc/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <Bundle-SymbolicName>com.redhat.thermostat.vm.gc.common</Bundle-SymbolicName> <Bundle-Activator>com.redhat.thermostat.vm.gc.common.internal.Activator</Bundle-Activator> <Export-Package> - com.redhat.thermostat.vm.gc.common + com.redhat.thermostat.vm.gc.common, + com.redhat.thermostat.vm.gc.common.model </Export-Package> <Private-Package> com.redhat.thermostat.vm.gc.common.internal
--- a/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/VmGcStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/VmGcStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,7 +42,7 @@ 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.storage.model.VmGcStat; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; @Service public interface VmGcStatDAO {
--- a/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,8 +42,8 @@ import com.redhat.thermostat.storage.core.Storage; import com.redhat.thermostat.storage.core.VmLatestPojoListGetter; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmGcStat; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; public class VmGcStatDAOImpl implements VmGcStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-gc/common/src/main/java/com/redhat/thermostat/vm/gc/common/model/VmGcStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,117 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.gc.common.model; + +import 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 VmGcStat extends BasePojo implements TimeStampedPojo { + + private long timeStamp; + private int vmId; + private String collectorName; + private long runCount; + private long wallTime; + + public VmGcStat() { + super(); + } + + public VmGcStat(int vmId, long timestamp, String collectorName, long runCount, long wallTime) { + this.timeStamp = timestamp; + this.vmId = vmId; + this.collectorName = collectorName; + this.runCount = runCount; + this.wallTime = wallTime; + } + + @Persist + public int getVmId() { + return vmId; + } + + @Persist + public void setVmId(int vmId) { + this.vmId = vmId; + } + + @Persist + public String getCollectorName() { + return collectorName; + } + + @Persist + public void setCollectorName(String collectorName) { + this.collectorName = collectorName; + } + + @Persist + public long getRunCount() { + return runCount; + } + + @Persist + public void setRunCount(long runCount) { + this.runCount = runCount; + } + + @Persist + public long getWallTime() { + return wallTime; + } + + @Persist + public void setWallTime(long wallTime) { + this.wallTime = wallTime; + } + + @Override + @Persist + public long getTimeStamp() { + return timeStamp; + } + + @Persist + public void setTimeStamp(long timeStamp) { + this.timeStamp = timeStamp; + } + +} +
--- a/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-gc/common/src/test/java/com/redhat/thermostat/vm/gc/common/internal/VmGcStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -58,8 +58,8 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmGcStat; import com.redhat.thermostat.vm.gc.common.VmGcStatDAO; +import com.redhat.thermostat.vm.gc.common.model.VmGcStat; public class VmGcStatDAOTest {
--- a/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiver.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/agent/src/main/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiver.java Thu Jan 31 14:35:34 2013 -0500 @@ -47,10 +47,10 @@ import com.redhat.thermostat.common.command.Response; import com.redhat.thermostat.common.command.Response.ResponseType; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HistogramLoader; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class HeapDumpReceiver implements RequestReceiver {
--- a/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiverTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/agent/src/test/java/com/redhat/thermostat/vm/heap/analysis/agent/internal/HeapDumpReceiverTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -56,10 +56,10 @@ import com.redhat.thermostat.common.command.Request; import com.redhat.thermostat.common.command.Response; import com.redhat.thermostat.common.command.Response.ResponseType; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HistogramLoader; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class HeapDumpReceiverTest {
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapDumperService.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/HeapDumperService.java Thu Jan 31 14:35:34 2013 -0500 @@ -38,8 +38,8 @@ import com.redhat.thermostat.client.core.Filter; import com.redhat.thermostat.client.core.InformationService; +import com.redhat.thermostat.client.core.NameMatchingRefFilter; import com.redhat.thermostat.client.core.controllers.InformationServiceController; -import com.redhat.thermostat.client.core.NameMatchingRefFilter; import com.redhat.thermostat.common.ApplicationService; import com.redhat.thermostat.common.utils.OSGIUtils; import com.redhat.thermostat.storage.core.VmRef;
--- a/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumpController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/client-core/src/main/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumpController.java Thu Jan 31 14:35:34 2013 -0500 @@ -55,10 +55,6 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.dao.VmInfoDAO; -import com.redhat.thermostat.storage.model.HeapInfo; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapDumpDetailsViewProvider; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapHistogramViewProvider; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapView; @@ -71,7 +67,11 @@ import com.redhat.thermostat.vm.heap.analysis.client.locale.LocaleResources; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class HeapDumpController implements InformationServiceController<VmRef> {
--- a/vm-heap-analysis/client-core/src/test/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumpControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/client-core/src/test/java/com/redhat/thermostat/vm/heap/analysis/client/core/internal/HeapDumpControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -73,11 +73,7 @@ import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.dao.VmInfoDAO; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.storage.model.VmInfo; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapDumpDetailsView; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapDumpDetailsViewProvider; import com.redhat.thermostat.vm.heap.analysis.client.core.HeapHistogramView; @@ -92,7 +88,11 @@ import com.redhat.thermostat.vm.heap.analysis.client.core.ObjectRootsViewProvider; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class HeapDumpControllerTest { private static int TIMEOUT_MS = 1000;
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindObjectsCommand.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindObjectsCommand.java Thu Jan 31 14:35:34 2013 -0500 @@ -45,10 +45,10 @@ import com.redhat.thermostat.common.cli.TableRenderer; import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.command.locale.LocaleResources; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaHeapObject; public class FindObjectsCommand extends AbstractCommand {
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommand.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommand.java Thu Jan 31 14:35:34 2013 -0500 @@ -51,9 +51,9 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; import com.redhat.thermostat.storage.dao.VmInfoDAO; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.command.locale.LocaleResources; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class ListHeapDumpsCommand extends AbstractCommand {
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ObjectCommandHelper.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ObjectCommandHelper.java Thu Jan 31 14:35:34 2013 -0500 @@ -39,9 +39,9 @@ import com.redhat.thermostat.common.cli.Arguments; import com.redhat.thermostat.common.cli.CommandContext; import com.redhat.thermostat.common.cli.CommandException; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaHeapObject; public class ObjectCommandHelper {
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/SaveHeapDumpToFileCommand.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/SaveHeapDumpToFileCommand.java Thu Jan 31 14:35:34 2013 -0500 @@ -51,9 +51,9 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.common.utils.OSGIUtils; import com.redhat.thermostat.common.utils.StreamUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.command.locale.LocaleResources; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class SaveHeapDumpToFileCommand extends AbstractCommand {
--- a/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ShowHeapHistogramCommand.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/main/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ShowHeapHistogramCommand.java Thu Jan 31 14:35:34 2013 -0500 @@ -45,11 +45,11 @@ import com.redhat.thermostat.common.cli.TableRenderer; import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.command.locale.LocaleResources; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HistogramRecord; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class ShowHeapHistogramCommand extends AbstractCommand {
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindObjectsCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindObjectsCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -55,10 +55,10 @@ import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaClass; import com.sun.tools.hat.internal.model.JavaHeapObject;
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindRootCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/FindRootCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -60,10 +60,10 @@ import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaClass; import com.sun.tools.hat.internal.model.JavaHeapObject; import com.sun.tools.hat.internal.model.Root;
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ListHeapDumpsCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -60,10 +60,10 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.dao.HostInfoDAO; import com.redhat.thermostat.storage.dao.VmInfoDAO; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.command.internal.ListHeapDumpsCommand; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class ListHeapDumpsCommandTest {
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ObjectInfoCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ObjectInfoCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -60,10 +60,10 @@ import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaClass; import com.sun.tools.hat.internal.model.JavaHeapObject; import com.sun.tools.hat.internal.model.JavaHeapObjectVisitor;
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/SaveHeapDumpToFileCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/SaveHeapDumpToFileCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -53,11 +53,11 @@ import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.command.internal.SaveHeapDumpToFileCommand; import com.redhat.thermostat.vm.heap.analysis.command.internal.SaveHeapDumpToFileCommand.FileStreamCreator; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class SaveHeapDumpToFileCommandTest {
--- a/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ShowHeapHistogramCommandTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/command/src/test/java/com/redhat/thermostat/vm/heap/analysis/command/internal/ShowHeapHistogramCommandTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -49,10 +49,10 @@ import com.redhat.thermostat.common.cli.CommandException; import com.redhat.thermostat.common.cli.SimpleArguments; import com.redhat.thermostat.common.utils.OSGIUtils; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.test.TestCommandContextFactory; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaClass; import com.sun.tools.hat.internal.model.JavaHeapObject;
--- a/vm-heap-analysis/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -57,7 +57,8 @@ <Bundle-Vendor>Red Hat, Inc.</Bundle-Vendor> <Bundle-SymbolicName>com.redhat.thermostat.vm.heap.analysis.common</Bundle-SymbolicName> <Export-Package> - com.redhat.thermostat.vm.heap.analysis.common + com.redhat.thermostat.vm.heap.analysis.common, + com.redhat.thermostat.vm.heap.analysis.common.model </Export-Package> <Private-Package> com.redhat.thermostat.vm.heap.analysis.common.internal
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -45,7 +45,7 @@ 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.storage.model.HeapInfo; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; @Service public interface HeapDAO {
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDump.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDump.java Thu Jan 31 14:35:34 2013 -0500 @@ -67,7 +67,7 @@ import org.apache.lucene.util.Version; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.HeapInfo; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaHeapObject; import com.sun.tools.hat.internal.model.Snapshot; import com.sun.tools.hat.internal.parser.Reader;
--- a/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -57,10 +57,10 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HeapDump; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; public class HeapDAOImpl implements HeapDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-heap-analysis/common/src/main/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfo.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,130 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.heap.analysis.common.model; + +import java.util.Objects; + +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 HeapInfo extends BasePojo implements TimeStampedPojo { + + private int vmId; + private long timeStamp; + + private String heapId; + private String heapDumpId; + private String histogramId; + + public HeapInfo() { + this(-1, -1); + } + + public HeapInfo(int vmId, long timestamp) { + this.vmId = vmId; + this.timeStamp = timestamp; + } + + @Persist + public void setVmId(int vmId) { + this.vmId = vmId; + } + + @Persist + public int getVmId() { + return vmId; + } + + @Persist + public long getTimeStamp() { + return timeStamp; + } + + @Persist + public void setTimeStamp(long timestamp) { + this.timeStamp = timestamp; + } + + @Persist + public void setHeapId(String heapId) { + this.heapId = heapId; + } + + @Persist + public String getHeapId() { + return heapId; + } + + @Persist + public void setHeapDumpId(String heapDumpId) { + this.heapDumpId = heapDumpId; + } + + @Persist + public String getHeapDumpId() { + return heapDumpId; + } + + @Override + public boolean equals(Object o) { + if (! (o instanceof HeapInfo)) { + return false; + } + HeapInfo other = (HeapInfo) o; + return vmId == other.vmId && Objects.equals(heapDumpId, other.heapDumpId) + && Objects.equals(histogramId, other.histogramId) && timeStamp == other.timeStamp; + } + + @Override + public int hashCode() { + return Objects.hash(vmId, heapDumpId, histogramId, timeStamp); + } + + @Persist + public String getHistogramId() { + return histogramId; + } + + @Persist + public void setHistogramId(String histogramId) { + this.histogramId = histogramId; + } +} +
--- a/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDumpTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/HeapDumpTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -49,8 +49,8 @@ import org.junit.Before; import org.junit.Test; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaHeapObject; /*
--- a/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/internal/HeapDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -70,10 +70,10 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.HeapInfo; import com.redhat.thermostat.vm.heap.analysis.common.HeapDAO; import com.redhat.thermostat.vm.heap.analysis.common.HistogramRecord; import com.redhat.thermostat.vm.heap.analysis.common.ObjectHistogram; +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; import com.sun.tools.hat.internal.model.JavaClass; import com.sun.tools.hat.internal.model.JavaHeapObject;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-heap-analysis/common/src/test/java/com/redhat/thermostat/vm/heap/analysis/common/model/HeapInfoTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,78 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.heap.analysis.common.model; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNull; + +import org.junit.Before; +import org.junit.Test; + +import com.redhat.thermostat.vm.heap.analysis.common.model.HeapInfo; + +public class HeapInfoTest { + + private HeapInfo heapInfo; + + @Before + public void setUp() { + heapInfo = new HeapInfo(321, 12345); + heapInfo.setAgentId("test-agent"); + } + + @Test + public void testProperties() { + assertEquals("test-agent", heapInfo.getAgentId()); + assertEquals(321, heapInfo.getVmId()); + assertEquals(12345, heapInfo.getTimeStamp()); + } + + @Test + public void testHeapDumpId() { + assertNull(heapInfo.getHeapDumpId()); + heapInfo.setHeapDumpId("test"); + assertEquals("test", heapInfo.getHeapDumpId()); + } + + @Test + public void testHistogramId() { + assertNull(heapInfo.getHistogramId()); + heapInfo.setHistogramId("test"); + assertEquals("test", heapInfo.getHistogramId()); + } +} +
--- a/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryDataExtractor.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryDataExtractor.java Thu Jan 31 14:35:34 2013 -0500 @@ -40,7 +40,7 @@ import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitoredVm; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; /** * A helper class to provide type-safe access to commonly used jvmstat monitors
--- a/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListener.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/agent/src/main/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListener.java Thu Jan 31 14:35:34 2013 -0500 @@ -46,10 +46,10 @@ import sun.jvmstat.monitor.event.VmListener; import com.redhat.thermostat.common.utils.LoggingUtils; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class VmMemoryVmListener implements VmListener {
--- a/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryDataExtractorTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryDataExtractorTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -44,13 +44,13 @@ import org.junit.Test; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; - import sun.jvmstat.monitor.LongMonitor; import sun.jvmstat.monitor.MonitorException; import sun.jvmstat.monitor.MonitoredVm; import sun.jvmstat.monitor.StringMonitor; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; + public class VmMemoryDataExtractorTest { private MonitoredVm buildStringMonitoredVm(String monitorName, String monitorReturn) throws MonitorException {
--- a/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListenerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/agent/src/test/java/com/redhat/thermostat/vm/memory/agent/internal/VmMemoryVmListenerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -53,10 +53,10 @@ import sun.jvmstat.monitor.MonitoredVm; import sun.jvmstat.monitor.event.VmEvent; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class VmMemoryVmListenerTest { private static final String[] GEN_NAMES = new String[] { "Gen1", "Gen2" };
--- a/vm-memory/client-cli/src/main/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegate.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/client-cli/src/main/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegate.java Thu Jan 31 14:35:34 2013 -0500 @@ -44,8 +44,8 @@ import com.redhat.thermostat.common.locale.Translate; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.TimeStampedPojo; -import com.redhat.thermostat.storage.model.VmMemoryStat; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; public class VmMemoryStatPrintDelegate implements VMStatPrintDelegate {
--- a/vm-memory/client-cli/src/test/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegateTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/client-cli/src/test/java/com/redhat/thermostat/vm/memory/client/cli/internal/VmMemoryStatPrintDelegateTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -52,10 +52,10 @@ import com.redhat.thermostat.storage.core.HostRef; import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.model.TimeStampedPojo; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class VmMemoryStatPrintDelegateTest {
--- a/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsController.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/client-core/src/main/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsController.java Thu Jan 31 14:35:34 2013 -0500 @@ -62,15 +62,15 @@ import com.redhat.thermostat.storage.core.VmRef; import com.redhat.thermostat.storage.dao.AgentInfoDAO; import com.redhat.thermostat.storage.dao.VmInfoDAO; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.client.core.MemoryStatsView; import com.redhat.thermostat.vm.memory.client.core.MemoryStatsViewProvider; import com.redhat.thermostat.vm.memory.client.core.Payload; import com.redhat.thermostat.vm.memory.client.core.StatsModel; import com.redhat.thermostat.vm.memory.client.locale.LocaleResources; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class MemoryStatsController implements InformationServiceController<VmRef> {
--- a/vm-memory/client-core/src/test/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsControllerTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/client-core/src/test/java/com/redhat/thermostat/vm/memory/client/core/internal/MemoryStatsControllerTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -71,13 +71,13 @@ import com.redhat.thermostat.storage.dao.AgentInfoDAO; import com.redhat.thermostat.storage.dao.VmInfoDAO; import com.redhat.thermostat.storage.model.VmInfo; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.client.core.MemoryStatsView; import com.redhat.thermostat.vm.memory.client.core.MemoryStatsViewProvider; import com.redhat.thermostat.vm.memory.client.core.Payload; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class MemoryStatsControllerTest {
--- a/vm-memory/common/pom.xml Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/common/pom.xml Thu Jan 31 14:35:34 2013 -0500 @@ -21,7 +21,8 @@ <Bundle-SymbolicName>com.redhat.thermostat.vm.memory.common</Bundle-SymbolicName> <Bundle-Activator>com.redhat.thermostat.vm.memory.common.internal.Activator</Bundle-Activator> <Export-Package> - com.redhat.thermostat.vm.memory.common + com.redhat.thermostat.vm.memory.common, + com.redhat.thermostat.vm.memory.common.model </Export-Package> <Private-Package> com.redhat.thermostat.vm.memory.common.internal
--- a/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/VmMemoryStatDAO.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/VmMemoryStatDAO.java Thu Jan 31 14:35:34 2013 -0500 @@ -42,8 +42,8 @@ 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.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; @Service public interface VmMemoryStatDAO {
--- a/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImpl.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOImpl.java Thu Jan 31 14:35:34 2013 -0500 @@ -46,8 +46,8 @@ import com.redhat.thermostat.storage.core.Storage; import com.redhat.thermostat.storage.core.VmLatestPojoListGetter; import com.redhat.thermostat.storage.core.VmRef; -import com.redhat.thermostat.storage.model.VmMemoryStat; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; class VmMemoryStatDAOImpl implements VmMemoryStatDAO {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/vm-memory/common/src/main/java/com/redhat/thermostat/vm/memory/common/model/VmMemoryStat.java Thu Jan 31 14:35:34 2013 -0500 @@ -0,0 +1,235 @@ +/* + * Copyright 2012, 2013 Red Hat, Inc. + * + * This file is part of Thermostat. + * + * Thermostat is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published + * by the Free Software Foundation; either version 2, or (at your + * option) any later version. + * + * Thermostat is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Thermostat; see the file COPYING. If not see + * <http://www.gnu.org/licenses/>. + * + * Linking this code with other modules is making a combined work + * based on this code. Thus, the terms and conditions of the GNU + * General Public License cover the whole combination. + * + * As a special exception, the copyright holders of this code give + * you permission to link this code with independent modules to + * produce an executable, regardless of the license terms of these + * independent modules, and to copy and distribute the resulting + * executable under terms of your choice, provided that you also + * meet, for each linked independent module, the terms and conditions + * of the license of that module. An independent module is a module + * which is not derived from or based on this code. If you modify + * this code, you may extend this exception to your version of the + * library, but you are not obligated to do so. If you do not wish + * to do so, delete this exception statement from your version. + */ + +package com.redhat.thermostat.vm.memory.common.model; + +import 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.Pojo; +import com.redhat.thermostat.storage.model.TimeStampedPojo; + +@Entity +public class VmMemoryStat extends BasePojo implements TimeStampedPojo { + + @Entity + public static class Generation implements Pojo { + public static final String COLLECTOR_NONE = "none"; + private String name; + private long capacity; + private long maxCapacity; + private Space[] spaces; + private String collector; + + @Persist + public String getName() { + return name; + } + + @Persist + public void setName(String name) { + this.name = name; + } + + @Persist + public long getCapacity() { + return capacity; + } + + @Persist + public void setCapacity(long capacity) { + this.capacity = capacity; + } + + @Persist + public long getMaxCapacity() { + return maxCapacity; + } + + @Persist + public void setMaxCapacity(long maxCapacity) { + this.maxCapacity = maxCapacity; + } + + @Persist + public Space[] getSpaces() { + return spaces; + } + + @Persist + public void setSpaces(Space[] spaces) { + this.spaces = spaces; + } + + @Persist + public String getCollector() { + return collector; + } + + @Persist + public void setCollector(String collector) { + this.collector = collector; + } + + public Space getSpace(String string) { + for (Space s : spaces) { + if (s.name.equals(string)) { + return s; + } + } + return null; + } + } + + @Entity + public static class Space implements Pojo { + + private int index; + private String name; + private long capacity; + private long maxCapacity; + private long used; + + @Persist + public int getIndex() { + return index; + } + + @Persist + public void setIndex(int index) { + this.index = index; + } + + @Persist + public String getName() { + return name; + } + + @Persist + public void setName(String name) { + this.name = name; + } + + @Persist + public long getCapacity() { + return capacity; + } + + @Persist + public void setCapacity(long capacity) { + this.capacity = capacity; + } + + @Persist + public long getMaxCapacity() { + return maxCapacity; + } + + @Persist + public void setMaxCapacity(long maxCapacity) { + this.maxCapacity = maxCapacity; + } + + @Persist + public long getUsed() { + return used; + } + + @Persist + public void setUsed(long used) { + this.used = used; + } + + } + + private Generation[] generations; + private long timestamp; + private int vmId; + + public VmMemoryStat() { + this(-1, -1, null); + } + + public VmMemoryStat(long timestamp, int vmId, Generation[] generations) { + this.timestamp = timestamp; + this.vmId = vmId; + if (generations != null) { + this.generations = generations; + } + } + + @Persist + public int getVmId() { + return vmId; + } + + @Persist + public void setVmId(int vmId) { + this.vmId = vmId; + } + + @Persist + @Override + public long getTimeStamp() { + return timestamp; + } + + @Persist + public void setTimeStamp(long timeStamp) { + this.timestamp = timeStamp; + } + + @Persist + public Generation[] getGenerations() { + return generations; + } + + @Persist + public void setGenerations(Generation[] generations) { + this.generations = generations; + } + + public Generation getGeneration(String name) { + for (Generation g : generations) { + if (g.name.equals(name)) { + return g; + } + } + return null; + } + +} +
--- a/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java Thu Jan 31 10:56:26 2013 +0100 +++ b/vm-memory/common/src/test/java/com/redhat/thermostat/vm/memory/common/internal/VmMemoryStatDAOTest.java Thu Jan 31 14:35:34 2013 -0500 @@ -61,10 +61,10 @@ import com.redhat.thermostat.storage.core.Query; import com.redhat.thermostat.storage.core.Query.Criteria; import com.redhat.thermostat.storage.core.Storage; -import com.redhat.thermostat.storage.model.VmMemoryStat; -import com.redhat.thermostat.storage.model.VmMemoryStat.Generation; -import com.redhat.thermostat.storage.model.VmMemoryStat.Space; import com.redhat.thermostat.vm.memory.common.VmMemoryStatDAO; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Generation; +import com.redhat.thermostat.vm.memory.common.model.VmMemoryStat.Space; public class VmMemoryStatDAOTest {