private void createDashboardConfigFile() throws IOException { try (FileWriter fw = createOrGetFile(webDir, "config")) { fw.write(createConfigJson(DashboardConfiguration.from(webRefreshIntervalMillis, ZonedDateTime.now()))); fw.flush(); } catch (IOException ioe) { LOG.error("Failed to write config file."); throw ioe; } }
private static String createConfigJson(DashboardConfiguration dashboardConfiguration) throws IOException { StringWriter writer = new StringWriter(); JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer); gen.writeStartObject(); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_REFRESH_INTERVAL, dashboardConfiguration.getRefreshInterval()); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_TIMEZONE_OFFSET, dashboardConfiguration.getTimeZoneOffset()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_TIMEZONE_NAME, dashboardConfiguration.getTimeZoneName()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_VERSION, dashboardConfiguration.getFlinkVersion()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_REVISION, dashboardConfiguration.getFlinkRevision()); gen.writeEndObject(); gen.close(); return writer.toString(); }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
private static String createConfigJson(DashboardConfiguration dashboardConfiguration) throws IOException { StringWriter writer = new StringWriter(); JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer); gen.writeStartObject(); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_REFRESH_INTERVAL, dashboardConfiguration.getRefreshInterval()); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_TIMEZONE_OFFSET, dashboardConfiguration.getTimeZoneOffset()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_TIMEZONE_NAME, dashboardConfiguration.getTimeZoneName()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_VERSION, dashboardConfiguration.getFlinkVersion()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_REVISION, dashboardConfiguration.getFlinkRevision()); gen.writeEndObject(); gen.close(); return writer.toString(); }
public DashboardConfigHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends RestfulGateway> leaderRetriever, Time timeout, Map<String, String> responseHeaders, MessageHeaders<EmptyRequestBody, DashboardConfiguration, EmptyMessageParameters> messageHeaders, long refreshInterval) { super(localRestAddress, leaderRetriever, timeout, responseHeaders, messageHeaders); dashboardConfiguration = DashboardConfiguration.from(refreshInterval, ZonedDateTime.now()); }
public static DashboardConfiguration from(long refreshInterval, ZonedDateTime zonedDateTime) { final String flinkVersion = EnvironmentInformation.getVersion(); final EnvironmentInformation.RevisionInformation revision = EnvironmentInformation.getRevisionInformation(); final String flinkRevision; if (revision != null) { flinkRevision = revision.commitId + " @ " + revision.commitDate; } else { flinkRevision = "unknown revision"; } return new DashboardConfiguration( refreshInterval, zonedDateTime.getZone().getDisplayName(TextStyle.FULL, Locale.getDefault()), // convert zone date time into offset in order to not do the day light saving adaptions wrt the offset zonedDateTime.toOffsetDateTime().getOffset().getTotalSeconds() * 1000, flinkVersion, flinkRevision); } }
private static String createConfigJson(DashboardConfiguration dashboardConfiguration) throws IOException { StringWriter writer = new StringWriter(); JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer); gen.writeStartObject(); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_REFRESH_INTERVAL, dashboardConfiguration.getRefreshInterval()); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_TIMEZONE_OFFSET, dashboardConfiguration.getTimeZoneOffset()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_TIMEZONE_NAME, dashboardConfiguration.getTimeZoneName()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_VERSION, dashboardConfiguration.getFlinkVersion()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_REVISION, dashboardConfiguration.getFlinkRevision()); gen.writeEndObject(); gen.close(); return writer.toString(); }
public DashboardConfigHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends RestfulGateway> leaderRetriever, Time timeout, Map<String, String> responseHeaders, MessageHeaders<EmptyRequestBody, DashboardConfiguration, EmptyMessageParameters> messageHeaders, long refreshInterval) { super(localRestAddress, leaderRetriever, timeout, responseHeaders, messageHeaders); dashboardConfiguration = DashboardConfiguration.from(refreshInterval, ZonedDateTime.now()); }
public static String createConfigJson(DashboardConfiguration dashboardConfiguration) throws IOException { StringWriter writer = new StringWriter(); JsonGenerator gen = JsonFactory.JACKSON_FACTORY.createGenerator(writer); gen.writeStartObject(); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_REFRESH_INTERVAL, dashboardConfiguration.getRefreshInterval()); gen.writeNumberField(DashboardConfiguration.FIELD_NAME_TIMEZONE_OFFSET, dashboardConfiguration.getTimeZoneOffset()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_TIMEZONE_NAME, dashboardConfiguration.getTimeZoneName()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_VERSION, dashboardConfiguration.getFlinkVersion()); gen.writeStringField(DashboardConfiguration.FIELD_NAME_FLINK_REVISION, dashboardConfiguration.getFlinkRevision()); gen.writeEndObject(); gen.close(); return writer.toString(); } }
public DashboardConfigHandler( CompletableFuture<String> localRestAddress, GatewayRetriever<? extends RestfulGateway> leaderRetriever, Time timeout, Map<String, String> responseHeaders, MessageHeaders<EmptyRequestBody, DashboardConfiguration, EmptyMessageParameters> messageHeaders, long refreshInterval) { super(localRestAddress, leaderRetriever, timeout, responseHeaders, messageHeaders); dashboardConfiguration = DashboardConfiguration.from(refreshInterval, ZonedDateTime.now()); }
public DashboardConfigHandler(Executor executor, long refreshInterval) { super(executor); dashboardConfiguration = DashboardConfiguration.from(refreshInterval, ZonedDateTime.now()); try { this.configString = createConfigJson(dashboardConfiguration); } catch (Exception e) { // should never happen throw new RuntimeException(e.getMessage(), e); } }
private void createDashboardConfigFile() throws IOException { try (FileWriter fw = createOrGetFile(webDir, "config")) { fw.write(createConfigJson(DashboardConfiguration.from(webRefreshIntervalMillis, ZonedDateTime.now()))); fw.flush(); } catch (IOException ioe) { LOG.error("Failed to write config file."); throw ioe; } }
private void createDashboardConfigFile() throws IOException { try (FileWriter fw = createOrGetFile(webDir, "config")) { fw.write(createConfigJson(DashboardConfiguration.from(webRefreshIntervalMillis, ZonedDateTime.now()))); fw.flush(); } catch (IOException ioe) { LOG.error("Failed to write config file."); throw ioe; } }