The application.xml file defines all the LayerModelFactories and also references to other xml files needed for the configuration of a Geomajas application. The LayerModelFactories are factories on the server that are able to create a LayerModel. A LayerModel in turn is, as the name reveals, the model behind a layer. They must also be able to serve as a datasource, and therefore often need connection parameters in their configuration. Geomajas is packaged with different kinds of these LayerModelFactories. Examples are factories for Shape files, WKT, Hibernate, GeoTools and so on. We have divided the LayerModels into 2 kinds: vector and raster models. This is done because both operate and behave very differently.
First up are the vector based layer models factories. They are defined by the 'layerModelFactory'-tag and an id attribute. The id is needed later when we refer to these factories in the definition of a FeatureType in a layer (in order for the layer to know where to get it's data).
First up is the a factory for creating LayerModels, stored in memory, from a single shapefile. It only needs one connection parameter: the location of the file.
Next up is the HibernateLayerModelFactory. In complex applications, this one is the most important, because it allows the user to define complex mappings, easily implement business logic and so forth. It uses hibernate-spatial to accomplish this, and therefore supports PostGIS and Oracle at the time of writing (hibernate-spatial-1.0-M1). This factory does not need connection parameters because hibernate uses it's own configuration file (hibernate.cfg.xml). When using the hibernare layermodel factory, always make sure that the hibernate configuration file is correct.
Another implementation of the LayerModelFactory interface creates LayerModels that actually use Geotools datastores behind the scenes. This in turn means that any type of data that can be retrieved by or through geotools can be fetched with these LayerModels as well. This also means that configuration of the factory (i.e. the connection parameters) are exactly the same as those geotools uses, because they are simply passed to the geotools datastorefinder. By using geotools, we can support shapefiles, databases, WFS and so on. Below is an example of a parametermap that will automatically determine the underlying datasource is a PostGIS database. (geotools determines this by which parameters are used)
The second option is to use a WMS server to fetch your raster-images from. This factory requires some preset connection parameters. baseWMSurl: The base url to the WMS service. From this base url, the LayerModel knows how to create the complex urls needed for fetching specific data from a WMS server. version: The version of the WMS protocol you want to use. format: The preferred image format. srs: The standard coordinate system used for fetching images from this WMS service.
The application.xml contains more then just factories for vector and raster layers. Before we even get to these factories, we must first define 2 other parameters: url: This parameter contains a string with the name of the directory in which this application.xml can be found. In the example below we see as value: 'demo'. This means that this xml file can be found under /applications/demo/application.xml. Geomajas will always look for it's applications under the 'applications' directory under the webapp root. name: This is the full name of the application in question. On the server nothing is done with this parameter, be it is sent to the client along with most of the configuration. At the bottom of the application.xml there are references to other xml files. Each of these contain different parts of the Geomajas configuration. In what follows we will assume that the names of these files have not been altered.