Package io.apigee.trireme.core.internal

Examples of io.apigee.trireme.core.internal.ScriptRunner


    @Override
    public Scriptable registerExports(Context cx, Scriptable scope, NodeRuntime runner)
        throws InvocationTargetException, IllegalAccessException, InstantiationException
    {
        ScriptRunner internalRunner = (ScriptRunner)runner;
        internalRunner.require("stream", cx);

        ScriptableObject.defineClass(scope, ProcessImpl.class, false, true);
        ScriptableObject.defineClass(scope, ProcessModuleImpl.class);

        ProcessModuleImpl exports = (ProcessModuleImpl)cx.newObject(scope, ProcessModuleImpl.CLASS_NAME);
View Full Code Here


            String name = stringArg(args, 0);
            if ((thisObj != null) && (thisObj instanceof NativeImpl)) {
                NativeImpl self = (NativeImpl)thisObj;
                return self.internalRequire(name, cx);
            } else {
                ScriptRunner r = getRunner(cx);
                return r.getNativeModule().internalRequire(name, cx);
            }
        }
View Full Code Here

        @JSStaticFunction
        @SuppressWarnings("unused")
        public static Object createContext(Context cx, Scriptable thisObj, Object[] args, Function func)
        {
            ScriptRunner runner = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            Scriptable ctx = cx.newObject(runner.getScriptScope());
            ctx.setPrototype(getTopLevelScope(runner.getScriptScope()));
            ctx.setParentScope(null);
            return ctx;
        }
View Full Code Here

        @JSStaticFunction
        @SuppressWarnings("unused")
        public static Object getGlobalContext(Context cx, Scriptable thisObj, Object[] args, Function func)
        {
            ScriptRunner runner = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            return runner.getScriptScope();
        }
View Full Code Here

            }
        }

        private static Script getCompiledScript(Context cx, String code, String fileName)
        {
            ScriptRunner runner = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            ClassCache cache = runner.getEnvironment().getClassCache();

            if (cache == null) {
                return compileScript(cx, code, fileName);
            }
View Full Code Here

        {
            if (!inNewExpr) {
                return cx.newObject(ctorObj, CLASS_NAME);
            }

            ScriptRunner runtime = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            AbstractHandle handle = objArg(args, 0, AbstractHandle.class, true);
            return new ConsoleWrapImpl(handle, runtime);
        }
View Full Code Here

        {
            if (!inNewExpr) {
                return cx.newObject(ctorObj, CLASS_NAME, args);
            }

            ScriptRunner runner = getRunner(cx);
            NIOSocketHandle handle = objArg(args, 0, NIOSocketHandle.class, false);
            if (handle == null) {
                handle = new NIOSocketHandle(runner);
            }
View Full Code Here

        {
            if (!inNewExpr) {
                return cx.newObject(ctorObj, CLASS_NAME, args);
            }

            ScriptRunner runtime = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            AbstractHandle handle = objArg(args, 0, AbstractHandle.class, true);
            return new StreamWrapImpl(handle, runtime);
        }
View Full Code Here

    public static void setTrustStore(Context cx, Scriptable thisObj, Object[] args, Function func)
    {
        String name = stringArg(args, 0);
        SecureContextImpl self = (SecureContextImpl)thisObj;
        self.initialized = false;
        ScriptRunner runtime = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);

        try {
            FileInputStream keyIn = new FileInputStream(runtime.translatePath(name));
            try {
                KeyStore trustStore = KeyStore.getInstance(KeyStore.getDefaultType());
                trustStore.load(keyIn, null);
                TrustManagerFactory trustFactory = TrustManagerFactory.getInstance(TrustManagerFactory.getDefaultAlgorithm());
                trustFactory.init(trustStore);
View Full Code Here

    {
        String name = stringArg(args, 0);
        String p = stringArg(args, 1);
        SecureContextImpl self = (SecureContextImpl)thisObj;
        self.initialized = false;
        ScriptRunner runtime = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);

        char[] passphrase = p.toCharArray();
        try {
            FileInputStream keyIn = new FileInputStream(runtime.translatePath(name));
            try {
                KeyStore keyStore = KeyStore.getInstance(KeyStore.getDefaultType());
                keyStore.load(keyIn, passphrase);
                KeyManagerFactory keyFactory = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());
                keyFactory.init(keyStore, passphrase);
View Full Code Here

TOP

Related Classes of io.apigee.trireme.core.internal.ScriptRunner

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.