L2pNodeLauncher Interactive Command Line - rwth-acis/las2peer-template-project GitHub Wiki

This tutorial will show you advanced features of the L2pNodeLauncher.

For more basic information on how to use the L2pNodeLauncher, please see the L2pNodeLauncher-Commands. This tutorial shows the power of the command line tool and what else can be done with it.

You can type the help command that prints out all possible commands. We will explain some interesting commands here in detail and give some possible usage scenarios.

Creating local variables using the assignment operator is one of the basic commands needed. You can basically assign a variable to any object in the available libraries.

user = i5.las2peer.security.UserAgent.createUserAgent('Pass')

The object can also be a basic java object:

a = new java.lang.Integer ('5')

You can also call methods on those objects exactly as you would do that in java code using the "." notation.

A call to the method setLogin of the UserAgent object would look like this on the console:

user.setLoginName('NewName')

The bind command

The command line tool gives you the option to change the bound object by using the bind command and hence directly call methods on the new bound object.

The list command

The list command just prints all accessible methods of the bound object including their parameter list.

Using the bind command for example, one can bind the previously declared user agent with the command bind user. After that a call to the command list would list all accessible methods on that UserAgent object. This can be seen in the following screenshot.

calculateRectangleAreaInvokeCmd

After binding the user object, you can directly call methods on that bound object (without having to type user.[method]).

The package command

The package command gives you the option to add a prefix for all class relevant operations on the command line. This can be useful if you are willing to create multiple agents on the command line and would rather avoid writing 'i5.las2peer.security' every time. In this scenario a command would look like this package i5.las2peer.security. The following screenshot shows this case with creating a service agent.

calculateRectangleAreaInvokeCmd

After using the package command you may like to remove the package prefix and go back to the default (empty) package prefix, to do that you would call the package command without parameters.

The print and the printStackTrace commands

The print command can be used to print the values of one (or multiple) local variables. The printStackTrace command is useful to understand the cause of the last exception that occurred.

⚠️ **GitHub.com Fallback** ⚠️