Next: Basic UI Features, Previous: General Concepts, Up: Top
Let's start with a simple address management application.
For now, we will assume that gnue-appserver has been installed properly and is already running, that gnue-forms and gnue-reports are also installed, and that your connections.conf file is set up correctly to allow connections to the running application server with the [appserver] connection.
To define the classes for GNU Enterprise, we use GCD files (GNUe Class Definition files). These files are a specialized XML file format. You can write GCD files with any editor you want.
So for a start, let's look at a very simple GCD file:
<module name="address">
<class name="person">
<property name="name" type="string(35)" />
<property name="street" type="string(35)" />
<property name="zip" type="string(8)" />
<property name="city" type="string(35)" />
</class>
</module>
After having written the above GCD file, save it as `address.gcd' and stop gnue-appserver. Now we have to make GNU Enterprise read and process our class definition. We do this by typing
gnue-readgcd address.gcd
at the command prompt. This will teach GNU Enterprise about our new class and make the database backend create the tables necessary to hold the data of this class. You can re-run gnue-readgcd as often as necessary and the database will be inserted/updated, but elements will not be deleted. Restart gnue-appserver.
Please note that some databases may allow adding new tables while there is an active connection to the database server. You may not have to stop gnue-appserver depending on the database selected.
As an alternative, GNU Enterprise supports a configuration option called the module path. You can simply place your GCD files (and also the GLD files we will learn about later) into any directory given in that path or into a subdirectory of any of these directories, send the gnue-appserver process a SIGHUP signal, and GNU Enterprise will read in the GCD files automatically. However, this does not work under Windows.
Now, as GNU Enterprise has learned about our class, we are ready to display a form and enter data: type
gnue-forms appserver://appserver/form/address_person
and enjoy your first application!

Please note the syntax of the last part in the command line, consisting of the module name, an underscore, and the class name. We call this the fully qualified class name.
You will probably notice that the form doesn't look very good yet. Of course we will improve that later, but first let us analyze the content of our little example file so far.
The outermost level in the XML hierarchy, the root element, is the
module. Everything we define in a GCD file is defined within a module,
and you can have exactly one module per GCD file.
The following attributes are valid for the module tag:
namecommentNaturally, we start the module by defining a class. The class tag can
have the following attributes:
namecommentmoduleThe most important building blocks of a class definition are property
tags, defining the data fields of the class. These attributes can be given for
a property tag:
namecommenttypelengthscalenullableNone is valid for this property, while
`false' means it is not (optional, defaults to `true')
GNU Enterprise supports the following basic data types:
stringnumberbooleanTRUE or FALSE. Neither length nor scale
may be given for booleans.
datetimedatetimeLength and scale may also be given in the type attribute, after the name
of the type, enclosed in parathenses, with a comma between length and scale.
So
<property name="foo" type="string(35)" />
<property name="bar" type="number(12,2)" />
is equivalent to
<property name="foo" type="string" length="35" />
<property name="bar" type="number" length="12" scale="2" />
For every class, GNU Enterprise implicitly creates a few properties:
gnue_idgnue_createdategnue_createusergnue_modifydategnue_modifyuser