Skip to content

Using The Agent Generator Scripts

Jasper Nalbach edited this page Feb 11, 2016 · 4 revisions

This tutorial explains the usage of the agent generator scripts located in the 'bin' folder of this project.
Agents can be persisted in an XML description file, having the benefit that they can be for example uploaded automatically at a node's startup (using uploadStartupDirectory, see also the L2PNodeLauncher Commands).

There are two types of agent generators. One is the 'UserAgentGenerator' and the other one is the 'ServiceAgentGenerator'.

Generating a user agent

To generate a user agent, start the 'bin/start_UserAgentGenerator.[sh|bat]' script:

start_UserAgentGenerator [desired pass phrase] [desired user (login) name] [desired mail address]

Please note, that you have to put your parameters in quotes, if you use blanks in them.

The output looks something like this:

<las2peer:agent type="user">
        <id>2191391394947202766</id>
        <publickey encoding="base64">[..]</publickey>
        <privatekey encrypted="AES" keygen="[..]">
                <salt encoding="base64">[..]</salt>
                <data encoding="base64">[..]</data>
        </privatekey>
        <login>[..]</login>
        <email>[..]</email>
</las2peer:agent>

This needs to be stored in an '.xml' file and given a name that starts with 'agent-'. This file should be located at the startup directory (etc/startup) in order to be uploaded using the L2pNodeLauncher's uploadStartupDirectory command.

Generating a service agent

To generate a service agent, start the 'bin/start_ServiceAgentGenerator.[sh|bat]' script:

start_ServiceAgentGenerator [your service class]@[your service version] [your service pass phrase]

Please note, that the service class must exactly match your service's main class (e.g. the one that extends 'service').

The output looks something like this:

<las2peer:agent type="service" serviceclass="[..]@[..]">
   <id>[..]</id>
        <publickey encoding="base64">[..]</publickey>
        <privatekey encrypted="AES" keygen="[..]">
                <salt encoding="base64">[..]</salt>
                <data encoding="base64">[..]</data>
        </privatekey>
</las2peer:agent>

This needs to be stored in an .xml file and given a name that starts with agent-. This file should be located at the startup directory (etc/startup) in order to be uploaded using the L2pNodeLauncher's uploadStartupDirectory command.

Clone this wiki locally