SDN Controller Programming Guide

199
Now add a break point and verify that the controller stops at such point. Skip the rest of this
information if familiar with the Eclipse’s debug perspective. Use the application developed at 4
Sample Application on page 106 at the point of section GUI-Specific REST API on page 173. The
reason to do so is because at that point the application generates a very simple user interface with
a single button that displays a message retrieved from the server via RESTful web services; and this
adds a breakpoint in such REST API. You may not be able to follow the remaining of this section
using such application in that particular state, however you can follow the section just by adding a
break point in any code that is executed in the controller (Which is any Java code in your
application); you just need to figure out an action that triggers the code you want to remotely
debug.
Open a Java file and add a break point. Following the sample application we will open the REST
API used by the GUI, SwitchViewResource from module hm-ui, and add a break point in the only
RESTful method there as illustrated in Figure 71.
Figure 71 Adding Break Point to SwitchViewResource.java
Figure 1
Now open the application and click on the Refresh Data button that displays a message retrieved
from the REST API where the break point was just added. Figure 72 shows the sample
application’s view. After clicking Refresh Data, notice that a confirmation message from Eclipse
requesting to change to the debug perspective, Figure 73. That means the controller hit the break
point and now it can run step by step. Select Yes to continue.