t
Copyright (c) 2001, 2013, Oracle and/or its affiliates. All rights reserved.
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.

This code is free software; you can redistribute it and/or modify it
under the terms of the GNU General Public License version 2 only, as
published by the Free Software Foundation.

This code is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
version 2 for more details (a copy is included in the LICENSE file that
accompanied this code).

You should have received a copy of the GNU General Public License version
2 along with this work; if not, write to the Free Software Foundation,
Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.

Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
or visit www.oracle.com if you need additional information or have any
questions.

Arch: generic
Software: JDK 8
Date: 21 November 2013
SectDesc: Java IDL and RMI-IIOP Tools
Title: idlj.1

idlj 1 "21 November 2013" "JDK 8" "Java IDL and RMI-IIOP Tools"
-----------------------------------------------------------------
* Define some portability stuff
-----------------------------------------------------------------
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
http://bugs.debian.org/507673
http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-----------------------------------------------------------------
* set default formatting
-----------------------------------------------------------------
disable hyphenation
disable justification (adjust text to left margin only)
-----------------------------------------------------------------
* MAIN CONTENT STARTS HERE *
-----------------------------------------------------------------
NAME
idlj - Generates Java bindings for a specified Interface Definition Language (IDL) file.
SYNOPSIS
 

idlj [ options ] idlfile

options The command-line options. See Options. Options can appear in any order, but must precede the \f3idlfile.

idlfile The name of a file that contains Interface Definition Language (IDL) definitions.

DESCRIPTION
The IDL-to-Java Compiler generates the Java bindings for a specified IDL file. For binding details, see Java IDL: IDL to Java Language Mapping at http://docs.oracle.com/javase/8/docs/technotes/guides/idl/mapping/jidlMapping.html

Some earlier releases of the IDL-to-Java compiler were named \f3idltojava.

EMIT CLIENT AND SERVER BINDINGS
The following \f3idlj command generates an IDL file named \f3My.idl with client-side bindings.
 
\f3idlj My.idl
 
\f3
The previous syntax is equivalent to the following:
 
\f3idlj -fclient My.idl
 
\f3
The next example generates the server-side bindings, and includes the client-side bindings plus the skeleton, all of which are POA (Inheritance Model).
 
\f3idlg -fserver My.idl
 
\f3
If you want to generate both client and server-side bindings, then use one of the following (equivalent) commands:
 
\f3idlj -fclient -fserver My.idl
 
\f3idlj -fall My.idl
 
\f3
There are two possible server-side models: the Portal Servant Inheritance Model and the Tie Model. See Tie Delegation Model.

\f3Portable Servant Inheritance Model. The default server-side model is the Portable Servant Inheritance Model. Given an interface \f3My defined in \f3My.idl, the file \f3MyPOA.java is generated. You must provide the implementation for the \f3My interface, and the \f3My interface must inherit from the \f3MyPOA class. \f3MyPOA.java is a stream-based skeleton that extends the \f3org.omg.PortableServer.Servant class at http://docs.oracle.com/javase/8/docs/api/org/omg/PortableServer/Servant.html The \f3My interface implements the \f3callHandler interface and the operations interface associated with the IDL interface the skeleton implements.The \f3PortableServer module for the Portable Object Adapter (POA) defines the native \f3Servant type. See Portable Object Adapter (POA) at http://docs.oracle.com/javase/8/docs/technotes/guides/idl/POA.html In the Java programming language, the \f3Servant type is mapped to the Java \f3org.omg.PortableServer.Servant class. It serves as the base class for all POA servant implementations and provides a number of methods that can be called by the application programmer, and methods that are called by the POA and that can be overridden by the user to control aspects of servant behavior.Another option for the Inheritance Model is to use the \f3-oldImplBase flag to generate server-side bindings that are compatible with releases of the Java programming language before Java SE 1.4. The -\f3oldImplBase flag is nonstandard, and these APIs are deprecated. You would use this flag only for compatibility with existing servers written in Java SE 1.3. In that case, you would need to modify an existing make file to add the \f3-oldImplBase flag to the \f3idlj compiler. Otherwise POA-based server-side mappings are generated. To generate server-side bindings that are backward compatible, do the following:

 
\f3idlj -fclient -fserver -oldImplBase My.idl
 
