Package io.apigee.trireme.core.internal

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


            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

        @JSFunction
        @SuppressWarnings("unused")
        public static Object getOSRelease(Context cx, Scriptable thisObj, Object[] args, Function func)
        {
            ScriptRunner runner = getRunner(cx);
            if ((runner.getSandbox() != null) &&
                runner.getSandbox().isHideOSDetails()) {
                return HIDDEN_OS_RELEASE;
            }
            return System.getProperty("os.version");
        }
View Full Code Here

        @SuppressWarnings("unused")
        public static Object getInterfaceAddresses(Context cx, Scriptable thisObj, Object[] args, Function func)
                throws SocketException
        {
            Scriptable obj = cx.newObject(thisObj);
            ScriptRunner runner = getRunner(cx);

            Enumeration<NetworkInterface> nets = NetworkInterface.getNetworkInterfaces();
            // Only include non-loopback interfaces if we are not "hiding" the OS details.
            for (NetworkInterface netIf : Collections.list(nets)) {
                if ((runner.getSandbox() == null) ||
                    !runner.getSandbox().isHideOSDetails() ||
                    netIf.isLoopback()) {

                    List<InterfaceAddress> ifAddresses = netIf.getInterfaceAddresses();
                    Scriptable ifAddressesArray = cx.newArray(thisObj, ifAddresses.size());
View Full Code Here

        throws NodeException
    {
        ModuleRegistry registry = getRegistry();

        if ((scriptFile == null) && (script == null)) {
            runner = new ScriptRunner(this, env, sandbox, args, forceRepl);
        } else if (scriptFile == null) {
            runner = new ScriptRunner(this, env, sandbox, scriptName, script, args);
        } else {
            runner = new ScriptRunner(this, env, sandbox, scriptFile, args);
        }
        runner.setRegistry(registry);
        runner.setParentProcess((ProcessWrap.ProcessImpl)parentProcess);
        if (workingDir != null) {
            try {
View Full Code Here

        if (scriptFile == null) {
            throw new NodeException("Modules must be specified as a file name and not as a string");
        }
        ModuleRegistry registry = getRegistry();

        runner = new ScriptRunner(this, env, sandbox, scriptName,
                                  makeModuleScript(), args);
        runner.setParentProcess((ProcessWrap.ProcessImpl)parentProcess);
        runner.setRegistry(registry);
        if (workingDir != null) {
            try {
View Full Code Here

    /**
     * An internal method to retrieve the "process" argument for sending events.
     */
    public Scriptable _getProcessObject()
    {
        ScriptRunner runner = _getRuntime();
        return (runner == null ? null : runner.getProcess());
    }
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.