本文整理汇总了Java中org.apache.kylin.job.dao.ExecutablePO.getType方法的典型用法代码示例。如果您正苦于以下问题:Java ExecutablePO.getType方法的具体用法?Java ExecutablePO.getType怎么用?Java ExecutablePO.getType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.kylin.job.dao.ExecutablePO
的用法示例。
在下文中一共展示了ExecutablePO.getType方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: parseTo
import org.apache.kylin.job.dao.ExecutablePO; //导入方法依赖的package包/类
private static AbstractExecutable parseTo(ExecutablePO executablePO) {
if (executablePO == null) {
return null;
}
String type = executablePO.getType();
try {
Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class);
Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor();
AbstractExecutable result = constructor.newInstance();
result.setId(executablePO.getUuid());
result.setName(executablePO.getName());
result.setParams(executablePO.getParams());
List<ExecutablePO> tasks = executablePO.getTasks();
if (tasks != null && !tasks.isEmpty()) {
Preconditions.checkArgument(result instanceof DefaultChainedExecutable);
for (ExecutablePO subTask: tasks) {
((DefaultChainedExecutable) result).addTask(parseTo(subTask));
}
}
return result;
} catch (ReflectiveOperationException e) {
throw new IllegalArgumentException("cannot parse this job:" + executablePO.getId(), e);
}
}
示例2: parseTo
import org.apache.kylin.job.dao.ExecutablePO; //导入方法依赖的package包/类
private AbstractExecutable parseTo(ExecutablePO executablePO) {
if (executablePO == null) {
logger.warn("executablePO is null");
return null;
}
String type = executablePO.getType();
try {
Class<? extends AbstractExecutable> clazz = ClassUtil.forName(type, AbstractExecutable.class);
Constructor<? extends AbstractExecutable> constructor = clazz.getConstructor();
AbstractExecutable result = constructor.newInstance();
result.initConfig(config);
result.setId(executablePO.getUuid());
result.setName(executablePO.getName());
result.setParams(executablePO.getParams());
List<ExecutablePO> tasks = executablePO.getTasks();
if (tasks != null && !tasks.isEmpty()) {
Preconditions.checkArgument(result instanceof ChainedExecutable);
for (ExecutablePO subTask : tasks) {
((ChainedExecutable) result).addTask(parseTo(subTask));
}
}
List<ExecutablePO> tasksForCheck = executablePO.getTasksForCheck();
if (tasksForCheck != null && !tasksForCheck.isEmpty()) {
Preconditions.checkArgument(result instanceof CheckpointExecutable);
for (ExecutablePO subTaskForCheck : tasksForCheck) {
((CheckpointExecutable) result).addTaskForCheck(parseTo(subTaskForCheck));
}
}
return result;
} catch (ReflectiveOperationException e) {
throw new IllegalStateException("cannot parse this job:" + executablePO.getId(), e);
}
}