datahub/wherehows-backend/app/msgs/EtlJobMessage.java

78 lines
1.9 KiB
Java
Raw Normal View History

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;
import java.util.Properties;
import metadata.etl.models.EtlType;
import metadata.etl.models.RefIdType;
import wherehows.common.Constant;
2015-11-19 14:39:21 -08:00
/**
* Created by zechen on 9/4/15.
*/
public class EtlJobMessage {
private static int DEFAULT_TIMEOUT = 20000;
private Long whEtlExecId;
private String etlJobName;
private Properties etlJobProperties;
public EtlJobMessage(String etlJobName, Properties etlJobProperties) {
2015-11-19 14:39:21 -08:00
this.etlJobName = etlJobName;
this.etlJobProperties = etlJobProperties;
2015-11-19 14:39:21 -08:00
}
public Long getWhEtlExecId() {
return whEtlExecId;
}
public void setWhEtlExecId(Long whEtlExecId) {
this.whEtlExecId = whEtlExecId;
}
public String getEtlJobName() {
2015-11-19 14:39:21 -08:00
return etlJobName;
}
public Properties getEtlJobProperties() {
return etlJobProperties;
2015-11-19 14:39:21 -08:00
}
public String getCmdParam() {
return etlJobProperties.getProperty(Constant.JOB_CMD_PARAMS_KEY, "");
}
public int getTimeout() {
String timeout = etlJobProperties.getProperty(Constant.JOB_TIMEOUT_KEY, null);
if (timeout == null) {
return DEFAULT_TIMEOUT;
}
return Integer.parseInt(timeout);
}
public String getCronExpr() {
return etlJobProperties.getProperty(Constant.JOB_CRON_EXPR_KEY, null);
}
2015-11-19 14:39:21 -08:00
/**
* For debuging
* @return
*/
public String toDebugString() {
return String.format("(jobName:%s, whEtlExecId:%d)", this.etlJobName, this.whEtlExecId);
2015-11-19 14:39:21 -08:00
}
}