Source:
public static void main(String[] args) throws IOException { String userName = args[0]; String authToken = args[1]; String url = args[2]; String instanceName = args[3]; boolean allowInsecure = false; if (args.length == 5 && "true".equals(args[4])) { allowInsecure = false; } StreamsConnection sClient = StreamsConnectionFactory.createStreamsConnection(userName, authToken, url, allowInsecure); try { System.out.println("Instance: "); Instance instance = sClient.getInstance(instanceName); List<Job> jobs = instance.getJobs(); for (Job job : jobs) { System.out.println("Job: " + job.toString()); List<Operator> operators = job.getOperators(); for (Operator op : operators) { System.out.println("Operator: " + op.toString()); List<Metric> metrics = op.getMetrics(); for (Metric m : metrics) { System.out.println("Metric: " + m.toString()); } List<OutputPort> outP = op.getOutputPorts(); for (OutputPort oport : outP) { System.out.println("Output Port: " + oport.toString()); for (Metric om : oport.getMetrics()) { System.out.println("Output Port Metric: " + om.toString()); } } List<InputPort> inP = op.getInputPorts(); for (InputPort ip : inP) { System.out.println("Input Port: " + ip.toString()); for (Metric im : ip.getMetrics()) { System.out.println("Input Port Metric: " + im.toString()); } } } for (ProcessingElement pe : job.getPes()) { System.out.println("ProcessingElement:" + pe.toString()); } } try { instance.getJob("99999"); } catch (RESTException e) { System.out.println("Status Code: " + e.getStatusCode()); System.out.println("Message Id: " + e.getStreamsErrorMessageId()); System.out.println("MessageAsJson: " + e.getStreamsErrorMessageAsJson().toString()); System.out.println("Message: " + e.getMessage()); } } catch (Exception e) { e.printStackTrace(); } }

Target:
public static void main(String[] args) throws IOException { String userName = args[0]; String authToken = args[1]; String url = args[2]; String instanceName = args[3]; boolean allowInsecure = false; if (args.length == 5 && "true".equals(args[4])) { allowInsecure = true; } IStreamsConnection sClient = StreamsRestFactory.createStreamsConnection(userName, authToken, url, allowInsecure); try { System.out.println("Instance: "); Instance instance = sClient.getInstance(instanceName); List<Job> jobs = instance.getJobs(); for (Job job : jobs) { System.out.println("Job: " + job.toString()); List<Operator> operators = job.getOperators(); for (Operator op : operators) { System.out.println("Operator: " + op.toString()); List<Metric> metrics = op.getMetrics(); for (Metric m : metrics) { System.out.println("Metric: " + m.toString()); } List<OutputPort> outP = op.getOutputPorts(); for (OutputPort oport : outP) { System.out.println("Output Port: " + oport.toString()); for (Metric om : oport.getMetrics()) { System.out.println("Output Port Metric: " + om.toString()); } } List<InputPort> inP = op.getInputPorts(); for (InputPort ip : inP) { System.out.println("Input Port: " + ip.toString()); for (Metric im : ip.getMetrics()) { System.out.println("Input Port Metric: " + im.toString()); } } } for (ProcessingElement pe : job.getPes()) { System.out.println("ProcessingElement:" + pe.toString()); } } try { instance.getJob("99999"); } catch (RESTException e) { System.out.println("Status Code: " + e.getStatusCode()); System.out.println("Message Id: " + e.getStreamsErrorMessageId()); System.out.println("MessageAsJson: " + e.getStreamsErrorMessageAsJson().toString()); System.out.println("Message: " + e.getMessage()); } } catch (Exception e) { e.printStackTrace(); } }