Tooling used for netkernel development

Poster Content
nk4um Moderator
Posts: 901
July 23, 2012 11:24

Hi Barry/Prasan,

Here are some answers...

1. What is the typical approach people take to development/debugging netkernel programs? In particular how would one use Eclipse Breakpoints/watchpoints to isolate a problem in one’s module when the modules are being invoked as endpoints by netkernel? Can one just run the whole of netkernel under Eclipse? Is there other tools that are used to achieve a similar functionality?

Sure there are two options

a) Run directly inside Eclipse. You need to have in the classpath and execute the Bootloader class (this is in the root of the classpath ie there's no package name). You can copy the CLI options from jvmsettings.cnf as a baseline - you also must specify the NK install basepath as the only required argument. The shell scripts show the details but the basic idea is this...

java Bootloader /path/to/nk/install/

b) If you just want to run the standard distribution but want to do Java debugging of your own classes then start the NK with remote JVM debugging... -debug

(or on Windows netkernel-debug.bat)

This starts the JVM with a remote debug interface on port 8000. Just use Eclipses standard debug tool to connect a remote debug session.

Of course low-level debugging doesn't give you the full ROC picture - which is why there is the Visualizer


This is a time-machine-debugger - you don't set breakpoints since it captures everything. You run it and the inspect wherever you are interested. A further advantage of the visualizer is that the state it captures is known by NK anyway, it just persists it, so given this is just regular operation there is no Heisenberg effect.

2. We have had discussions as to the viability of running Spring Containers under netkernel. Although this would not take advantage of the netkernel architecture, do you have examples of how this would be done?

NK is a very stripped down "plain old Java" system. It doesn't use any additional frameworks or any bloated J2EE infrastructure. Therefore one way to think of NK's endpoints is just as very basic "POJO containers" with logical ROC addressing. Each module has its own classloader - so in principal ther are no limitations to what you can deploy.

We've never found a java library that couldn't be deployed in an NK module.

We don't use Spring for the obvious reason that we steer clear of brittle low-level Java coding. We build our solutions out of composite services in the ROC domain.

3. One of the projects we are bidding on requires us to implement a remote API such that a test station can make API calls into an API set on a device being tested. We will need to implement the code on both the test station and the device being tested (called a proxy application) to enable the test station to make calls into the actual API on the device being tested via the proxy application. One thought to doing this would be to run an instance of netkernel as the proxy application. Two sub questions here: (1) If the underlying API on the device under test is C/C++ how do we call/process callbacks? Does this have to go through JNI? (2) Is there some type of automated way in which a structure type of argument can be mapped to a URI or does one have to manually marshal these arguments?

NK needs a JVM since it considers Java as being the "home language". Being on Java means you have to use standard java techniques to get to the metal of system libraries or your own C/C++ code.

The standard approach provided by Java is JNI. But we also provide a simpler more unix-like solution which is to think of a forked process as runtime. The active:exec accessor then allows switches and std in/out/err to be treated as resource streams.

Here's an example from the PhotoNK application which is able to use ImageMagick natively to do image scaling...

HDSBuilder b = new HDSBuilder();
String c="cmd";
//workaround problem that image magick process name is same as builtin windows convert command! - must rename in installationboolean isWindows=ManagementFactory.getOperatingSystemMXBean().getName().toLowerCase().contains("window");
String procName=isWindows?"convert-im":"convert";
b.addNode(c, procName);
b.addNode(c, aSrc.getAbsoluteFile());
b.addNode(c, "-gamma");
b.addNode(c, "0.45455");
b.addNode(c, "-filter");
b.addNode(c, "blackman");
b.addNode(c, "-resize");
b.addNode(c, Integer.toString(thumbWidth)+"x"+Integer.toString(thumbHeight));
b.addNode(c, "-strip");
b.addNode(c, "-sharpen");
b.addNode(c, "0.5x0.5");
b.addNode(c, "-gamma");
b.addNode(c, "2.2");
b.addNode(c, "-quality");
b.addNode(c, Integer.toString(comp));

{   case 6:
        b.addNode(c, "-rotate");
        b.addNode(c, "90");
    case 8:
        b.addNode(c, "-rotate");
        b.addNode(c, "270");
    case 3:
        b.addNode(c, "-rotate");
        b.addNode(c, "180");

b.addNode(c, aDest.getAbsoluteFile());
INKFRequest req=aHelper.createRequest("active:exec");
req.addArgumentByValue("command", b.getRoot());
IBinaryStreamRepresentation r=(IBinaryStreamRepresentation)aHelper.issueRequest(req);
ByteArrayOutputStream baos = new ByteArrayOutputStream(256);

Hope these answers help. Let us know if you have any trouble with any of these.



Like · Post Reply
nk4um User
Posts: 1
July 23, 2012 01:07Tooling used for netkernel development

I am evaluating netkernel and looking for some insight on how people are using Eclipse in the netkernel environment.

In our work with netkernel to date we have used the visulizer as the main tool for debugging a complete system.

Our typical development is under Eclipse. Can netkernel be run under Eclipse such that one can use the normal breakpoint/watchpoint facilities of Eclipse? If not, what is the normal practice for debugging a netkernel based system?

Like · Post Reply