Generated Files Category

Some objects in the Profile category include a Generated Files category that defines the files that will be generated for the metaclass or for the instances of the metaclass with a selected stereotype or criterion.

Example

The Generated Files category for file objects in Java contains the EmbeddedArtifact entry that applies to all embedded files of type Artifact to be generated. The EmbeddedArtifact entry contains the File name box that contains the template for the name of the file to be generated.

At the bottom, it contains a text zone that displays the code of the template of the file to generate.



For more information on the Generated Files entry, see Templates and Generated Files (Profile).

Encoding

You can define the format for generated files in the Encoding box for each file you generate. A default encoding format is provided to you, but you can also click the Ellipsis button beside the Encoding box to change it. This opens the Text Output Encoding Format dialog box in which you can select the encoding format of your choice.

This dialog box includes the following properties:

Property

Description

Encoding

Encoding format of the generated file

Abort on character loss

Allows you to stop generation if characters cannot be identified and are to be lost in current encoding

Syntactic Coloring

If the File Name box in the Generated Files entry is empty, there is no file generated. However, it can be very useful to leave this column empty so as to preview the content of the file before generation. You can use the Preview page of the corresponding object at any time for this purpose.

During generation, the template in File Name is evaluated and if one of the following extensions is found, the code is displayed with the corresponding language editor and syntactic coloring (example: .cs for C++):

Extension

Syntactic coloring

.java

Java

.c, .h

C

.sru

PowerBuilder

.html

HTML

.xml, .xsd, .dtd, .xmi, .jsp, .wsdl, .asp, .aspx, .asmx

XML

.cpp, .hpp

CPP

.cs

C++

.cls, .vb

Visual Basic 6

.vbs

VB Script

.sql

SQL

.idl

CORBA

.txt

Default text editor

There are two possible scenarii during generation:


  • A file is generated

  • No file is generated

File Generated

The mechanism of file generation is the following for each object having a Generated Files entry that is not empty:



A file is generated when the File name box contains the name of the file or the template for the name of the file to generate. You can type the name of the file to generate as follows:


  • file_name.extension (for example, ejb-jar.xml)

  • %extensionfile_name% (for example, %asmxFileName%)

In this example, a file called ejb-jar.xml located in the META-INF folder is generated.



No File Generated

In this example, there is no file generated since the File name box starts with a . (dot) character. The contents of the file is only available in the Preview page of the component (EJB - Entity Bean) property sheet.