# Artifact

Artifacts are used to produce source file(s) when the stereotype is source, or to specified how libraries or an executable are composed.

An artifact stereotyped source (potentially) associated to classes to produce their code, but you may directly give its source(s) contain for instance to define the C++ main function, as it is made in the plug-outs.

An artifact stereotyped text is not associated to classes and allows to produce its C++, Java, Php, python or Idl definition as it is set, without any changes. The generated file is named like the stereotype, including the extension.

The non source nor text artifacts may be associated to other artifacts, this allows to define libraries and executable, to generate Makefiles etc ... see the plug-out genpro producing a .pro file from the artifact executable of the plug-outs.

An artifact may be created through the new artifact entry of the deployment view menu, through the artifact button of a deployment diagram, or through the create source artifact of the class menu (in case the class view containing the class has an associated deployment view).

## Browser Menu

The artifact menu appearing with a right mouse click on its representation in the browser is something like these, supposing the artifact not read-only nor deleted (see also menu in a diagram) :

### Menu : edit

edit allows to show/modify the artifact properties. In case the artifact is read-only, the fields of the dialog are also read-only.

#### Artifact dialog, tab Uml

The tab Uml is a global tab, independent of the language :

The proposed stereotypes are the default one specified through the Default stereotypes dialog more the current one (empty here). It is possible to choose into the list or to give a new one, or to empty it.

