001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.io.watcher.driver.context; 007@SuppressWarnings("all") 008@org.apache.avro.specific.AvroGenerated 009public class AvroFailedContext extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 010 public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroFailedContext\",\"namespace\":\"org.apache.reef.io.watcher.driver.context\",\"fields\":[{\"name\":\"base\",\"type\":{\"type\":\"record\",\"name\":\"AvroContextBase\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorId\",\"type\":\"string\"},{\"name\":\"parentId\",\"type\":[\"string\",\"null\"]},{\"name\":\"evaluatorDescriptor\",\"type\":[{\"type\":\"record\",\"name\":\"AvroEvaluatorDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.evaluator\",\"fields\":[{\"name\":\"nodeDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptor\",\"namespace\":\"org.apache.reef.io.watcher.driver.catalog\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"},{\"name\":\"rackDescriptor\",\"type\":{\"type\":\"record\",\"name\":\"AvroRackDescriptor\",\"fields\":[{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"nodes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AvroNodeDescriptorInRackDescriptor\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"name\",\"type\":\"string\"},{\"name\":\"inetSocketAddress\",\"type\":\"string\"}]}}}]}}]}},{\"name\":\"process\",\"type\":{\"type\":\"record\",\"name\":\"AvroEvaluatorProcess\",\"fields\":[{\"name\":\"commandLines\",\"type\":{\"type\":\"array\",\"items\":[\"string\",\"null\"]}},{\"name\":\"evaluatorType\",\"type\":{\"type\":\"enum\",\"name\":\"AvroEvaluatorType\",\"symbols\":[\"JVM\",\"CLR\",\"UNDECIDED\"]}},{\"name\":\"isOptionSet\",\"type\":\"boolean\"}]}},{\"name\":\"memory\",\"type\":\"int\"},{\"name\":\"numberOfCores\",\"type\":\"int\"}]},\"null\"]}]}},{\"name\":\"parentContext\",\"type\":[{\"type\":\"record\",\"name\":\"AvroActiveContext\",\"fields\":[{\"name\":\"base\",\"type\":\"AvroContextBase\"}]},\"null\"]},{\"name\":\"failure\",\"type\":{\"type\":\"record\",\"name\":\"AvroFailure\",\"namespace\":\"org.apache.reef.io.watcher.common\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"message\",\"type\":\"string\"},{\"name\":\"description\",\"type\":[\"string\",\"null\"]},{\"name\":\"reason\",\"type\":[\"string\",\"null\"]},{\"name\":\"data\",\"type\":[\"bytes\",\"null\"]},{\"name\":\"asError\",\"type\":\"string\"}]}}]}"); 011 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 012 @Deprecated public org.apache.reef.io.watcher.driver.context.AvroContextBase base; 013 @Deprecated public org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext; 014 @Deprecated public org.apache.reef.io.watcher.common.AvroFailure failure; 015 016 /** 017 * Default constructor. Note that this does not initialize fields 018 * to their default values from the schema. If that is desired then 019 * one should use <code>newBuilder()</code>. 020 */ 021 public AvroFailedContext() {} 022 023 /** 024 * All-args constructor. 025 */ 026 public AvroFailedContext(org.apache.reef.io.watcher.driver.context.AvroContextBase base, org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext, org.apache.reef.io.watcher.common.AvroFailure failure) { 027 this.base = base; 028 this.parentContext = parentContext; 029 this.failure = failure; 030 } 031 032 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 033 // Used by DatumWriter. Applications should not call. 034 public java.lang.Object get(int field$) { 035 switch (field$) { 036 case 0: return base; 037 case 1: return parentContext; 038 case 2: return failure; 039 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 040 } 041 } 042 // Used by DatumReader. Applications should not call. 043 @SuppressWarnings(value="unchecked") 044 public void put(int field$, java.lang.Object value$) { 045 switch (field$) { 046 case 0: base = (org.apache.reef.io.watcher.driver.context.AvroContextBase)value$; break; 047 case 1: parentContext = (org.apache.reef.io.watcher.driver.context.AvroActiveContext)value$; break; 048 case 2: failure = (org.apache.reef.io.watcher.common.AvroFailure)value$; break; 049 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 050 } 051 } 052 053 /** 054 * Gets the value of the 'base' field. 055 */ 056 public org.apache.reef.io.watcher.driver.context.AvroContextBase getBase() { 057 return base; 058 } 059 060 /** 061 * Sets the value of the 'base' field. 062 * @param value the value to set. 063 */ 064 public void setBase(org.apache.reef.io.watcher.driver.context.AvroContextBase value) { 065 this.base = value; 066 } 067 068 /** 069 * Gets the value of the 'parentContext' field. 070 */ 071 public org.apache.reef.io.watcher.driver.context.AvroActiveContext getParentContext() { 072 return parentContext; 073 } 074 075 /** 076 * Sets the value of the 'parentContext' field. 077 * @param value the value to set. 078 */ 079 public void setParentContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) { 080 this.parentContext = value; 081 } 082 083 /** 084 * Gets the value of the 'failure' field. 085 */ 086 public org.apache.reef.io.watcher.common.AvroFailure getFailure() { 087 return failure; 088 } 089 090 /** 091 * Sets the value of the 'failure' field. 092 * @param value the value to set. 093 */ 094 public void setFailure(org.apache.reef.io.watcher.common.AvroFailure value) { 095 this.failure = value; 096 } 097 098 /** Creates a new AvroFailedContext RecordBuilder */ 099 public static org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder newBuilder() { 100 return new org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder(); 101 } 102 103 /** Creates a new AvroFailedContext RecordBuilder by copying an existing Builder */ 104 public static org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder other) { 105 return new org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder(other); 106 } 107 108 /** Creates a new AvroFailedContext RecordBuilder by copying an existing AvroFailedContext instance */ 109 public static org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder newBuilder(org.apache.reef.io.watcher.driver.context.AvroFailedContext other) { 110 return new org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder(other); 111 } 112 113 /** 114 * RecordBuilder for AvroFailedContext instances. 115 */ 116 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailedContext> 117 implements org.apache.avro.data.RecordBuilder<AvroFailedContext> { 118 119 private org.apache.reef.io.watcher.driver.context.AvroContextBase base; 120 private org.apache.reef.io.watcher.driver.context.AvroActiveContext parentContext; 121 private org.apache.reef.io.watcher.common.AvroFailure failure; 122 123 /** Creates a new Builder */ 124 private Builder() { 125 super(org.apache.reef.io.watcher.driver.context.AvroFailedContext.SCHEMA$); 126 } 127 128 /** Creates a Builder by copying an existing Builder */ 129 private Builder(org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder other) { 130 super(other); 131 if (isValidValue(fields()[0], other.base)) { 132 this.base = data().deepCopy(fields()[0].schema(), other.base); 133 fieldSetFlags()[0] = true; 134 } 135 if (isValidValue(fields()[1], other.parentContext)) { 136 this.parentContext = data().deepCopy(fields()[1].schema(), other.parentContext); 137 fieldSetFlags()[1] = true; 138 } 139 if (isValidValue(fields()[2], other.failure)) { 140 this.failure = data().deepCopy(fields()[2].schema(), other.failure); 141 fieldSetFlags()[2] = true; 142 } 143 } 144 145 /** Creates a Builder by copying an existing AvroFailedContext instance */ 146 private Builder(org.apache.reef.io.watcher.driver.context.AvroFailedContext other) { 147 super(org.apache.reef.io.watcher.driver.context.AvroFailedContext.SCHEMA$); 148 if (isValidValue(fields()[0], other.base)) { 149 this.base = data().deepCopy(fields()[0].schema(), other.base); 150 fieldSetFlags()[0] = true; 151 } 152 if (isValidValue(fields()[1], other.parentContext)) { 153 this.parentContext = data().deepCopy(fields()[1].schema(), other.parentContext); 154 fieldSetFlags()[1] = true; 155 } 156 if (isValidValue(fields()[2], other.failure)) { 157 this.failure = data().deepCopy(fields()[2].schema(), other.failure); 158 fieldSetFlags()[2] = true; 159 } 160 } 161 162 /** Gets the value of the 'base' field */ 163 public org.apache.reef.io.watcher.driver.context.AvroContextBase getBase() { 164 return base; 165 } 166 167 /** Sets the value of the 'base' field */ 168 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder setBase(org.apache.reef.io.watcher.driver.context.AvroContextBase value) { 169 validate(fields()[0], value); 170 this.base = value; 171 fieldSetFlags()[0] = true; 172 return this; 173 } 174 175 /** Checks whether the 'base' field has been set */ 176 public boolean hasBase() { 177 return fieldSetFlags()[0]; 178 } 179 180 /** Clears the value of the 'base' field */ 181 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder clearBase() { 182 base = null; 183 fieldSetFlags()[0] = false; 184 return this; 185 } 186 187 /** Gets the value of the 'parentContext' field */ 188 public org.apache.reef.io.watcher.driver.context.AvroActiveContext getParentContext() { 189 return parentContext; 190 } 191 192 /** Sets the value of the 'parentContext' field */ 193 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder setParentContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) { 194 validate(fields()[1], value); 195 this.parentContext = value; 196 fieldSetFlags()[1] = true; 197 return this; 198 } 199 200 /** Checks whether the 'parentContext' field has been set */ 201 public boolean hasParentContext() { 202 return fieldSetFlags()[1]; 203 } 204 205 /** Clears the value of the 'parentContext' field */ 206 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder clearParentContext() { 207 parentContext = null; 208 fieldSetFlags()[1] = false; 209 return this; 210 } 211 212 /** Gets the value of the 'failure' field */ 213 public org.apache.reef.io.watcher.common.AvroFailure getFailure() { 214 return failure; 215 } 216 217 /** Sets the value of the 'failure' field */ 218 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder setFailure(org.apache.reef.io.watcher.common.AvroFailure value) { 219 validate(fields()[2], value); 220 this.failure = value; 221 fieldSetFlags()[2] = true; 222 return this; 223 } 224 225 /** Checks whether the 'failure' field has been set */ 226 public boolean hasFailure() { 227 return fieldSetFlags()[2]; 228 } 229 230 /** Clears the value of the 'failure' field */ 231 public org.apache.reef.io.watcher.driver.context.AvroFailedContext.Builder clearFailure() { 232 failure = null; 233 fieldSetFlags()[2] = false; 234 return this; 235 } 236 237 @Override 238 public AvroFailedContext build() { 239 try { 240 AvroFailedContext record = new AvroFailedContext(); 241 record.base = fieldSetFlags()[0] ? this.base : (org.apache.reef.io.watcher.driver.context.AvroContextBase) defaultValue(fields()[0]); 242 record.parentContext = fieldSetFlags()[1] ? this.parentContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) defaultValue(fields()[1]); 243 record.failure = fieldSetFlags()[2] ? this.failure : (org.apache.reef.io.watcher.common.AvroFailure) defaultValue(fields()[2]); 244 return record; 245 } catch (Exception e) { 246 throw new org.apache.avro.AvroRuntimeException(e); 247 } 248 } 249 } 250}