本文整理了Java中azkaban.utils.Utils
类的一些代码示例,展示了Utils
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils
类的具体详情如下:
包路径:azkaban.utils.Utils
类名称:Utils
[英]A util helper class full of static methods that are commonly used.
[中]一个包含常用静态方法的util helper类。
代码示例来源:origin: azkaban/azkaban
private File unzipFile(final File archiveFile) throws IOException {
final ZipFile zipfile = new ZipFile(archiveFile);
final File unzipped = Utils.createTempDir(this.tempDir);
Utils.unzip(zipfile, unzipped);
zipfile.close();
return unzipped;
}
代码示例来源:origin: azkaban/azkaban
public TriggerAction createAction(final String type, final Object... args) {
TriggerAction action = null;
final Class<? extends TriggerAction> actionClass = actionToClass.get(type);
action = (TriggerAction) Utils.callConstructor(actionClass, args);
return action;
}
代码示例来源:origin: azkaban/azkaban
@Override
public Object toJson() {
final Map<String, Object> jsonObj = new HashMap<>();
jsonObj.put("type", type);
jsonObj.put("firstCheckTime", String.valueOf(this.firstCheckTime));
jsonObj.put("timezone", this.timezone.getID());
jsonObj.put("nextCheckTime", String.valueOf(this.nextCheckTime));
jsonObj.put("isRecurring", String.valueOf(this.isRecurring));
jsonObj.put("skipPastChecks", String.valueOf(this.skipPastChecks));
jsonObj.put("period", Utils.createPeriodString(this.period));
jsonObj.put("id", this.id);
jsonObj.put("cronExpression", this.cronExpression);
return jsonObj;
}
代码示例来源:origin: azkaban/azkaban
public static Object callConstructor(final Class<?> c, final Object... args) {
return callConstructor(c, getTypes(args), args);
}
代码示例来源:origin: azkaban/azkaban
public static File createTempDir() {
return createTempDir(new File(System.getProperty("java.io.tmpdir")));
}
代码示例来源:origin: azkaban/azkaban
public static BasicTimeChecker createFromJson(final HashMap<String, Object> obj)
throws Exception {
final Map<String, Object> jsonObj = (HashMap<String, Object>) obj;
if (!jsonObj.get("type").equals(type)) {
throw new Exception("Cannot create checker of " + type + " from "
+ jsonObj.get("type"));
}
final Long firstCheckTime = Long.valueOf((String) jsonObj.get("firstCheckTime"));
final String timezoneId = (String) jsonObj.get("timezone");
final long nextCheckTime = Long.valueOf((String) jsonObj.get("nextCheckTime"));
final DateTimeZone timezone = DateTimeZone.forID(timezoneId);
final boolean isRecurring = Boolean.valueOf((String) jsonObj.get("isRecurring"));
final boolean skipPastChecks =
Boolean.valueOf((String) jsonObj.get("skipPastChecks"));
final ReadablePeriod period =
Utils.parsePeriodString((String) jsonObj.get("period"));
final String id = (String) jsonObj.get("id");
final String cronExpression = (String) jsonObj.get("cronExpression");
final BasicTimeChecker checker =
new BasicTimeChecker(id, firstCheckTime, timezone, nextCheckTime,
isRecurring, skipPastChecks, period, cronExpression);
if (skipPastChecks) {
checker.updateNextCheckTime();
}
return checker;
}
代码示例来源:origin: azkaban/azkaban
message.println("<tr><td>" + sdf.format(new Date(triggerInst.getEndTime())) + "</td><td>");
message.println("<tr><td>Duration</td><td>"
+ Utils.formatDuration(triggerInst.getStartTime(), triggerInst.getEndTime())
+ "</td></tr>");
message.println("<tr><td>Status</td><td>" + triggerInst.getStatus() + "</td></tr>");
代码示例来源:origin: azkaban/azkaban
@Override
public String toString() {
return Utils.flattenToString(this.permissions, ",");
}
代码示例来源:origin: azkaban/azkaban
public TriggerAction createActionFromJson(final String type, final Object obj)
throws Exception {
TriggerAction action = null;
final Class<? extends TriggerAction> actionClass = actionToClass.get(type);
if (actionClass == null) {
throw new Exception("Action Type " + type + " not supported!");
}
action =
(TriggerAction) Utils.invokeStaticMethod(actionClass.getClassLoader(),
actionClass.getName(), "createFromJson", obj);
return action;
}
代码示例来源:origin: azkaban/azkaban
public BasicTimeChecker(final String id, final long firstCheckTime,
final DateTimeZone timezone, final long nextCheckTime, final boolean isRecurring,
final boolean skipPastChecks, final ReadablePeriod period, final String cronExpression) {
this.id = id;
this.firstCheckTime = firstCheckTime;
this.timezone = timezone;
this.nextCheckTime = nextCheckTime;
this.isRecurring = isRecurring;
this.skipPastChecks = skipPastChecks;
this.period = period;
this.cronExpression = cronExpression;
this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
logger.info("Downloading zip file.");
ZipFile zip = new ZipFile(projectFileHandler.getLocalFile());
Utils.unzip(zip, tempDir);
代码示例来源:origin: azkaban/azkaban
x = Utils.convertToDouble(layoutInfo.get("x"));
y = Utils.convertToDouble(layoutInfo.get("y"));
level = (Integer) layoutInfo.get("level");
} catch (final ClassCastException e) {
代码示例来源:origin: azkaban/azkaban
final File tempDir = Utils.createTempDir();
OutputStream out = null;
try {
代码示例来源:origin: com.linkedin.azkaban/azkaban
public static Object callConstructor(Class<?> c, Object... args) {
return callConstructor(c, getTypes(args), args);
}
代码示例来源:origin: azkaban/azkaban
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
if (this.checkTime < flow.getStartTime()) {
final ReadablePeriod duration =
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(flow.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
Utils.parsePeriodString((String) this.slaOption.getInfo().get(
SlaOption.INFO_DURATION));
final DateTime startTime = new DateTime(node.getStartTime());
代码示例来源:origin: azkaban/azkaban
+ convertMSToString(flow.getEndTime()) + "</td></tr>");
message.println("<tr><td>Duration</td><td>"
+ Utils.formatDuration(flow.getStartTime(), flow.getEndTime())
+ "</td></tr>");
message.println("<tr><td>Status</td><td>" + flow.getStatus() + "</td></tr>");
代码示例来源:origin: azkaban/azkaban
page.add("admins", Utils.flattenToString(
project.getUsersWithPermission(Type.ADMIN), ","));
final Permission perm = this.getPermissionObject(project, user, Type.ADMIN);
代码示例来源:origin: azkaban/azkaban
public ConditionChecker createCheckerFromJson(final String type, final Object obj)
throws Exception {
ConditionChecker checker = null;
final Class<? extends ConditionChecker> checkerClass = checkerToClass.get(type);
if (checkerClass == null) {
throw new Exception("Checker type " + type + " not supported!");
}
checker =
(ConditionChecker) Utils.invokeStaticMethod(
checkerClass.getClassLoader(), checkerClass.getName(),
"createFromJson", obj);
return checker;
}
代码示例来源:origin: azkaban/azkaban
public BasicTimeChecker(final String id, final long firstCheckTime,
final DateTimeZone timezone, final boolean isRecurring, final boolean skipPastChecks,
final ReadablePeriod period, final String cronExpression) {
this.id = id;
this.firstCheckTime = firstCheckTime;
this.timezone = timezone;
this.isRecurring = isRecurring;
this.skipPastChecks = skipPastChecks;
this.period = period;
this.nextCheckTime = firstCheckTime;
this.cronExpression = cronExpression;
this.cronExecutionTime = Utils.parseCronExpression(cronExpression, timezone);
this.nextCheckTime = calculateNextCheckTime();
}
代码示例来源:origin: com.linkedin.azkaban/azkaban
x = Utils.convertToDouble(layoutInfo.get("x"));
y = Utils.convertToDouble(layoutInfo.get("y"));
level = (Integer)layoutInfo.get("level");
内容来源于网络,如有侵权,请联系作者删除!