Examples of ScriptReader


Examples of org.h2.util.ScriptReader

        session.getUser().checkAdmin();
        int count = 0;
        try {
            openInput();
            Reader reader = new InputStreamReader(in, charset);
            ScriptReader r = new ScriptReader(reader);
            while (true) {
                String sql = r.readStatement();
                if (sql == null) {
                    break;
                }
                execute(sql);
                count++;
View Full Code Here

Examples of org.h2.util.ScriptReader

                    throw new FileNotFoundException(fileName);
                }

                // execute init script
                try (Reader reader = Resources.asCharSource(url, Charsets.UTF_8).openStream()) {
                    ScriptReader scriptReader = new ScriptReader(reader);
                    for (String statement = scriptReader.readStatement(); statement != null; statement = scriptReader.readStatement()) {
                        executeCommand(connection, statement);
                    }
                }
            }
View Full Code Here

Examples of org.h2.util.ScriptReader

                    throw new FileNotFoundException(fileName);
                }

                // execute init script
                try (Reader reader = Resources.asCharSource(url, UTF_8).openStream()) {
                    ScriptReader scriptReader = new ScriptReader(reader);
                    for (String statement = scriptReader.readStatement(); statement != null; statement = scriptReader.readStatement()) {
                        executeCommand(connection, statement);
                    }
                }
            }
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

            jaggeryContext.addProperty(CommonManager.JAGGERY_OUTPUT_STREAM, System.out);
         
          RhinoEngine.putContextProperty("jaggeryContext", jaggeryContext);

            //Parsing the script
          final Reader source = new ScriptReader(new BufferedInputStream(fstream));
            out.println("\n");
            ShellUtilityService.initializeUtilityServices();
            engine.exec(source, scope, null);
            ShellUtilityService.destroyUtilityServices();
            out.flush();
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

        }
        if (isIncludeOnce && includedScripts.get(fileURL) != null) {
            return scope;
        }

        ScriptReader source;
        RhinoEngine engine = jaggeryContext.getEngine();
        if (isBuilt) {
            source = new ScriptReader(context.getResourceAsStream(fileURL)) {
                @Override
                protected void build() throws IOException {
                    try {
                        if (isJSON) {
                            sourceReader = new StringReader("(" + HostObjectUtil.streamToString(sourceIn) + ")");
                        } else {
                            sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                        }
                    } catch (ScriptException e) {
                        throw new IOException(e);
                    }
                }
            };
        } else {
            source = new ScriptReader(context.getResourceAsStream(fileURL));
        }

        ScriptCachingContext sctx = new ScriptCachingContext(jaggeryContext.getTenantId(), keys[0], keys[1], keys[2]);
        sctx.setSecurityDomain(new JaggerySecurityDomain(fileURL, context));
        long lastModified = WebAppManager.getScriptLastModified(context, fileURL);
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

                            }
                            String path = (String) script;
                            path = path.startsWith("/") ? path : "/" + path;
                            Stack<String> callstack = CommonManager.getCallstack(sharedContext);
                            callstack.push(path);
                            engine.exec(new ScriptReader(servletContext.getResourceAsStream(path)) {
                                @Override
                                protected void build() throws IOException {
                                    try {
                                        sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                                    } catch (ScriptException e) {
                                        throw new IOException(e);
                                    }
                                }
                            }, sharedScope, null);
                            callstack.pop();
                        }
                    }
                }
            }

            Object serveFunction = request.getServletContext().getAttribute(SERVE_FUNCTION_JAGGERY);
            if (serveFunction != null) {
                Function function = (Function) serveFunction;
                ScriptableObject scope = context.getScope();
                function.call(cx, scope, scope, new Object[]{
                        scope.get("request", scope),
                        scope.get("response", scope),
                        scope.get("session", scope)
                });
            } else {
                //resource rendering model proceeding
                sourceIn = request.getServletContext().getResourceAsStream(scriptPath);
                if (sourceIn == null) {
                    response.sendError(HttpServletResponse.SC_NOT_FOUND, request.getRequestURI());
                    return;
                }
                CommonManager.getInstance().getEngine()
                        .exec(new ScriptReader(sourceIn), context.getScope(),
                                getScriptCachingContext(request, scriptPath));
            }
        } catch (ScriptException e) {
            String msg = e.getMessage();
            log.error(msg, e);
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

        RhinoEngine.defineProperty(clonedScope, session);

        for (Object jsListener : jsListeners) {
            CommonManager.getCallstack(context).push((String) jsListener);
            try {
                ScriptReader sr = new ScriptReader(ctx.getResourceAsStream((String) jsListener)) {
                    @Override
                    protected void build() throws IOException {
                        try {
                            sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                        } catch (ScriptException e) {
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

        RhinoEngine.defineProperty(clonedScope, session);

        for (Object jsListener : jsListeners) {
            CommonManager.getCallstack(context).push((String) jsListener);
            try {
                ScriptReader sr = new ScriptReader(ctx.getResourceAsStream((String) jsListener)) {
                    @Override
                    protected void build() throws IOException {
                        try {
                            sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                        } catch (ScriptException e) {
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

                    callstack.push(path);
                    String[] parts = WebAppManager.getKeys(servletContext.getContextPath(), path, path);
                    ScriptCachingContext sctx = new ScriptCachingContext(sharedContext.getTenantId(),
                            parts[0], parts[1], parts[2]);
                    sctx.setSecurityDomain(new JaggerySecurityDomain(path, servletContext));
                    engine.exec(new ScriptReader(servletContext.getResourceAsStream(path)) {
                        @Override
                        protected void build() throws IOException {
                            try {
                                sourceReader = new StringReader(HostObjectUtil.streamToString(sourceIn));
                            } catch (ScriptException e) {
View Full Code Here

Examples of org.jaggeryjs.jaggery.core.ScriptReader

        }
        fileURL = FilenameUtils.normalize(fileURL);
        if (includesCallstack.search(fileURL) != -1) {
            return;
        }
        ScriptReader source = null;
        try {
            source = new ScriptReader(new FileInputStream(fileURL));
            includedScripts.put(fileURL, true);
            includesCallstack.push(fileURL);
            engine.exec(source, scope, null);
            includesCallstack.pop();
        } catch (FileNotFoundException e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.