/**
* Abiquo community edition
* cloud management application for hybrid clouds
* Copyright (C) 2008-2010 - Abiquo Holdings S.L.
*
* This application is free software; you can redistribute it and/or
* modify it under the terms of the GNU LESSER GENERAL PUBLIC
* LICENSE as published by the Free Software Foundation under
* version 3 of the License
*
* This software 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
* LESSER GENERAL PUBLIC LICENSE v.3 for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
package com.abiquo.aimstub;
/**
* Autogenerated by Thrift
*
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
*/
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.util.Arrays;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.apache.thrift.*;
import org.apache.thrift.meta_data.*;
import org.apache.thrift.protocol.*;
public class Datastore implements TBase<Datastore._Fields>, java.io.Serializable, Cloneable, Comparable<Datastore> {
private static final TStruct STRUCT_DESC = new TStruct("Datastore");
private static final TField DEVICE_FIELD_DESC = new TField("device", TType.STRING, (short)1);
private static final TField PATH_FIELD_DESC = new TField("path", TType.STRING, (short)2);
private static final TField TYPE_FIELD_DESC = new TField("type", TType.STRING, (short)3);
private static final TField TOTAL_SIZE_FIELD_DESC = new TField("totalSize", TType.I64, (short)4);
private static final TField USABLE_SIZE_FIELD_DESC = new TField("usableSize", TType.I64, (short)5);
public String device;
public String path;
public String type;
public long totalSize;
public long usableSize;
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
public enum _Fields implements TFieldIdEnum {
DEVICE((short)1, "device"),
PATH((short)2, "path"),
TYPE((short)3, "type"),
TOTAL_SIZE((short)4, "totalSize"),
USABLE_SIZE((short)5, "usableSize");
private static final Map<Integer, _Fields> byId = new HashMap<Integer, _Fields>();
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
static {
for (_Fields field : EnumSet.allOf(_Fields.class)) {
byId.put((int)field._thriftId, field);
byName.put(field.getFieldName(), field);
}
}
/**
* Find the _Fields constant that matches fieldId, or null if its not found.
*/
public static _Fields findByThriftId(int fieldId) {
return byId.get(fieldId);
}
/**
* 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 static final int __TOTALSIZE_ISSET_ID = 0;
private static final int __USABLESIZE_ISSET_ID = 1;
private BitSet __isset_bit_vector = new BitSet(2);
public static final Map<_Fields, FieldMetaData> metaDataMap = Collections.unmodifiableMap(new EnumMap<_Fields, FieldMetaData>(_Fields.class) {{
put(_Fields.DEVICE, new FieldMetaData("device", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
put(_Fields.PATH, new FieldMetaData("path", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
put(_Fields.TYPE, new FieldMetaData("type", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.STRING)));
put(_Fields.TOTAL_SIZE, new FieldMetaData("totalSize", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
put(_Fields.USABLE_SIZE, new FieldMetaData("usableSize", TFieldRequirementType.DEFAULT,
new FieldValueMetaData(TType.I64)));
}});
static {
FieldMetaData.addStructMetaDataMap(Datastore.class, metaDataMap);
}
public Datastore() {
}
public Datastore(
String device,
String path,
String type,
long totalSize,
long usableSize)
{
this();
this.device = device;
this.path = path;
this.type = type;
this.totalSize = totalSize;
setTotalSizeIsSet(true);
this.usableSize = usableSize;
setUsableSizeIsSet(true);
}
/**
* Performs a deep copy on <i>other</i>.
*/
public Datastore(Datastore other) {
__isset_bit_vector.clear();
__isset_bit_vector.or(other.__isset_bit_vector);
if (other.isSetDevice()) {
this.device = other.device;
}
if (other.isSetPath()) {
this.path = other.path;
}
if (other.isSetType()) {
this.type = other.type;
}
this.totalSize = other.totalSize;
this.usableSize = other.usableSize;
}
public Datastore deepCopy() {
return new Datastore(this);
}
@Deprecated
public Datastore clone() {
return new Datastore(this);
}
public String getDevice() {
return this.device;
}
public Datastore setDevice(String device) {
this.device = device;
return this;
}
public void unsetDevice() {
this.device = null;
}
/** Returns true if field device is set (has been asigned a value) and false otherwise */
public boolean isSetDevice() {
return this.device != null;
}
public void setDeviceIsSet(boolean value) {
if (!value) {
this.device = null;
}
}
public String getPath() {
return this.path;
}
public Datastore setPath(String path) {
this.path = path;
return this;
}
public void unsetPath() {
this.path = null;
}
/** Returns true if field path is set (has been asigned a value) and false otherwise */
public boolean isSetPath() {
return this.path != null;
}
public void setPathIsSet(boolean value) {
if (!value) {
this.path = null;
}
}
public String getType() {
return this.type;
}
public Datastore setType(String type) {
this.type = type;
return this;
}
public void unsetType() {
this.type = null;
}
/** Returns true if field type is set (has been asigned a value) and false otherwise */
public boolean isSetType() {
return this.type != null;
}
public void setTypeIsSet(boolean value) {
if (!value) {
this.type = null;
}
}
public long getTotalSize() {
return this.totalSize;
}
public Datastore setTotalSize(long totalSize) {
this.totalSize = totalSize;
setTotalSizeIsSet(true);
return this;
}
public void unsetTotalSize() {
__isset_bit_vector.clear(__TOTALSIZE_ISSET_ID);
}
/** Returns true if field totalSize is set (has been asigned a value) and false otherwise */
public boolean isSetTotalSize() {
return __isset_bit_vector.get(__TOTALSIZE_ISSET_ID);
}
public void setTotalSizeIsSet(boolean value) {
__isset_bit_vector.set(__TOTALSIZE_ISSET_ID, value);
}
public long getUsableSize() {
return this.usableSize;
}
public Datastore setUsableSize(long usableSize) {
this.usableSize = usableSize;
setUsableSizeIsSet(true);
return this;
}
public void unsetUsableSize() {
__isset_bit_vector.clear(__USABLESIZE_ISSET_ID);
}
/** Returns true if field usableSize is set (has been asigned a value) and false otherwise */
public boolean isSetUsableSize() {
return __isset_bit_vector.get(__USABLESIZE_ISSET_ID);
}
public void setUsableSizeIsSet(boolean value) {
__isset_bit_vector.set(__USABLESIZE_ISSET_ID, value);
}
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case DEVICE:
if (value == null) {
unsetDevice();
} else {
setDevice((String)value);
}
break;
case PATH:
if (value == null) {
unsetPath();
} else {
setPath((String)value);
}
break;
case TYPE:
if (value == null) {
unsetType();
} else {
setType((String)value);
}
break;
case TOTAL_SIZE:
if (value == null) {
unsetTotalSize();
} else {
setTotalSize((Long)value);
}
break;
case USABLE_SIZE:
if (value == null) {
unsetUsableSize();
} else {
setUsableSize((Long)value);
}
break;
}
}
public void setFieldValue(int fieldID, Object value) {
setFieldValue(_Fields.findByThriftIdOrThrow(fieldID), value);
}
public Object getFieldValue(_Fields field) {
switch (field) {
case DEVICE:
return getDevice();
case PATH:
return getPath();
case TYPE:
return getType();
case TOTAL_SIZE:
return new Long(getTotalSize());
case USABLE_SIZE:
return new Long(getUsableSize());
}
throw new IllegalStateException();
}
public Object getFieldValue(int fieldId) {
return getFieldValue(_Fields.findByThriftIdOrThrow(fieldId));
}
/** Returns true if field corresponding to fieldID is set (has been asigned a value) and false otherwise */
public boolean isSet(_Fields field) {
switch (field) {
case DEVICE:
return isSetDevice();
case PATH:
return isSetPath();
case TYPE:
return isSetType();
case TOTAL_SIZE:
return isSetTotalSize();
case USABLE_SIZE:
return isSetUsableSize();
}
throw new IllegalStateException();
}
public boolean isSet(int fieldID) {
return isSet(_Fields.findByThriftIdOrThrow(fieldID));
}
@Override
public boolean equals(Object that) {
if (that == null)
return false;
if (that instanceof Datastore)
return this.equals((Datastore)that);
return false;
}
public boolean equals(Datastore that) {
if (that == null)
return false;
boolean this_present_device = true && this.isSetDevice();
boolean that_present_device = true && that.isSetDevice();
if (this_present_device || that_present_device) {
if (!(this_present_device && that_present_device))
return false;
if (!this.device.equals(that.device))
return false;
}
boolean this_present_path = true && this.isSetPath();
boolean that_present_path = true && that.isSetPath();
if (this_present_path || that_present_path) {
if (!(this_present_path && that_present_path))
return false;
if (!this.path.equals(that.path))
return false;
}
boolean this_present_type = true && this.isSetType();
boolean that_present_type = true && that.isSetType();
if (this_present_type || that_present_type) {
if (!(this_present_type && that_present_type))
return false;
if (!this.type.equals(that.type))
return false;
}
boolean this_present_totalSize = true;
boolean that_present_totalSize = true;
if (this_present_totalSize || that_present_totalSize) {
if (!(this_present_totalSize && that_present_totalSize))
return false;
if (this.totalSize != that.totalSize)
return false;
}
boolean this_present_usableSize = true;
boolean that_present_usableSize = true;
if (this_present_usableSize || that_present_usableSize) {
if (!(this_present_usableSize && that_present_usableSize))
return false;
if (this.usableSize != that.usableSize)
return false;
}
return true;
}
@Override
public int hashCode() {
return 0;
}
public int compareTo(Datastore other) {
if (!getClass().equals(other.getClass())) {
return getClass().getName().compareTo(other.getClass().getName());
}
int lastComparison = 0;
Datastore typedOther = (Datastore)other;
lastComparison = Boolean.valueOf(isSetDevice()).compareTo(isSetDevice());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(device, typedOther.device);
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = Boolean.valueOf(isSetPath()).compareTo(isSetPath());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(path, typedOther.path);
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = Boolean.valueOf(isSetType()).compareTo(isSetType());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(type, typedOther.type);
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = Boolean.valueOf(isSetTotalSize()).compareTo(isSetTotalSize());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(totalSize, typedOther.totalSize);
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = Boolean.valueOf(isSetUsableSize()).compareTo(isSetUsableSize());
if (lastComparison != 0) {
return lastComparison;
}
lastComparison = TBaseHelper.compareTo(usableSize, typedOther.usableSize);
if (lastComparison != 0) {
return lastComparison;
}
return 0;
}
public void read(TProtocol iprot) throws TException {
TField field;
iprot.readStructBegin();
while (true)
{
field = iprot.readFieldBegin();
if (field.type == TType.STOP) {
break;
}
_Fields fieldId = _Fields.findByThriftId(field.id);
if (fieldId == null) {
TProtocolUtil.skip(iprot, field.type);
} else {
switch (fieldId) {
case DEVICE:
if (field.type == TType.STRING) {
this.device = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case PATH:
if (field.type == TType.STRING) {
this.path = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case TYPE:
if (field.type == TType.STRING) {
this.type = iprot.readString();
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case TOTAL_SIZE:
if (field.type == TType.I64) {
this.totalSize = iprot.readI64();
setTotalSizeIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
case USABLE_SIZE:
if (field.type == TType.I64) {
this.usableSize = iprot.readI64();
setUsableSizeIsSet(true);
} else {
TProtocolUtil.skip(iprot, field.type);
}
break;
}
iprot.readFieldEnd();
}
}
iprot.readStructEnd();
// check for required fields of primitive type, which can't be checked in the validate method
validate();
}
public void write(TProtocol oprot) throws TException {
validate();
oprot.writeStructBegin(STRUCT_DESC);
if (this.device != null) {
oprot.writeFieldBegin(DEVICE_FIELD_DESC);
oprot.writeString(this.device);
oprot.writeFieldEnd();
}
if (this.path != null) {
oprot.writeFieldBegin(PATH_FIELD_DESC);
oprot.writeString(this.path);
oprot.writeFieldEnd();
}
if (this.type != null) {
oprot.writeFieldBegin(TYPE_FIELD_DESC);
oprot.writeString(this.type);
oprot.writeFieldEnd();
}
oprot.writeFieldBegin(TOTAL_SIZE_FIELD_DESC);
oprot.writeI64(this.totalSize);
oprot.writeFieldEnd();
oprot.writeFieldBegin(USABLE_SIZE_FIELD_DESC);
oprot.writeI64(this.usableSize);
oprot.writeFieldEnd();
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@Override
public String toString() {
StringBuilder sb = new StringBuilder("Datastore(");
boolean first = true;
sb.append("device:");
if (this.device == null) {
sb.append("null");
} else {
sb.append(this.device);
}
first = false;
if (!first) sb.append(", ");
sb.append("path:");
if (this.path == null) {
sb.append("null");
} else {
sb.append(this.path);
}
first = false;
if (!first) sb.append(", ");
sb.append("type:");
if (this.type == null) {
sb.append("null");
} else {
sb.append(this.type);
}
first = false;
if (!first) sb.append(", ");
sb.append("totalSize:");
sb.append(this.totalSize);
first = false;
if (!first) sb.append(", ");
sb.append("usableSize:");
sb.append(this.usableSize);
first = false;
sb.append(")");
return sb.toString();
}
public void validate() throws TException {
// check for required fields
}
}