\f3idlj -fall -oldImplBase My.idl
 
\f3
Given an interface \f3My defined in \f3My.idl, the file \f3_MyImplBase.java is generated. You must provide the implementation for the \f3My interface, and the \f3My interface must inherit from the \f3_MyImplBase class.

\f3Tie Delegation Model. The other server-side model is called the Tie Model. This is a delegation model. Because it is not possible to generate ties and skeletons at the same time, they must be generated separately. The following commands generate the bindings for the Tie Model:

 
\f3idlj -fall My.idl
 
\f3idlj -fallTIE My.idl
 
\f3
For the \f3My interface, the second command generates \f3MyPOATie.java. The constructor to the \f3MyPOATie class takes a delegate. In this example, using the default POA model, the constructor also needs a POA. You must provide the implementation for the delegate, but it does not have to inherit from any other class, only the interface \f3MyOperations. To use it with the ORB, you must wrap your implementation within the \f3MyPOATie class, for example:
 
\f3ORB orb = ORB.init(args, System.getProperties());
 
\f3
 
\f3// Get reference to rootpoa & activate the POAManager
 
\f3POA rootpoa = (POA)orb.resolve_initial_references("RootPOA");
 
\f3rootpoa.the_POAManager().activate();
 
\f3
 
\f3// create servant and register it with the ORB
 
\f3MyServant myDelegate = new MyServant();
 
\f3myDelegate.setORB(orb); 
 
\f3
 
\f3// create a tie, with servant being the delegate.
 
\f3MyPOATie tie = new MyPOATie(myDelegate, rootpoa);
 
\f3
 
\f3// obtain the objectRef for the tie
 
\f3My ref = tie._this(orb);
 
\f3
You might want to use the Tie model instead of the typical Inheritance model when your implementation must inherit from some other implementation. Java allows any number of interface inheritance, but there is only one slot for class inheritance. If you use the inheritance model, then that slot is used up. With the Tie Model, that slot is freed up for your own use. The drawback is that it introduces a level of indirection: one extra method call occurs when a method is called.

For server-side generation, Tie model bindings that are compatible with versions of the IDL to Java language mapping in versions earlier than Java SE 1.4.

 
\f3idlj -oldImplBase -fall My.idl
 
\f3idlj -oldImplBase -fallTIE My.idl
 
\f3
For the \f3My interface, the this generates \f3My_Tie.java. The constructor to the \f3My_Tie class takes an \f3impl object. You must provide the implementation for \f3impl, but it does not have to inherit from any other class, only the interface \f3HelloOperations. But to use it with the ORB, you must wrap your implementation within \f3My_Tie, for example:
 
\f3ORB orb = ORB.init(args, System.getProperties());
 
\f3
 
\f3// create servant and register it with the ORB
 
\f3MyServant myDelegate = new MyServant();
 
\f3myDelegate.setORB(orb); 
 
\f3
 
\f3// create a tie, with servant being the delegate.
 
\f3MyPOATie tie = new MyPOATie(myDelegate);
 
\f3
 
\f3// obtain the objectRef for the tie
 
\f3My ref = tie._this(orb);
 
\f3
SPECIFY ALTERNATE LOCATIONS FOR EMITTED FILES
If you want to direct the emitted files to a directory other than the current directory, then call the compiler this way: \f3i\f3dlj -td /altdir My.idl.

For the \f3My interface, the bindings are emitted to \f3/altdir/My.java, etc., instead of \f3./My.java.

SPECIFY ALTERNATE LOCATIONS FOR INCLUDE FILES
If the \f3My.idl file includes another \f3idl file, \f3MyOther.idl, then the compiler assumes that the \f3MyOther.idl file resides in the local directory. If it resides in \f3/includes, for example, then you call the compiler with the following command:
 
\f3idlj -i /includes My.idl
 
\f3
If \f3My.idl also included \f3Another.idl that resided in \f3/moreIncludes, for example, then you call the compiler with the following command:
 
\f3idlj -i /includes -i /moreIncludes My.idl
 
