Skip to content

Latest commit

 

History

History
85 lines (52 loc) · 2.2 KB

WireProtocol.pod

File metadata and controls

85 lines (52 loc) · 2.2 KB

NOTE

This is just some internal notes for the developer. Understanding the material in this file shouldn't be neccessary unless you are planning on making fairly deep changes to the code.

perl -> java protocol

The protocol consists of a sequence of commands from the perl side to the java side. Each command is a line of text, terminated by a newline. They consist of several elements, seperated by a single space character.

The first element of each line is a command_id -- an arbitrary identifier that the java side will pass you back to let you know what command this is a repsonse to. It must be non-empty, and cannot include space characters. Other then that, the java side doesn't care what it consists of.

The second element of each line is the command name.

An object is represented by an obj_ident, which can be:

  • a java class name (in binary form), followed by a '>' and the System.identityHashCode() of the object (in hex, lowercase, with no leading zeroes or 0x).

  • null, which represents undef (in Perl), or null (in Java).

The commands are:

create
1 create java.lang.Runtime

Calls the nullary constructor of the given class.

DESTROY
2 DESTROY java.lang.Runtime>1234

Notes that the perl side has finished with this object. The java side will release it's reference to it in the big hash of objects. Note that this will not neccessarly destroy the object on the java side; something else might hold a reference to it.

SHUTDOWN
3 SHUTDOWN

Notes that the perl side is no longer intersted in the bridge. Any objects that have not been DESTROYed will be reported as leaked, the java side will reply to the command, and then exit.

call_method
4 call_method java.lang.System>1234 getProperties

Calls, on the given object, the given method. Currently, methods that take parameters are not yet supported.

call_static_method
5 call_static_method java.lang.System getProperties

Calls, on the given *class*, the given static method.

fetch_static_field
6 fetch_static_field java.lang.Boolean TRUE

Fetches, on the given *class*, the given static field. (Static fields are often used for constants.)