Chapter 5 Object Languages Reference Guide
Some objects in the Profile category include a Generated Files entry that contains file entries. These entries define the files that will be generated for a given metaclass or for the instances of a 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 section Defining templates and generated files in a profile, in chapter Managing profiles.
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 |
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 | C |
.h | C |
.sru | PowerBuilder |
.html | HTML |
.xml | XML |
.xsd | XML |
.dtd | XML |
.xmi | XML |
.jsp | XML |
.wsdl | XML |
.asp | XML |
.aspx | XML |
.asmx | XML |
.cpp | CPP |
.hpp | CPP |
.cs | C++ |
.cls | Visual Basic 6 |
.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.
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.
Copyright (C) 2005. Sybase Inc. All rights reserved. |
![]() |