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.
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).
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:
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:
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:
In this example, a file called ejb-jar.xml located in the META-INF folder is generated.