Brewer: The J-Integra® Espresso Proxy Generator

Brewer, the J-Integra® Espresso Proxy Generator, is a utility that generates C# proxies or IDL files from either Java Classes or IDL files. These proxies can then be used to access Java or Corba objects from .NET.

As of Brewer Version 1.0.2, all existing tools have been combined into one single tool. This tool provides all the functionality of the existing tools: IcsIdl2Cs and IcsJava2Idl.


Overview:

Brewer generates proxies in four steps, which users may navigate by clicking the 'Back' or 'Next' buttons at the bottom of the dialog, or by clicking the tabs at the top of the dialog:
  1. Selecting your proxy sources
  2. Configuring your proxies
  3. Generate the proxies via Output tab
  4. Configuring Advanced Options
Brewer also boasts a number of configurability features for making proxy generation more convenient: The Brewer also consists of another standalone command line application.


Step 1: Select your proxy source

Proxies contains items that you wish to generate proxies from. These can be in several different formats such as JAR files, individual IDL files, or Directories containing class and/or IDL files.

Dependencies are JARs or Directories contain required classes for the proxy sources but you do not wish to generate proxies for them. For example, supporting JARs like j2ee.jar should typically be added here.

Both Proxies and Dependencies added and removed using the following controls:
  • Context Menu
  • Add JAR/IDL Button
  • Add Directory Button
  • Remove Button
When a JAR file or directory is added to these areas, Brewer will automatically begin analyzing their contents. This process may take up to several minutes to complete. Please note that during this time, users will not be able to remove the JAR or directory being analyzed using the Remove button.

Step 2: Configure the Proxies

Please refer to the proxy item below for more information about the configuration options available to it.
  • JAR File - All available classes are listed under the JAR. Users may check each individual java classes or packages to mark them for proxy generation. Checked classes will be generated during the proxy generation step. If a desired class is unavailable then double check the dependencies and add any required JARs or directories.
  • IDL File - This IDL file will be included in proxy generation.
  • Class Directory - All available classes are listed under the Directory. Users may check each individual java classes or packages to mark them for proxy generation. Checked classes will be generated during the proxy generation step. If a desired class is unavailable then double check the dependencies and add any required JARs or directories.
  • IDL DirectoryAll IDL files within this directory will be included in proxy generation.


Please see Configuring Advanced Output Options for more information about advanced IDL and Java Class options.

All proxy items are automatically updated when the item is deleted, renamed, or changed. Proxies are not automatically regenerated and must be regenerated manually.


Step 3: Generate Proxies via the Output Tab

The Output tab's Proxy Output area allows users to select which type of output to generate. Each type can be included in the proxy generation by selecting the checkbox which enables the corresponding section.
  • Generate Assembly: compiles a .NET assembly.
    • Assembly Name: The name of the .NET assembly that will contain the compiled C# proxies. Brewer will automatically append '.dll' to this entry.
    • Output Directory:The location where Brewer will place the assembly.
  • Generate C# Source: creates C# proxy files in a directory structure similar to the original java package structure
    • Output Directory:The location where Brewer will place the generated files.
  • IDL Files: creates IDL files that are used to create the C# source.
    • Output Directory:The location where Brewer will place the generated IDL files.
Advanced Generation Options are available by clicking the Advanced Button. Please see Configuring Advanced Output Options for more information.

Users may click the Show Detailed Output checkbox to view additional information generated by the proxy generation phase, including detailed error information. Users may view information on the entire process by clicking the Proxy Generation hotlink, or view information specific to the IDL Generation, C# Source Generation or Assembly Compilation phases by clicking the respective hotlink.

The proxy generation process is initiated by clicking the Generate button.

Step 4: Configuring Advanced Output Options

The following advanced options configure the proxy generation process.

Java Options

  • Single File per Package - Specifies that one IDL file per java package be generated.
  • Don't generate methods for value classes - In Serializable and Externalizable classes, don't generate method. If this is unchecked, the assembly may not compile properly and require user modification.

IDL Options

  • Generate built in types - Generate code for the built in types.
  • Generate default factories for value types - Generate default factories for the value types.
  • Generate default implementations for value types - If this is unchecked, then the assembly may not properly compile.
  • Generate TIE style object implementation classes - Generate TIE style object implementation classes.
  • Don't generate POA skeleton classes, only client side stubs - Don't generate POA skeleton classes, only client side stubs
  • Generate code for all included IDLs - Generate code for all included IDLs.
  • IDL Compiler Extra Arguments - Specify any extra arguments that you wish to pass to the IDL compiler.

