Orbix.cfg
. On UNIX systems, this file will be automatically located if it has been installed in the /etc
directory. If however it is not installed there, or the compiler is running on Windows 95 or Windows NT, then you must set the environment variable IT_CONFIG_PATH
to point to it. By default, Orbix.cfg
is placed in the OrbixWeb installation directory.The OrbixWeb configuration file is usually configured during installation. The contents of the file are described in Chapter 3, "OrbixWeb Configuration".
2.1.2 Running the IDL Compiler
The OrbixWeb IDL compiler is invoked by the command idl
. It takes one parameterthe name of the IDL file. The extension for this file must be .idl
. However, when compiling it is not necessary to specify the .idl
extension.BANK.idl
could be compiled with the following command:
idl BANKor as follows:
idl BANK.idl
By default, the IDL compiler maps global IDL definitions to Java definitions in the global package. Also by default, the compiler output is redirected to a local directory named
java_output
. Both these functional characteristics can be configured (with the -jP
and -jO
switch, respectively), but we will examine the default case first.
// IDL // in file Cust.idl interface Customer { void setCustomerName (in string name); void getCustomerName (out string name); };This file could be compiled as follows:
idl CustThis would result in the generation of the file structure shown in Figure 2.1.
![]()
|
Of course, the generation of Java class definitions directly into the global package has the potential to cause naming clashes. Therefore, when compiling IDL it is often desirable to specify a package name into which all generated Java definitions are placed. The IDL compiler
-jP
switch supports this functionality.Cust.idl
to be scoped within the package COM.Company.internal
, we can use the following command:
idl -jP COM.Company.internal CustAs a result of this command, the IDL compiler will generate the file structure illustrated in Figure 2.2.
![]()
|
The IDL command line can accept a series of
-jP
switches of the following form:
idl -jP <package> -jP <IDL module>=<package> <IDL module=package> ...A command line of this format indicates that IDL types defined in the target IDL file should be mapped to the main
-jP
package, but that the specified modules, which are only referenced in the target IDL file are actually located in other, existing Java packages.For example, take the following IDL file:
// IDL // In file CustomerTypes.idl module CustomerTypes { interface Customer { ... }; };Now, assume that this definition is compiled with the following command:
idl -jP CustomerPackage CustomerTypes.idlAll generated types for this IDL file will be scoped by the package
CustomerPackage
. Now, a second IDL file is written as follows:
// IDL // In file BankTypes.idl # include "CustomerTypes.idl" module BankTypes { interface Bank { CustomerTypes::Customer getCustomer (); }; };If this file were compiled with a single
-jP
switch, then the target Java package name would need to be CustomerPackage
, to satisfy the IDL generated references to the Java types for interface Customer
. To avoid this restriction, the -jP
switch can be used with an alternative package value for module CustomerTypes
, as follows:
idl -jP BankPackage -jP CustomerTypes=CustomerPackage BankTypes.idlAnother issue associated with IDL output is the top level target directory for generated files. The local directory
java_output
is not always the desired target for the IDL output file structure, so the IDL compiler allows an alternative to be specified. This can be done by invoking the compiler with the -jO
switch, followed by the new output directory name.
Executing
idl
without any parameters outputs a summary of its switches.Note that it is necessary to process each IDL file through the IDL compiler: inclusion of an IDL file in another (using
#include
) is not sufficient to produce output for the included file (unless the -N
switch is specified to the compiler). Otherwise, Java code generation would occur more than once for a file that was included in more than one file.
There are two primary sources of Java code in an OrbixWeb program: IDL compiler generated code, which maps IDL definitions to Java code, and user-supplied code, which uses the types defined in the generated code.
The code generated by the IDL compiler relies on the Java API classes and the standard OrbixWeb package
IE.Iona.Orbix2
. User-supplied client code may rely on other Java packages.Therefore, before compiling an OrbixWeb client application, it is necessary to ensure that the Java compiler can locate each of the following:
IE.Iona.Orbix2
package (usually located in the OrbixWeb classes
directory).
javac
compiler, this can be achieved by setting the environment variable CLASSPATH
to include the location of each of these items, before compilation. Alternatively, the location of each item could be specified to the -classpath
compiler switch.In order to compile the application, it is necessary to compile all user-supplied code and all relevant Java source files produced by the IDL compiler. The IDL compiler may produce Java source code which is not required for a given application (for example, some generated files are only relevant to servers, while others are only relevant to clients). It is not necessary to compile such code (although users may safely do so).