org.voltdb.catalog.Deployment Maven / Gradle / Ivy
/* This file is part of VoltDB.
* Copyright (C) 2008-2020 VoltDB Inc.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with VoltDB. If not, see .
*/
/* WARNING: THIS FILE IS AUTO-GENERATED
DO NOT MODIFY THIS SOURCE
ALL CHANGES MUST BE MADE IN THE CATALOG GENERATOR */
package org.voltdb.catalog;
/**
* Run-time deployment settings
*/
public class Deployment extends CatalogType {
int m_kfactor;
CatalogMap m_systemsettings;
CatalogMap m_threadPools;
@Override
void initChildMaps() {
m_systemsettings = new CatalogMap(getCatalog(), this, "systemsettings", Systemsettings.class, m_parentMap.m_depth + 1);
m_threadPools = new CatalogMap(getCatalog(), this, "threadPools", ThreadPool.class, m_parentMap.m_depth + 1);
}
public String[] getFields() {
return new String[] {
"kfactor",
};
};
String[] getChildCollections() {
return new String[] {
"systemsettings",
"threadPools",
};
};
public Object getField(String field) {
switch (field) {
case "kfactor":
return getKfactor();
case "systemsettings":
return getSystemsettings();
case "threadPools":
return getThreadpools();
default:
throw new CatalogException("Unknown field");
}
}
/** GETTER: The required k-safety factor */
public int getKfactor() {
return m_kfactor;
}
/** GETTER: Values from the systemsettings element */
public CatalogMap getSystemsettings() {
return m_systemsettings;
}
/** GETTER: The Thread Pool configuration */
public CatalogMap getThreadpools() {
return m_threadPools;
}
/** SETTER: The required k-safety factor */
public void setKfactor(int value) {
m_kfactor = value;
}
@Override
void set(String field, String value) {
if ((field == null) || (value == null)) {
throw new CatalogException("Null value where it shouldn't be.");
}
switch (field) {
case "kfactor":
assert(value != null);
m_kfactor = Integer.parseInt(value);
break;
default:
throw new CatalogException("Unknown field");
}
}
@Override
public void copyFields(CatalogType obj) {
// this is safe from the caller
Deployment other = (Deployment) obj;
other.m_kfactor = m_kfactor;
other.m_systemsettings.copyFrom(m_systemsettings);
other.m_threadPools.copyFrom(m_threadPools);
}
public boolean equals(Object obj) {
// this isn't really the convention for null handling
if ((obj == null) || (obj.getClass().equals(getClass()) == false))
return false;
// Do the identity check
if (obj == this)
return true;
// this is safe because of the class check
// it is also known that the childCollections var will be the same
// from the class check
Deployment other = (Deployment) obj;
// are the fields / children the same? (deep compare)
if (m_kfactor != other.m_kfactor) return false;
if ((m_systemsettings == null) != (other.m_systemsettings == null)) return false;
if ((m_systemsettings != null) && !m_systemsettings.equals(other.m_systemsettings)) return false;
if ((m_threadPools == null) != (other.m_threadPools == null)) return false;
if ((m_threadPools != null) && !m_threadPools.equals(other.m_threadPools)) return false;
return true;
}
}