Package org.freeplane.main.application

Examples of org.freeplane.main.application.FreeplaneSecurityManager


      LogUtils.createLogger();
      FreeplaneGUIStarter.showSysInfo();
      final HeadlessMapViewController mapViewController = new HeadlessMapViewController();
      controller.setMapViewManager(mapViewController);
      controller.setViewController(new HeadlessUIController(controller, mapViewController, ""));
      System.setSecurityManager(new FreeplaneSecurityManager());
      FilterController.install();
      FormatController.install(new FormatController());
          final ScannerController scannerController = new ScannerController();
          ScannerController.install(scannerController);
          scannerController.addParsersForStandardFormats();
View Full Code Here


                throw new ExecuteScriptException(errorsInScript.getMessage(), errorsInScript);
            }
            final ScriptingSecurityManager scriptingSecurityManager = createScriptingSecurityManager();
            final ScriptingPermissions originalScriptingPermissions = new ScriptingPermissions(ResourceController
                .getResourceController().getProperties());
            final FreeplaneSecurityManager securityManager = (FreeplaneSecurityManager) System.getSecurityManager();
            final boolean needToSetFinalSecurityManager = securityManager.needToSetFinalSecurityManager();
            final PrintStream oldOut = System.out;
            try {
                final SimpleScriptContext context = createScriptContext(node);
                if (compilationEnabled && engine instanceof Compilable) {
                    compileAndCache((Compilable) engine);
                    if (needToSetFinalSecurityManager)
                        securityManager.setFinalSecurityManager(scriptingSecurityManager);
                    System.setOut(outStream);
                    return compiledScript.eval(context);
                }
                else {
                    if (needToSetFinalSecurityManager)
                        securityManager.setFinalSecurityManager(scriptingSecurityManager);
                    System.setOut(outStream);
                    return engine.eval(scriptSource.getScript(), context);
                }
            }
            finally {
                System.setOut(oldOut);
                if (needToSetFinalSecurityManager && securityManager.hasFinalSecurityManager())
                    securityManager.removeFinalSecurityManager(scriptingSecurityManager);
                /* restore preferences (and assure that the values are unchanged!). */
                originalScriptingPermissions.restorePermissions();
            }
        }
        catch (final ScriptException e) {
View Full Code Here

      this.specificPermissions = specificPermissions;
      this.outStream = outStream;
    }

    ScriptingSecurityManager getScriptingSecurityManager() {
        final FreeplaneSecurityManager securityManager = (FreeplaneSecurityManager) System.getSecurityManager();
        final ScriptingSecurityManager scriptingSecurityManager;
        // get preferences (and store them again after the script execution,
        // such that the scripts are not able to change them).
        if (securityManager.needToSetFinalSecurityManager()) {
            final ScriptingPermissions permissions = permissions();
            permissions.assertScriptExecutionAllowed();
            final boolean executeSignedScripts = permissions.isExecuteSignedScriptsWithoutRestriction();
            if (executeSignedScripts && isSignedScript()) {
                scriptingSecurityManager = permissions.getPermissiveScriptingSecurityManager();
View Full Code Here

                throw new ExecuteScriptException(errorsInScript.getMessage(), errorsInScript);
            }
            final ScriptingSecurityManager scriptingSecurityManager = createScriptingSecurityManager();
            final ScriptingPermissions originalScriptingPermissions = new ScriptingPermissions(ResourceController
                .getResourceController().getProperties());
            final FreeplaneSecurityManager securityManager = (FreeplaneSecurityManager) System.getSecurityManager();
            final boolean needToSetFinalSecurityManager = securityManager.needToSetFinalSecurityManager();
            final PrintStream oldOut = System.out;
            try {
                compileAndCache();
                final Binding binding = createBinding(node);
                compiledScript.setBinding(binding);
                if (needToSetFinalSecurityManager)
                    securityManager.setFinalSecurityManager(scriptingSecurityManager);
                System.setOut(outStream);
                return compiledScript.run();
            }
            finally {
                System.setOut(oldOut);
                if (needToSetFinalSecurityManager && securityManager.hasFinalSecurityManager())
                    securityManager.removeFinalSecurityManager(scriptingSecurityManager);
                /* restore preferences (and assure that the values are unchanged!). */
                originalScriptingPermissions.restorePermissions();
            }
        }
        catch (final GroovyRuntimeException e) {
View Full Code Here

TOP

Related Classes of org.freeplane.main.application.FreeplaneSecurityManager

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.