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.task;
007
008import org.apache.avro.specific.SpecificData;
009
010@SuppressWarnings("all")
011@org.apache.avro.specific.AvroGenerated
012public class AvroFailedTask extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -7992044544888107003L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroFailedTask\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"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\":\"activeContext\",\"type\":[{\"type\":\"record\",\"name\":\"AvroActiveContext\",\"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\"]}]}}]},\"null\"]}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public org.apache.reef.io.watcher.common.AvroFailure failure;
017  @Deprecated public org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext;
018
019  /**
020   * Default constructor.  Note that this does not initialize fields
021   * to their default values from the schema.  If that is desired then
022   * one should use <code>newBuilder()</code>.
023   */
024  public AvroFailedTask() {}
025
026  /**
027   * All-args constructor.
028   * @param failure The new value for failure
029   * @param activeContext The new value for activeContext
030   */
031  public AvroFailedTask(org.apache.reef.io.watcher.common.AvroFailure failure, org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext) {
032    this.failure = failure;
033    this.activeContext = activeContext;
034  }
035
036  public org.apache.avro.Schema getSchema() { return SCHEMA$; }
037  // Used by DatumWriter.  Applications should not call.
038  public java.lang.Object get(int field$) {
039    switch (field$) {
040    case 0: return failure;
041    case 1: return activeContext;
042    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
043    }
044  }
045
046  // Used by DatumReader.  Applications should not call.
047  @SuppressWarnings(value="unchecked")
048  public void put(int field$, java.lang.Object value$) {
049    switch (field$) {
050    case 0: failure = (org.apache.reef.io.watcher.common.AvroFailure)value$; break;
051    case 1: activeContext = (org.apache.reef.io.watcher.driver.context.AvroActiveContext)value$; break;
052    default: throw new org.apache.avro.AvroRuntimeException("Bad index");
053    }
054  }
055
056  /**
057   * Gets the value of the 'failure' field.
058   * @return The value of the 'failure' field.
059   */
060  public org.apache.reef.io.watcher.common.AvroFailure getFailure() {
061    return failure;
062  }
063
064  /**
065   * Sets the value of the 'failure' field.
066   * @param value the value to set.
067   */
068  public void setFailure(org.apache.reef.io.watcher.common.AvroFailure value) {
069    this.failure = value;
070  }
071
072  /**
073   * Gets the value of the 'activeContext' field.
074   * @return The value of the 'activeContext' field.
075   */
076  public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() {
077    return activeContext;
078  }
079
080  /**
081   * Sets the value of the 'activeContext' field.
082   * @param value the value to set.
083   */
084  public void setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
085    this.activeContext = value;
086  }
087
088  /**
089   * Creates a new AvroFailedTask RecordBuilder.
090   * @return A new AvroFailedTask RecordBuilder
091   */
092  public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder() {
093    return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder();
094  }
095
096  /**
097   * Creates a new AvroFailedTask RecordBuilder by copying an existing Builder.
098   * @param other The existing builder to copy.
099   * @return A new AvroFailedTask RecordBuilder
100   */
101  public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder other) {
102    return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder(other);
103  }
104
105  /**
106   * Creates a new AvroFailedTask RecordBuilder by copying an existing AvroFailedTask instance.
107   * @param other The existing instance to copy.
108   * @return A new AvroFailedTask RecordBuilder
109   */
110  public static org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroFailedTask other) {
111    return new org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder(other);
112  }
113
114  /**
115   * RecordBuilder for AvroFailedTask instances.
116   */
117  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroFailedTask>
118    implements org.apache.avro.data.RecordBuilder<AvroFailedTask> {
119
120    private org.apache.reef.io.watcher.common.AvroFailure failure;
121    private org.apache.reef.io.watcher.common.AvroFailure.Builder failureBuilder;
122    private org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext;
123    private org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder activeContextBuilder;
124
125    /** Creates a new Builder */
126    private Builder() {
127      super(SCHEMA$);
128    }
129
130    /**
131     * Creates a Builder by copying an existing Builder.
132     * @param other The existing Builder to copy.
133     */
134    private Builder(org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder other) {
135      super(other);
136      if (isValidValue(fields()[0], other.failure)) {
137        this.failure = data().deepCopy(fields()[0].schema(), other.failure);
138        fieldSetFlags()[0] = true;
139      }
140      if (other.hasFailureBuilder()) {
141        this.failureBuilder = org.apache.reef.io.watcher.common.AvroFailure.newBuilder(other.getFailureBuilder());
142      }
143      if (isValidValue(fields()[1], other.activeContext)) {
144        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
145        fieldSetFlags()[1] = true;
146      }
147      if (other.hasActiveContextBuilder()) {
148        this.activeContextBuilder = org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(other.getActiveContextBuilder());
149      }
150    }
151
152    /**
153     * Creates a Builder by copying an existing AvroFailedTask instance
154     * @param other The existing instance to copy.
155     */
156    private Builder(org.apache.reef.io.watcher.driver.task.AvroFailedTask other) {
157            super(SCHEMA$);
158      if (isValidValue(fields()[0], other.failure)) {
159        this.failure = data().deepCopy(fields()[0].schema(), other.failure);
160        fieldSetFlags()[0] = true;
161      }
162      this.failureBuilder = null;
163      if (isValidValue(fields()[1], other.activeContext)) {
164        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
165        fieldSetFlags()[1] = true;
166      }
167      this.activeContextBuilder = null;
168    }
169
170    /**
171      * Gets the value of the 'failure' field.
172      * @return The value.
173      */
174    public org.apache.reef.io.watcher.common.AvroFailure getFailure() {
175      return failure;
176    }
177
178    /**
179      * Sets the value of the 'failure' field.
180      * @param value The value of 'failure'.
181      * @return This builder.
182      */
183    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setFailure(org.apache.reef.io.watcher.common.AvroFailure value) {
184      validate(fields()[0], value);
185      this.failureBuilder = null;
186      this.failure = value;
187      fieldSetFlags()[0] = true;
188      return this;
189    }
190
191    /**
192      * Checks whether the 'failure' field has been set.
193      * @return True if the 'failure' field has been set, false otherwise.
194      */
195    public boolean hasFailure() {
196      return fieldSetFlags()[0];
197    }
198
199    /**
200     * Gets the Builder instance for the 'failure' field and creates one if it doesn't exist yet.
201     * @return This builder.
202     */
203    public org.apache.reef.io.watcher.common.AvroFailure.Builder getFailureBuilder() {
204      if (failureBuilder == null) {
205        if (hasFailure()) {
206          setFailureBuilder(org.apache.reef.io.watcher.common.AvroFailure.newBuilder(failure));
207        } else {
208          setFailureBuilder(org.apache.reef.io.watcher.common.AvroFailure.newBuilder());
209        }
210      }
211      return failureBuilder;
212    }
213
214    /**
215     * Sets the Builder instance for the 'failure' field
216     * @param value The builder instance that must be set.
217     * @return This builder.
218     */
219    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setFailureBuilder(org.apache.reef.io.watcher.common.AvroFailure.Builder value) {
220      clearFailure();
221      failureBuilder = value;
222      return this;
223    }
224
225    /**
226     * Checks whether the 'failure' field has an active Builder instance
227     * @return True if the 'failure' field has an active Builder instance
228     */
229    public boolean hasFailureBuilder() {
230      return failureBuilder != null;
231    }
232
233    /**
234      * Clears the value of the 'failure' field.
235      * @return This builder.
236      */
237    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder clearFailure() {
238      failure = null;
239      failureBuilder = null;
240      fieldSetFlags()[0] = false;
241      return this;
242    }
243
244    /**
245      * Gets the value of the 'activeContext' field.
246      * @return The value.
247      */
248    public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() {
249      return activeContext;
250    }
251
252    /**
253      * Sets the value of the 'activeContext' field.
254      * @param value The value of 'activeContext'.
255      * @return This builder.
256      */
257    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
258      validate(fields()[1], value);
259      this.activeContextBuilder = null;
260      this.activeContext = value;
261      fieldSetFlags()[1] = true;
262      return this;
263    }
264
265    /**
266      * Checks whether the 'activeContext' field has been set.
267      * @return True if the 'activeContext' field has been set, false otherwise.
268      */
269    public boolean hasActiveContext() {
270      return fieldSetFlags()[1];
271    }
272
273    /**
274     * Gets the Builder instance for the 'activeContext' field and creates one if it doesn't exist yet.
275     * @return This builder.
276     */
277    public org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder getActiveContextBuilder() {
278      if (activeContextBuilder == null) {
279        if (hasActiveContext()) {
280          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(activeContext));
281        } else {
282          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder());
283        }
284      }
285      return activeContextBuilder;
286    }
287
288    /**
289     * Sets the Builder instance for the 'activeContext' field
290     * @param value The builder instance that must be set.
291     * @return This builder.
292     */
293    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder value) {
294      clearActiveContext();
295      activeContextBuilder = value;
296      return this;
297    }
298
299    /**
300     * Checks whether the 'activeContext' field has an active Builder instance
301     * @return True if the 'activeContext' field has an active Builder instance
302     */
303    public boolean hasActiveContextBuilder() {
304      return activeContextBuilder != null;
305    }
306
307    /**
308      * Clears the value of the 'activeContext' field.
309      * @return This builder.
310      */
311    public org.apache.reef.io.watcher.driver.task.AvroFailedTask.Builder clearActiveContext() {
312      activeContext = null;
313      activeContextBuilder = null;
314      fieldSetFlags()[1] = false;
315      return this;
316    }
317
318    @Override
319    public AvroFailedTask build() {
320      try {
321        AvroFailedTask record = new AvroFailedTask();
322        if (failureBuilder != null) {
323          record.failure = this.failureBuilder.build();
324        } else {
325          record.failure = fieldSetFlags()[0] ? this.failure : (org.apache.reef.io.watcher.common.AvroFailure) defaultValue(fields()[0]);
326        }
327        if (activeContextBuilder != null) {
328          record.activeContext = this.activeContextBuilder.build();
329        } else {
330          record.activeContext = fieldSetFlags()[1] ? this.activeContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) defaultValue(fields()[1]);
331        }
332        return record;
333      } catch (Exception e) {
334        throw new org.apache.avro.AvroRuntimeException(e);
335      }
336    }
337  }
338
339  private static final org.apache.avro.io.DatumWriter
340    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
341
342  @Override public void writeExternal(java.io.ObjectOutput out)
343    throws java.io.IOException {
344    WRITER$.write(this, SpecificData.getEncoder(out));
345  }
346
347  private static final org.apache.avro.io.DatumReader
348    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
349
350  @Override public void readExternal(java.io.ObjectInput in)
351    throws java.io.IOException {
352    READER$.read(this, SpecificData.getDecoder(in));
353  }
354
355}