Package io.apigee.trireme.core.internal

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


            }
        }

        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

            if (!inNewExpr) {
                return cx.newObject(ctorObj, CLASS_NAME, args);
            }
            Scriptable context = objArg(args, 0, Scriptable.class, true);

            ScriptRunner runner = (ScriptRunner)cx.getThreadLocal(ScriptRunner.RUNNER);
            ContextImpl self = new ContextImpl();
            self.globalProxy = new Forwarder(runner.getScriptScope(), context);
            context.setParentScope(null);
            self.context = context;
            return self;
        }
View Full Code Here

        {
            Scriptable module = objArg(args, 0, Scriptable.class, true);
            String fileName = stringArg(args, 1);

            // This method is called anonymously by "module.js"
            ScriptRunner runner = getRunner(cx);

            Matcher m = FILE_NAME_PATTERN.matcher(fileName);
            if (!m.matches()) {
                throw Utils.makeError(cx, thisObj, "dlopen(" + fileName + "): Native module not supported");
            }

            String name = m.group(4);

            try {
                Object nativeMod = runner.initializeModule(name, ModuleRegistry.ModuleType.NATIVE, cx,
                                                           runner.getScriptScope());
                if (log.isTraceEnabled()) {
                    log.trace("Creating new instance {} of native module {}",
                              System.identityHashCode(nativeMod), name);
                }
View Full Code Here

        @JSFunction
        @SuppressWarnings("unused")
        public static Object getCPUs(Context cx, Scriptable thisObj, Object[] args, Function func)
        {
            int numProcessors = ManagementFactory.getOperatingSystemMXBean().getAvailableProcessors();
            ScriptRunner runner = getRunner(cx);
            if ((runner.getSandbox() != null) &&
                runner.getSandbox().isHideOSDetails()) {
                // Obscure processor count if OS details are hidden on purpose
                numProcessors = 1;
            }
            Object[] cpuObjects = new Object[numProcessors];
View Full Code Here

        @JSFunction
        @SuppressWarnings("unused")
        public static Object getOSType(Context cx, Scriptable thisObj, Object[] args, Function func)
        {
            ScriptRunner runner = getRunner(cx);
            if ((runner.getSandbox() != null) &&
                runner.getSandbox().isHideOSDetails()) {
                return HIDDEN_OS_NAME;
            }

            String name = System.getProperty("os.name");
View Full Code Here

TOP

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

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.