120 String... args) throws Exception;
121
122 /**
123 * Find the Jar for service/client based on module type and if service
124 * descriptor required.
125 */
126 public abstract Path findJarPath(boolean service, MODULE_TYPE moduleType,
127 boolean addMetaDesc, boolean dependsOnServiceModule);
128
129 /**
130 * Constructs a Java Command line string based on modular structure followed
131 * by modular client and service.
132 */
133 public String[] getJavaCommand(Path modulePath, String classPath,
134 String clientModuleName, String mainClass,
135 Map<String, String> vmArgs, String... options) throws IOException {
136
137 final StringJoiner command = new StringJoiner(SPACE, SPACE, SPACE);
138 vmArgs.forEach((key, value) -> command.add(key + value));
139 if (modulePath != null) {
140 command.add("-mp").add(modulePath.toFile().getCanonicalPath());
141 }
142 if (classPath != null && classPath.length() > 0) {
143 command.add("-cp").add(classPath);
144 }
145 if (clientModuleName != null && clientModuleName.length() > 0) {
146 command.add("-m").add(clientModuleName + "/" + mainClass);
147 } else {
148 command.add(mainClass);
149 }
150 command.add(Arrays.stream(options).collect(Collectors.joining(SPACE)));
151 return command.toString().trim().split("[\\s]+");
152 }
153
154 /**
155 * Generate ModuleDescriptor object for explicit/auto based client/Service
156 * modules type.
157 */
158 public ModuleDescriptor generateModuleDescriptor(boolean isService,
159 MODULE_TYPE moduleType, String moduleName, String pkg,
160 String serviceInterface, String serviceImpl,
|
120 String... args) throws Exception;
121
122 /**
123 * Find the Jar for service/client based on module type and if service
124 * descriptor required.
125 */
126 public abstract Path findJarPath(boolean service, MODULE_TYPE moduleType,
127 boolean addMetaDesc, boolean dependsOnServiceModule);
128
129 /**
130 * Constructs a Java Command line string based on modular structure followed
131 * by modular client and service.
132 */
133 public String[] getJavaCommand(Path modulePath, String classPath,
134 String clientModuleName, String mainClass,
135 Map<String, String> vmArgs, String... options) throws IOException {
136
137 final StringJoiner command = new StringJoiner(SPACE, SPACE, SPACE);
138 vmArgs.forEach((key, value) -> command.add(key + value));
139 if (modulePath != null) {
140 command.add("--module-path").add(modulePath.toFile().getCanonicalPath());
141 }
142 if (classPath != null && classPath.length() > 0) {
143 command.add("-cp").add(classPath);
144 }
145 if (clientModuleName != null && clientModuleName.length() > 0) {
146 command.add("-m").add(clientModuleName + "/" + mainClass);
147 } else {
148 command.add(mainClass);
149 }
150 command.add(Arrays.stream(options).collect(Collectors.joining(SPACE)));
151 return command.toString().trim().split("[\\s]+");
152 }
153
154 /**
155 * Generate ModuleDescriptor object for explicit/auto based client/Service
156 * modules type.
157 */
158 public ModuleDescriptor generateModuleDescriptor(boolean isService,
159 MODULE_TYPE moduleType, String moduleName, String pkg,
160 String serviceInterface, String serviceImpl,
|