public synchronized void init()

in gshell-wisdom/gshell-wisdom-core/src/main/java/org/apache/geronimo/gshell/wisdom/shell/ShellImpl.java [91:130]


    public synchronized void init() throws Exception {
        if (opened) {
            throw new IllegalStateException("Shell is already opened");
        }

        log.debug("Initializing");

        assert application != null;

        // Each shell gets its own variables, using application variables for defaults
        final Variables vars = new Variables(application.getVariables());

        context = new ShellContext()
        {
            public Shell getShell() {
                return ShellImpl.this;
            }

            public IO getIo() {
                // Shells inherit the application's IO
                return application.getIo();
            }

            public Variables getVariables() {
                return vars;
            }
        };

        vars.set("gshell.prompt", application.getModel().getBranding().getPrompt());
        vars.set(CommandResolver.GROUP, "/");
        vars.set("gshell.username", application.getUserName());
        vars.set("gshell.hostname", application.getLocalHost());

        // HACK: Add history for the 'history' command, since its not part of the Shell intf it can't really access it
        vars.set("gshell.internal.history", getHistory(), true);

        loadProfileScripts();

        opened = true;
    }