use of org.eclipse.che.api.debugger.server.Debugger in project che by eclipse.
the class JavaDebuggerFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
String host = normalizedProps.get("host");
if (host == null) {
throw new DebuggerException("Can't establish connection: host property is unknown.");
}
String portProp = normalizedProps.get("port");
if (portProp == null) {
throw new DebuggerException("Can't establish connection: port property is unknown.");
}
int port;
try {
port = Integer.parseInt(portProp);
} catch (NumberFormatException e) {
throw new DebuggerException("Unknown port property format: " + portProp);
}
return new JavaDebugger(host, port, debuggerCallback);
}
use of org.eclipse.che.api.debugger.server.Debugger in project che by eclipse.
the class ZendDbgFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
String breakAtFirstLineProp = normalizedProps.get("break-at-first-line");
if (breakAtFirstLineProp == null) {
throw new DebuggerException("Can't establish connection: debug break at first line property is unknown.");
}
boolean breakAtFirstLine = Boolean.valueOf(breakAtFirstLineProp);
String clientHostIPProp = normalizedProps.get("client-host-ip");
if (clientHostIPProp == null) {
throw new DebuggerException("Can't establish connection: client host/IP property is unknown.");
}
String debugPortProp = normalizedProps.get("debug-port");
if (debugPortProp == null) {
throw new DebuggerException("Can't establish connection: debug port property is unknown.");
}
int debugPort;
try {
debugPort = Integer.parseInt(debugPortProp);
} catch (NumberFormatException e) {
throw new DebuggerException("Unknown debug port property format: " + debugPortProp);
}
String useSslEncryptionProp = normalizedProps.get("use-ssl-encryption");
if (useSslEncryptionProp == null) {
throw new DebuggerException("Can't establish connection: debug use SSL encryption property is unknown.");
}
boolean useSslEncryption = Boolean.valueOf(useSslEncryptionProp);
return new ZendDebugger(new ZendDbgSettings(debugPort, clientHostIPProp, breakAtFirstLine, useSslEncryption), new ZendDbgLocationHandler(), debuggerCallback);
}
use of org.eclipse.che.api.debugger.server.Debugger in project che by eclipse.
the class GdbDebuggerFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
String host = normalizedProps.get("host");
int port;
try {
port = Integer.parseInt(normalizedProps.getOrDefault("port", "0"));
} catch (NumberFormatException e) {
throw new DebuggerException("Unknown port property format: " + normalizedProps.get("port"));
}
String file = normalizedProps.get("binary");
if (file == null) {
throw new DebuggerException("binary property is null. Debugger can't be started");
}
String sources = normalizedProps.get("sources");
if (sources == null) {
sources = Paths.get(file).getParent().toString();
}
return GdbDebugger.newInstance(host, port, file, sources, debuggerCallback);
}
use of org.eclipse.che.api.debugger.server.Debugger in project che by eclipse.
the class NodeJsDebuggerFactory method create.
@Override
public Debugger create(Map<String, String> properties, Debugger.DebuggerCallback debuggerCallback) throws DebuggerException {
Map<String, String> normalizedProps = properties.entrySet().stream().collect(toMap(e -> e.getKey().toLowerCase(), Map.Entry::getValue));
Integer pid = null;
URI uri = null;
String pidStr = normalizedProps.get("pid");
if (!isNullOrEmpty(pidStr)) {
try {
pid = Integer.valueOf(pidStr);
} catch (NumberFormatException e) {
throw new DebuggerException(String.format("Illegal 'pid' format %s. Debugger can't be started.", pidStr));
}
}
String uriStr = normalizedProps.get("uri");
if (!isNullOrEmpty(uriStr)) {
try {
uri = URI.create(uriStr);
} catch (IllegalArgumentException e) {
throw new DebuggerException(String.format("Illegal 'uri' format %s. Debugger can't be started.", uriStr));
}
}
String script = normalizedProps.get("script");
if (!isNullOrEmpty(script) && !Files.exists(Paths.get(script))) {
throw new DebuggerException(String.format("Script '%s' to debug not found. Debugger can't be started.", script));
}
if (isNullOrEmpty(pidStr) && isNullOrEmpty(uriStr) && isNullOrEmpty(script)) {
throw new DebuggerException("Unrecognized debug connection options. Allowed only: pid, uri or script.");
}
return NodeJsDebugger.newInstance(pid, uri, script, debuggerCallback);
}
Aggregations