/** * Return {@code true} if the upstream module (the module that appears before * the provided module) contains partition related properties. * * @param stream stream for the module * @param currentModule module for which to determine if the upstream module * has partition properties * @param streamDeploymentProperties deployment properties for the stream * @return true if the upstream module has partition properties */ private boolean upstreamModuleHasPartitionInfo(StreamDefinition stream, ModuleDefinition currentModule, Map<String, String> streamDeploymentProperties) { Iterator<ModuleDefinition> iterator = stream.getDeploymentOrderIterator(); while (iterator.hasNext()) { ModuleDefinition module = iterator.next(); if (module.equals(currentModule) && iterator.hasNext()) { ModuleDefinition prevModule = iterator.next(); Map<String, String> moduleDeploymentProperties = extractModuleDeploymentProperties(prevModule, streamDeploymentProperties); return moduleDeploymentProperties.containsKey(PARTITION_KEY_EXPRESSION) || moduleDeploymentProperties.containsKey(PARTITION_KEY_EXTRACTOR_CLASS); } } return false; }
/** * Return {@code true} if the upstream app (the app that appears before the provided app) * contains partition related properties. * * @param stream stream for the app * @param currentApp app for which to determine if the upstream app has partition * properties * @param streamDeploymentProperties deployment properties for the stream * @return true if the upstream app has partition properties */ /* default */ boolean upstreamAppHasPartitionInfo(StreamDefinition stream, StreamAppDefinition currentApp, Map<String, String> streamDeploymentProperties) { Iterator<StreamAppDefinition> iterator = stream.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition app = iterator.next(); if (app.equals(currentApp) && iterator.hasNext()) { StreamAppDefinition prevApp = iterator.next(); Map<String, String> appDeploymentProperties = extractAppProperties(prevApp, streamDeploymentProperties); return appDeploymentProperties.containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXPRESSION) || appDeploymentProperties .containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXTRACTOR_CLASS); } } return false; }
/** * Return {@code true} if the upstream app (the app that appears before the provided app) * contains partition related properties. * * @param stream stream for the app * @param currentApp app for which to determine if the upstream app has partition * properties * @param streamDeploymentProperties deployment properties for the stream * @return true if the upstream app has partition properties */ /* default */ boolean upstreamAppHasPartitionInfo(StreamDefinition stream, StreamAppDefinition currentApp, Map<String, String> streamDeploymentProperties) { Iterator<StreamAppDefinition> iterator = stream.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition app = iterator.next(); if (app.equals(currentApp) && iterator.hasNext()) { StreamAppDefinition prevApp = iterator.next(); Map<String, String> appDeploymentProperties = extractAppProperties(prevApp, streamDeploymentProperties); return appDeploymentProperties.containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXPRESSION) || appDeploymentProperties .containsKey(BindingPropertyKeys.OUTPUT_PARTITION_KEY_EXTRACTOR_CLASS); } } return false; }
@Override public boolean addProposals(String text, StreamDefinition parseResult, int detailLevel, List<CompletionProposal> collector) { Set<String> propertyNames = new HashSet<>( parseResult.getDeploymentOrderIterator().next().getProperties().keySet()); propertyNames.removeAll(CompletionUtils.IMPLICIT_PARAMETER_NAMES); if (text.endsWith(" ") || propertyNames.isEmpty()) { return false; } String propertyName = recoverPropertyName(text); StreamAppDefinition lastApp = parseResult.getDeploymentOrderIterator().next(); String alreadyTyped = lastApp.getProperties().get(propertyName); AppRegistration lastAppRegistration = this.collectorSupport.findAppRegistration(lastApp.getName(), CompletionUtils.determinePotentialTypes(lastApp, parseResult.getAppDefinitions().size() > 1)); if (lastAppRegistration != null) { return this.collectorSupport.addAlreadyTypedValueHintsProposals(text, lastAppRegistration, collector, propertyName, valueHintProviders, alreadyTyped); } return false; }
@Override public boolean addProposals(String text, StreamDefinition streamDefinition, int detailLevel, List<CompletionProposal> collector) { StreamAppDefinition lastApp = streamDefinition.getDeploymentOrderIterator().next(); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(lastApp.getName(), CompletionUtils.determinePotentialTypes(lastApp,streamDefinition.getAppDefinitions().size() > 1)); if (appRegistration != null) { Set<String> alreadyPresentOptions = new HashSet<>(lastApp.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(text, "", appRegistration, alreadyPresentOptions, collector, detailLevel); } return false; } }
private AppRegistration lookupLastApp(CheckPointedParseException exception) { String safe = exception.getExpressionStringUntilCheckpoint(); StreamDefinition streamDefinition = new StreamDefinition("__dummy", safe); StreamAppDefinition lastApp = streamDefinition.getDeploymentOrderIterator().next(); return this.collectorSupport.findAppRegistration(lastApp.getName(), CompletionUtils.determinePotentialTypes(lastApp, streamDefinition.getAppDefinitions().size() > 1)); }
@Override public void addProposals(String dsl, CheckPointedParseException exception, int detailLevel, List<CompletionProposal> collector) { String safe = exception.getExpressionStringUntilCheckpoint(); StreamDefinition streamDefinition = new StreamDefinition("__dummy", safe); StreamAppDefinition lastApp = streamDefinition.getDeploymentOrderIterator().next(); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(lastApp.getName(), CompletionUtils.determinePotentialTypes(lastApp, streamDefinition.getAppDefinitions().size() > 1)); if (appRegistration != null) { Set<String> alreadyPresentOptions = new HashSet<>(lastApp.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(safe, "", appRegistration, alreadyPresentOptions, collector, detailLevel); } } }
List<CompletionProposal> collector) { StreamAppDefinition lastApp = streamDefinition.getDeploymentOrderIterator().next(); Set<String> parameterNames = new HashSet<>(lastApp.getProperties().keySet()); parameterNames.removeAll(CompletionUtils.IMPLICIT_PARAMETER_NAMES);
@Override public void addProposals(String dsl, CheckPointedParseException exception, int detailLevel, List<CompletionProposal> collector) { String safe = exception.getExpressionStringUntilCheckpoint(); StreamDefinition streamDefinition = new StreamDefinition("__dummy", safe); StreamAppDefinition lastApp = streamDefinition.getDeploymentOrderIterator().next(); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(lastApp.getName(), CompletionUtils.determinePotentialTypes(lastApp, streamDefinition.getAppDefinitions().size() > 1)); if (appRegistration != null) { String startsWith = ProposalsCollectorSupportUtils.computeStartsWith(exception); Set<String> alreadyPresentOptions = new HashSet<>(lastApp.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(safe, startsWith, appRegistration, alreadyPresentOptions, collector, detailLevel); } } }
updateProperties = Collections.emptyMap(); Iterator<StreamAppDefinition> iterator = streamDefinition.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition currentApp = iterator.next();
updateProperties = Collections.emptyMap(); Iterator<StreamAppDefinition> iterator = streamDefinition.getDeploymentOrderIterator(); while (iterator.hasNext()) { StreamAppDefinition currentApp = iterator.next();
streamDeploymentProperties = Collections.emptyMap(); Iterator<StreamAppDefinition> iterator = streamDefinition.getDeploymentOrderIterator(); int nextAppCount = 0; boolean isDownStreamAppPartitioned = false;
streamDeploymentProperties = Collections.emptyMap(); Iterator<StreamAppDefinition> iterator = streamDefinition.getDeploymentOrderIterator(); int nextAppCount = 0; boolean isDownStreamAppPartitioned = false;
@Override public boolean addProposals(String text, StreamDefinition parseResult, int detailLevel, List<CompletionProposal> collector) { if (text.isEmpty() || !text.endsWith(" ")) { return false; } StreamAppDefinition lastApp = parseResult.getDeploymentOrderIterator().next(); // Consider "bar | foo". If there is indeed a sink named foo in the registry, // "foo" may also be a processor, in which case we can continue boolean couldBeASink = appRegistry.find(lastApp.getName(), ApplicationType.sink) != null; if (couldBeASink) { boolean couldBeAProcessor = appRegistry.find(lastApp.getName(), ApplicationType.processor) != null; if (!couldBeAProcessor) { return false; } } CompletionProposal.Factory proposals = CompletionProposal.expanding(text); for (AppRegistration appRegistration : appRegistry.findAll()) { if (appRegistration.getType() == ApplicationType.processor || appRegistration.getType() == ApplicationType.sink) { String expansion = CompletionUtils.maybeQualifyWithLabel(appRegistration.getName(), parseResult); collector.add(proposals.withSeparateTokens("| " + expansion, "Continue stream definition with a " + appRegistration.getType())); } } return false; } }
streamDeploymentProperties = Collections.emptyMap(); Iterator<ModuleDefinition> iterator = stream.getDeploymentOrderIterator(); int nextModuleCount = 0; boolean isDownStreamModulePartitioned = false;