In this article we are going to see the idlj commands.

What is idl?

IDL means interface definition Language.

What is idlj?

idlj builds IDL file to JAVA following specifications.

Previously it was named as idltojava. idlj is a compiler that reads an OMG(Object Management Group) IDL file and translates / maps to a Java interface.

It creates stub, skeleton, helper, holder and other necessary files. The specified pdf formatted OMG file defines the interface file(.java).

Syntax

idlj [options] [idl-file]

jdlj Options :

  • d (symbol) : Is same as #define symbol in a idl file.
  • emitAll : Emit all types along with files found in #include
  • f(side) : Defines bindings to emit. A side can be client, server, serverTIE, all, or allTIE. fserverTIE and -fallTIE cause delegate to be emitted.(-fclient is not specified)
  • i (include-path) : To add another directory for scanning with default one.
  • keep : To set not to overwrite an existed file.
  • noWarn : Set No warning messages.
  • oldImplBase : Generates skeletons compatible with pre-1.4 JDK ORBs.(backward-compatibility to ImplBase Inheritance Model classes)
  • pkgPrefix (type) (prefix) : Generates Java package name with prefix for all files generated for that type(type is the simple name of either a top-level module, or an IDL type defined outside of any module)
  • pkgTranslate (type) (package) : Replaces type module in the identifier with package for all generated Java package files
  • td (dir) : To set dir as output directory
  • verbose : Verbose mode
  • skeletonName (xxx%yyy) : Naming pattern for skeleton. The defaults are: %POA for the POA base class (-fserver /-fall), _%ImplBase for the oldImplBase class (-oldImplBase and -fserver /-fall)
  • tieName (xxx%yyy) : Naming pattern for tie .The defaults are: %POATie for the POA tie base class (-fserverTie /-fallTie), %_Tie for the oldImplBase tie class (-oldImplBase and -fserverTie /-fallTie)

Notes:

  • pkgPrefix changes are made first. If more than one translation matches an identifier, the longest match is chosen.
  • Escaped identifiers in the global scope may not have the same spelling as IDL primitive types, Object, or ValueBase as the symbol table is pre-loaded with these identifiers
  • The fixed IDL type is not supported.
  • No import for global identifiers. When we invoke on an unexported local impl,we will get exception, (due to a NullPointerException in the ServerDelegate DSI code)

Uses: When we are using old OMG IDL code to rewriting new java code. Spatially used while converting old codes/definitions. Some time it is used to followup old interface.

From CLI

Compiler Usage:

    java com.sun.tools.corba.se.idl.toJavaPortable.Compile [options] <idl file>

where <idl file> is the name of a file containing IDL definitions, and
[options] is any combination of the options listed below.  The options
are optional and may appear in any order; <idl file> is required and
must appear last.

Options:
-d <symbol>               This is equivalent to the following line in an
                          IDL file:  #define <symbol>
-emitAll                  Emit all types, including those found in #included files.
-f<side>                  Define what bindings to emit.  <side> is one of client,
                          server, all, serverTIE, allTIE.  serverTIE and allTIE
                          cause delegate model skeletons to be emitted.  If this
                          flag is not used, -fclient is assumed.
-i <include path>         By default, the current directory is scanned for
                          included files.  This option adds another directory.
-keep                     If a file to be generated already exists, do not
                          overwrite it.  By default it is overwritten.
-noWarn                   Suppress warnings.
-oldImplBase              Generate skeletons compatible with old (pre-1.4) JDK ORBs.
-pkgPrefix <t> <prefix>   When the type or module name <t> is encountered at
                          file scope, begin the Java package name for all files
                          generated for <t> with <prefix>.
-pkgTranslate <t> <pkg>   When the type or module name <t> in encountered, replace
                          it with <pkg> in the generated java package.  Note that
                          pkgPrefix changes are made first.  <t> must match the
                          full package name exactly.  Also, <t> must not be
                          org, org.omg, or any subpackage of org.omg.
-skeletonName <xxx%yyy>   Name the skeleton according to the pattern.
                          The defaults are:
                          %POA for the POA base class (-fserver or -fall)
                          _%ImplBase for the oldImplBase base class
                          (-oldImplBase and (-fserver or -fall)).
-td <dir>                 use <dir> for the output directory instead of
                          the current directory.
-tieName <xxx%yyy>        Name the tie according to the pattern.  The defaults are:
                          %POATie for the POA tie (-fserverTie or -fallTie)
                          %_Tie for the oldImplBase tie
                          (-oldImplBase and (-fserverTie or -fallTie)).
-v, -verbose              Verbose mode.
-version                  Display the version number and quit.

Thanks…:)