\f3
Because this form of \f3include can become long, another way to indicate to the compiler where to search for included files is provided. This technique is similar to the idea of an environment variable. Create a file named idl.config in a directory that is listed in your \f3CLASSPATH variable. Inside of \f3idl.config, provide a line with the following form:
 
\f3includes=/includes;/moreIncludes
 
\f3
The compiler will find this file and read in the includes list. Note that in this example the separator character between the two directories is a semicolon (;). This separator character is platform dependent. On the Windows platform, use a semicolon, on the Unix platform, use a colon, and so on.
EMIT BINDINGS FOR INCLUDE FILES
By default, only those interfaces, structures, and so on, that are defined in the \f3idl file on the command line have Java bindings generated for them. The types defined in included files are not generated. For example, assume the following two \f3idl files:
 
\f3My.idl file:
 
\f3
 
\f3#include <MyOther.idl>
 
\f3interface My
 
\f3{
 
\f3};
 
\f3
 
\f3MyOther.idl file:
 
\f3
 
\f3interface MyOther
 
\f3{
 
\f3};
 
\f3
There is a caveat to the default rule. Any \f3#include statements that appear at the global scope are treated as described. These \f3#include statements can be thought of as import statements. The \f3#include statements that appear within an enclosed scope are treated as true \f3#include statements, which means that the code within the included file is treated as though it appeared in the original file and, therefore, Java bindings are emitted for it. Here is an example:
 
\f3My.idl file:
 
\f3
 
\f3#include <MyOther.idl>
 
\f3interface My
 
\f3{
 
\f3 #include <Embedded.idl>
 
\f3};
 
\f3
 
\f3MyOther.idl file:
 
\f3
 
\f3interface MyOther
 
\f3{
 
\f3};
 
\f3
 
\f3Embedded.idl
 
\f3
 
\f3enum E {one, two, three};
 
\f3
Run\f3idlj My.idlto generate the following list of Java files. Notice that \f3MyOther.java is not generated because it is defined in an import-like \f3#include. But \f3E.java was generated because it was defined in a true \f3#include. Notice that because the \f3Embedded.idl file is included within the scope of the interface \f3My, it appears within the scope of \f3My (in \f3MyPackage). If the \f3-emitAll flag had been used, then all types in all included files would have been emitted.
 
\f3./MyHolder.java
 
\f3./MyHelper.java
 
\f3./_MyStub.java
 
\f3./MyPackage
 
\f3./MyPackage/EHolder.java
 
\f3./MyPackage/EHelper.java
 
\f3./MyPackage/E.java
 
\f3./My.java
 
\f3
INSERT PACKAGE PREFIXES
Suppose that you work for a company named ABC that has constructed the following IDL file:
 
\f3Widgets.idl file:
 
\f3
 
\f3module Widgets
 
\f3{
 
\f3 interface W1 {...};
 
\f3 interface W2 {...};
 
\f3};
 
\f3
If you run this file through the IDL-to-Java compiler, then the Java bindings for W1 and W2 are placed within the \f3Widgets package. There is an industry convention that states that a company's packages should reside within a package named \f3com.<company name>. To follow this convention, the package name should be \f3com.abc.Widgets. To place this package prefix onto the Widgets module, execute the following:
 
\f3idlj -pkgPrefix Widgets com.abc Widgets.idl
 
\f3
If you have an IDL file that includes Widgets.idl, then the \f3-pkgPrefix flag must appear in that command also. If it does not, then your IDL file will be looking for a \f3Widgets package rather than a \f3com.abc.Widgets package.

If you have a number of these packages that require prefixes, then it might be easier to place them into the idl.config file described previously. Each package prefix line should be of the form: \f3PkgPrefix.<type>=<prefix>. The line for the previous example would be \f3PkgPrefix.Widgets=com.abc. This option does not affect the Repository ID.

DEFINE SYMBOLS BEFORE COMPILATION
You might need to define a symbol for compilation that is not defined within the IDL file, perhaps to include debugging code in the bindings. The command \f3idlj -d MYDEF My.idlis equivalent to putting the line \f3#define MYDEF inside My.idl.
PRESERVE PREEXISTING BINDINGS
If the Java binding files already exist, then the \f3-keep flag keeps the compiler from overwriting them. The default is to generate all files without considering that they already exist. If you have customized those files (which you should not do unless you are very comfortable with their contents), then the \f3-keep option is very useful. The command \f3idlj -keep My.idl emits all client-side bindings that do not already exist.
VIEW COMPILATION PROGRESS
The IDL-to-Java compiler generates status messages as it progresses through its phases of execution. Use the \f3-v option to activate the verbose mode: \f3idlj -v My.idl.

