anmolbabu has uploaded a new change for review. Change subject: engine : Introduce base class for nfs and brick profile ......................................................................
engine : Introduce base class for nfs and brick profile Introduce base class for nfs and brick profile Change-Id: Ib78fa33cd268097adf8e442e653bb0f1454be4d5 Signed-off-by: Anmol Babu <anb...@redhat.com> --- M backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java M backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQueryTest.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/BrickProfileDetails.java M backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileInfo.java A backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileStats.java D backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/NfsProfileDetails.java M backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeProfileInfoMapper.java M backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java 8 files changed, 73 insertions(+), 104 deletions(-) git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/85/28485/1 diff --git a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java index c08466f..d52b44f 100644 --- a/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java +++ b/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQuery.java @@ -37,7 +37,7 @@ protected GlusterVolumeProfileInfo populateBrickNames(GlusterVolumeProfileInfo profileInfo) { List<BrickProfileDetails> brickProfiles= profileInfo.getBrickProfileDetails(); for(BrickProfileDetails brickProfileDetails : brickProfiles) { - brickProfileDetails.setBrickName(getGlusterBrickDao().getById(brickProfileDetails.getBrickId()).getQualifiedName()); + brickProfileDetails.setIdentity(getGlusterBrickDao().getById(brickProfileDetails.getBrickId()).getQualifiedName()); } return profileInfo; } diff --git a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQueryTest.java b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQueryTest.java index 1f30b3b..6e6b0f5 100644 --- a/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQueryTest.java +++ b/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/gluster/GetGlusterVolumeProfileInfoQueryTest.java @@ -111,7 +111,7 @@ private List<BrickProfileDetails> getBrickProfileDetails() { BrickProfileDetails profileDetails = new BrickProfileDetails(); profileDetails.setBrickId(Guid.newGuid()); - profileDetails.setStatsInfo(getStatsInfo()); + profileDetails.setProfileStats(getStatsInfo()); return Collections.singletonList(profileDetails); } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/BrickProfileDetails.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/BrickProfileDetails.java index 39dcd62..ceb33de 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/BrickProfileDetails.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/BrickProfileDetails.java @@ -1,18 +1,13 @@ package org.ovirt.engine.core.common.businessentities.gluster; -import java.io.Serializable; -import java.util.List; - import org.ovirt.engine.core.common.utils.ObjectUtils; import org.ovirt.engine.core.compat.Guid; -public class BrickProfileDetails implements Serializable { +public class BrickProfileDetails extends GlusterVolumeProfileStats { private static final long serialVersionUID = 3609367118733238971L; private Guid brickId; - private String brickName; - private List<StatsInfo> statsInfo; public BrickProfileDetails() { } @@ -25,33 +20,13 @@ this.brickId = brickId; } - public List<StatsInfo> getStatsInfo() { - return statsInfo; - } - - public void setStatsInfo(List<StatsInfo> statsInfo) { - this.statsInfo = statsInfo; - } - - public String getBrickName() { - return brickName; - } - - public void setBrickName(String brickName) { - this.brickName = brickName; - } - @Override public boolean equals(Object obj) { if(!(obj instanceof BrickProfileDetails)) { return false; } BrickProfileDetails brickDetails = (BrickProfileDetails) obj; - if(! (ObjectUtils.objectsEqual(getBrickId(), brickDetails.getBrickId()) && - ObjectUtils.objectsEqual(getBrickName(), brickDetails.getBrickName()))) { - return false; - } - if(! (ObjectUtils.objectsEqual(getStatsInfo(), brickDetails.getStatsInfo()))) { + if(! (ObjectUtils.objectsEqual(getBrickId(), brickDetails.getBrickId()))) { return false; } return true; @@ -62,8 +37,6 @@ final int prime = 31; int result = 1; result = prime * result + ((getBrickId() == null) ? 0 : getBrickId().hashCode()); - result = prime * result + ((getBrickName() == null) ? 0 : getBrickName().hashCode()); - result = prime * result + ((getStatsInfo() == null) ? 0 : getStatsInfo().hashCode()); return result; } } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileInfo.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileInfo.java index 4b52a06..3e5158e 100644 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileInfo.java +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileInfo.java @@ -15,7 +15,7 @@ private static final long serialVersionUID = -768822766895441186L; private Guid volumeId; private List<BrickProfileDetails> brickProfileDetails; - private List<NfsProfileDetails> nfsProfileDetails; + private List<GlusterVolumeProfileStats> nfsProfileDetails; public GlusterVolumeProfileInfo() { } @@ -36,11 +36,11 @@ this.brickProfileDetails = brickProfileDetails; } - public List<NfsProfileDetails> getNfsProfileDetails() { + public List<GlusterVolumeProfileStats> getNfsProfileDetails() { return nfsProfileDetails; } - public void setNfsProfileDetails(List<NfsProfileDetails> nfsProfileDetails) { + public void setNfsProfileDetails(List<GlusterVolumeProfileStats> nfsProfileDetails) { this.nfsProfileDetails = nfsProfileDetails; } diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileStats.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileStats.java new file mode 100644 index 0000000..e3441f2 --- /dev/null +++ b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/GlusterVolumeProfileStats.java @@ -0,0 +1,54 @@ +package org.ovirt.engine.core.common.businessentities.gluster; + +import java.io.Serializable; +import java.util.List; + +import org.ovirt.engine.core.common.utils.ObjectUtils; + +public class GlusterVolumeProfileStats implements Serializable { + private static final long serialVersionUID = 1L; + + private String name; + private List<StatsInfo> profileStats; + + public String getName() { + return name; + } + + public void setIdentity(String identity) { + this.name = identity; + } + + public List<StatsInfo> getProfileStats() { + return profileStats; + } + + public void setProfileStats(List<StatsInfo> profileStats) { + this.profileStats = profileStats; + } + + @Override + public boolean equals(Object obj) { + if(!(obj instanceof GlusterVolumeProfileStats)) { + return false; + } + GlusterVolumeProfileStats profileDetails = (GlusterVolumeProfileStats) obj; + if(!ObjectUtils.objectsEqual(getName(), profileDetails.getName())) { + return false; + } + if(!ObjectUtils.objectsEqual(getProfileStats(), profileDetails.getProfileStats())) { + return false; + } + return true; + } + + @Override + public int hashCode() { + final int prime = 31; + int result = 1; + result = prime * result + ((getName() == null) ? 0 : getName().hashCode()); + result = prime * result + ((getProfileStats() == null) ? 0 : getProfileStats().hashCode()); + return result; + } + +} diff --git a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/NfsProfileDetails.java b/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/NfsProfileDetails.java deleted file mode 100644 index ea455d8..0000000 --- a/backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/businessentities/gluster/NfsProfileDetails.java +++ /dev/null @@ -1,58 +0,0 @@ -/** - * - */ -package org.ovirt.engine.core.common.businessentities.gluster; - -import java.io.Serializable; -import java.util.List; - -import org.ovirt.engine.core.common.utils.ObjectUtils; - -public class NfsProfileDetails implements Serializable { - - private static final long serialVersionUID = 1L; - - private String nfsServerIp; - private List<StatsInfo> statsInfo; - - public NfsProfileDetails() { - super(); - } - - public String getNfsServerIp() { - return nfsServerIp; - } - public void setNfsServerIp(String nfsServerIp) { - this.nfsServerIp = nfsServerIp; - } - public List<StatsInfo> getStatsInfo() { - return statsInfo; - } - public void setStatsInfo(List<StatsInfo> statsInfo) { - this.statsInfo = statsInfo; - } - - @Override - public boolean equals(Object obj) { - if(!(obj instanceof NfsProfileDetails)) { - return false; - } - NfsProfileDetails nfsDetails = (NfsProfileDetails) obj; - if(!ObjectUtils.objectsEqual(getNfsServerIp(), nfsDetails.getNfsServerIp())) { - return false; - } - if(!ObjectUtils.objectsEqual(getStatsInfo(), nfsDetails.getStatsInfo())) { - return false; - } - return true; - } - - @Override - public int hashCode() { - final int prime = 31; - int result = 1; - result = prime * result + ((getNfsServerIp() == null) ? 0 : getNfsServerIp().hashCode()); - result = prime * result + ((getStatsInfo() == null) ? 0 : getStatsInfo().hashCode()); - return result; - } -} diff --git a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeProfileInfoMapper.java b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeProfileInfoMapper.java index 777615e..78631b4 100644 --- a/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeProfileInfoMapper.java +++ b/backend/manager/modules/restapi/types/src/main/java/org/ovirt/engine/api/restapi/types/GlusterVolumeProfileInfoMapper.java @@ -54,8 +54,8 @@ fromEntity.getBrickProfileDetails()) { BrickProfileDetail brickprofileDetail = new BrickProfileDetail(); brickprofileDetail.setBrick(new GlusterBrick()); - brickprofileDetail.getBrick().setBrickDir(brickDetailEntity.getBrickName()); - mapProfileDetails(brickDetailEntity.getStatsInfo(), brickprofileDetail); + brickprofileDetail.getBrick().setBrickDir(brickDetailEntity.getName()); + mapProfileDetails(brickDetailEntity.getProfileStats(), brickprofileDetail); brickprofileDetails.getBrickProfileDetail().add(brickprofileDetail); } } @@ -63,11 +63,11 @@ NfsProfileDetails nfsprofileDetails = new NfsProfileDetails(); if (fromEntity.getNfsProfileDetails() != null) { - for (org.ovirt.engine.core.common.businessentities.gluster.NfsProfileDetails nfsDetailEntity: + for (org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats nfsDetailEntity: fromEntity.getNfsProfileDetails()) { NfsProfileDetail nfsprofileDetail = new NfsProfileDetail(); - nfsprofileDetail.setNfsServerIp(nfsDetailEntity.getNfsServerIp()); - mapProfileDetails(nfsDetailEntity.getStatsInfo(), nfsprofileDetail); + nfsprofileDetail.setNfsServerIp(nfsDetailEntity.getName()); + mapProfileDetails(nfsDetailEntity.getProfileStats(), nfsprofileDetail); nfsprofileDetails.getNfsProfileDetail().add(nfsprofileDetail); } } diff --git a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java index 3f30527..aa7b585 100644 --- a/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java +++ b/backend/manager/modules/vdsbroker/src/main/java/org/ovirt/engine/core/vdsbroker/gluster/GlusterVolumeProfileInfoReturnForXmlRpc.java @@ -11,7 +11,7 @@ import org.ovirt.engine.core.common.businessentities.gluster.GlusterBrickEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeEntity; import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileInfo; -import org.ovirt.engine.core.common.businessentities.gluster.NfsProfileDetails; +import org.ovirt.engine.core.common.businessentities.gluster.GlusterVolumeProfileStats; import org.ovirt.engine.core.common.businessentities.gluster.ProfileStatsType; import org.ovirt.engine.core.common.businessentities.gluster.StatsInfo; import org.ovirt.engine.core.common.utils.Pair; @@ -76,17 +76,17 @@ } } - private List<NfsProfileDetails> prepareNfsProfileDetails(Object[] nfsServerProfileDetails) { - List<NfsProfileDetails> nfsProfileDetails = new ArrayList<NfsProfileDetails>(); + private List<GlusterVolumeProfileStats> prepareNfsProfileDetails(Object[] nfsServerProfileDetails) { + List<GlusterVolumeProfileStats> nfsProfileDetails = new ArrayList<GlusterVolumeProfileStats>(); for(Object nfsObject : nfsServerProfileDetails) { - NfsProfileDetails nfsDetails = new NfsProfileDetails(); + GlusterVolumeProfileStats nfsDetails = new GlusterVolumeProfileStats(); Map<String, Object> nfsProfile = (Map<String, Object>) nfsObject; - nfsDetails.setNfsServerIp((String) nfsProfile.get(NFS)); + nfsDetails.setIdentity((String) nfsProfile.get(NFS)); List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) nfsProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) nfsProfile.get(INTERVAL_STATS), INTERVAL_STATS)); - nfsDetails.setStatsInfo(statsInfo); + nfsDetails.setProfileStats(statsInfo); nfsProfileDetails.add(nfsDetails); } return nfsProfileDetails; @@ -107,7 +107,7 @@ List<StatsInfo> statsInfo = new ArrayList<StatsInfo>(); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(CUMULATIVE_STATS), CUMULATIVE_STATS)); statsInfo.add(getStatInfo((Map<String, Object>) brickProfile.get(INTERVAL_STATS), INTERVAL_STATS)); - brickProfileDetail.setStatsInfo(statsInfo); + brickProfileDetail.setProfileStats(statsInfo); brickProfileDetailsList.add(brickProfileDetail); } return brickProfileDetailsList; -- To view, visit http://gerrit.ovirt.org/28485 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: newchange Gerrit-Change-Id: Ib78fa33cd268097adf8e442e653bb0f1454be4d5 Gerrit-PatchSet: 1 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: anmolbabu <anb...@redhat.com> _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches