« What!!! Notes 10 is coming 2018! | Main| The quest to avoid SMTP Hacking and "Authentication Failed" on Domino-server continues »

Wow! SmartNSF (BETA-5) can now call java directly, and work with the parameters with ease!

Tags: Lotus Domino Java SmartNSF
0

This evening it was time to test the latest and greatest version of SmartNSF – BETA 5. When you have installed it (via an updatesite database for the server) and via a local update site in your Designer, you get some cool new features. First of all, intellisense seems to work very good so now it is much easier to get the available methods etc.

But, the really cool feature in this version is the support for CUSTOM strategies. This means that you can define a route like this (the example below is directly from the discussion.nsf sample database enclosed in the SmartNSF zip);

SNAGHTML2c2833ab

The URI infos will call the Info-class in the package org.opennrf.smartnsf. This means that an URL like  http://www.vcode.no/test/discussion.nsf/xsp/.xrest/infos (note; URL is shown just for illustration purposes, and is not active) will call the java code shown below;

image

(Click on image to enlarge)

Tips, If you can find the java code directly, then ensure you open the Java perspective in Domino Designer;

SNAGHTML2c2e2db3

Then you can navigate to the java objects in the Package Explorer like this;

SNAGHTML2c2f5606

What about other URIs (variables)?

From the example above it looked like it was very easy to produces JSON output from an arbitrary java-class. But what if you want to use URIs like this:

http://www.vcode.no/test/discussion.nsf/xsp/.xrest/info/123 (again, URL is just for illustration purposes)

Note that I have stuffed my own variable "123" to the URL above.

The SmartNSF developers with Christian Güdemann and Martin Jinoch hang out on the OpenNTF's Slack channel a lot, and Chritian answered my question within minutes (!). Giving me the correct pointers I was able to create this route;

SNAGHTML2c3504ad

Note the variables {myparam}. This is what should contain "123" in my sample.

The super-cool thing with SmartNSF is that all router variables (amongst other stuff) are transfered along the input-context to the backend java-class. Using the intellisense I could see that the context contained a method called getRouterVariables;

SNAGHTML2c3770cb

I modified the sample code to reveal the content of the getRouterVariables-method, like this;

SNAGHTML2c39353f

Marked by 1, I define a Map of strings, and fill it with the result from the getRouterVariables-method. Marked by 2 I have a small loop dumping all the variables. Note that I prefix them with "p_" just to be able to locate them directly. The result from the code above was this;

SNAGHTML2c3fe613

Whoo!! In other words, the variable definition from the route was used directly, and I can now continue to use my other java-classes instantly!! Marvelous!!! Thanks a million Christian and Martin (hope I don't forget too many others now Smile).

Comments

Gravatar Image1 - Very nice! Emoticon

Post A Comment

:-D:-o:-p:-x:-(:-):-\:angry::cool::cry::emb::grin::huh::laugh::lips::rolleyes:;-)