Jrpcgen compiles RPC/XDR IDL ("*.x") files into Java client and server stubs.
java Jrpcgen [ options ] filename.x
The Jrpcgen command compiles RPC/XDR IDL ".x" files into Java client and server stubs. You then integrate these stubs with your RPC client or server application, compile the complete application with javac (or an equivalent Java compiler), and run it together with the Distinct ONC RPC/XDR for Java.package. The stubs are created as Java files in the current directory. Jrpcgen creates one main stub class file per ".x" file, which has the same name as the ".x" file but has a ".java" extension, as well as one Java class per data structure defined in the ".x" file. The server stubs include an additional stub for the server.The main stub class is always derived from the class JRPCClient. It defines a constructor that connects the client to the server and one method for each function defined in the RPC/XDR interface description. As with the C mapping, the interface version number is automatically appended after an underscore to the method names. All defined types in the interface description and the types of the methods input and output parameters are mapped to equivalent Java types.
XDR data structures are mapped to Java types as follows.
Each generated class implements the XDRType interface. This interface defines the methods for encoding and decoding the classes into and from an XDRStream. You can define your own types (or alter the Jrpcgen generated files) and use them in RPC calls as long as they define these RFC 1832 (XDR) compliant encoding and decoding methods.
(unsigned) int int (unsigned) long int (unsigned) short short (unsigned) char char (unsigned) hyper long float float double double bool boolean string String opaque byte array fixed length array Java array variable length array Java array optional data (pointer-like *x) Reference to an object of class x. If x is a basic type, a special wrapper class XDRx which implements XDRType is used instead. enum x Class x implements XDRType with member variable int value and one constant int per enum constant. struct x Class x implements XDRType with member variables for each struct member. union x Class x implements XDRType with member variables for each union member including discriminant. No overlaying of members is supported (neither for type conversion nor for saving space). typedef x y Class x implements XDRType with member variable value of the redefined type y. Jrpcgen understands C-like comments (/* ... */) and it copies lines that are starting with a "%" symbol in front of all generated output files. By default, Jrpcgen runs a C/C++ preprocessor on the given ".x" file before translating it to Java. It defines two symbols for this preprocessor run. The symbol "JAVA" is always defined. In addition, a context symbol with the name of the top-level ".x" file (without extension) is defined (i.e. "java Jrpcgen demo.x" defines a symbol "demo"). This allows the writing of RPC/XDR specifications with special Java related parts (although this is not recommended, it might sometimes be necessary).