The editor button visible above and associated here to the description, allows to edit the description in an other window, or to call an external editor (for instance Xcoral) specified through the environment dialog. Note that this external editor have to create an own window, its parameter is the pathname of the file containing the description, its execution is done in parallel with BOUML which looks each second at the file contents to get the new definition until the dialog is closed (I do not like very much this polling but this works even QT isn't compiled with the thread support).

The default button visible above associated to the description allows to set the description with a default contain specified through the generation settings. Useful to generate comments compatible Java Doc or Doxygen for instance.

#### Artifact dialog, tab C++ header

This tab is only available for the source artifacts and allows to give the definition of the C++ header file generated for the artifact, it is visible only if C++ is set through the menu Languages

In BOUML the generated code is obtained by the substitution of macros in a text, only the Definition part is editable, the other one help you to see what will be generated for C++ (supposing you do not modify the C++ code generator !).

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the C++ header file (for instance for the main), empties the declaration manually or using the button not generated in C++.

${NAME} produce the artifact's name capitalized, ${Name} produce the artifact's name with the first letter capitalized, ${nAME} produce the artifact's name converted to lower case, at least ${name} produce the artifact name without modification.

${comment} is replaced by the artifact description adding //

${description} is replaced by the artifact description without adding //

${includes} is replaced by the automatically generated #include and using forms (done by the C++ code generator, not made by the dialog which produce a fixed form). It is also a good place to add your #include and using forms, when the ones produced by the code generator are not sufficient. The C++ code generator does not look at in the operations body, only the operation's profiles, relations and attributes, classes inheritances etc ... are used to compute the needed #include list. You can also use dependencies to ask for to add #includes specifying is these ones must be placed in header or source file. ${includes} and ${all_includes} are exclusive.

${all_includes} is replaced by all the automatically generated #include and using forms, it is also a good place to add your #include and using forms, when the ones produced by the code generator are not sufficient. In this case the code generator doesn't produce declarations in the header file nor #include in the source file, except the ones added by you. ${all_includes} and ${includes} are exclusive.

${declarations} is replaced by the class declarations generated automatically (done by the C++ code generator, not made by the dialog which produce a fixed form). It is also a good place to add your declarations, when the ones produced by the code generator are not sufficient.

${namespace_start} is replaced by the namespace xx { forms, dependent on the namespace specifications associated to the package containing the deployment view where the artifact is defined.

${definition} is replaced by the definition of the classes associated to the artifact.

${namespace_end} is replaced by the } forms, dependent on the namespace specifications associated to the package containing the deployment view where the artifact is defined.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab C++ source

This tab is only available for the source artifacts and allows to give the definition of the C++ source file generated for the artifact, it is visible only if C++ is set through the menu Languages

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the C++ source file (for instance the artifact is only associated to an enum), empties the declaration manually or using the button not generated in C++.

${comment} is replaced by the artifact description

${description} is replaced by the artifact description without adding //

${includes} if ${all_includes} is not used in the header definition, it is replaced by the automatically generated #include and using forms (done by the C++ code generator, not made by the dialog which produce a fixed form). If ${all_includes} is used in the header definition, it is replaced by the #include of the header. It is also a good place to add your #include and using forms, the code generator does not look inside the bodies to compute the needed ones.

${namespace_start} is replaced by the namespace xx { forms, dependent on the namespace specifications associated to the package containing the deployment view where the artifact is defined.

${members} is replaced by the non inline members of the classes associated to the artifact.

${namespace_end} is replaced by the } forms, dependent on the namespace specifications associated to the package containing the deployment view where the artifact is defined.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab Java source

This tab is only available for the source artifacts and allows to give the definition of the Java source file generated for the artifact, it is visible only if Java is set through the menu Languages

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the Java source file, empties the declaration manually or using the button not generated in Java.

${comment} is replaced by the artifact description adding /* */

${description} is replaced by the artifact description without adding /* */

${package} is replaced by the package xx forms, dependent on the package specifications associated to the BOUML package containing the deployment view where the artifact is defined.

${definition} is replaced by the definition of the classes associated to the artifact.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab Php source

This tab is only available for the source artifacts and allows to give the definition of the Php source file generated for the artifact, it is visible only if Php is set through the menu Languages

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the Php source file, empties the declaration manually or using the button not generated in Php.

${comment} is replaced by the artifact description adding /* */

${description} is replaced by the artifact description without adding /* */

${definition} is replaced by the definition of the classes associated to the artifact.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab Python source

This tab is only available for the source artifacts and allows to give the definition of the Python source file generated for the artifact, it is visible only if Python is set through the menu Languages

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the Python source file, empties the declaration manually or using the button not generated in Python.

${comment} is replaced by the artifact description adding # at the beginning of each line

${description} is replaced by the artifact description without adding #

${imports} is replaced by the automatically generated import and from .. import forms (done by the Python code generator, not made by the dialog which produce a fixed form) from the dependencies between classes and between artifacts stereotyped import or from. A dependency stereotyped import between artifact produces an import, stereotyped from this produces a from ... import *. A dependency stereotyped import between classes produces an import, stereotyped from this produces a form from ... import.

${definition} is replaced by the definition of the classes associated to the artifact.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab Idl source

This tab is only available for the source artifacts and allows to give the definition of the Idl source file generated for the artifact, it is visible only if Idl is set through the menu Languages. In the picture given for the UML tab, the Idl tab is not enabled because the artifact is not associated to at least one class defined in Idl, else :

When you push the button default declaration, the form specified through the generation settings is proposed, this last may be modified as you want, even to produce illegal source code.

When you do not want to generate the Idl source file, empties the declaration manually or using the button not generated in Idl.

${NAME} produce the artifact name capitalized, ${Name} produce the artifact name with the first letter capitalized, at least ${name} produce the artifact name without modification.

${comment} is replaced by the artifact description adding //

${description} is replaced by the artifact description without adding //

${includes} will be replaced by the automatically generated #include forms (not made by the dialog which produce a fixed form) ... in a future version of the Idl generator, it is a good place to add your #include forms.

${module_start} is replaced by the module xx { forms, dependent on the module specifications associated to the BOUML package containing the deployment view where the artifact is defined.

${definition} is replaced by the definition of the classes associated to the artifact.

${module_end} is replaced by the } forms, dependent on the module specifications associated to the BOUML package containing the deployment view where the artifact is defined.

Refer to the generation settings for more details.

The forms @{property} are replaced by the value of the corresponding user property if it is defined for the class or at an upper level, else it is not substituted.

#### Artifact dialog, tab associated classes

This tab is only available for the source artifacts and allows to set the list of classes associated with the artifact. The order of the associated classes is important because it is followed by the code generators to produce the class definitions.

All the classes without associated artifact are given in the left table (above all the classes are associated with an artifact), the classes associated with the current artifact and given in the table on the right. To move classes from a table to the other one, select them and click on the appropriate arrow.

go up and go down allows to change the order of the associated classes. Select the wrong ordered classes and use the appropriate button.

#### Artifact dialog, tab associated artifacts

This tab is not enabled for a source artifact, to set the unordered list of artifacts associated to the current one. For instance for the artifact executable of the plug-out html :

### Menu : delete

The menu entry delete is only present when the artifact is not read-only.

Delete the artifact and all its representation in the opened diagrams. After that it is possible to undelete it (from the browser) until you close the project : obviously the deleted items are not saved !

### Menu : generate

The menu entry generate is only present when the artifact is a source artifact.

Allows to call the C++ generator, Java generator, Php Generator and Idl generator.

### Menu : edit

The menu entry edit is only present when the artifact is not read only and is a source artifact.

Allows to edit one of the generated files, for instance the header file :

### Menu : referenced by

To know who are the classes associated to the artifact, and the artifact referencing the current one through a relation.

### Menu : mark

See mark

### Menu : tool

Appears only when at least one plug-out is associated to the artifacts. To apply a plug-out on the artifact.

### Menu : select associated class

### Menu : select an associated class

Only for the artifact source, appears only when at least one class is associated to the artifacts. To quickly select the appropriate class, the current artifact may also be quickly selected from its associated classes.

## Default stereotypes

The dialog allowing to set the default stereotypes has a tab reserved for the artifacts :

## Generation settings

This very important dialog allows to specify many default definitions concerning the classes, more details will be given in C++ generator, Java generator and Idl generator.

The first C++ tab allows to specify the default header and source file definitions, it is visible only if C++ is set through the menu Languages :

As you can see it is possible to choose the extension of the header and source files, to force the production of the namespace header and to ask for the Javadoc style comment.

The are four ways to produce #include :

- without path : ask for the C++ code generator to generate the #include without relative or absolute path

- with absolute path : ask for the C++ code generator to generate the absolute path of the automatically included files.

- with relative path : ask for the C++ code generator to generate the relative path of the automatically included files, relative to the file containing the #include

- with root relative path : ask for the C++ code generator to generate the relative path of the automatically included files, relative to the directory specified by the generation settings

The first Java tab allows to set the default Java file content associated to an artifact, it is visible only if Java is set through the menu Languages :

As you can see it is possible to choose the extension of the files (even this is generally java), to force the production of the package prefix before class names (this prefix is not produced in case the class or its package are imported) and to ask for the Javadoc style comment.

The first Php tab allows to set the default Php file content associated to an artifact, it is visible only if Php is set through the menu Languages :

The first Python tab allows to set the default Python file content associated to an artifact, it is visible only if Python is set through the menu Languages :

The first Idl tab allows to set the default Idl file content associated to an artifact, it is visible only if Idl is set through the menu Languages :

## Drawing

An artifact is drawn in a deployment diagram as a rectangle containing the artifact icon :

If the artifact is stereotyped by a stereotype part of a profile and this stereotype has an associated icon, this icon will be used unchanged when the scale is 100% else it is resized.

The default color of an artifact may be set through the drawing settings.

A right mouse click on an artifact in a diagram calls the following menu (supposing the artifact editable) :

### Menu : edit drawing settings

These drawing settings concerns only the picture for which the menu is called.

A settings valuing default indicates that the setting specified in the upper level (here the diagram) must be followed, obviously this one may also be default ... up to the project level. When you add an artifact in a diagram, all the settings are set to default.

### Menu : set associated diagram

set associated diagram allows to automatically open the current diagram when a double mouse click is made on the artifact representation in a diagram or the browser. After that the only way to edit the artifact is to choose the edit entry in the menu.

### Menu : remove diagram association

To stop to associate a diagram to the artifact.

Previous : component

Next : deployment node