Package com.ericsson.otp.erlang

Examples of com.ericsson.otp.erlang.OtpErlangPid


                if (obj == null) {
                    return;
                }

                final OtpErlangPid pid = (OtpErlangPid) ((OtpErlangTuple) obj)
                        .elementAt(0);

                final OtpErlangObject r = ErlangEngine.getInstance().getProclistService()
                        .getProcessInfo(getBackend().getOtpRpc(), pid);
                if (r instanceof OtpErlangList) {
                    final OtpErlangList l = (OtpErlangList) r;
                    final StringBuilder s = new StringBuilder();
                    for (int i = 0; i < l.arity(); i++) {
                        final OtpErlangTuple e = (OtpErlangTuple) l.elementAt(i);
                        s.append(' ').append(e.elementAt(0).toString()).append("\t= ")
                                .append(e.elementAt(1).toString()).append('\n');
                    }
                    showMessage(s.toString());
                } else {
                    showMessage("Process " + pid.toString()
                            + " is probably dead.\nPlease refresh process list.");
                }
            }
        };
    }
View Full Code Here


            leader = b.getPid("Leader");
            final OtpErlangObject s = b.get("From");
            if (s instanceof OtpErlangPid) {
                sender = (OtpErlangPid) s;
            } else {
                sender = new OtpErlangPid("s", 0, 0, 0);
            }
        } catch (final Exception e) {
            message = null;
        }
        if (RE_PROMPT.matcher(message).matches()) {
View Full Code Here

    public IoRequest(final String msg, final IoRequestKind kind) {
        assertThat(kind, is(not(IoRequestKind.OUTPUT)));
        assertThat(kind, is(not(IoRequestKind.PROMPT)));
        message = msg;
        encoding = Charsets.ISO_8859_1;
        leader = new OtpErlangPid("s", 0, 0, 0);
        sender = new OtpErlangPid("s", 0, 0, 0);
        this.kind = kind;
    }
View Full Code Here

            // {Registered_name, Node()}
            final OtpErlangTuple processTuple = (OtpErlangTuple) erlangObject;
            int index = 0;

            // pid
            OtpErlangPid pid = null;
            if (processTuple.arity() == 3) {
                // {Pid(), Initial_call()|Registered_name(), Node()}
                pid = (OtpErlangPid) processTuple.elementAt(INDEX_PROCESS_PID);
                pidNode = new TreeNode("pid: " + pid2Str(pid),
                        Activator.getImage(Images.INFO_NODE));
            } else {
                index = 1;// tuple doesn't contain Pid element
            }

            final OtpErlangObject info = processTuple.elementAt(INDEX_PROCESS_INFO
                    - index);

            // process node
            final OtpErlangObject processNode = processTuple.elementAt(INDEX_PROCESS_NODE
                    - index);
            processNodeNode = new TreeNode("node: " + processNode,
                    Activator.getImage(Images.INFO_NODE));

            if (info instanceof OtpErlangTuple) {
                // initial call
                functionNode = createFunctionNode("initial call:", info);
                functionNode.setImage(Activator.getImage(Images.INFO_NODE));
                if (pid != null) {
                    builder.append(pid2Str(pid));
                } else {
                    builder.append(lastFunctionDescription);
                }
            } else {
                // registered name
                nameNode = new TreeNode("name: " + info,
                        Activator.getImage(Images.INFO_NODE));
                builder.append(info.toString());
            }
            builder.append(" (").append(processNode).append(")");
        } else if (erlangObject instanceof OtpErlangPid) {
            // Pid
            final OtpErlangPid pid = (OtpErlangPid) erlangObject;
            pidNode = new TreeNode("pid: " + pid2Str(pid),
                    Activator.getImage(Images.INFO_NODE));
            processNodeNode = new TreeNode("node: " + pid.node(),
                    Activator.getImage(Images.INFO_NODE));
            builder.append(pid2Str(pid)).append(" (").append(pid.node()).append(")");
        } else {
            // Atom (registered name)
            nameNode = new TreeNode("name: " + erlangObject,
                    Activator.getImage(Images.INFO_NODE));
            builder.append(erlangObject.toString());
View Full Code Here

            if (b == null) {
                return null;
            }
            final String topic = b.getAtom("Topic");
            final OtpErlangObject event = b.get("Event");
            final OtpErlangPid sender = b.getPid("Sender");
            return new ErlEvent(topic, nodeProxy, event, sender);
        } catch (final TermParserException e) {
            return null;
        } catch (final OtpErlangException e) {
            ErlLogger.warn("Unrecognized event: " + msg);
View Full Code Here

    private void handleMessage(final OtpErlangObject msg) {
        final OtpErlangTuple tuple = (OtpErlangTuple) msg;
        final String tag = ((OtpErlangAtom) tuple.elementAt(0)).atomValue();
        if ("io_request".equals(tag)) {
            final OtpErlangPid from = (OtpErlangPid) tuple.elementAt(1);
            final OtpErlangObject replyAs = tuple.elementAt(2);
            final OtpErlangTuple request = (OtpErlangTuple) tuple.elementAt(3);
            final OtpErlangObject reply = processRequest(from, request);
            final OtpErlangTuple replyMsg = OtpErlang.mkTuple(new OtpErlangAtom(
                    "io_reply"), replyAs, reply);
View Full Code Here

        cacheCurrentProcess();
    }

    private void cacheCurrentProcess() {
        final DebugTraceEvent event = getCurrentEvent();
        final OtpErlangPid pid = event.getPid();
        currentProcess = getProcessWithPid(pid);
        if (currentProcess == null) {
            currentProcess = new DebugTraceProcess(this, pid);
            processes.add(currentProcess);
        }
View Full Code Here

            }

            @Override
            public void progress(final OtpErlangObject msg) {
                final OtpErlangTuple t = (OtpErlangTuple) msg;
                final OtpErlangPid backgroundSearchPid = (OtpErlangPid) t.elementAt(0);
                final OtpErlangLong progressL = (OtpErlangLong) t.elementAt(1);
                final OtpErlangObject resultO = t.elementAt(2);
                int progress = 1;
                try {
                    progress = progressL.intValue();
View Full Code Here

            final OtpErlangObject o = t.elementAt(1);
            final IStatus s = new Status(IStatus.ERROR, BackendActivator.PLUGIN_ID,
                    DebugException.REQUEST_FAILED, o.toString(), null);
            throw new DebugException(s);
        }
        final OtpErlangPid pid = (OtpErlangPid) res;
        return pid;
    }
View Full Code Here

        OtpErlangObject res = null;
        try {
            res = backend.call(ERLIDE_DEBUG, "attached", "xx", pid, jpid);
            if (res instanceof OtpErlangTuple) {
                final OtpErlangTuple t = (OtpErlangTuple) res;
                final OtpErlangPid meta = (OtpErlangPid) t.elementAt(1);
                return meta;
            }
            return null;
        } catch (final RpcException e) {
            ErlLogger.warn(e);
View Full Code Here

TOP

Related Classes of com.ericsson.otp.erlang.OtpErlangPid

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.