Subscribe rss
Blog categories
All | Backendless features
Feature 111: CodeRunner – Custom Business Logic Utility
May 1, 2015 by markpiller

In my previous post I described how to use custom business logic code generator to create Backendless timer code. The previous post left off at the step when the Backendless Console created the code. To download the project files with the source code click the Download button:

The downloaded file is a ZIP archive of the project. The contents of the archive would have the same structure as shown below:

There is a project file for IntelliJ IDEA, however if you use Eclipse, it is very easy to import the project in it as well. Open the project and you should be able to compile it without any changes. The code straight out of the code generator does not have any custom business logic –  it is a wrapper required by the Backendless framework. To add custom business logic open the timer class, it will be in the hierarchy of the /src directory. I have added custom code which stores an object in Backendless Data Store every time the timer runs:

Now that I have a Backendless Timer with custom code in it, the question is how to run it. Obviously the code can be deployed to the Backendless cloud, however, wouldn’t it be nice to be able to run it locally first for testing and debugging purposes? The answer is ‘yes’! This is exactly what Backendless CodeRunner for Java does. The best part is CodeRunner is already included into the ZIP file generated by Backendless Console (the file downloaded at the beginning of the post).

If you use IntelliJ IDEA, the project is automatically configured to compile the code into the /classes directory shown in the screenshot above. The directory is special – this is where CodeRunner looks for custom code classes.

To run CodeRunner, open a command prompt window and change the current directory to /bin (see it in the screenshot above). Run CodeRunner using the scripts in the /bin directory. For example on a Linux system, run the following:

You should see the following output:

CodeRunner automatically inspects the compiled code, determines that is has one timer and registers it with the Backendless ‘mothership’.

In the future posts I will be describing the process for debugging the timer code on the developer machine and deploying custom code to Backendless.


Share this post
Tweet about this on TwitterShare on FacebookGoogle+