use of com.alipay.sofa.ark.spi.argument.LaunchCommand in project sofa-ark by alipay.
the class ArkContainer method main.
public static Object main(String[] args) throws ArkRuntimeException {
if (args.length < MINIMUM_ARGS_SIZE) {
throw new ArkRuntimeException("Please provide suitable arguments to continue !");
}
try {
LaunchCommand launchCommand = LaunchCommand.parse(args);
if (launchCommand.isExecutedByCommandLine()) {
ExecutableArkBizJar executableArchive;
File rootFile = new File(URLDecoder.decode(launchCommand.getExecutableArkBizJar().getFile()));
if (rootFile.isDirectory()) {
executableArchive = new ExecutableArkBizJar(new ExplodedArchive(rootFile));
} else {
executableArchive = new ExecutableArkBizJar(new JarFileArchive(rootFile, launchCommand.getExecutableArkBizJar()));
}
return new ArkContainer(executableArchive, launchCommand).start();
} else {
ClassPathArchive classPathArchive;
if (ArkConfigs.isEmbedEnable()) {
classPathArchive = new EmbedClassPathArchive(launchCommand.getEntryClassName(), launchCommand.getEntryMethodName(), launchCommand.getClasspath());
} else {
classPathArchive = new ClassPathArchive(launchCommand.getEntryClassName(), launchCommand.getEntryMethodName(), launchCommand.getClasspath());
}
return new ArkContainer(classPathArchive, launchCommand).start();
}
} catch (IOException e) {
throw new ArkRuntimeException(String.format("SOFAArk startup failed, commandline=%s", LaunchCommand.toString(args)), e);
}
}
Aggregations