Search in sources :

Example 1 with OrchidSecurityManager

use of com.eden.orchid.api.OrchidSecurityManager in project Orchid by JavaEden.

the class Orchid method start.

public boolean start(List<Module> modules) {
    OrchidContext context = null;
    try {
        String moduleLog = "\n--------------------";
        for (Module module : modules) {
            if (!module.getClass().getName().startsWith("com.eden.orchid.OrchidModule")) {
                moduleLog += "\n * " + module.getClass().getName();
            }
        }
        moduleLog += "\n";
        Clog.tag("Using the following modules").log(moduleLog);
        Injector injector = Guice.createInjector(modules);
        String flagLog = "";
        flagLog += "\n--------------------\n";
        flagLog += OrchidFlags.getInstance().printFlags();
        flagLog += "\n";
        Clog.tag("Flag values").log(flagLog);
        context = injector.getInstance(OrchidContext.class);
        try {
            OrchidSecurityManager manager = injector.getInstance(OrchidSecurityManager.class);
            System.setSecurityManager(manager);
        } catch (Exception e) {
        }
        Clog.i("Running Orchid version {}, site version {} in {} environment", context.getOrchidVersion(), context.getVersion(), context.getEnvironment());
        context.start();
        context.finish();
        return true;
    } catch (Exception e) {
        Clog.e("Something went wrong running Orchid", e);
        e.printStackTrace();
        if (context != null) {
            context.broadcast(Orchid.Lifecycle.Shutdown.fire(context, this));
        }
        return false;
    }
}
Also used : OrchidContext(com.eden.orchid.api.OrchidContext) Injector(com.google.inject.Injector) OrchidSecurityManager(com.eden.orchid.api.OrchidSecurityManager) Module(com.google.inject.Module)

Aggregations

OrchidContext (com.eden.orchid.api.OrchidContext)1 OrchidSecurityManager (com.eden.orchid.api.OrchidSecurityManager)1 Injector (com.google.inject.Injector)1 Module (com.google.inject.Module)1