Skip to content

Commit 5b363aa

Browse files
committed
Revert "Add boot version to 'app register' flow (spring-attic#5240)"
This reverts commit 4f10587.
1 parent 4f51871 commit 5b363aa

File tree

9 files changed

+26
-257
lines changed

9 files changed

+26
-257
lines changed

spring-cloud-dataflow-core/src/main/java/org/springframework/cloud/dataflow/core/AppBootSchemaVersion.java

Lines changed: 0 additions & 58 deletions
This file was deleted.

spring-cloud-dataflow-core/src/test/java/org/springframework/cloud/dataflow/core/AppBootSchemaVersionTests.java

Lines changed: 0 additions & 59 deletions
This file was deleted.

spring-cloud-dataflow-rest-client/src/main/java/org/springframework/cloud/dataflow/rest/client/AppRegistryOperations.java

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.util.Properties;
2020

21-
import org.springframework.cloud.dataflow.core.AppBootSchemaVersion;
2221
import org.springframework.cloud.dataflow.core.ApplicationType;
2322
import org.springframework.cloud.dataflow.rest.resource.AppRegistrationResource;
2423
import org.springframework.cloud.dataflow.rest.resource.DetailedAppRegistrationResource;
@@ -33,7 +32,6 @@
3332
* @author Patrick Peralta
3433
* @author Mark Fisher
3534
* @author Chris Schaefer
36-
* @author Chris Bono
3735
*/
3836
public interface AppRegistryOperations {
3937

@@ -83,24 +81,9 @@ public interface AppRegistryOperations {
8381
* @param metadataUri URI for the application metadata artifact
8482
* @param force if {@code true}, overwrites a pre-existing registration
8583
* @return the new app registration
86-
* @deprecated in favor of {@link #register(String, ApplicationType, AppBootSchemaVersion, String, String, boolean)}
8784
*/
88-
@Deprecated
8985
AppRegistrationResource register(String name, ApplicationType type, String uri, String metadataUri, boolean force);
9086

91-
/**
92-
* Register an application name, type, and boot version with its Maven coordinates.
93-
*
94-
* @param name application name
95-
* @param type application type
96-
* @param bootVersion application boot version
97-
* @param uri URI for the application artifact
98-
* @param metadataUri URI for the application metadata artifact
99-
* @param force if {@code true}, overwrites a pre-existing registration
100-
* @return the new app registration
101-
*/
102-
AppRegistrationResource register(String name, ApplicationType type, AppBootSchemaVersion bootVersion, String uri, String metadataUri, boolean force);
103-
10487
/**
10588
* Register an application name, type and version with its Maven coordinates.
10689
*
@@ -111,27 +94,10 @@ public interface AppRegistryOperations {
11194
* @param metadataUri URI for the application metadata artifact
11295
* @param force if {@code true}, overwrites a pre-existing registration
11396
* @return the new app registration
114-
* @deprecated in favor of {@link #register(String, ApplicationType, AppBootSchemaVersion, String, String, String, boolean)}
11597
*/
116-
@Deprecated
11798
AppRegistrationResource register(String name, ApplicationType type, String version, String uri,
11899
String metadataUri, boolean force);
119100

120-
/**
121-
* Register an application name, type, boot version, and version with its Maven coordinates.
122-
*
123-
* @param name application name
124-
* @param type application type
125-
* @param bootVersion application boot version
126-
* @param version application version
127-
* @param uri URI for the application artifact
128-
* @param metadataUri URI for the application metadata artifact
129-
* @param force if {@code true}, overwrites a pre-existing registration
130-
* @return the new app registration
131-
*/
132-
AppRegistrationResource register(String name, ApplicationType type, AppBootSchemaVersion bootVersion, String version, String uri,
133-
String metadataUri, boolean force);
134-
135101
/**
136102
* Unregister an application name and type.
137103
*

spring-cloud-dataflow-rest-client/src/main/java/org/springframework/cloud/dataflow/rest/client/AppRegistryTemplate.java

Lines changed: 12 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2019 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -18,7 +18,6 @@
1818

1919
import java.util.Properties;
2020

21-
import org.springframework.cloud.dataflow.core.AppBootSchemaVersion;
2221
import org.springframework.cloud.dataflow.core.ApplicationType;
2322
import org.springframework.cloud.dataflow.rest.resource.AppRegistrationResource;
2423
import org.springframework.cloud.dataflow.rest.resource.DetailedAppRegistrationResource;
@@ -41,7 +40,6 @@
4140
* @author Patrick Peralta
4241
* @author Christian Tzolov
4342
* @author Chris Schaefer
44-
* @author Chris Bono
4543
*/
4644
public class AppRegistryTemplate implements AppRegistryOperations {
4745
/**
@@ -114,44 +112,31 @@ public DetailedAppRegistrationResource info(String name, ApplicationType type, S
114112
}
115113

116114
@Override
117-
public AppRegistrationResource register(String name, ApplicationType type, String uri, String metadataUri, boolean force) {
118-
return register(name, type, (AppBootSchemaVersion) null, uri, metadataUri, force);
119-
}
115+
public AppRegistrationResource register(String name, ApplicationType type, String uri, String metadataUri,
116+
boolean force) {
117+
MultiValueMap<String, Object> values = new LinkedMultiValueMap<String, Object>();
118+
values.add("uri", uri);
119+
if (metadataUri != null) {
120+
values.add("metadata-uri", metadataUri);
121+
}
122+
values.add("force", Boolean.toString(force));
120123

121-
@Override
122-
public AppRegistrationResource register(String name, ApplicationType type, AppBootSchemaVersion bootVersion,
123-
String uri, String metadataUri, boolean force) {
124-
MultiValueMap<String, Object> values = valuesForRegisterPost(bootVersion, uri, metadataUri, force);
125124
return restTemplate.postForObject(appsLink.getHref() + "/{type}/{name}", values,
126125
AppRegistrationResource.class, type, name);
127126
}
128127

129128
@Override
130129
public AppRegistrationResource register(String name, ApplicationType type, String version, String uri,
131130
String metadataUri, boolean force) {
132-
return this.register(name, type, null, version, uri, metadataUri, force);
133-
}
134-
135-
@Override
136-
public AppRegistrationResource register(String name, ApplicationType type, AppBootSchemaVersion bootVersion,
137-
String version, String uri, String metadataUri, boolean force) {
138-
MultiValueMap<String, Object> values = valuesForRegisterPost(bootVersion, uri, metadataUri, force);
139-
return restTemplate.postForObject(appsLink.getHref() + "/{type}/{name}/{version}", values,
140-
AppRegistrationResource.class, type, name, version);
141-
}
142-
143-
private MultiValueMap<String, Object> valuesForRegisterPost(AppBootSchemaVersion bootVersion, String uri,
144-
String metadataUri, boolean force) {
145131
MultiValueMap<String, Object> values = new LinkedMultiValueMap<>();
146132
values.add("uri", uri);
147133
if (metadataUri != null) {
148134
values.add("metadata-uri", metadataUri);
149135
}
150-
if (bootVersion != null) {
151-
values.add("bootVersion", bootVersion.getBootVersion());
152-
}
153136
values.add("force", Boolean.toString(force));
154-
return values;
137+
138+
return restTemplate.postForObject(appsLink.getHref() + "/{type}/{name}/{version}", values,
139+
AppRegistrationResource.class, type, name, version);
155140
}
156141

157142
@Override

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/config/web/WebConfiguration.java

Lines changed: 1 addition & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2015-2023 the original author or authors.
2+
* Copyright 2015-2022 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -34,15 +34,12 @@
3434
import org.springframework.boot.autoconfigure.http.HttpMessageConverters;
3535
import org.springframework.boot.autoconfigure.jackson.Jackson2ObjectMapperBuilderCustomizer;
3636
import org.springframework.boot.web.servlet.ServletContextInitializer;
37-
import org.springframework.cloud.dataflow.core.AppBootSchemaVersion;
3837
import org.springframework.cloud.dataflow.rest.support.jackson.ISO8601DateFormatWithMilliSeconds;
3938
import org.springframework.cloud.dataflow.rest.support.jackson.Jackson2DataflowModule;
4039
import org.springframework.context.ApplicationListener;
4140
import org.springframework.context.annotation.Bean;
4241
import org.springframework.context.annotation.Configuration;
4342
import org.springframework.context.event.ContextClosedEvent;
44-
import org.springframework.core.convert.converter.Converter;
45-
import org.springframework.format.FormatterRegistry;
4643
import org.springframework.hateoas.server.core.DefaultLinkRelationProvider;
4744
import org.springframework.http.converter.HttpMessageConverter;
4845
import org.springframework.http.converter.ResourceHttpMessageConverter;
@@ -61,8 +58,6 @@
6158
* @author Christian Tzolov
6259
* @author David Turanski
6360
* @author Michael Wirth
64-
* @author Chris Bono
65-
* @author Corneil du Plessis
6661
*/
6762
@Configuration(proxyBeanMethods = false)
6863
@ConditionalOnWebApplication
@@ -97,11 +92,6 @@ public WebMvcConfigurer configurer() {
9792
public void configurePathMatch(PathMatchConfigurer configurer) {
9893
configurer.setUseSuffixPatternMatch(false);
9994
}
100-
101-
@Override
102-
public void addFormatters(FormatterRegistry registry) {
103-
registry.addConverter(new AppBootVersionConverter());
104-
}
10595
};
10696
}
10797

@@ -143,13 +133,4 @@ public void onApplicationEvent(ContextClosedEvent event) {
143133
this.longTaskSample = null;
144134
}
145135
}
146-
147-
static class AppBootVersionConverter implements Converter<String, AppBootSchemaVersion> {
148-
149-
@Override
150-
public AppBootSchemaVersion convert(String value) {
151-
return value != null ? AppBootSchemaVersion.fromBootVersion(value) : null;
152-
}
153-
}
154-
155136
}

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/controller/AppRegistryController.java

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535

3636
import org.springframework.boot.configurationmetadata.ConfigurationMetadataProperty;
3737
import org.springframework.cloud.dataflow.configuration.metadata.ApplicationConfigurationMetadataResolver;
38-
import org.springframework.cloud.dataflow.core.AppBootSchemaVersion;
3938
import org.springframework.cloud.dataflow.core.AppRegistration;
4039
import org.springframework.cloud.dataflow.core.ApplicationType;
4140
import org.springframework.cloud.dataflow.core.StreamAppDefinition;
@@ -222,21 +221,17 @@ else if (entry.getKey().equals("outbound")) {
222221
* @param type module type
223222
* @param name module name
224223
* @param version module version
225-
* @param bootVersion module boot version or {@code null} to use the default
226224
* @param uri URI for the module artifact (e.g. {@literal maven://group:artifact:version})
227225
* @param metadataUri URI for the metadata artifact
228226
* @param force if {@code true}, overwrites a pre-existing registration
229227
*/
230228
@RequestMapping(value = "/{type}/{name}/{version:.+}", method = RequestMethod.POST)
231229
@ResponseStatus(HttpStatus.CREATED)
232-
public void register(
233-
@PathVariable("type") ApplicationType type,
234-
@PathVariable("name") String name,
230+
public void register(@PathVariable("type") ApplicationType type, @PathVariable("name") String name,
235231
@PathVariable("version") String version,
236-
@RequestParam(name = "bootVersion", required = false) AppBootSchemaVersion bootVersion,
237-
@RequestParam("uri") String uri,
238-
@RequestParam(name = "metadata-uri", required = false) String metadataUri,
232+
@RequestParam("uri") String uri, @RequestParam(name = "metadata-uri", required = false) String metadataUri,
239233
@RequestParam(value = "force", defaultValue = "false") boolean force) {
234+
240235
validateApplicationName(name);
241236
appRegistryService.validate(appRegistryService.getDefaultApp(name, type), uri, version);
242237
AppRegistration previous = appRegistryService.find(name, type, version);
@@ -256,15 +251,11 @@ public void register(
256251
@Deprecated
257252
@RequestMapping(value = "/{type}/{name}", method = RequestMethod.POST)
258253
@ResponseStatus(HttpStatus.CREATED)
259-
public void register(
260-
@PathVariable("type") ApplicationType type,
261-
@PathVariable("name") String name,
262-
@RequestParam(name = "bootVersion", required = false) AppBootSchemaVersion bootVersion,
263-
@RequestParam("uri") String uri,
264-
@RequestParam(name = "metadata-uri", required = false) String metadataUri,
254+
public void register(@PathVariable("type") ApplicationType type, @PathVariable("name") String name,
255+
@RequestParam("uri") String uri, @RequestParam(name = "metadata-uri", required = false) String metadataUri,
265256
@RequestParam(value = "force", defaultValue = "false") boolean force) {
266257
String version = this.appRegistryService.getResourceVersion(uri);
267-
this.register(type, name, version, bootVersion, uri, metadataUri, force);
258+
this.register(type, name, version, uri, metadataUri, force);
268259
}
269260

270261
/**

0 commit comments

Comments
 (0)