use of org.exist.debuggee.dbgp.packets.Command in project exist by eXist-db.
the class RequestDecoder method doDecode.
@Override
protected boolean doDecode(IoSession session, IoBuffer in, ProtocolDecoderOutput out) throws Exception {
byte b;
while (true) {
if (in.remaining() > 0) {
b = in.get();
if (b == (byte) 0) {
Command command = Command.parse(session, sCommand);
command.exec();
System.out.println("doDecode command = " + command);
if (!(command instanceof CommandContinuation)) {
out.write(command);
}
sCommand = "";
continue;
}
sCommand += (char) b;
} else {
return false;
}
}
}
use of org.exist.debuggee.dbgp.packets.Command in project exist by eXist-db.
the class ProtocolHandler method messageReceived.
@Override
public void messageReceived(IoSession session, Object message) {
Command command = (Command) message;
if (LOG.isDebugEnabled())
LOG.debug("" + command.toString());
session.write(command);
}
use of org.exist.debuggee.dbgp.packets.Command in project exist by eXist-db.
the class ContextGet method eval.
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
try {
Debuggee dbgr = BrokerPool.getInstance().getDebuggee();
IoSession session = (IoSession) dbgr.getSession(args[0].getStringValue());
if (session == null)
return StringValue.EMPTY_STRING;
Command command = new org.exist.debuggee.dbgp.packets.ContextGet(session, "");
command.exec();
return Utils.nodeFromString(getContext(), new String(command.responseBytes()));
} catch (Throwable e) {
throw new XPathException(this, Module.DEBUG001, e);
}
}
use of org.exist.debuggee.dbgp.packets.Command in project exist by eXist-db.
the class Stop method eval.
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
try {
Debuggee dbgr = BrokerPool.getInstance().getDebuggee();
IoSession session = (IoSession) dbgr.getSession(args[0].getStringValue());
if (session == null)
return BooleanValue.FALSE;
Command command = new org.exist.debuggee.dbgp.packets.Stop(session, "");
command.exec();
return BooleanValue.TRUE;
} catch (Throwable e) {
throw new XPathException(this, Module.DEBUG001, e);
}
}
use of org.exist.debuggee.dbgp.packets.Command in project exist by eXist-db.
the class Run method eval.
@Override
public Sequence eval(Sequence[] args, Sequence contextSequence) throws XPathException {
try {
Debuggee dbgr = BrokerPool.getInstance().getDebuggee();
IoSession session = (IoSession) dbgr.getSession(args[0].getStringValue());
if (session == null)
return BooleanValue.FALSE;
Command command = new org.exist.debuggee.dbgp.packets.Run(session, "");
command.exec();
return BooleanValue.TRUE;
} catch (Throwable e) {
throw new XPathException(this, Module.DEBUG001, e);
}
}
Aggregations