예제 #1
0
  /**
   * builds an ScheduleItem object from a Result object obtained from a Scan or Get in the
   * underlying storage
   *
   * @param result
   * @return
   */
  public static ScheduleItem fromResultObject(Schedule schedule, Result result) {
    ScheduleItem r = ScheduleItem.fromRowKey(schedule, result.getRowKey());

    byte[] stat = result.getValue("bigs", "status");
    if (stat != null) {
      r.setStatusFromString(new String(stat));
    }

    byte[] etime = result.getValue("bigs", "elapsedtime");
    if (etime != null) {
      r.setElapsedTime(new Long(new String(etime)));
    }

    byte[] lastupdate = result.getValue("bigs", "lastupdate");
    if (lastupdate != null) {
      r.setLastUpdateFromString(new String(lastupdate));
    }

    byte[] suuid = result.getValue("bigs", "uuid");
    if (suuid != null) {
      r.setUuidStored(new String(suuid));
    }

    byte[] smethod = result.getValue("scheduling", "method");
    if (smethod != null) {
      r.setMethodName(new String(smethod));
    }

    byte[] shostname = result.getValue("bigs", "hostname");
    if (shostname != null) {
      r.setHostnameStored(new String(shostname));
    }

    String parentsIdsString = new String(result.getValue("scheduling", "parents"));

    if (parentsIdsString != null && !parentsIdsString.trim().isEmpty()) {
      r.parentsRowkeys = Text.parseObjectList(parentsIdsString, " ", String.class);
    }

    r.preparedTask = TaskHelper.fromResultObject(result, "scheduling", "task.class", "task.object");
    r.processState = State.fromResultObject(result, "content", "class", "data");
    r.preparedTaskContainer =
        TaskContainer.fromResultObject(
            result, "scheduling", "task.container.class", "task.container.object");
    if (schedule != null) {
      r.preparedTaskContainer.setPipelineStage(schedule.getPipelineStage());
    }
    r.tags = result.getFamilyMap("tags");

    return r;
  }
예제 #2
0
 public ScheduleItem clone() {
   ScheduleItem r = new ScheduleItem(this.schedule);
   r.preparedTask = this.preparedTask;
   r.preparedTaskContainer = this.preparedTaskContainer;
   r.rowkey = this.rowkey;
   r.parentsRowkeys = this.parentsRowkeys;
   r.hostnameStored = this.hostnameStored;
   r.uuiStored = this.uuiStored;
   r.lastUpdate = this.lastUpdate;
   r.status = this.status;
   r.elapsedTime = this.elapsedTime;
   r.processState = this.processState;
   r.rowkey = this.rowkey;
   return r;
 }