< prev index next >
test/java/security/modules/JigsawSecurityUtils.java
Print this page
*** 24,33 ****
--- 24,34 ----
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
+ import java.util.Arrays;
import java.lang.module.ModuleDescriptor;
import static java.lang.module.ModuleDescriptor.Builder;
/**
* Jigsaw utility methods are part of this class. It exposes methods to generate
*** 50,60 ****
* Constructs a Java Command line string based on modular structure followed
* by modular client and service.
*/
public static String[] getJavaCommand(Path modulePath,
StringBuilder classPath, String clientModuleName,
! String mainClass, Map<String, String> vmArgs) throws IOException {
final StringBuilder command = new StringBuilder();
vmArgs.forEach((key, value) -> command.append(key + value + SPACE));
if (modulePath != null) {
command.append("-mp" + SPACE + modulePath.toRealPath() + SPACE);
--- 51,62 ----
* Constructs a Java Command line string based on modular structure followed
* by modular client and service.
*/
public static String[] getJavaCommand(Path modulePath,
StringBuilder classPath, String clientModuleName,
! String mainClass, Map<String, String> vmArgs,
! String... options) throws IOException {
final StringBuilder command = new StringBuilder();
vmArgs.forEach((key, value) -> command.append(key + value + SPACE));
if (modulePath != null) {
command.append("-mp" + SPACE + modulePath.toRealPath() + SPACE);
*** 64,73 ****
--- 66,76 ----
}
if (clientModuleName != null && clientModuleName.length() > 0) {
command.append("-m" + SPACE + clientModuleName + "/");
}
command.append(mainClass);
+ Arrays.asList(options).stream().forEach(o -> command.append(SPACE + o));
return command.toString().trim().split("[\\s]+");
}
/**
* Generate ModuleDescriptor object for explicit/auto based client/service
*** 103,115 ****
* Generates service descriptor inside META-INF folder.
*/
public static boolean createMetaInfServiceDescriptor(
Path serviceDescriptorFile, String serviceImpl) {
boolean created = true;
! System.out.println(String.format("Creating META-INF service descriptor"
! + " for '%s' at path '%s'", serviceImpl,
! serviceDescriptorFile));
try {
Path parent = serviceDescriptorFile.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
--- 106,118 ----
* Generates service descriptor inside META-INF folder.
*/
public static boolean createMetaInfServiceDescriptor(
Path serviceDescriptorFile, String serviceImpl) {
boolean created = true;
! System.out.println(String.format(
! "Creating META-INF service descriptor for '%s' "
! + "at path '%s'", serviceImpl, serviceDescriptorFile));
try {
Path parent = serviceDescriptorFile.getParent();
if (parent != null) {
Files.createDirectories(parent);
}
< prev index next >