Search in sources :

Example 1 with ClassPathArchive

use of com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive in project sofa-ark by alipay.

the class SofaArkBootstrap method remain.

private static void remain(String[] args) throws Exception {
    // NOPMD
    AssertUtils.assertNotNull(entryMethod, "No Entry Method Found.");
    URL[] urls = getURLClassPath();
    new ClasspathLauncher(new ClassPathArchive(entryMethod.getDeclaringClassName(), entryMethod.getMethodName(), urls)).launch(args, getClasspath(urls), entryMethod.getMethod());
}
Also used : ClasspathLauncher(com.alipay.sofa.ark.bootstrap.ClasspathLauncher) URL(java.net.URL) ClassPathArchive(com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive)

Example 2 with ClassPathArchive

use of com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive 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);
    }
}
Also used : ExplodedArchive(com.alipay.sofa.ark.loader.archive.ExplodedArchive) LaunchCommand(com.alipay.sofa.ark.spi.argument.LaunchCommand) EmbedClassPathArchive(com.alipay.sofa.ark.loader.EmbedClassPathArchive) ExecutableArkBizJar(com.alipay.sofa.ark.loader.ExecutableArkBizJar) JarFileArchive(com.alipay.sofa.ark.loader.archive.JarFileArchive) IOException(java.io.IOException) File(java.io.File) ArkRuntimeException(com.alipay.sofa.ark.exception.ArkRuntimeException) ClassPathArchive(com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive) EmbedClassPathArchive(com.alipay.sofa.ark.loader.EmbedClassPathArchive)

Aggregations

ClassPathArchive (com.alipay.sofa.ark.bootstrap.ClasspathLauncher.ClassPathArchive)2 ClasspathLauncher (com.alipay.sofa.ark.bootstrap.ClasspathLauncher)1 ArkRuntimeException (com.alipay.sofa.ark.exception.ArkRuntimeException)1 EmbedClassPathArchive (com.alipay.sofa.ark.loader.EmbedClassPathArchive)1 ExecutableArkBizJar (com.alipay.sofa.ark.loader.ExecutableArkBizJar)1 ExplodedArchive (com.alipay.sofa.ark.loader.archive.ExplodedArchive)1 JarFileArchive (com.alipay.sofa.ark.loader.archive.JarFileArchive)1 LaunchCommand (com.alipay.sofa.ark.spi.argument.LaunchCommand)1 File (java.io.File)1 IOException (java.io.IOException)1 URL (java.net.URL)1