Search in sources :

Example 1 with JSonParser

use of org.jboss.tools.openshift.core.odo.JSonParser in project jbosstools-openshift by jbosstools.

the class OdoCli method debugInfo.

@Override
public DebugInfo debugInfo(String project, String application, String context, String component) throws IOException {
    try {
        ExecResult result = ExecHelper.execute(command, new File(context), envVars, "debug", "info", "-o", "json");
        JSonParser parser = new JSonParser(JSON_MAPPER.readTree(result.getStdOut()));
        return parser.parseDebugInfo();
    } catch (IOException e) {
        if (e.getMessage().contains("debug is not running")) {
            return new DebugInfo(DebugStatus.NOT_RUNNING);
        }
        throw e;
    }
}
Also used : IOException(java.io.IOException) File(java.io.File) JSonParser(org.jboss.tools.openshift.core.odo.JSonParser) DebugInfo(org.jboss.tools.openshift.core.odo.DebugInfo) ExecResult(org.jboss.tools.openshift.internal.ui.odo.ExecHelper.ExecResult)

Example 2 with JSonParser

use of org.jboss.tools.openshift.core.odo.JSonParser in project jbosstools-openshift by jbosstools.

the class OdoCli method loadSwagger.

private void loadSwagger() {
    try {
        Request req = new Request.Builder().get().url(new java.net.URL(client.getMasterUrl(), "/openapi/v2")).build();
        Response response = client.adapt(OkHttpClient.class).newCall(req).execute();
        if (response.isSuccessful()) {
            swagger = new JSonParser(new ObjectMapper().readTree(response.body().charStream()));
        }
    } catch (IOException e) {
        OpenShiftUIActivator.log(IStatus.ERROR, e.getLocalizedMessage(), e);
    }
}
Also used : Response(okhttp3.Response) Request(okhttp3.Request) IOException(java.io.IOException) JSonParser(org.jboss.tools.openshift.core.odo.JSonParser) URL(org.jboss.tools.openshift.core.odo.URL) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper)

Aggregations

IOException (java.io.IOException)2 JSonParser (org.jboss.tools.openshift.core.odo.JSonParser)2 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)1 File (java.io.File)1 Request (okhttp3.Request)1 Response (okhttp3.Response)1 DebugInfo (org.jboss.tools.openshift.core.odo.DebugInfo)1 URL (org.jboss.tools.openshift.core.odo.URL)1 ExecResult (org.jboss.tools.openshift.internal.ui.odo.ExecHelper.ExecResult)1