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 AvroRunningTask extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
013  private static final long serialVersionUID = -504230958324499171L;
014  public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroRunningTask\",\"namespace\":\"org.apache.reef.io.watcher.driver.task\",\"fields\":[{\"name\":\"id\",\"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\"]}]}}]}}]}");
015  public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
016  @Deprecated public java.lang.CharSequence id;
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 AvroRunningTask() {}
025
026  /**
027   * All-args constructor.
028   * @param id The new value for id
029   * @param activeContext The new value for activeContext
030   */
031  public AvroRunningTask(java.lang.CharSequence id, org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext) {
032    this.id = id;
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 id;
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: id = (java.lang.CharSequence)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 'id' field.
058   * @return The value of the 'id' field.
059   */
060  public java.lang.CharSequence getId() {
061    return id;
062  }
063
064  /**
065   * Sets the value of the 'id' field.
066   * @param value the value to set.
067   */
068  public void setId(java.lang.CharSequence value) {
069    this.id = 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 AvroRunningTask RecordBuilder.
090   * @return A new AvroRunningTask RecordBuilder
091   */
092  public static org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder newBuilder() {
093    return new org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder();
094  }
095
096  /**
097   * Creates a new AvroRunningTask RecordBuilder by copying an existing Builder.
098   * @param other The existing builder to copy.
099   * @return A new AvroRunningTask RecordBuilder
100   */
101  public static org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder other) {
102    return new org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder(other);
103  }
104
105  /**
106   * Creates a new AvroRunningTask RecordBuilder by copying an existing AvroRunningTask instance.
107   * @param other The existing instance to copy.
108   * @return A new AvroRunningTask RecordBuilder
109   */
110  public static org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder newBuilder(org.apache.reef.io.watcher.driver.task.AvroRunningTask other) {
111    return new org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder(other);
112  }
113
114  /**
115   * RecordBuilder for AvroRunningTask instances.
116   */
117  public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroRunningTask>
118    implements org.apache.avro.data.RecordBuilder<AvroRunningTask> {
119
120    private java.lang.CharSequence id;
121    private org.apache.reef.io.watcher.driver.context.AvroActiveContext activeContext;
122    private org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder activeContextBuilder;
123
124    /** Creates a new Builder */
125    private Builder() {
126      super(SCHEMA$);
127    }
128
129    /**
130     * Creates a Builder by copying an existing Builder.
131     * @param other The existing Builder to copy.
132     */
133    private Builder(org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder other) {
134      super(other);
135      if (isValidValue(fields()[0], other.id)) {
136        this.id = data().deepCopy(fields()[0].schema(), other.id);
137        fieldSetFlags()[0] = true;
138      }
139      if (isValidValue(fields()[1], other.activeContext)) {
140        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
141        fieldSetFlags()[1] = true;
142      }
143      if (other.hasActiveContextBuilder()) {
144        this.activeContextBuilder = org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(other.getActiveContextBuilder());
145      }
146    }
147
148    /**
149     * Creates a Builder by copying an existing AvroRunningTask instance
150     * @param other The existing instance to copy.
151     */
152    private Builder(org.apache.reef.io.watcher.driver.task.AvroRunningTask other) {
153            super(SCHEMA$);
154      if (isValidValue(fields()[0], other.id)) {
155        this.id = data().deepCopy(fields()[0].schema(), other.id);
156        fieldSetFlags()[0] = true;
157      }
158      if (isValidValue(fields()[1], other.activeContext)) {
159        this.activeContext = data().deepCopy(fields()[1].schema(), other.activeContext);
160        fieldSetFlags()[1] = true;
161      }
162      this.activeContextBuilder = null;
163    }
164
165    /**
166      * Gets the value of the 'id' field.
167      * @return The value.
168      */
169    public java.lang.CharSequence getId() {
170      return id;
171    }
172
173    /**
174      * Sets the value of the 'id' field.
175      * @param value The value of 'id'.
176      * @return This builder.
177      */
178    public org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder setId(java.lang.CharSequence value) {
179      validate(fields()[0], value);
180      this.id = value;
181      fieldSetFlags()[0] = true;
182      return this;
183    }
184
185    /**
186      * Checks whether the 'id' field has been set.
187      * @return True if the 'id' field has been set, false otherwise.
188      */
189    public boolean hasId() {
190      return fieldSetFlags()[0];
191    }
192
193
194    /**
195      * Clears the value of the 'id' field.
196      * @return This builder.
197      */
198    public org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder clearId() {
199      id = null;
200      fieldSetFlags()[0] = false;
201      return this;
202    }
203
204    /**
205      * Gets the value of the 'activeContext' field.
206      * @return The value.
207      */
208    public org.apache.reef.io.watcher.driver.context.AvroActiveContext getActiveContext() {
209      return activeContext;
210    }
211
212    /**
213      * Sets the value of the 'activeContext' field.
214      * @param value The value of 'activeContext'.
215      * @return This builder.
216      */
217    public org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder setActiveContext(org.apache.reef.io.watcher.driver.context.AvroActiveContext value) {
218      validate(fields()[1], value);
219      this.activeContextBuilder = null;
220      this.activeContext = value;
221      fieldSetFlags()[1] = true;
222      return this;
223    }
224
225    /**
226      * Checks whether the 'activeContext' field has been set.
227      * @return True if the 'activeContext' field has been set, false otherwise.
228      */
229    public boolean hasActiveContext() {
230      return fieldSetFlags()[1];
231    }
232
233    /**
234     * Gets the Builder instance for the 'activeContext' field and creates one if it doesn't exist yet.
235     * @return This builder.
236     */
237    public org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder getActiveContextBuilder() {
238      if (activeContextBuilder == null) {
239        if (hasActiveContext()) {
240          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder(activeContext));
241        } else {
242          setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.newBuilder());
243        }
244      }
245      return activeContextBuilder;
246    }
247
248    /**
249     * Sets the Builder instance for the 'activeContext' field
250     * @param value The builder instance that must be set.
251     * @return This builder.
252     */
253    public org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder setActiveContextBuilder(org.apache.reef.io.watcher.driver.context.AvroActiveContext.Builder value) {
254      clearActiveContext();
255      activeContextBuilder = value;
256      return this;
257    }
258
259    /**
260     * Checks whether the 'activeContext' field has an active Builder instance
261     * @return True if the 'activeContext' field has an active Builder instance
262     */
263    public boolean hasActiveContextBuilder() {
264      return activeContextBuilder != null;
265    }
266
267    /**
268      * Clears the value of the 'activeContext' field.
269      * @return This builder.
270      */
271    public org.apache.reef.io.watcher.driver.task.AvroRunningTask.Builder clearActiveContext() {
272      activeContext = null;
273      activeContextBuilder = null;
274      fieldSetFlags()[1] = false;
275      return this;
276    }
277
278    @Override
279    public AvroRunningTask build() {
280      try {
281        AvroRunningTask record = new AvroRunningTask();
282        record.id = fieldSetFlags()[0] ? this.id : (java.lang.CharSequence) defaultValue(fields()[0]);
283        if (activeContextBuilder != null) {
284          record.activeContext = this.activeContextBuilder.build();
285        } else {
286          record.activeContext = fieldSetFlags()[1] ? this.activeContext : (org.apache.reef.io.watcher.driver.context.AvroActiveContext) defaultValue(fields()[1]);
287        }
288        return record;
289      } catch (Exception e) {
290        throw new org.apache.avro.AvroRuntimeException(e);
291      }
292    }
293  }
294
295  private static final org.apache.avro.io.DatumWriter
296    WRITER$ = new org.apache.avro.specific.SpecificDatumWriter(SCHEMA$);
297
298  @Override public void writeExternal(java.io.ObjectOutput out)
299    throws java.io.IOException {
300    WRITER$.write(this, SpecificData.getEncoder(out));
301  }
302
303  private static final org.apache.avro.io.DatumReader
304    READER$ = new org.apache.avro.specific.SpecificDatumReader(SCHEMA$);
305
306  @Override public void readExternal(java.io.ObjectInput in)
307    throws java.io.IOException {
308    READER$.read(this, SpecificData.getDecoder(in));
309  }
310
311}