The GenNet Development Tool

In order for .NET clients to access Java objects using J-Integra for .NET, proxies must be generated from these Java objects and packaged into a .NET assembly. This .NET assembly in turn is deployed on the .NET platform to be referenced by the clients. The GenNet development tool is a pure Java tool that invokes GenService to generate such proxies. This section describes how to generate .NET proxy files using GenNet.

When reading this section, keep in mind the following important details:

Starting GenNet

Use this section as a quick reference to start GenNet.

Starting GenNet in Windows:

Launch GenNet from the Start Menu.

Note: When starting GenNet from Windows, it will automatically search for gennet.xml in $USER_INSTALL_DIR$
Starting GenNet in Command-Line:
java -jar $USER_INSTALL_DIR$\lib\gennet.jar [arguments]
Note: When starting GenNet from command-line, it will automatically search for gennet.xml from where the java command was issued.

Possible arguments include:

Argument Description Example
-f | -file filename
Read settings from filename
-f gennet.xml
-n | -nogui
Launch GenNet in non-interactive mode (see below).

The J-Integra® for .NET runtime (janet.jar) must also be in $USER_INSTALL_DIR$\lib. The main class that is called when launching GenNet is com.intrinsyc.janet.gennet.GenNetApp.

How to Use GenNet

GenNet can be started in interactive, or non-interactive mode.

Interactive Mode

  1. When GenNet first starts, it uses IP multicast to find existing instances of GenService:

    Note: Select "GenService" instead of "GenService_2.0", only if:

    For details of the two GenService versions, please refer to the section Multiple Versions: Genservice & GenService 2005 in the GenService section.

    Select an instance and click Next>.

    If, for whatever reason, multicasting is unavailable on your network, then GenNet will fail to find any instances that aren't running locally:

    If you select Enter Host Manually and click Next>, you will be prompted to manually enter a URI where GenService can be found. You should enter the following URI and click OK:

    	tcp://[GenService machine]:8001

  2. The next screen prompts for the components (JAR files or directories) to be added to the CLASSPATH. These components will be required by the Java runtime to resolve references to Java classes.

    Action Description
    Add Jar... Launches the file browser dialog to add JAR or ZIP files to the CLASSPATH.
    Add Directory... Launches the file browser dialog to add directories to the CLASSPATH. No files will be displayed.
    Remove... Removes an entry in the list of components.
  3. The next screen prompts for the specific Java classes that will have .NET proxies generated for them. This is where the components added to the CLASSPATH in the previous step are used to resolve references to the Java classes.

    Click Browse... or Add... to add your Java classes. Once one or more classes are added, the following options will appear:

    Action Description
    Filter... Launches Filter Referenced Classes.
    Browse... Launches Browse Classes.
    Add... Launches Add Java Class.
    Removes... Removes a selected entry.
    Options... Launches Java Class Options.
    Map Collections/Dictionaries

    If this option is checked, when generating Java proxies, GenNet will generate currently available mappings when encountering types from the java.util package. For example, for java.util.Vector, it will generate System.Collections.ArrayList. However, this implies that such types passed as parameters will always be marshalled by value.

    If this option is not checked, then GenNet will generate the normal remote proxy type so that there is no mapping. This implies that such types passed as parameters will always be marshalled by reference.

    This must be used in conjunction with the Map Collections/Dictionaries option in Janetor.

    Filter Referenced Classes

    GenNet will not only attempt to generate proxies for the listed Java classes, but also other Java classes that are referenced. The list of classes to generate could be huge, and more likely than not, you will not need to access so many Java classes from the .NET client. To solve this, GenNet provides a way for you to manually select which classes you want to be filtered out from proxy generation. Click Filter... to show:

    In the screenshot above, for example, we can see that all classes from java.util will not have a proxy generated for it except for java.util.Enumeration.

    Note: Be careful with filtering out types - if you filter out a type that is used as a return type of a method, GenNet will skip generation of the method altogether.
    Browse Classes

    Instead of adding manually, GenNet provides the option of browsing the classes found in the CLASSPATH and selecting which of these classes to generate proxies for. Click Browse... to show:

    Use the CTRL or SHIFT keys to select more than one class. You can visually select the classes and click Add Selected. For each class selected, you will see an entry in the list of Java classes to generate proxies for:

    Add Java Class

    You can alternatively enter the Java class manually - the full package name must be included also. The OK button is only enabled when GenNet finds the class in the CLASSPATH, otherwise, it is disabled. Click Add... to show:

    If you are not sure of the class name, it is best to browse for it instead.

    Java Class Options

    For Java classes that implement, there is the option to marshal that class by value. All public/private/protected fields will be generated, along with get/set methods. For such classes, click Options... to show:

    Check Pass by value and click OK. You will now see that the class is now denoted as pass by value:

  4. The next screen prompts for the name of the .NET assembly and an output directory on the .NET platform where the generated assembly will go:

    The name of the assembly (without the DLL extension) must match what was entered in Assembly Name of the Activation tab under the Local Objects category in Janetor.

    The Browse... button will be disabled if GenService was found to be remote rather than local to the machine that GenNet was launched from.

    Action Description
    Generate Strong Named Assembly

    Generate a strong named assembly. Strong named assemblies are required when installing assemblies in the GAC to be referenced by COM+ (for example). See Strong-Named Assemblies for more details.

  5. The final screen shows the output of the generation, and if there were any errors encountered:

Non-Interactive Mode

GenNet is normally used interactively, with a graphical user interface, but it can also be run without stepping through the GUI wizard. This can be useful when GenNet is used as part of an automated build procedure, for example. To use GenNet in this non-interactive mode, GenNet must first be run in interactive mode to create a valid settings file. It can then be run again non-interactively using the same settings.

To create the settings file, simply run through the steps above and once generation has been successful and the Exit is clicked, a settings file will be created and saved to gennet.xml. If GenNet is run from Windows, then gennet.xml will be created in $USER_INSTALL_DIR$, otherwise, it will be created from wherever GenNet was launched on the command-line.

To run in non-interactive mode, GenNet must be started from the command-line. Review Starting GenNet to see how to start GenNet in non-interactive mode.

If the settings file is read and processed correctly, GenNet creates the proxies immediately and exits. All status and error messages are displayed on the console's standard output and standard error streams.

© 2007 Intrinsyc Software International, Inc. All rights reserved. Legal