/**
* Autogenerated by Thrift Compiler (0.9.0)
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
* @generated
*/
package com.vmware.bdd.software.mgmt.thrift;
import org.apache.thrift.scheme.IScheme;
import org.apache.thrift.scheme.SchemeFactory;
import org.apache.thrift.scheme.StandardScheme;
import org.apache.thrift.scheme.TupleScheme;
import org.apache.thrift.protocol.TTupleProtocol;
import org.apache.thrift.protocol.TProtocolException;
import org.apache.thrift.EncodingUtils;
import org.apache.thrift.TException;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.util.HashMap;
import java.util.EnumMap;
import java.util.Set;
import java.util.HashSet;
import java.util.EnumSet;
import java.util.Collections;
import java.util.BitSet;
import java.nio.ByteBuffer;
import java.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Cluster operation data structure
*/
public class ClusterOperation implements org.apache.thrift.TBase<ClusterOperation, ClusterOperation._Fields>, java.io.Serializable, Cloneable {
private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("ClusterOperation");
private static final org.apache.thrift.protocol.TField ACTION_FIELD_DESC = new org.apache.thrift.protocol.TField("action", org.apache.thrift.protocol.TType.I32, (short)1);
private static final org.apache.thrift.protocol.TField TARGET_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("targetName", org.apache.thrift.protocol.TType.STRING, (short)2);
private static final org.apache.thrift.protocol.TField SPEC_FILE_NAME_FIELD_DESC = new org.apache.thrift.protocol.TField("specFileName", org.apache.thrift.protocol.TType.STRING, (short)3);
private static final org.apache.thrift.protocol.TField LOG_LEVEL_FIELD_DESC = new org.apache.thrift.protocol.TField("logLevel", org.apache.thrift.protocol.TType.STRING, (short)4);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
schemes.put(StandardScheme.class, new ClusterOperationStandardSchemeFactory());
schemes.put(TupleScheme.class, new ClusterOperationTupleSchemeFactory());
}
/**
*
* @see ClusterAction
*/
public ClusterAction action; // required
public String targetName; // required
public String specFileName; // optional
public String logLevel; // optional
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements org.apache.thrift.TFieldIdEnum {
/**
*
* @see ClusterAction
*/
ACTION((short)1, "action"),
TARGET_NAME((short)2, "targetName"),
SPEC_FILE_NAME((short)3, "specFileName"),
LOG_LEVEL((short)4, "logLevel");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
switch(fieldId) {
case 1: // ACTION
return ACTION;
case 2: // TARGET_NAME
return TARGET_NAME;
case 3: // SPEC_FILE_NAME
return SPEC_FILE_NAME;
case 4: // LOG_LEVEL
return LOG_LEVEL;
default:
return null;
}
}
/**
* Find the _Fields constant that matches fieldId, throwing an exception
* if it is not found.
*/
public static _Fields findByThriftIdOrThrow(int fieldId) {
_Fields fields = findByThriftId(fieldId);
if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
return fields;
}
/**
* Find the _Fields constant that matches name, or null if its not found.
*/
public static _Fields findByName(String name) {
return byName.get(name);
}
private final short _thriftId;
private final String _fieldName;
_Fields(short thriftId, String fieldName) {
_thriftId = thriftId;
_fieldName = fieldName;
}
public short getThriftFieldId() {
return _thriftId;
}
public String getFieldName() {
return _fieldName;
}
}
// isset id assignments
private _Fields optionals[] = {_Fields.SPEC_FILE_NAME,_Fields.LOG_LEVEL};
public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
static {
Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
tmpMap.put(_Fields.ACTION, new org.apache.thrift.meta_data.FieldMetaData("action", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.EnumMetaData(org.apache.thrift.protocol.TType.ENUM, ClusterAction.class)));
tmpMap.put(_Fields.TARGET_NAME, new org.apache.thrift.meta_data.FieldMetaData("targetName", org.apache.thrift.TFieldRequirementType.REQUIRED,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.SPEC_FILE_NAME, new org.apache.thrift.meta_data.FieldMetaData("specFileName", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
tmpMap.put(_Fields.LOG_LEVEL, new org.apache.thrift.meta_data.FieldMetaData("logLevel", org.apache.thrift.TFieldRequirementType.OPTIONAL,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(ClusterOperation.class, metaDataMap);
}
public ClusterOperation() {
}
public ClusterOperation(
ClusterAction action,
String targetName)
{
this();
this.action = action;
this.targetName = targetName;
}
/**
* Performs a deep copy on <i>other</i>.
*/
public ClusterOperation(ClusterOperation other) {
if (other.isSetAction()) {
this.action = other.action;
}
if (other.isSetTargetName()) {
this.targetName = other.targetName;
}
if (other.isSetSpecFileName()) {
this.specFileName = other.specFileName;
}
if (other.isSetLogLevel()) {
this.logLevel = other.logLevel;
}
}
public ClusterOperation deepCopy() {
return new ClusterOperation(this);
}
@Override
public void clear() {
this.action = null;
this.targetName = null;
this.specFileName = null;
this.logLevel = null;
}
/**
*
* @see ClusterAction
*/
public ClusterAction getAction() {
return this.action;
}
/**
*
* @see ClusterAction
*/
public ClusterOperation setAction(ClusterAction action) {
this.action = action;
return this;
}
public void unsetAction() {
this.action = null;
}
/** Returns true if field action is set (has been assigned a value) and false otherwise */
public boolean isSetAction() {
return this.action != null;
}
public void setActionIsSet(boolean value) {
if (!value) {
this.action = null;
}
}
public String getTargetName() {
return this.targetName;
}
public ClusterOperation setTargetName(String targetName) {
this.targetName = targetName;
return this;
}
public void unsetTargetName() {
this.targetName = null;
}
/** Returns true if field targetName is set (has been assigned a value) and false otherwise */
public boolean isSetTargetName() {
return this.targetName != null;
}
public void setTargetNameIsSet(boolean value) {
if (!value) {
this.targetName = null;
}
}
public String getSpecFileName() {
return this.specFileName;
}
public ClusterOperation setSpecFileName(String specFileName) {
this.specFileName = specFileName;
return this;
}
public void unsetSpecFileName() {
this.specFileName = null;
}
/** Returns true if field specFileName is set (has been assigned a value) and false otherwise */
public boolean isSetSpecFileName() {
return this.specFileName != null;
}
public void setSpecFileNameIsSet(boolean value) {
if (!value) {
this.specFileName = null;
}
}
public String getLogLevel() {
return this.logLevel;
}
public ClusterOperation setLogLevel(String logLevel) {
this.logLevel = logLevel;
return this;
}
public void unsetLogLevel() {
this.logLevel = null;
}
/** Returns true if field logLevel is set (has been assigned a value) and false otherwise */
public boolean isSetLogLevel() {
return this.logLevel != null;
}
public void setLogLevelIsSet(boolean value) {
if (!value) {
this.logLevel = null;
}
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case ACTION:
if (value == null) {
unsetAction();
} else {
setAction((ClusterAction)value);
}
break;
case TARGET_NAME:
if (value == null) {
unsetTargetName();
} else {
setTargetName((String)value);
}
break;
case SPEC_FILE_NAME:
if (value == null) {
unsetSpecFileName();
} else {
setSpecFileName((String)value);
}
break;
case LOG_LEVEL:
if (value == null) {
unsetLogLevel();
} else {
setLogLevel((String)value);
}
break;
}
}
public Object getFieldValue(_Fields field) {
switch (field) {
case ACTION:
return getAction();
case TARGET_NAME:
return getTargetName();
case SPEC_FILE_NAME:
return getSpecFileName();
case LOG_LEVEL:
return getLogLevel();
}
throw new IllegalStateException();
}
/** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
public boolean isSet(_Fields field) {
if (field == null) {
throw new IllegalArgumentException();
}
switch (field) {
case ACTION:
return isSetAction();
case TARGET_NAME:
return isSetTargetName();
case SPEC_FILE_NAME:
return isSetSpecFileName();
case LOG_LEVEL:
return isSetLogLevel();
}
throw new IllegalStateException();
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof ClusterOperation)
return this.equals((ClusterOperation)that);
return false;
}
public boolean equals(ClusterOperation that) {
if (that == null)
return false;
boolean this_present_action = true && this.isSetAction();
boolean that_present_action = true && that.isSetAction();
if (this_present_action || that_present_action) {
if (!(this_present_action && that_present_action))
return false;
if (!this.action.equals(that.action))
return false;
}
boolean this_present_targetName = true && this.isSetTargetName();
boolean that_present_targetName = true && that.isSetTargetName();
if (this_present_targetName || that_present_targetName) {
if (!(this_present_targetName && that_present_targetName))
return false;
if (!this.targetName.equals(that.targetName))
return false;
}
boolean this_present_specFileName = true && this.isSetSpecFileName();
boolean that_present_specFileName = true && that.isSetSpecFileName();
if (this_present_specFileName || that_present_specFileName) {
if (!(this_present_specFileName && that_present_specFileName))
return false;
if (!this.specFileName.equals(that.specFileName))
return false;
}
boolean this_present_logLevel = true && this.isSetLogLevel();
boolean that_present_logLevel = true && that.isSetLogLevel();
if (this_present_logLevel || that_present_logLevel) {
if (!(this_present_logLevel && that_present_logLevel))
return false;
if (!this.logLevel.equals(that.logLevel))
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(ClusterOperation other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
ClusterOperation typedOther = (ClusterOperation)other;
lastComparison = Boolean.valueOf(isSetAction()).compareTo(typedOther.isSetAction());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetAction()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.action, typedOther.action);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetTargetName()).compareTo(typedOther.isSetTargetName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetTargetName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.targetName, typedOther.targetName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetSpecFileName()).compareTo(typedOther.isSetSpecFileName());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetSpecFileName()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.specFileName, typedOther.specFileName);
if (lastComparison != 0) {
return lastComparison;
}
}
lastComparison = Boolean.valueOf(isSetLogLevel()).compareTo(typedOther.isSetLogLevel());
if (lastComparison != 0) {
return lastComparison;
}
if (isSetLogLevel()) {
lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.logLevel, typedOther.logLevel);
if (lastComparison != 0) {
return lastComparison;
}
}
return 0;
}
public _Fields fieldForId(int fieldId) {
return _Fields.findByThriftId(fieldId);
}
public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
}
public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("ClusterOperation(");
boolean first = true;
sb.append("action:");
if (this.action == null) {
sb.append("null");
} else {
sb.append(this.action);
}
first = false;
if (!first) sb.append(", ");
sb.append("targetName:");
if (this.targetName == null) {
sb.append("null");
} else {
sb.append(this.targetName);
}
first = false;
if (isSetSpecFileName()) {
if (!first) sb.append(", ");
sb.append("specFileName:");
if (this.specFileName == null) {
sb.append("null");
} else {
sb.append(this.specFileName);
}
first = false;
}
if (isSetLogLevel()) {
if (!first) sb.append(", ");
sb.append("logLevel:");
if (this.logLevel == null) {
sb.append("null");
} else {
sb.append(this.logLevel);
}
first = false;
}
sb.append(")");
return sb.toString();
}
public void validate() throws org.apache.thrift.TException {
// check for required fields
if (action == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'action' was not present! Struct: " + toString());
}
if (targetName == null) {
throw new org.apache.thrift.protocol.TProtocolException("Required field 'targetName' was not present! Struct: " + toString());
}
// check for sub-struct validity
}
private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
try {
write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
try {
read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
} catch (org.apache.thrift.TException te) {
throw new java.io.IOException(te);
}
}
private static class ClusterOperationStandardSchemeFactory implements SchemeFactory {
public ClusterOperationStandardScheme getScheme() {
return new ClusterOperationStandardScheme();
}
}
private static class ClusterOperationStandardScheme extends StandardScheme<ClusterOperation> {
public void read(org.apache.thrift.protocol.TProtocol iprot, ClusterOperation struct) throws org.apache.thrift.TException {
org.apache.thrift.protocol.TField schemeField;
iprot.readStructBegin();
while (true)
{
schemeField = iprot.readFieldBegin();
if (schemeField.type == org.apache.thrift.protocol.TType.STOP) {
break;
}
switch (schemeField.id) {
case 1: // ACTION
if (schemeField.type == org.apache.thrift.protocol.TType.I32) {
struct.action = ClusterAction.findByValue(iprot.readI32());
struct.setActionIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 2: // TARGET_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.targetName = iprot.readString();
struct.setTargetNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 3: // SPEC_FILE_NAME
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.specFileName = iprot.readString();
struct.setSpecFileNameIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
case 4: // LOG_LEVEL
if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
struct.logLevel = iprot.readString();
struct.setLogLevelIsSet(true);
} else {
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
iprot.readFieldEnd();
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
struct.validate();
}
public void write(org.apache.thrift.protocol.TProtocol oprot, ClusterOperation struct) throws org.apache.thrift.TException {
struct.validate();
oprot.writeStructBegin(STRUCT_DESC);
if (struct.action != null) {
oprot.writeFieldBegin(ACTION_FIELD_DESC);
oprot.writeI32(struct.action.getValue());
oprot.writeFieldEnd();
}
if (struct.targetName != null) {
oprot.writeFieldBegin(TARGET_NAME_FIELD_DESC);
oprot.writeString(struct.targetName);
oprot.writeFieldEnd();
}
if (struct.specFileName != null) {
if (struct.isSetSpecFileName()) {
oprot.writeFieldBegin(SPEC_FILE_NAME_FIELD_DESC);
oprot.writeString(struct.specFileName);
oprot.writeFieldEnd();
}
}
if (struct.logLevel != null) {
if (struct.isSetLogLevel()) {
oprot.writeFieldBegin(LOG_LEVEL_FIELD_DESC);
oprot.writeString(struct.logLevel);
oprot.writeFieldEnd();
}
}
oprot.writeFieldStop();
oprot.writeStructEnd();
}
}
private static class ClusterOperationTupleSchemeFactory implements SchemeFactory {
public ClusterOperationTupleScheme getScheme() {
return new ClusterOperationTupleScheme();
}
}
private static class ClusterOperationTupleScheme extends TupleScheme<ClusterOperation> {
@Override
public void write(org.apache.thrift.protocol.TProtocol prot, ClusterOperation struct) throws org.apache.thrift.TException {
TTupleProtocol oprot = (TTupleProtocol) prot;
oprot.writeI32(struct.action.getValue());
oprot.writeString(struct.targetName);
BitSet optionals = new BitSet();
if (struct.isSetSpecFileName()) {
optionals.set(0);
}
if (struct.isSetLogLevel()) {
optionals.set(1);
}
oprot.writeBitSet(optionals, 2);
if (struct.isSetSpecFileName()) {
oprot.writeString(struct.specFileName);
}
if (struct.isSetLogLevel()) {
oprot.writeString(struct.logLevel);
}
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, ClusterOperation struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
struct.action = ClusterAction.findByValue(iprot.readI32());
struct.setActionIsSet(true);
struct.targetName = iprot.readString();
struct.setTargetNameIsSet(true);
BitSet incoming = iprot.readBitSet(2);
if (incoming.get(0)) {
struct.specFileName = iprot.readString();
struct.setSpecFileNameIsSet(true);
}
if (incoming.get(1)) {
struct.logLevel = iprot.readString();
struct.setLogLevelIsSet(true);
}
}
}
}