Ravi Nori has posted comments on this change.
Change subject: engine: Add infrastructure code for removal of parameter classes
......................................................................
Patch Set 12:
(6 comments)
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/InvalidParameterGuidException.java
Line 1: package org.ovirt.engine.core.common.utils;
Line 2:
Line 3: public class InvalidParameterGuidException extends
IllegalArgumentException {
Line 4:
Line 5: public InvalidParameterGuidException(String name, VdcParameter
param) {
Not for RTEs
Line 6: super("Invalid value for Guid "+param.getGuid()+" for Parameter
" + name +
Line 7: ". A parameter with the same Guid already exists " +
param.getName());
Line 8: }
Line 9:
....................................................
File
backend/manager/modules/common/src/main/java/org/ovirt/engine/core/common/utils/VdcParameter.java
Line 34: }
Line 35:
Line 36: @Override
Line 37: public boolean equals(Object other) {
Line 38: if (other == null || !(other instanceof VdcParameter)) {
Need to change this :)
Line 39: return false;
Line 40: }
Line 41: return getGuid().equals(((VdcParameter) other).getGuid());
Line 42: }
Line 37: public boolean equals(Object other) {
Line 38: if (other == null || !(other instanceof VdcParameter)) {
Line 39: return false;
Line 40: }
Line 41: return getGuid().equals(((VdcParameter) other).getGuid());
will change to
guid.equals(((VdcParameter) other).getGuid());
I am used to programming with never accessing the class level variables
directly, but I see we are doing it in other parts of the code base so will
change
Line 42: }
Line 43:
Line 44: @Override
Line 45: public int hashCode() {
Line 55:
Line 56: public static VdcParameter create(String name, Class javaType,
String guidStr) {
Line 57: Guid guid = new Guid(guidStr);
Line 58: synchronized (parametersMap) {
Line 59: if (parametersMap.containsKey(guid)) {
Ok
Line 60: throw new InvalidParameterGuidException(name,
parametersMap.get(guid));
Line 61: }
Line 62: VdcParameter param = new VdcParameter(name, javaType,
guid);
Line 63: parametersMap.put(guid, param);
Line 83: }
Line 84:
Line 85: switch (Integer.parseInt(map.get(VERSION_KEY))) {
Line 86: case 0:
Line 87: synchronized (parametersMap) {
No not available
Line 88: Guid guid = new Guid(map.get(GUID_KEY));
Line 89: if (!parametersMap.containsKey(guid)) {
Line 90: throw new
InvalidParameterKeyException("VdcParameter with guid not found "+
guid.toString());
Line 91: }
....................................................
File
backend/manager/modules/utils/src/main/java/org/ovirt/engine/core/utils/serialization/json/JsonObjectSerializer.java
Line 99: public String serializeUnformattedJson(Serializable payload)
throws SerializationExeption {
Line 100: return writeJsonAsString(payload, unformattedMapper);
Line 101: }
Line 102:
Line 103: private static class VdcParameterSerializer extends
JsonSerializer<VdcParameter> {
Probably should move this out as a separate class and not crowd this class
Line 104: @Override
Line 105: public void serialize(VdcParameter key, JsonGenerator jg,
SerializerProvider sp) throws IOException {
Line 106: jg.writeFieldName(VdcParameter.serialize(key));
Line 107: }
--
To view, visit http://gerrit.ovirt.org/20414
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I6a0970e492c0eff561888a46b02e47645ff68fc3
Gerrit-PatchSet: 12
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Ravi Nori <[email protected]>
Gerrit-Reviewer: Alon Bar-Lev <[email protected]>
Gerrit-Reviewer: Barak Azulay <[email protected]>
Gerrit-Reviewer: Liran Zelkha <[email protected]>
Gerrit-Reviewer: Ravi Nori <[email protected]>
Gerrit-Reviewer: Yaniv Bronhaim <[email protected]>
Gerrit-Reviewer: mooli tayer <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
Gerrit-HasComments: Yes
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches