ConfigurationPropertyValueHintRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "foo --bar=", "foo | wizz --bar="); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }
@Override public void addProposals(String dsl, CheckPointedParseException exception, int detailLevel, List<CompletionProposal> collector) { String safe = exception.getExpressionStringUntilCheckpoint(); TaskDefinition taskDefinition = new TaskDefinition("__dummy", safe); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(taskDefinition.getRegisteredAppName(), ApplicationType.task); if (appRegistration != null) { String startsWith = ProposalsCollectorSupportUtils.computeStartsWith(exception); Set<String> alreadyPresentOptions = new HashSet<>(taskDefinition.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(safe, startsWith, appRegistration, alreadyPresentOptions, collector, detailLevel); } } }
@Override public boolean addProposals(String text, TaskDefinition taskDefinition, int detailLevel, List<CompletionProposal> collector) { String appName = taskDefinition.getRegisteredAppName(); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(appName, ApplicationType.task); if (appRegistration != null) { Set<String> alreadyPresentOptions = new HashSet<>(taskDefinition.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(text, "", appRegistration, alreadyPresentOptions, collector, detailLevel); } return false; } }
@Override public boolean addProposals(String text, TaskDefinition parseResult, int detailLevel, List<CompletionProposal> collector) { Set<String> propertyNames = new HashSet<>(parseResult.getProperties().keySet()); propertyNames.removeAll(CompletionUtils.IMPLICIT_TASK_PARAMETER_NAMES); if (text.endsWith(" ") || propertyNames.isEmpty()) { return false; } String propertyName = recoverPropertyName(text); String alreadyTyped = parseResult.getProperties().get(propertyName); AppRegistration lastAppRegistration = this.collectorSupport.findAppRegistration(parseResult.getRegisteredAppName(), ApplicationType.task); if (lastAppRegistration != null) { return this.collectorSupport.addAlreadyTypedValueHintsProposals(text, lastAppRegistration, collector, propertyName, valueHintProviders, alreadyTyped); } return false; }
private AppRegistration lookupLastApp(CheckPointedParseException exception) { String safe = exception.getExpressionStringUntilCheckpoint(); TaskDefinition taskDefinition = new TaskDefinition("__dummy", safe); return this.collectorSupport.findAppRegistration(taskDefinition.getRegisteredAppName(), ApplicationType.task); }
@Override public void addProposals(String dsl, CheckPointedParseException exception, int detailLevel, List<CompletionProposal> collector) { String propertyName = recoverPropertyName(exception); AppRegistration lastAppRegistration = lookupLastApp(exception); if (lastAppRegistration != null) { this.collectorSupport.addValueHintsProposals(dsl, lastAppRegistration, collector, propertyName, valueHintProviders); } }
return this.doWithClassLoader(classLoader, () -> { CompletionProposal.Factory proposals = CompletionProposal.expanding(text); List<ConfigurationMetadataProperty> allProps = metadataResolver.listProperties(metadataResource, true);
@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); } } }
@Override public void addProposals(String dsl, CheckPointedParseException exception, int detailLevel, List<CompletionProposal> collector) { String safe = exception.getExpressionStringUntilCheckpoint(); TaskDefinition taskDefinition = new TaskDefinition("__dummy", safe); AppRegistration appRegistration = this.collectorSupport.findAppRegistration(taskDefinition.getRegisteredAppName(), ApplicationType.task); if (appRegistration != null) { Set<String> alreadyPresentOptions = new HashSet<>(taskDefinition.getProperties().keySet()); this.collectorSupport.addPropertiesProposals(safe, "", appRegistration, alreadyPresentOptions, collector, detailLevel); } } }
@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; }
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 propertyName = recoverPropertyName(exception); AppRegistration appRegistration = lookupLastApp(exception); if (appRegistration != null) { this.collectorSupport.addValueHintsProposals(dsl, appRegistration, collector, propertyName, valueHintProviders); } }
void addValueHintsProposals(final String dsl, AppRegistration appRegistration, final List<CompletionProposal> collector, final String propertyName, final ValueHintProvider[] valueHintProviders){ final Resource metadataResource = this.appRegistry.getAppMetadataResource(appRegistration); if (metadataResource != null) { final URLClassLoader classLoader = metadataResolver.createAppClassLoader(metadataResource); this.doWithClassLoader(classLoader, () -> { CompletionProposal.Factory proposals = CompletionProposal.expanding(dsl); List<ConfigurationMetadataProperty> whiteList = metadataResolver.listProperties(metadataResource); for (ConfigurationMetadataProperty property : metadataResolver.listProperties(metadataResource, true)) { if (CompletionUtils.isMatchingProperty(propertyName, property, whiteList)) { for (ValueHintProvider valueHintProvider : valueHintProviders) { for (ValueHint valueHint : valueHintProvider.generateValueHints(property, classLoader)) { collector.add(proposals.withSuffix(String.valueOf(valueHint.getValue()), valueHint.getShortDescription())); } } } } return null; }); } }
@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; } }
ConfigurationPropertyValueHintTaskRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "foo --bar="); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }
@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); } } }
ConfigurationPropertyNameAfterDashDashTaskRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "file --"); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }
ConfigurationPropertyNameAfterDashDashRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "file --", "file | foo --"); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }
UnfinishedConfigurationPropertyNameRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "file --foo", "file | bar --quick", "file --foo.", "file | bar " + "--quick."); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }
UnfinishedConfigurationPropertyNameTaskRecoveryStrategy(AppRegistryService appRegistry, ApplicationConfigurationMetadataResolver metadataResolver) { super(CheckPointedParseException.class, "file --foo", "file --foo."); this.collectorSupport = new ProposalsCollectorSupportUtils(appRegistry, metadataResolver); }