Rogue Wave banner
Previous fileTop of DocumentContentsIndex pageNext file
HydraExpress Web Service Development Guide
Rogue Wave web site:  Home Page  |  Main Documentation Page

21.2 The Project File

When the code generator rwsfgen is invoked, a top-level configuration file is created that contains all project elements, including any WSDLs or XML Schemas provided to the generator, all generation options, and any special mappings or other elements used as an argument during code generation. This file supports a project structure of any complexity and allows you to easily maintain your project using one file.

The code generator accepts any file of any name that adheres to the schema used by the project file, so you can easily create and maintain your own project files that contain special options or elements you wish to use for particular projects.

One useful technique is to create a customized project file containing special generation options that you want your project to use. If you provide this file to HydraExpress, it will use it to generate code. HydraExpress will then create a new project file in the output directory you specify for the project. This new project file is a combination of the custom project file provided the code generator, default generation options, and any additional options specifically provided on the command line. See Section 20.6.1, "Adding Options and Customized Mappings to the HydraExpress Project File," for more information.

This section discusses a sample project file, adding options to a project file, and the HydraExpress project schema.

21.2.1 A Sample Project File

Let's look at a simple project file. If you generated code using the default options for the example DayOfWeek located in your <installdir>\examples\webservices\DayOfWeek directory, you will have the following project file in a code generation directory DayofWeekExample:

//1

The options element includes all options, either default options, or options provided to the generator on the command line. For instance, because the whitespace option was set to true in the initial example-project.xml file provided on the command line, the option is copied to the generated project file, DayOfWeekExample.xml. The whitespace option would have been the default value, false, otherwise. (See Section 20.6 for a list of all generator options and their default values.)

//2

The project-name is a required option and is the basis for the name of the generated project file, as well as the name of the code generation directory.

Note: HydraExpress supports only file paths without spaces, so do not include spaces in file or directory names.

//3

The outdir value corresponds to the name of the code generation directory, including its full path. This value defaults to the project-name.

//4

The mapping element contains any customized datatype mappings you provided to the generator. Note that one customized mapping is always present, to map any schema element named choice to an object ChoiceElement. Without this mapping, a conflict could occur between an element named choice, and XML Schema's <xsd:choice>.

//5

The files element lists all WSDLs or XML Schemas provided to the generator. Any number of WSDLs or schemas are supported.

If you wish to override elements in the project file, you may enter them on the command line. Any options entered on the command line override those inside the HydraExpress project file. In addition, if you provide more than one HydraExpress project file to the code generator, the values in the last project file override any previously-set values in the event of conflicts. See Section 20.6.3 for more information on property precedence.

21.2.2 Adding Options to a Project File Vs. Adding them to the Command Line

Adding options to a project file requires a slightly different syntax than adding them to the command line. The command line accepts options prefaced with "no", such as "nohtml" or "noserver," while the project file instead requires a simple option value of "false".

For example, to override the default setting html that always generates documentation, on the command line, you would enter:

However, in a project file, you would enter:

For a list of all generator options, see Table 12, "Code generator options."

21.2.3 Creating a Customized Project File for Special Generation Options

HydraExpress reads any file of any name that contains supported project file options. This ability provides a great degree of flexibility while generating code.

The advantage of this feature is that, for instance, if you want code to be regularly generated using a particular option, you can create an XML file specifying that option and provide it as an argument to the generator. The code generator uses the options contained in any such file to generate code, and then merges these options with the HydraExpress project file it generates.

For example, if you want to always generate code with the -whitespace and -sourcepro options, you could create a HydraExpress project file titled standard-properties.xml. If you used this as an argument to the code generator, you would not need to specify these options on the command line.



Previous fileTop of DocumentContentsIndex pageNext file

Copyright © Rogue Wave Software, Inc. All Rights Reserved.

The Rogue Wave name and logo are registered trademarks of Rogue Wave Software, and HydraExpress is a trademark of Rogue Wave Software. All other trademarks are the property of their respective owners.
Contact Rogue Wave about documentation or support issues.