Assembly Options

  • Generate Strong Named Assemblies: Selecting this checkbox will cause Brewer to automatically sign the generated assemblies with the key file specified in the Key File text area.

Project Management

Brewer uses the concepts of 'Projects' to ease managing different sets of Java sources and .NET assemblies.

The configurable parts of each proxy generation session (classpaths, output assembly name and paths, etc) can be saved to a file, and easily restored. Users may save a session by selecting the Save menu item or the Save As menu item from the File Menu, and restore a session by selecting the Open menu item from the File Menu. Saving and restoring Brewer projects affects the following options:
  • Proxy Items and Dependencies.
  • Output Settings such as output path, assembly name.
  • Advanced Output Settings.

Brewer Settings

Brewer offers a handful of options that are application-wide. These options can be found under the Settings menu:
  • Autoload Previous Project - Selecting this menu item will cause Brewer to automatically load the project that was open when the application was last exited.
  • Show Help Toolbars - Selecting this menu item will display a toolbar at the top of the dialog that describes each panel and provides contextual help information.
  • Show Classpath Error Message - Selecting this menu item will show a dialog box everytime the Java Analyzer can't load a class. This is useful in determining when a dependency is missing.
Selecting the Advanced... menu item under the Options menu will display the J-Integra® Java Settings dialog (shown right). This dialog allows the user to specify which JVM will be utilized by Brewer. The drop down list is populated from the registry. Additional JVM directories may be added by using the Browse button.

Note: The Java version MUST correspond with the JVM path or unpredicted errors may occur.

Brewer Command Line

A seperate executable called BrewerCmd.exe provides a command line mode application providing the complete functionality of the GUI brewer.

This will typically be used from an automated or nightly build.

Usage: BrewerCmd [options] Target

General Options:
-h, -? Prints out this message
-d <dir> Set the output directory to <dir>.  If generation target is 'all' and you wish the the idl and cs files to be in seperate directories then use the -didl -dcs options
-didl <dir> Set the output directory for IDL files to be <dir>.
-dcs <dir> Set the output directory for C# source files to be<dir>.
-g Specifies what gets generated:
    assembly Generates a .NET assembly. Default.
    cs Generates C# source files.
    idl Generates IDL source files.
    source Generates C# & IDL source files.
    all Generate everything - Assembly, C# source, and IDL source.
-o <name> Specifies the assembly name to be <name>.  If ommited it will default to Espresso.dll
-v Verbose output.
-version Print version info.

IDL options:

-cp <dir1;..|jar1;..> Sets the classpath to directories and jar files.
-m Generate methods for value types
-p Generate a single file per class, if not specified will generate single file per package.

C# options:
-all Emit code for the included idl-files as well.
-I <dir> Built in types are not included.
-noBuiltInTypes Include <dir> in search path for the preprocessor.
-noDefaultFactories No default factories for value types are generated.
-noDefImpl No default implementation classes are generated.
-noPOA No POA skeleton classes are generated, only client side stubs.
-noTIE No TIE style object implementation classes are generated.
-prefix <name> <pref> Extend the name <name> of a module at root level by the prefix <pref>.
-w Supress IDL compiler warning messages.
-Wp <arg1>,...,<argn> Pass these arguments to the preprocessor.

Assembly Options
-sn <keyfile> Strong name the generated assembly with the supplied <keyfile>.

Arguments
Target Specifies what the proxies should generate.
    ISI-file Use the ISI file for the settings.
    List A semicolon ';' delimited list of items. This may contain IDL filenames, classnames, JAR names, or directories containing classes or IDL files.

Examples:

BrewerCmd -cp j2ee.jar MyEjbBean.jar
This will generate proxies for all the classes inside MyEjbBean.jar in an assembly named Espresso.dll in the current directory.

BrewerCmd -d output -o MyEjbBeanProxy -cp j2ee.jar MyEjbBean.jar
This will generate an assembly called MyEjbBeanProxy in a directory "output" for all classes inside MyEjbBean.jar

BrewerCmd -I c:\referenceIDls MyApp.idl
This will generate an assembly called Espresso.dll from MyApp.idl using C:\ReferenceIdls for any idl references from MyApp.idl.