Nolio opens its gates for Developers
It is clear that Continues Delivery has become much more than a buzz word, and that more and more companies design their development processes around this concept. Our product, Nolio ASAP, enables you to turn this concept into a full working reality with ease and simplicity. This, however refers to a topic of a different post. The topic of this post is the new Nolio API.
From Version 4.0.0, Nolio offers a simple and convenient API so that your customized solution will actually be tailored to your needs. Now, in addition to the hundreds of actions that Nolio provides, you can create your own actions with an extremely simple and intuitive API, and then, in less than two minutes, install and integrate them within the Nolio Framework. How? This too will be discussed in a future post.
The subject of this post concerns three features that automatically and - without any additional coding - apply to your action from the moment you install it in Nolio ASAP:
Full integration in the Nolio Model: The actions you develop can be added to any process, and be installed in every environment, their parameters fully accessible and their execution fully reported and documented. The Nolio model - the strongest model supporting Continuous Delivery to date - will wrap your actions seamlessly.
Complete Action Dependency Support: As with all Nolio actions you can include your actions in a Nolio process and define their pre and post conditions. You can specify which actions run before or after your custom action and which actions are executed when your action fails or succeeds. You can set dependency relations between different servers and different server types.
Applicability of the Nolio User Permission Model: The Nolio innovative permission model introduced in version 3.3 enables you to run your action under any user, regardless of the user under which you installed the Nolio Agent. Just provide a username and password and Nolio will run your action under that username.
Finally, I would like to stress two implications of the above features:
First, that Nolio can answer your special needs even when your deployment tools are unique and customized specifically to the needs of your organization. By using an extremely simple code you can write your own fully customized actions and then integrate them in the powerful framework that Nolio provides.
Second, you may wonder why you need Nolio when you still have to write your logic by yourself. I hope this post clarifies how your actions can benefit from being wrapped by the Nolio framework.
The API for developers that we expose now in version 4.0.0 constitutes a significant improvement compared to past versions. We invested a considerable amount of resources and efforts in Nolio ASAP after carefully listening to the requests and feedback of our customers. We believe that the new Nolio API will enable you to achieve a deployment process that is both customized and tailored to your organization workflow and tools and still yet - fully automatic.
How to develop your own actions?
So how do you start creating your own actions? The simplest way is to use the Nolio Eclipse Plugin. Follow the steps below:
1. Download Eclipse.
2. Install the Nolio Eclipse Plugin.
3. In Eclipse, create a new Java project.
4. Open New->Nolio Action and fill the required fields.
5. Verify that the Generate Example checkbox is selected.
6. Save the form.
That's it. You are now in an excellent position to create your first action.
To test your action, right-click the new file and select Test New Action. The Tester will ask you to enter values for all the action input parameters. It will then produce a report that will display the action result, the output parameter values and all sorts of coding and syntax errors and warnings, if there are any. We recommend fixing all errors and warnings before you pack and install your new action.
Send an email to Nolio Support or firstname.lastname@example.org regarding any question relating to action development or for any problem you came across during the course of installing the plugin, developing the action, testing it and fixing the errors and warnings.
How to install new actions
Yes we know - you are probably expecting to receive a complicated manual that tells you to add a JAR to the hundreds of agents that are installed in your organization. Well...no! Our mission is let you create simple and clean deployments, especially so when you deploy one of our products. So here is a simple way to install your new actions:
1. When the Nolio ASAP 4.0 server is running, open its installation directory. Find the customerActions directory and paste your JAR there. Nolio ASAP will propagate the JAR to all agents.
2. To have your new action displayed in the Nolio ASAP GUI, select Administration -> Action Inventory in Nolio ASAP main menu.
3. In the upper right section of the window click the Reload Action icon.
4. Select the customerActions path and click the Reload Action Libraries icon.
That's it. Your action is ready. Quite simple isn't it?
A few "rules of thumb" for action development
As you can see it's quite simple to develop actions. In this post you'll get to know a little more about the Nolio ASAP framework and what best practices it implies for action development.
An Action is Stateless
The guiding principal of the Nolio ASAP framework is that actions are self-sufficient entities with an independent logic. This principal has come to our aid when we sought to provide a convenient and simple API for action developers as well as advanced features for the Nolio agents.
The implication of this fundamental principal is that your actions should stand on their own. Do not assume that other actions precede or follow it, and do not create static variables that other actions have to read or modify. Do not create "critical segments" that enforce synchronization, and remember that whoever is using the action may insert it anywhere. Remember also that the Nolio ASAP framework can distribute your action and execute it in different processes. The only communication between your action and the outside world should be by means of input and output parameters and by the returned action result.
Good action encapsulation will enable you to utilize as many framework features as possible, allow you to insert your actions in a large variety of contexts, and be compatible with prior versions of Nolio ASAP. You will also be able to share your actions with the community of Nolio actions developers.
Parameters Variables and Other Varieties
For every action that gets executed in a flow a new object is created. As a general rule an executed action passes through the following three phases:
1. Values are written to input parameters.
2. Action logic is executed by the executeAction()function.
3. Values are read from output parameters.
Phase 2 may occur multiple times during one action execution (for example, when an action fails or when it is resumed after a pause) while phase 1 happens only once. This has the following implications on action development practice:
- Do not modify input parameters values during execution, as their initial values will be lost if executeAction() is called again.
- Do not create parameters that simultaneously functions as both an input and an output parameter. That is because the value of input parameters cannot change during execution while the value of output parameters can.
- Class variables that are not parameters have to be initialized in every call to executeAction(). Do not rely on static initialization because, if the variable value changes during execution and executeAction() will be called again - the value in the second execution will be irrelevant.
As you can see, NolioAction inherits from Serializable. That is because certain actions can run in other processes in addition to the Nolio agent process (due to internal considerations, such as permissions and performance). In this case, ASAP passes the action to these other processes in a Serialized form. For this reason all fields and parameters should also be Serializable. Internal variables that are not Serializable, must be transient.
Transient variables constitute another reason for initializing class variables at the beginning of every call to executeAction() because if transient variables have default values, these values are lost in the serialization.
Here is the SDK Guide
Here is the eclipse-plugin-for-sdk
Here is the eclipse-tutorial to video
Here is the sdk documntation
I did everything described in this post and in the SDK Guide. I opened a new Java project and added a Nolio Action, but in the generated code, all the Nolio classes are unresolved.
Checking the build-path, it seems that the Nolio libraries point to a wrong file. Both the log4j and the nolio-shared-... point to 'com.nolio.actions_188.8.131.52205240903.jar_sdk' which is indicated as missing.
The issue can happened in case eclipse couldn't extract the SDK jars from the eclipse plugin.
In order to fix it ,you can take the Nolio-shared and log4j jars from the Nolio Center or Agent installation (/lib>
This document was generated from the following discussion: Nolio Official KB:Nolio SDK resources