This project has retired. For details please refer to its Attic page.
Source code
001/**
002 * Autogenerated by Avro
003 *
004 * DO NOT EDIT DIRECTLY
005 */
006package org.apache.reef.io.watcher.driver.evaluator;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroFailedEvaluator extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = 487338380532630852L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroFailedEvaluator\",\"namespace\":\"org.apache.reef.io.watcher.driver.evaluator\",\"fields\":[{\"name\":\"id\",\"type\":\"string\"},{\"name\":\"evaluatorException\",\"type\":\"string\"},{\"name\":\"failedContextList\",\"type\":{\"type\":\"array\",\"items\":{\"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\"}]}}]}}},{\"name\":\"failedTask\",\"type\":[{\"type\":\"record\",\"name\":\"AvroFailedTask\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"name\":\"failure\",\"type\":\"org.apache.reef.io.watcher.common.AvroFailure\"},{\"name\":\"activeContext\",\"type\":[\"org.apache.reef.io.watcher.driver.context.AvroActiveContext\",\"null\"]}]},\"null\"]}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
017  @Deprecated public java.lang.CharSequence evaluatorException;
018  @Deprecated public java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> failedContextList;
019  @Deprecated public org.apache.reef.io.watcher.driver.task.AvroFailedTask failedTask;
020
021  /**
022   * Default constructor.  Note that this does not initialize fields
023   * to their default values from the schema.  If that is desired then
024   * one should use <code>newBuilder()</code>.
025   */
026  public AvroFailedEvaluator() {}
027
028  /**
029   * All-args constructor.
030   * @param id The new value for id
031   * @param evaluatorException The new value for evaluatorException
032   * @param failedContextList The new value for failedContextList
033   * @param failedTask The new value for failedTask
034   */
035  public AvroFailedEvaluator(java.lang.CharSequence id, java.lang.CharSequence evaluatorException, java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> failedContextList, org.apache.reef.io.watcher.driver.task.AvroFailedTask failedTask) {
036    this.id = id;
037    this.evaluatorException = evaluatorException;
038    this.failedContextList = failedContextList;
039    this.failedTask = failedTask;
040  }
041
042  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
043  // Used by DatumWriter.  Applications should not call.
044  public java.lang.Object get(int field$) {
045    switch (field$) {
046    case 0: return id;
047    case 1: return evaluatorException;
048    case 2: return failedContextList;
049    case 3: return failedTask;
050    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
051    }
052  }
053
054  // Used by DatumReader.  Applications should not call.
055  @SuppressWarnings(value="unchecked")
056  public void put(int field$, java.lang.Object value$) {
057    switch (field$) {
058    case 0: id = (java.lang.CharSequence)value$; break;
059    case 1: evaluatorException = (java.lang.CharSequence)value$; break;
060    case 2: failedContextList = (java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext>)value$; break;
061    case 3: failedTask = (org.apache.reef.io.watcher.driver.task.AvroFailedTask)value$; break;
062    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
063    }
064  }
065
066  /**
067   * Gets the value of the 'id' field.
068   * @return The value of the 'id' field.
069   */
070  public java.lang.CharSequence getId() {
071    return id;
072  }
073
074  /**
075   * Sets the value of the 'id' field.
076   * @param value the value to set.
077   */
078  public void setId(java.lang.CharSequence value) {
079    this.id = value;
080  }
081
082  /**
083   * Gets the value of the 'evaluatorException' field.
084   * @return The value of the 'evaluatorException' field.
085   */
086  public java.lang.CharSequence getEvaluatorException() {
087    return evaluatorException;
088  }
089
090  /**
091   * Sets the value of the 'evaluatorException' field.
092   * @param value the value to set.
093   */
094  public void setEvaluatorException(java.lang.CharSequence value) {
095    this.evaluatorException = value;
096  }
097
098  /**
099   * Gets the value of the 'failedContextList' field.
100   * @return The value of the 'failedContextList' field.
101   */
102  public java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> getFailedContextList() {
103    return failedContextList;
104  }
105
106  /**
107   * Sets the value of the 'failedContextList' field.
108   * @param value the value to set.
109   */
110  public void setFailedContextList(java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> value) {
111    this.failedContextList = value;
112  }
113
114  /**
115   * Gets the value of the 'failedTask' field.
116   * @return The value of the 'failedTask' field.
117   */
118  public org.apache.reef.io.watcher.driver.task.AvroFailedTask getFailedTask() {
119    return failedTask;
120  }
121
122  /**
123   * Sets the value of the 'failedTask' field.
124   * @param value the value to set.
125   */
126  public void setFailedTask(org.apache.reef.io.watcher.driver.task.AvroFailedTask value) {
127    this.failedTask = value;
128  }
129
130  /**
131   * Creates a new AvroFailedEvaluator RecordBuilder.
132   * @return A new AvroFailedEvaluator RecordBuilder
133   */
134  public static org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder newBuilder() {
135    return new org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder();
136  }
137
138  /**
139   * Creates a new AvroFailedEvaluator RecordBuilder by copying an existing Builder.
140   * @param other The existing builder to copy.
141   * @return A new AvroFailedEvaluator RecordBuilder
142   */
143  public static org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder newBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder other) {
144    return new org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder(other);
145  }
146
147  /**
148   * Creates a new AvroFailedEvaluator RecordBuilder by copying an existing AvroFailedEvaluator instance.
149   * @param other The existing instance to copy.
150   * @return A new AvroFailedEvaluator RecordBuilder
151   */
152  public static org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder newBuilder(org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator other) {
153    return new org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder(other);
154  }
155
156  /**
157   * RecordBuilder for AvroFailedEvaluator instances.
158   */
159  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailedEvaluator>
160    implements org.apache.avro.data.RecordBuilder<AvroFailedEvaluator> {
161
162    private java.lang.CharSequence id;
163    private java.lang.CharSequence evaluatorException;
164    private java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> failedContextList;
165    private org.apache.reef.io.watcher.driver.task.AvroFailedTask failedTask;
166    private org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder failedTaskBuilder;
167
168    /** Creates a new Builder */
169    private Builder() {
170      super(SCHEMA$);
171    }
172
173    /**
174     * Creates a Builder by copying an existing Builder.
175     * @param other The existing Builder to copy.
176     */
177    private Builder(org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder other) {
178      super(other);
179      if (isValidValue(fields()[0], other.id)) {
180        this.id = data().deepCopy(fields()[0].schema(), other.id);
181        fieldSetFlags()[0] = true;
182      }
183      if (isValidValue(fields()[1], other.evaluatorException)) {
184        this.evaluatorException = data().deepCopy(fields()[1].schema(), other.evaluatorException);
185        fieldSetFlags()[1] = true;
186      }
187      if (isValidValue(fields()[2], other.failedContextList)) {
188        this.failedContextList = data().deepCopy(fields()[2].schema(), other.failedContextList);
189        fieldSetFlags()[2] = true;
190      }
191      if (isValidValue(fields()[3], other.failedTask)) {
192        this.failedTask = data().deepCopy(fields()[3].schema(), other.failedTask);
193        fieldSetFlags()[3] = true;
194      }
195      if (other.hasFailedTaskBuilder()) {
196        this.failedTaskBuilder = org.apache.reef.io.watcher.driver.task.AvroFailedTask.newBuilder(other.getFailedTaskBuilder());
197      }
198    }
199
200    /**
201     * Creates a Builder by copying an existing AvroFailedEvaluator instance
202     * @param other The existing instance to copy.
203     */
204    private Builder(org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator other) {
205            super(SCHEMA$);
206      if (isValidValue(fields()[0], other.id)) {
207        this.id = data().deepCopy(fields()[0].schema(), other.id);
208        fieldSetFlags()[0] = true;
209      }
210      if (isValidValue(fields()[1], other.evaluatorException)) {
211        this.evaluatorException = data().deepCopy(fields()[1].schema(), other.evaluatorException);
212        fieldSetFlags()[1] = true;
213      }
214      if (isValidValue(fields()[2], other.failedContextList)) {
215        this.failedContextList = data().deepCopy(fields()[2].schema(), other.failedContextList);
216        fieldSetFlags()[2] = true;
217      }
218      if (isValidValue(fields()[3], other.failedTask)) {
219        this.failedTask = data().deepCopy(fields()[3].schema(), other.failedTask);
220        fieldSetFlags()[3] = true;
221      }
222      this.failedTaskBuilder = null;
223    }
224
225    /**
226      * Gets the value of the 'id' field.
227      * @return The value.
228      */
229    public java.lang.CharSequence getId() {
230      return id;
231    }
232
233    /**
234      * Sets the value of the 'id' field.
235      * @param value The value of 'id'.
236      * @return This builder.
237      */
238    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder setId(java.lang.CharSequence value) {
239      validate(fields()[0], value);
240      this.id = value;
241      fieldSetFlags()[0] = true;
242      return this;
243    }
244
245    /**
246      * Checks whether the 'id' field has been set.
247      * @return True if the 'id' field has been set, false otherwise.
248      */
249    public boolean hasId() {
250      return fieldSetFlags()[0];
251    }
252
253
254    /**
255      * Clears the value of the 'id' field.
256      * @return This builder.
257      */
258    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder clearId() {
259      id = null;
260      fieldSetFlags()[0] = false;
261      return this;
262    }
263
264    /**
265      * Gets the value of the 'evaluatorException' field.
266      * @return The value.
267      */
268    public java.lang.CharSequence getEvaluatorException() {
269      return evaluatorException;
270    }
271
272    /**
273      * Sets the value of the 'evaluatorException' field.
274      * @param value The value of 'evaluatorException'.
275      * @return This builder.
276      */
277    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder setEvaluatorException(java.lang.CharSequence value) {
278      validate(fields()[1], value);
279      this.evaluatorException = value;
280      fieldSetFlags()[1] = true;
281      return this;
282    }
283
284    /**
285      * Checks whether the 'evaluatorException' field has been set.
286      * @return True if the 'evaluatorException' field has been set, false otherwise.
287      */
288    public boolean hasEvaluatorException() {
289      return fieldSetFlags()[1];
290    }
291
292
293    /**
294      * Clears the value of the 'evaluatorException' field.
295      * @return This builder.
296      */
297    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder clearEvaluatorException() {
298      evaluatorException = null;
299      fieldSetFlags()[1] = false;
300      return this;
301    }
302
303    /**
304      * Gets the value of the 'failedContextList' field.
305      * @return The value.
306      */
307    public java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> getFailedContextList() {
308      return failedContextList;
309    }
310
311    /**
312      * Sets the value of the 'failedContextList' field.
313      * @param value The value of 'failedContextList'.
314      * @return This builder.
315      */
316    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder setFailedContextList(java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext> value) {
317      validate(fields()[2], value);
318      this.failedContextList = value;
319      fieldSetFlags()[2] = true;
320      return this;
321    }
322
323    /**
324      * Checks whether the 'failedContextList' field has been set.
325      * @return True if the 'failedContextList' field has been set, false otherwise.
326      */
327    public boolean hasFailedContextList() {
328      return fieldSetFlags()[2];
329    }
330
331
332    /**
333      * Clears the value of the 'failedContextList' field.
334      * @return This builder.
335      */
336    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder clearFailedContextList() {
337      failedContextList = null;
338      fieldSetFlags()[2] = false;
339      return this;
340    }
341
342    /**
343      * Gets the value of the 'failedTask' field.
344      * @return The value.
345      */
346    public org.apache.reef.io.watcher.driver.task.AvroFailedTask getFailedTask() {
347      return failedTask;
348    }
349
350    /**
351      * Sets the value of the 'failedTask' field.
352      * @param value The value of 'failedTask'.
353      * @return This builder.
354      */
355    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder setFailedTask(org.apache.reef.io.watcher.driver.task.AvroFailedTask value) {
356      validate(fields()[3], value);
357      this.failedTaskBuilder = null;
358      this.failedTask = value;
359      fieldSetFlags()[3] = true;
360      return this;
361    }
362
363    /**
364      * Checks whether the 'failedTask' field has been set.
365      * @return True if the 'failedTask' field has been set, false otherwise.
366      */
367    public boolean hasFailedTask() {
368      return fieldSetFlags()[3];
369    }
370
371    /**
372     * Gets the Builder instance for the 'failedTask' field and creates one if it doesn't exist yet.
373     * @return This builder.
374     */
375    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder getFailedTaskBuilder() {
376      if (failedTaskBuilder == null) {
377        if (hasFailedTask()) {
378          setFailedTaskBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.newBuilder(failedTask));
379        } else {
380          setFailedTaskBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.newBuilder());
381        }
382      }
383      return failedTaskBuilder;
384    }
385
386    /**
387     * Sets the Builder instance for the 'failedTask' field
388     * @param value The builder instance that must be set.
389     * @return This builder.
390     */
391    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder setFailedTaskBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder value) {
392      clearFailedTask();
393      failedTaskBuilder = value;
394      return this;
395    }
396
397    /**
398     * Checks whether the 'failedTask' field has an active Builder instance
399     * @return True if the 'failedTask' field has an active Builder instance
400     */
401    public boolean hasFailedTaskBuilder() {
402      return failedTaskBuilder != null;
403    }
404
405    /**
406      * Clears the value of the 'failedTask' field.
407      * @return This builder.
408      */
409    public org.apache.reef.io.watcher.driver.evaluator.AvroFailedEvaluator.Builder clearFailedTask() {
410      failedTask = null;
411      failedTaskBuilder = null;
412      fieldSetFlags()[3] = false;
413      return this;
414    }
415
416    @Override
417    public AvroFailedEvaluator build() {
418      try {
419        AvroFailedEvaluator record = new AvroFailedEvaluator();
420        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
421        record.evaluatorException = fieldSetFlags()[1] ? this.evaluatorException : (java.lang.CharSequence) defaultValue(fields()[1]);
422        record.failedContextList = fieldSetFlags()[2] ? this.failedContextList : (java.util.List<org.apache.reef.io.watcher.driver.context.AvroFailedContext>) defaultValue(fields()[2]);
423        if (failedTaskBuilder != null) {
424          record.failedTask = this.failedTaskBuilder.build();
425        } else {
426          record.failedTask = fieldSetFlags()[3] ? this.failedTask : (org.apache.reef.io.watcher.driver.task.AvroFailedTask) defaultValue(fields()[3]);
427        }
428        return record;
429      } catch (Exception e) {
430        throw new org.apache.avro.AvroRuntimeException(e);
431      }
432    }
433  }
434
435  private static final org.apache.avro.io.DatumWriter
436    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
437
438  @Override public void writeExternal(java.io.ObjectOutput out)
439    throws java.io.IOException {
440    WRITER$.write(this, SpecificData.getEncoder(out));
441  }
442
443  private static final org.apache.avro.io.DatumReader
444    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
445
446  @Override public void readExternal(java.io.ObjectInput in)
447    throws java.io.IOException {
448    READER$.read(this, SpecificData.getDecoder(in));
449  }
450
451}