This page last changed on May 08, 2007 by jdeolive.


Consider the following class diagram for the GeoServer catalog. In the following sections the diagram will be dissected and the individual components explained in detail.


Consider the following subset of the above diagram which centers on the ResourceInfo interface.

This class diagram depicts a number of important associations to the ResourceInfo interface. The first is a composition with NamespaceInfo. Each ResourceInfo is a part of a NamespsaceInfo, and NamspaceInfo can be viewed as a grouping or composition of ResourceInfo.

The second is the association to Resource. An important distinction to make in this model is that of a "published resource", and a "physical resource". The former being represented with ResourceInfo, the latter with Resource. A Resource can be thought of as a "handle" to a live physical real world resource. Whereas a ResourceInfo can be thought of as the published resource which captures all the metadata about it.

The third is the association to StoreInfo. Each ResourceInfo "comes from" a StoreInfo. More specifically the StoreInfo provides the Resource which the ResourceInfo references. So StoreInfo is the resource provider, Resource is the physical resource, and RsourceInfo is the published resource.

As an example consider a spatial database which contains three tables: roads,cities, and buildings. Though the database provides all of these tables, it is desired to only publish the roads table. So an instance of our model would be created that contains:

  • 1 StoreInfo representing the spatial database
  • 3 Resource , one for each table in the database
  • 1 ResourceInfo for the roads table that is to published


Consider the following subset of the above diagram which centers on the LayerInfo interface.

A LayerInfo can be thought of as a map layer and is used to portray or render another type of published resource info. Each LayerInfo contains a direct association to the ResourceInfo that is used to portray. StyleInfo is the part of the portrayal which has to do with styling. Each LayerInfo references a collection of StyleInfo, which represents the styles available for a layer.

A CompositeLayerInfo is an extension of LayerInfo used to represent a grouping of layers. Such layers are not backed by a ResourceInfo.


At the heart of the entire class diagram is the Catalog interface.

The Catalog is a data access object which provides access to the the various entities in the catalog:

  • namespaces
  • resources
  • stores
  • layers
  • styles

The Catalog contains a CatalogFactory which is used to create the various objects to be stored in the catalog.


Part of the catalog model is events.

CatalogListener is a simple listener or observer interface in which clients use to register the event callbacks with the catalog. CatalogEvent is the root of the event hierachy containing some properties common to all events. Most noteabley the "source" property which is the object which generated the event.

CatalogAddEvent and CatalogRemoveEvent are extensions of CatalogEvent representing the additional and removal of objects from the catalog respectively.

CatalogModifyEvent is an extension of CatalogEvent which represents the modification of an object in the catalog. It specifies which properties of the object were changed and the old and new values of those properties.


Iterating over objects in the Catalog

Catalog catalog = ..;

//iterate over all feature types
for ( Iterator f = catalog.featureTypes(); f.hasNext(); ) {
  FeatureTypeInfo featureType = (FeatureTypeInfo);
  //do something with this feature type

//iterate over all coverages
for ( Iterator c = catalog.coverages(); c.hasNext(); ) {
  CoverageInfo coverage = (CoverageInfo);

  //do something with this coverage

//iterate over all layers
for ( Iterator l = catalog.layers(); l.hasNext(); ) {
  LayerInfo layer = (LayerInfo);

  //do something with this layer

Adding new objects to the Catalog

Catalog catalog = ...;
CatalogFactory factory = catalog.getFactory();

//create a new namespace
NamespaceInfo namespace = factory.createNamespace();
namespace.setPrefix( "gs" );
namespace.setURI( "" );
catalog.add( namespace );

//create a new dataStore
DataStoreInfo dataStore = factory.createDataStore();
dataStore.setName( "myDataStore" );
dataStore.getConnectionParameters().put( MyDataStore.MY_PARAM.key, "myParamValue" );
catalog.add( dataStore );

//add a new feature type
FeatureTypeInfo featureType = catalog.createFeatureType();
featureType.setName( "myFeatureType" );
featureType.setStore( dataStore );
namespace.add( featureType );

Modifying an object in the Catalog

Catalog catalog = ...;

FeatureTypeInfo featureType = catalog.getFeatureTypeByName( "gs", "myFeatureType" );
featureType.setLatLonBoundingBox( new ReferencedEnvelope( -180,-90,180,90, DefaultGeographicCRS.WGS84) ); featureType );

Loading Data

Catalog catalog = ...;

//grab a feature type
FeatureTypeInfo featureType = catalog.getFeatureTypeByName( "gs", "myFeatureType" );
try {
  //load the feature source
  FeatureSource featureSource = featureType.getFeatureSource();
catch( IOException e ) {
  //error occurred

//grab a coverage
CoverageInfo coverage = catalog.getCoverageByName( "gs", "myCoverage" );
try {
  //load the grid geometry
  GridCoverage coverage = coverage.getGridCoverage();
catch( IOException e ) {
  //error occured

Processing a Layer

Catalog catalog = ...;

LayerInfo layer = catalog.getLayerByPath( "myLayer" );
ResourceInfo resource = layer.getResource();

//get bounds of layer
BoundingBox bounds = resource.getLatLonBoundingBox();

//figure out the type of layer
if ( resource instanceof FeatureTypeInfo ) {
  //process as vector layer
if ( resource instanceof CoverageInfo ) {
  //process as raster layer

Questions / Concerns / Feedback

Jody Garnett: Should StyleInfo represent a single feature type style? And a full SLD be something that is generated from a collection of feature type styles.
Graham Davis: The factory methods should take the mandatory parameters which are neccessary to persist a catalog object

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