private FormatSpecification getFormatSpec() { FormatSpecification formatSpec = null; if (!Strings.isNullOrEmpty(format)) { // try to parse the schema if there is one Schema schemaObj = parseSchema(); // strip format.settings. from any properties and use them in the format spec ImmutableMap.Builder<String, String> builder = ImmutableMap.builder(); for (Map.Entry<String, String> entry : getProperties().getProperties().entrySet()) { if (entry.getKey().startsWith(FORMAT_SETTING_PREFIX)) { String key = entry.getKey(); builder.put(key.substring(FORMAT_SETTING_PREFIX.length(), key.length()), entry.getValue()); } } formatSpec = new FormatSpecification(format, schemaObj, builder.build()); } return formatSpec; }
FormatSpecification actualSpec = new FormatSpecification(name, schema, settings); format.initialize(actualSpec); return format;
FormatSpecification actualSpec = new FormatSpecification(name, schema, settings); format.initialize(actualSpec); return format;
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { StreamId streamId = cliConfig.getCurrentNamespace().stream(arguments.get(ArgumentName.STREAM.toString())); StreamViewId viewId = streamId.view(arguments.get(ArgumentName.VIEW.toString())); String formatName = arguments.get(ArgumentName.FORMAT.toString()); Schema schema = getSchema(arguments); Map<String, String> settings = Collections.emptyMap(); if (arguments.hasArgument(ArgumentName.SETTINGS.toString())) { settings = ArgumentParser.parseMap(arguments.get(ArgumentName.SETTINGS.toString()), ArgumentName.SETTINGS.toString()); } FormatSpecification formatSpecification = new FormatSpecification(formatName, schema, settings); ViewSpecification viewSpecification = new ViewSpecification(formatSpecification); boolean created = client.createOrUpdate(viewId, viewSpecification); if (created) { output.printf("Successfully created stream-view '%s'\n", viewId.getEntityName()); } else { output.printf("Successfully updated stream-view '%s'\n", viewId.getEntityName()); } }
@Override public void perform(Arguments arguments, PrintStream output) throws Exception { StreamId streamId = cliConfig.getCurrentNamespace().stream(arguments.get(ArgumentName.STREAM.toString())); StreamProperties currentProperties = streamClient.getConfig(streamId); String formatName = arguments.get(ArgumentName.FORMAT.toString()); Schema schema = getSchema(arguments); Map<String, String> settings = Collections.emptyMap(); if (arguments.hasArgument(ArgumentName.SETTINGS.toString())) { settings = ArgumentParser.parseMap(arguments.get(ArgumentName.SETTINGS.toString()), ArgumentName.SETTINGS.toString()); } FormatSpecification formatSpecification = new FormatSpecification(formatName, schema, settings); StreamProperties streamProperties = new StreamProperties(currentProperties.getTTL(), formatSpecification, currentProperties.getNotificationThresholdMB(), currentProperties.getDescription()); streamClient.setStreamProperties(streamId, streamProperties); output.printf("Successfully set format of stream '%s'\n", streamId.getEntityName()); }
formatSpec = new FormatSpecification(formatSpec.getName(), format.getSchema(), formatSpec.getSettings()); } catch (UnsupportedTypeException e) {