2015-11-19 14:39:21 -08:00
|
|
|
/**
|
|
|
|
* Copyright 2015 LinkedIn Corp. All rights reserved.
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
*/
|
|
|
|
package msgs;
|
|
|
|
|
|
|
|
import com.fasterxml.jackson.databind.JsonNode;
|
2017-06-05 15:40:05 -07:00
|
|
|
import java.util.Properties;
|
2016-02-29 16:33:17 -08:00
|
|
|
import metadata.etl.models.EtlType;
|
|
|
|
import metadata.etl.models.RefIdType;
|
2017-06-05 15:40:05 -07:00
|
|
|
import wherehows.common.Constant;
|
2015-11-19 14:39:21 -08:00
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Created by zechen on 9/4/15.
|
|
|
|
*/
|
|
|
|
public class EtlJobMessage {
|
2017-06-05 15:40:05 -07:00
|
|
|
private static int DEFAULT_TIMEOUT = 20000;
|
|
|
|
|
2017-05-10 17:43:56 -07:00
|
|
|
private Long whEtlExecId;
|
2017-06-05 15:40:05 -07:00
|
|
|
private String etlJobName;
|
|
|
|
private Properties etlJobProperties;
|
2017-05-10 17:43:56 -07:00
|
|
|
|
2017-06-05 15:40:05 -07:00
|
|
|
public EtlJobMessage(String etlJobName, Properties etlJobProperties) {
|
2015-11-19 14:39:21 -08:00
|
|
|
this.etlJobName = etlJobName;
|
2017-06-05 15:40:05 -07:00
|
|
|
this.etlJobProperties = etlJobProperties;
|
2015-11-19 14:39:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
public Long getWhEtlExecId() {
|
|
|
|
return whEtlExecId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void setWhEtlExecId(Long whEtlExecId) {
|
|
|
|
this.whEtlExecId = whEtlExecId;
|
|
|
|
}
|
|
|
|
|
2017-06-05 15:40:05 -07:00
|
|
|
public String getEtlJobName() {
|
2015-11-19 14:39:21 -08:00
|
|
|
return etlJobName;
|
|
|
|
}
|
|
|
|
|
2017-06-05 15:40:05 -07:00
|
|
|
public Properties getEtlJobProperties() {
|
|
|
|
return etlJobProperties;
|
2015-11-19 14:39:21 -08:00
|
|
|
}
|
|
|
|
|
2016-02-29 16:33:17 -08:00
|
|
|
public String getCmdParam() {
|
2017-06-05 15:40:05 -07:00
|
|
|
return etlJobProperties.getProperty(Constant.JOB_CMD_PARAMS_KEY, "");
|
2016-02-29 16:33:17 -08:00
|
|
|
}
|
|
|
|
|
2017-05-10 17:43:56 -07:00
|
|
|
public int getTimeout() {
|
2017-06-05 15:40:05 -07:00
|
|
|
String timeout = etlJobProperties.getProperty(Constant.JOB_TIMEOUT_KEY, null);
|
|
|
|
if (timeout == null) {
|
|
|
|
return DEFAULT_TIMEOUT;
|
|
|
|
}
|
|
|
|
return Integer.parseInt(timeout);
|
2017-05-10 17:43:56 -07:00
|
|
|
}
|
|
|
|
|
2017-06-05 15:40:05 -07:00
|
|
|
public String getCronExpr() {
|
|
|
|
return etlJobProperties.getProperty(Constant.JOB_CRON_EXPR_KEY, null);
|
2017-05-10 17:43:56 -07:00
|
|
|
}
|
|
|
|
|
2015-11-19 14:39:21 -08:00
|
|
|
/**
|
|
|
|
* For debuging
|
|
|
|
* @return
|
|
|
|
*/
|
|
|
|
public String toDebugString() {
|
2017-06-05 15:40:05 -07:00
|
|
|
return String.format("(jobName:%s, whEtlExecId:%d)", this.etlJobName, this.whEtlExecId);
|
2015-11-19 14:39:21 -08:00
|
|
|
}
|
|
|
|
}
|