/** * Determines a deployment key for a task application. * * @param taskDefinition the task application definition * @return the deployment key */ public static String forTaskDefinition(TaskDefinition taskDefinition) { Assert.notNull(taskDefinition, "taskDefinition must not be null"); return String.format("%s.%s", taskDefinition.getRegisteredAppName(), taskDefinition.getName()); } }
@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; }
@Override public boolean addProposals(String text, TaskDefinition taskDefinition, int detailLevel, List<CompletionProposal> collector) { Set<String> parameterNames = new HashSet<>(taskDefinition.getProperties().keySet()); parameterNames.removeAll(CompletionUtils.IMPLICIT_TASK_PARAMETER_NAMES); if (!parameterNames.isEmpty() || !text.endsWith(taskDefinition.getRegisteredAppName())) { return false; } // Actually add completions String alreadyTyped = taskDefinition.getRegisteredAppName(); CompletionProposal.Factory proposals = CompletionProposal.expanding(text); List<ApplicationType> validTypesAtThisPosition = Arrays.asList(ApplicationType.task); for (AppRegistration appRegistration : appRegistry.findAll()) { String candidateName = appRegistration.getName(); if (validTypesAtThisPosition.contains(appRegistration.getType()) && !alreadyTyped.equals(candidateName) && candidateName.startsWith(alreadyTyped)) { String expansion = appRegistration.getName(); collector.add(proposals.withSuffix(expansion.substring(alreadyTyped.length()))); } } return false; } }
private void saveStandardTaskDefinition(TaskDefinition taskDefinition) { String appName = taskDefinition.getRegisteredAppName(); if (registry.find(appName, ApplicationType.task) == null) { throw new ApplicationDoesNotExistException( String.format("Application name '%s' with type '%s' does not exist in the app registry.", appName, ApplicationType.task)); } this.taskDefinitionRepository.save(taskDefinition); }
/** * Reverse engineers a {@link TaskDefinition} into a semantically equivalent DSL text representation. * @param taskDefinition task definition to be converted into DSL * @return the textual DSL representation of the task */ public String toDsl(TaskDefinition taskDefinition) { if (StringUtils.hasText(taskDefinition.getDslText())) { TaskParser taskParser = new TaskParser("__dummy", taskDefinition.getDslText(), true, true); Assert.isTrue(!taskParser.parse().isComposed(), "The TaskDefinitionToDslConverter doesn't support Composed Tasks!"); } StringBuilder dslBuilder = new StringBuilder(); Map<String, String> properties = taskDefinition.getProperties(); dslBuilder.append(taskDefinition.getRegisteredAppName()); for (String propertyName : properties.keySet()) { if (!dataFlowAddedProperties.contains(propertyName)) { String propertyValue = StringEscapeUtils.unescapeHtml(properties.get(propertyName)); dslBuilder.append(" --").append(propertyName).append("=").append( DefinitionUtils.autoQuotes(propertyValue)); } } return dslBuilder.toString(); } }
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 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); } } }
protected Resource getTaskResource(String taskDefinitionName) { TaskDefinition taskDefinition = this.taskDefinitionRepository.findById(taskDefinitionName) .orElseThrow(() -> new NoSuchTaskDefinitionException(taskDefinitionName)); AppRegistration appRegistration = null; if (TaskServiceUtils.isComposedTaskDefinition(taskDefinition.getDslText())) { appRegistration = this.registry.find(taskConfigurationProperties.getComposedTaskRunnerName(), ApplicationType.task); } else { appRegistration = this.registry.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); } Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName()); return this.registry.getAppResource(appRegistration); }
@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); } } }
protected Resource getTaskResource(String taskDefinitionName) { TaskDefinition taskDefinition = this.taskDefinitionRepository.findOne(taskDefinitionName); if (taskDefinition == null) { throw new NoSuchTaskDefinitionException(taskDefinitionName); } AppRegistration appRegistration = null; if (TaskServiceUtils.isComposedTaskDefinition(taskDefinition.getDslText())) { appRegistration = this.registry.find(taskConfigurationProperties.getComposedTaskRunnerName(), ApplicationType.task); } else { appRegistration = this.registry.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); } Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName()); return this.registry.getAppResource(appRegistration); }
private void saveStandardTaskDefinition(TaskDefinition taskDefinition) { String appName = taskDefinition.getRegisteredAppName(); if (registry.find(appName, ApplicationType.task) == null) { throw new NoSuchAppRegistrationException(appName, ApplicationType.task); } if (taskDefinitionRepository.existsById(taskDefinition.getTaskName())) { throw new DuplicateTaskException(String.format( "Cannot register task %s because another one has already " + "been registered with the same name", taskDefinition.getTaskName())); } taskDefinitionRepository.save(taskDefinition); } }
AppRegistration appRegistration = this.registry.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName()); Resource metadataResource = this.registry.getAppMetadataResource(appRegistration); TaskServiceUtils.extractAppProperties(taskDefinition.getRegisteredAppName(), taskDeploymentProperties)); .extractAndQualifyDeployerProperties(taskDeploymentProperties, taskDefinition.getRegisteredAppName()); if (StringUtils.hasText(this.dataflowServerUri) && taskNode.isComposed()) { TaskServiceUtils.updateDataFlowUriIfNeeded(this.dataflowServerUri, appDeploymentProperties, commandLineArgs);
AppRegistration appRegistration = this.registry.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName()); Resource metadataResource = this.registry.getAppMetadataResource(appRegistration); TaskServiceUtils.extractAppProperties(taskDefinition.getRegisteredAppName(), taskDeploymentProperties)); .extractAndQualifyDeployerProperties(taskDeploymentProperties, taskDefinition.getRegisteredAppName()); if (StringUtils.hasText(this.dataflowServerUri) && taskNode.isComposed()) { TaskServiceUtils.updateDataFlowUriIfNeeded(this.dataflowServerUri, appDeploymentProperties, commandLineArgs);
taskNode.getTaskApps().stream().forEach(task -> { TaskDefinition childDefinition = this.taskDefinitionRepository.findByTaskName(childTaskPrefix + task.getName()); boolean status = this.validate(childDefinition.getRegisteredAppName(), ApplicationType.task); validationStatus.getAppsStatuses().put( String.format("%s:%s", appType.name(), childDefinition.getName()), boolean status = this.validate(definition.getRegisteredAppName(), ApplicationType.task); validationStatus.getAppsStatuses().put( String.format("%s:%s", appType.name(), definition.getName()),
taskNode.getTaskApps().stream().forEach(task -> { TaskDefinition childDefinition = this.taskDefinitionRepository.findByNameRequired(childTaskPrefix + task.getName()); boolean status = this.validate(childDefinition.getRegisteredAppName(), ApplicationType.task); validationStatus.getAppsStatuses().put( String.format("%s:%s", appType.name(), childDefinition.getName()), boolean status = this.validate(definition.getRegisteredAppName(), ApplicationType.task); validationStatus.getAppsStatuses().put( String.format("%s:%s", appType.name(), definition.getName()),
AppRegistration appRegistration = this.registry.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName()); Resource appResource = this.registry.getAppResource(appRegistration); Resource metadataResource = this.registry.getAppMetadataResource(appRegistration); TaskServiceUtils.extractAppProperties(taskDefinition.getRegisteredAppName(), taskDeploymentProperties)); .extractAndQualifyDeployerProperties(taskDeploymentProperties, taskDefinition.getRegisteredAppName()); if (StringUtils.hasText(this.dataflowServerUri) && taskNode.isComposed()) { TaskServiceUtils.updateDataFlowUriIfNeeded(this.dataflowServerUri, appDeploymentProperties,
.findTaskExecutionInformation(taskName, taskDeploymentProperties); TaskDefinition taskDefinition = taskExecutionInformation.getTaskDefinition(); String registeredAppName = taskDefinition.getRegisteredAppName(); TaskExecution taskExecution = taskExecutionInformation.getTaskExecution();
dataSourceProperties); AppRegistration appRegistration = appRegistryService.find(taskDefinition.getRegisteredAppName(), ApplicationType.task); Assert.notNull(appRegistration, "Unknown task app: " + taskDefinition.getRegisteredAppName());