polishing
This commit is contained in:
@@ -19,11 +19,9 @@ package org.springframework.cloud.stream.module.launcher;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
/**
|
||||
* Encapsulates a reference to a module (as maven coordinates) and a set of "arguments" that must be passed to it.
|
||||
* Those arguments will eventually be passed to the module by the launcher, using any way appropriate.
|
||||
* Those arguments will be passed to the module by the launcher.
|
||||
*
|
||||
* @author Eric Bottard
|
||||
*/
|
||||
|
||||
@@ -67,7 +67,7 @@ public class ModuleLauncher {
|
||||
* The format of each module must conform to the <a href="http://www.eclipse.org/aether">Aether</a> convention:
|
||||
* <code><groupId>:<artifactId>[:<extension>[:<classifier>]]:<version></code>
|
||||
*
|
||||
* @param moduleLaunchRequests a list of modules with their (unqualified) arguments
|
||||
* @param moduleLaunchRequests a list of modules with their arguments
|
||||
*/
|
||||
public void launch(List<ModuleLaunchRequest> moduleLaunchRequests) {
|
||||
List<ModuleLaunchRequest> reversed = new ArrayList<>(moduleLaunchRequests);
|
||||
|
||||
@@ -19,8 +19,6 @@ package org.springframework.cloud.stream.module.launcher;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.validation.constraints.AssertFalse;
|
||||
|
||||
import org.hibernate.validator.constraints.NotEmpty;
|
||||
|
||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||
|
||||
@@ -34,6 +34,7 @@ import org.springframework.stereotype.Component;
|
||||
*
|
||||
* @author Marius Bogoevici
|
||||
* @author Ilayaperumal Gopinathan
|
||||
* @author Eric Bottard
|
||||
*/
|
||||
@Component
|
||||
@EnableConfigurationProperties(ModuleLauncherProperties.class)
|
||||
@@ -49,7 +50,7 @@ public class ModuleLauncherRunner implements CommandLineRunner {
|
||||
|
||||
@Override
|
||||
public void run(String... args) throws Exception {
|
||||
List<ModuleLaunchRequest> launchRequests = toModuleLaunchRequests(moduleLauncherProperties);
|
||||
List<ModuleLaunchRequest> launchRequests = generateModuleLaunchRequests();
|
||||
if (log.isInfoEnabled()) {
|
||||
StringBuilder sb = new StringBuilder("Launching\n");
|
||||
for (ModuleLaunchRequest moduleLaunchRequest : launchRequests) {
|
||||
@@ -60,15 +61,14 @@ public class ModuleLauncherRunner implements CommandLineRunner {
|
||||
this.moduleLauncher.launch(launchRequests);
|
||||
}
|
||||
|
||||
private List<ModuleLaunchRequest> toModuleLaunchRequests(ModuleLauncherProperties moduleLauncherProperties) {
|
||||
private List<ModuleLaunchRequest> generateModuleLaunchRequests() {
|
||||
List<ModuleLaunchRequest> requests = new ArrayList<>();
|
||||
String[] modules = moduleLauncherProperties.getModules();
|
||||
Map<Integer, Map<String, String>> arguments = moduleLauncherProperties.getArgs();
|
||||
String[] modules = this.moduleLauncherProperties.getModules();
|
||||
Map<Integer, Map<String, String>> arguments = this.moduleLauncherProperties.getArgs();
|
||||
for (int i = 0; i < modules.length; i++) {
|
||||
ModuleLaunchRequest moduleLaunchRequest = new ModuleLaunchRequest(modules[i], arguments.get(i));
|
||||
requests.add(moduleLaunchRequest);
|
||||
}
|
||||
return requests;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user