This page last changed on Mar 17, 2009 by aaime.

This page describes extending GeoServer's configuration in the new Catalog API, in use as of GeoServer 2.0.x.  The Catalog API is described in more detail here.

The Simple Case: Metadata Maps

In the Catalog API, most configuration objects include a metadata map which provides easy storage of arbitrarily named configuration options.  For example, if you simply want to add a new configuration option to a StoreInfo, just add it to the metadata map for the layer.  This is all you need to do:


StoreInfo aStore = theCatalog.getStoreInfo("store id", StoreInfo.class);

aStore.getMetadata().put("myparamname", paramValue);


To help avoid naming conflicts, please prefix your custom options with a string identifying the module that uses it.  For example, the name of the option that controls whether the GeoSearch extension will index a layer is called "geosearch.enable" rather than just "enable".

Where Should I Keep My Option?

The GeoServer Catalog API provides several types of configuration object.  The following table summarizes the object types and what they should be used for.

Interface
Purpose
ResourceInfo A particular data set, such as a table in a PostGIS database.  If you have an option that only makes sense in the context of vector data or raster data you should use FeatureTypeInfo or CoverageInfo respectively.
StoreInfo A physical collection of data sets (like the PostGIS database itself).  Similarly to the StoreInfo sub-interfaces, there are DataStoreInfo and CoverageStoreInfo for vector and raster data.
NamespaceInfo Describes a namespace; an attribute of a published layer to help avoid naming conflicts.  No metadata map is available for Namespaces; think about using LayerInfo metadata instead.
StyleInfo A style to be used in rendering a visible layer.  No metadata map is available, again, think about using LayerInfo metadata.
LayerInfo A logical, published map layer.  This controls settings for the layers that are exposed via OWS services.
WorkspaceInfo A grouping of ResourceInfo's.  Workspaces do not particularly influence the behavior of GeoServer and serve mostly as an organizational tool; potentially to include security features at some point in the future.
MapInfo A grouping of LayerInfo's.  MapInfo groups several layers into a cohesive map.

What If Metadata Isn't Enough?

The metadata map can contain any Serializable Java Object, so it should be sufficient for most needs.  However, if you are implementing a feature that simply does not map to any of the existing configuration objects, you will probably need to extend and implement one of the existing interfaces to provide the appropriate place.  For example, when implementing a new service you may need to provide a new type of ResourceInfo to control the data used by the service.

Document generated by Confluence on May 14, 2014 23:00