예제 #1
0
 private PreparedStatement getStatement(Connection connection, String query, Job job)
     throws SQLException {
   PutFileRequest request = (PutFileRequest) job;
   TRetentionPolicy retentionPolicy = request.getRetentionPolicy();
   TAccessLatency accessLatency = request.getAccessLatency();
   return getPreparedStatement(
       connection,
       query,
       request.getNextJobId(),
       request.getCreationTime(),
       request.getLifetime(),
       request.getState().getStateId(),
       request.getErrorMessage(),
       request.getSchedulerId(),
       request.getSchedulerTimeStamp(),
       0, // num of retries
       request.getLastStateTransitionTime(),
       request.getRequestId(),
       request.getStatusCodeString(),
       request.getSurlString(),
       request.getTurlString(),
       request.getFileId(),
       null, // parentFileId (unused)
       request.getSpaceReservationId(),
       request.getSize(),
       (retentionPolicy != null ? retentionPolicy.getValue() : null),
       (accessLatency != null ? accessLatency.getValue() : null),
       request.getId());
 }
예제 #2
0
 @Override
 public PreparedStatement getCreateStatement(Connection connection, Job job) throws SQLException {
   if (job == null || !(job instanceof PutFileRequest)) {
     throw new IllegalArgumentException("fr is not PutFileRequest");
   }
   PutFileRequest request = (PutFileRequest) job;
   TRetentionPolicy retentionPolicy = request.getRetentionPolicy();
   TAccessLatency accessLatency = request.getAccessLatency();
   return getPreparedStatement(
       connection,
       INSERT_SQL,
       request.getId(),
       request.getNextJobId(),
       request.getCreationTime(),
       request.getLifetime(),
       request.getState().getStateId(),
       request.getErrorMessage(),
       request.getSchedulerId(),
       request.getSchedulerTimeStamp(),
       0, // num of retries
       request.getLastStateTransitionTime(),
       request.getRequestId(),
       request.getStatusCodeString(),
       request.getSurlString(),
       request.getTurlString(),
       request.getFileId(),
       null, // parentFileId (unused)
       request.getSpaceReservationId(),
       request.getSize(),
       (retentionPolicy != null ? retentionPolicy.getValue() : null),
       (accessLatency != null ? accessLatency.getValue() : null));
 }
예제 #3
0
  @Override
  protected PutFileRequest getFileRequest(
      Connection _con,
      long ID,
      Long NEXTJOBID,
      long CREATIONTIME,
      long LIFETIME,
      int STATE,
      String ERRORMESSAGE,
      String SCHEDULERID,
      long SCHEDULER_TIMESTAMP,
      int NUMOFRETR,
      long LASTSTATETRANSITIONTIME,
      long REQUESTID,
      Long CREDENTIALID,
      String STATUSCODE,
      ResultSet set,
      int next_index)
      throws SQLException {
    String SURL = set.getString(next_index++);
    String TURL = set.getString(next_index++);
    String FILEID = set.getString(next_index++);
    String PARENTFILEID = set.getString(next_index++);
    String SPACERESERVATIONID = set.getString(next_index++);
    Long SIZE = set.getLong(next_index++);
    if (set.wasNull()) {
      SIZE = null;
    }
    String RETENTIONPOLICY = set.getString(next_index++);
    String ACCESSLATENCY = set.getString(next_index++);
    TRetentionPolicy retentionPolicy =
        RETENTIONPOLICY == null || RETENTIONPOLICY.equalsIgnoreCase("null")
            ? null
            : TRetentionPolicy.fromString(RETENTIONPOLICY);
    TAccessLatency accessLatency =
        ACCESSLATENCY == null || ACCESSLATENCY.equalsIgnoreCase("null")
            ? null
            : TAccessLatency.fromString(ACCESSLATENCY);

    Job.JobHistory[] jobHistoryArray = getJobHistory(ID, _con);
    return new PutFileRequest(
        ID,
        NEXTJOBID,
        CREATIONTIME,
        LIFETIME,
        STATE,
        ERRORMESSAGE,
        SCHEDULERID,
        SCHEDULER_TIMESTAMP,
        NUMOFRETR,
        LASTSTATETRANSITIONTIME,
        jobHistoryArray,
        REQUESTID,
        STATUSCODE,
        SURL,
        TURL,
        FILEID,
        SPACERESERVATIONID,
        SIZE,
        retentionPolicy,
        accessLatency);
  }