By default the compiler does not operate in verbose mode

DISPLAY VERSION INFORMATION
To display the build version of the IDL-to-Java compiler, specify the \f3-version option on the command-line: \f3idlj -version.

Version information also appears within the bindings generated by the compiler. Any additional options appearing on the command-line are ignored.

OPTIONS

-d symbol

This is equivalent to the following line in an IDL file:

 
\f3#define symbol
 
\f3

-demitAll

Emit all types, including those found in \f3#include files.

-fside

Defines what bindings to emit. The \f3side parameter can be \f3client, \f3server, \f3serverTIE, \f3all, or \f3allTIE. The \f3-fserverTIE and \f3-fallTIE options cause delegate model skeletons to be emitted. Defaults to \f3-fclient when the flag is not specified.

-i include-path

By default, the current directory is scanned for included files. This option adds another directory.

-i keep

If a file to be generated already exists, then do not overwrite it. By default it is overwritten.

-noWarn

Suppress warning messages.

-oldImplBase

Generates skeletons compatible with pre-1.4 JDK ORBs. By default, the POA Inheritance Model server-side bindings are generated. This option provides backward-compatibility with earlier releases of the Java programming language by generating server-side bindings that are \f3ImplBase Inheritance Model classes.

-pkgPrefix typeprefix

Wherever \f3type is encountered at file scope, prefix the generated Java package name with \f3prefix for all files generated for that type. The type is the simple name of either a top-level module, or an IDL type defined outside of any module.

-pkgTranslate typepackage

Whenever the module name type is encountered in an identifier, replace it in the identifier with package for all files in the generated Java package. Note that \f3pkgPrefix changes are made first. The type value is the simple name of either a top-level module, or an IDL type defined outside of any module and must match the full package name exactly. If more than one translation matches an identifier, then the longest match is chosen as shown in the following example: Command:

 
\f3pkgTranslate type pkg -pkgTranslate type2.baz pkg2.fizz
 
\f3
Resulting Translation:
 
\f3type => pkg
 
\f3type.ext => pkg.ext
 
\f3type.baz => pkg2.fizz
 
\f3type2.baz.pkg => pkg2.fizz.pkg
 
\f3
The following package names \f3org, \f3org.o\f3mg, or any subpackages of \f3org.omg cannot be translated. Any attempt to translate these packages results in uncompilable code, and the use of these packages as the first argument after \f3-pkgTranslate is treated as an error.

-skeletonName xxx%yyy

Use \f3xxx%yyy as the pattern for naming the skeleton. The defaults are: \f3%POA for the \f3POA base class (\f3-fserver or \f3-fall), and \f3_%ImplBase for the \f3oldImplBase class (-\f3oldImplBase) and (\f3-fserver or \f3-fall)).

-td dir

Use dir for the output directory instead of the current directory.

-tieName xxx%yyy

Use \f3xxx%yyy according to the pattern. The defaults are: \f3%POA for the \f3POA base class (\f3-fserverTie or -fallTie), and \f3_%Tie for the \f3oldImplBase tie class (-\f3oldImplBase) and (\f3-fserverTie or \f3-fallTie))

-nowarn, -verbose

Displays release information and terminates.

-version

Displays release information and terminates.

RESTRICTIONS
Escaped identifiers in the global scope cannot have the same spelling as IDL primitive types, \f3Object, or \f3ValueBase. This is because the symbol table is preloaded with these identifiers. Allowing them to be redefined would overwrite their original definitions. Possible permanent restriction.

The \f3fixed IDL type is not supported.

KNOWN PROBLEMS
No import is generated for global identifiers. If you call an unexported local \f3impl object, then you do get an exception, but it seems to be due to a \f3NullPointerException in the \f3ServerDelegate DSI code.

'pl 8.5i 'bp