GGL2 API for Java and Python

We are pleased to announce that the GGL2 tools are increasing constantly. The newcomer today is an API for Java and Python.

This API allows developers to execute GGL2 processes from their programs with a single call, passing the GGL2 code as a parameter. Thus, Java and Python developers can now run GGL2 algorithms using their own language easily.

In order to use this API, GGL2 must be installed and the installation directory specified before executing GGL2 code. Then, the execute call will run the GGL2 code and will return normally if the process finishes successfully or will throw an exception if anything fails. Different exceptions will be thrown depending on whether the error has been a GGL2 compilation error, a GGL2 execution error or any other unexpected error.

For Java developers, the GGL2 API is available with and without Maven. In the end, the necessary jars must be included in the classpath and then a simple program like this example can be executed:

import org.gearscape.ggl.GGL2;

public class Main {

    public static void main(String[] args) throws Exception {

        GGL2 ggl2 = new GGL2("/home/victorzinho/bin/ggl");

        ggl2.execute("show 'Hello World!';");

    }

}

For Python developers the module containing the GGL2 API must be imported. The previous example can be executed as follows:

import GGL2

GGL2.location = '/home/user/bin/ggl'
GGL2.execute("show 'Hello World!';")

There is a complete tutorial on how to configure and use the API with both Java and Python in [1].

—–

[1] http://www.gearscape.org/html/ggl2/ref/apis.html

Do you have a project idea and want to turn it into reality? We would like to hear from you, tell us about it

The facts define us