[es]

How to configure the application

The configuration of the application is done with two types of files in XML format.

  • sa_conf.xml
  • A set XML files describing the grammar.

Configuration file: sa_conf.xml

The first type of configuration file is just one file for the global concepts of the application, as also certain elements for the user interaction.

This is a table with all the configurable elements of that file.

Properties for the file sa_conf.xml
KeyDescriptionRequiredExample
GrammarFileNameNames of the files that have grammar definition for all commands. The files are separated by semi-period.Yesgrammar/db2-create.xml;command/db2-alter.xml
GrammarReaderNameImplementation of the read that will read the grammar.Yesname.angoca.zemucan.grammarReader.impl.xml.ImplementationXMLGrammarReader
PromptThe prompt that is shown in the console.Nosa>
ExitToken to exit from the application.Noexit
AboutTokenToken to ask for the application information.Noabout
HelpTokenToken to ask for help about how to use the application.No???
ShowIntroIf the introduction is show presented when the application started.Notrue/false
DB2NativeIf the DB2 commands have to be executed nativelyNotrue/false

Other configuration parameters

Some configuration parameters are defined in the JVM environment variables. These parameters are:

  • ConfigFile: Indicates which configuration file to use, if the user does not want to load the default one.
  • DB2params: DB2 parameters to consider when executing a DB2 command.
  • GrammarFileDescriptors: Name of the grammar file descriptors.
  • WithoutExtraNodes: Indicates to the grammar controller to not add the extra nodes. Extra nodes are: about, help and license nodes. These nodes are not defined in any grammar file, they are added in the graph when it is built.

Grammar files

The second type of files describes the grammar of the DB2 commands. Those files contain each token of a command, and for each one it says what the possible next tokens are.

When the application reads the grammar, it builds a graph in memory, where it has an only entering point, and only one exiting point. The entering point is called STARTING_NODE, and in this token all DB2 commands are added. The exiting point is called ENDING_NODE, and when a command can be executed, it has to refer to it (The command has enough parameters to realize some operation.)

Graph

Each token that represents a command name or a parameter, is written in a grammar file like a node. A node has the following attributes:

Attributes for a node
AtributeDescriptionExample
idUnique identifier of a node in the graph. It cannot be possible to have two nodes with the same name.<id>idCreate</id>
nameToken's name, which is the word that represents in the grammar.<name>create</name>
reservedIndicates if the node represents a reserved word, or if it is a value given by the user.<reserved />
childrenRepresents the options of the command in the current position. It is described with idToken attribute.-
idTokenFollowing node to the current node.<idNode>createTable</idNode>

The final node, ENDING_NODE, does not have children, because after this node, there are no more options.

The attribute reserved does not have any value, only its presence in the node means that the word represents a reserved word.

Following, there is an example of a node called create:

<token>
    <id>create</id>
    <name>create</name>
    <reserved />
    <children>
        <idToken>create_database</idToken>
        <idToken>create_table</idToken>
        <idToken>create_tablespace</idToken>
...
        <idToken>create_index</idToken>
    </children>
</token>

Video

Este video explica como incorporar un nuevo comando en la aplicación.


Other configuration files

There are other two properties files that configure the operation of the application.

  • logback.xml
  • messages/sa_*messages_*.properties

Logback

Logback is used for as the event registry system in the application. For its configuration, please look at Logback documentation (http://logback.qos.ch/manual/configuration.html).

Internationalization

Those files contain the messages showed in the user interface. This file is composed by elements: key/value.

Currently, the application is translated to English and Spanish. If you want to add another language, it is just necessary to translate the messages that can be found in those files. The language selection to show is done according to the Locale properties of the machine where the application is executed. (Locale in Java).

Information about translation for Internationalization: Resource Bundle.

[es]