PagedResources<AppRegistrationResource> registered = null; try { registered = appRegistryOperations().registerAll(applications, force); PagedResources<AppRegistrationResource> registered = appRegistryOperations().importFromResource(uri, force); return String.format("Successfully registered %d applications from '%s'", registered.getMetadata().getTotalElements(), uri);
@CliCommand(value = UNREGISTER_ALL, help = "Unregister all applications") public String unregisterAll() { appRegistryOperations().unregisterAll(); StringBuilder msg = new StringBuilder() .append("Successfully unregistered applications."); PagedResources<AppRegistrationResource> appRegistrationResources = appRegistryOperations().list(); if (!appRegistrationResources.getContent().isEmpty()) { msg.append(" The following were not unregistered as they are associated with an existing stream:"); for(AppRegistrationResource appRegistrationResource : appRegistrationResources) { msg.append(String.format(" [%s:%s:%s]", appRegistrationResource.getName(), appRegistrationResource.getType(), appRegistrationResource.getVersion())); } } return msg.toString(); }
@CliCommand(value = DEFAULT_APPLICATION, help = "Change the default application version") public String defaultApplicaiton( @CliOption(mandatory = true, key = { "", "id" }, help = "id of the application to query in the form of 'type:name'") QualifiedApplicationName application, @CliOption(mandatory = true, key = { "version" }, help = "the new default application version") String version) { appRegistryOperations().makeDefault(application.name, application.type, version); return String.format("New default Application %s:%s:%s", application.type, application.name, version); }
private List<AppRegistrationResource> findAllAppsByNameAndType(String appName, ApplicationType appType) { return appRegistryOperations().list().getContent().stream() .filter(a -> a.getName().equals(appName)) .filter(a -> a.getType().equals(appType.toString())) .collect(Collectors.toList()); }
@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type, @CliOption(key = { "version" }, help = "the version application to unregister") String version) { appRegistryOperations().unregister(name, type, version); List<AppRegistrationResource> appRegistrations = findAllAppsByNameAndType(name, type); Optional<AppRegistrationResource> defaultApp = appRegistrations.stream() .filter(a -> a.getDefaultVersion() == true).findFirst(); if (!CollectionUtils.isEmpty(appRegistrations) && !defaultApp.isPresent()) { String appVersions = appRegistrations.stream().map(app -> app.getVersion()) .collect(Collectors.joining(", ", "(", ")")); return String.format("Successfully unregistered application '%s' with type '%s'. " + "Please select new default version from: %s", name, type, appVersions); } return String.format("Successfully unregistered application '%s' with type '%s'.", name, type); }
@CliCommand(value = REGISTER_APPLICATION, help = "Register a new application") public String register( @CliOption(mandatory = true, key = { "", "name" }, help = "the name for the registered application") String name, @CliOption(mandatory = true, key = { "type" }, help = "the type for the registered application") ApplicationType type, @CliOption(mandatory = true, key = { "uri" }, help = "URI for the application artifact") String uri, @CliOption(key = { "metadata-uri" }, help = "Metadata URI for the application artifact") String metadataUri, @CliOption(key = "force", help = "force update if application is already registered (only if not in use)", specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean force) { appRegistryOperations().register(name, type, uri, metadataUri, force); return String.format(("Successfully registered application '%s:%s'"), type, name); }
private List<AppRegistrationResource> findAllAppsByNameAndType(String appName, ApplicationType appType) { return appRegistryOperations().list().getContent().stream() .filter(a -> a.getName().equals(appName)) .filter(a -> a.getType().equals(appType.toString())) .collect(Collectors.toList()); }
@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type, @CliOption(key = { "version" }, help = "the version application to unregister") String version) { appRegistryOperations().unregister(name, type, version); List<AppRegistrationResource> appRegistrations = findAllAppsByNameAndType(name, type); Optional<AppRegistrationResource> defaultApp = appRegistrations.stream() .filter(a -> a.getDefaultVersion() == true).findFirst(); if (!CollectionUtils.isEmpty(appRegistrations) && !defaultApp.isPresent()) { String appVersions = appRegistrations.stream().map(app -> app.getVersion()) .collect(Collectors.joining(", ", "(", ")")); return String.format("Successfully unregistered application '%s' with type '%s'. " + "Please select new default version from: %s", name, type, appVersions); } return String.format("Successfully unregistered application '%s' with type '%s'.", name, type); }
@CliCommand(value = REGISTER_APPLICATION, help = "Register a new application") public String register( @CliOption(mandatory = true, key = { "", "name" }, help = "the name for the registered application") String name, @CliOption(mandatory = true, key = { "type" }, help = "the type for the registered application") ApplicationType type, @CliOption(mandatory = true, key = { "uri" }, help = "URI for the application artifact") String uri, @CliOption(key = { "metadata-uri" }, help = "Metadata URI for the application artifact") String metadataUri, @CliOption(key = "force", help = "force update if application is already registered (only if not in use)", specifiedDefaultValue = "true", unspecifiedDefaultValue = "false") boolean force) { appRegistryOperations().register(name, type, uri, metadataUri, force); return String.format(("Successfully registered application '%s:%s'"), type, name); }
PagedResources<AppRegistrationResource> registered = null; try { registered = appRegistryOperations().registerAll(applications, force); PagedResources<AppRegistrationResource> registered = appRegistryOperations().importFromResource(uri, force); return String.format("Successfully registered %d applications from '%s'", registered.getMetadata().getTotalElements(), uri);
key = { "", "id" }, help = "id of the application to query in the form of 'type:name'") QualifiedApplicationName application) { PagedResources<AppRegistrationResource> appRegistrations = appRegistryOperations().list();
@CliCommand(value = UNREGISTER_APPLICATION, help = "Unregister an application") public String unregister( @CliOption(mandatory = true, key = { "", "name" }, help = "name of the application to unregister") String name, @CliOption(mandatory = true, key = { "type" }, help = "type of the application to unregister") ApplicationType type) { appRegistryOperations().unregister(name, type, null); return String.format(("Successfully unregistered application '%s' with type '%s'"), name, type); } }
List<Object> result = new ArrayList<>(); try { DetailedAppRegistrationResource info = appRegistryOperations().info(name, type, exhaustive); if (info != null) { List<ConfigurationMetadataProperty> options = info.getOptions();
@CliCommand(value = DEFAULT_APPLICATION, help = "Change the default application version") public String defaultApplicaiton( @CliOption(mandatory = true, key = { "", "id" }, help = "id of the application to query in the form of 'type:name'") QualifiedApplicationName application, @CliOption(mandatory = true, key = { "version" }, help = "the new default application version") String version) { appRegistryOperations().makeDefault(application.name, application.type, version); return String.format("New default Application %s:%s:%s", application.type, application.name, version); } }
@Override public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target) { for (AppRegistrationResource app : dataFlowShell.getDataFlowOperations().appRegistryOperations().list()) { String value = app.getType() + ":" + app.getName(); completions.add(new Completion(value, app.getName(), pretty(app.getType()), 0)); } return true; }
@Override public boolean getAllPossibleValues(List<Completion> completions, Class<?> targetType, String existingData, String optionContext, MethodTarget target) { for (AppRegistrationResource app : dataFlowShell.getDataFlowOperations().appRegistryOperations().list()) { String value = app.getType() + ":" + app.getName(); completions.add(new Completion(value, app.getName(), pretty(app.getType()), 0)); } return true; }
key = { "", "id" }, help = "id of the application to query in the form of 'type:name'") QualifiedApplicationName application) { PagedResources<AppRegistrationResource> appRegistrations = appRegistryOperations().list();