OGC-Services via GeoServer
" GeoServer is an open source software server written in Java that allows users to share and edit geospatial data. Designed for interoperability, it publishes data from any major spatial data source using open standards."
As both POLYMAP3 and GeoServer are based on GeoTools and GeoAPI it is a natural choice to let GeoServer provide the data from the Workbench as OGC services (WMS and WFS).
GeoServer brings its native catalog structure. The catalog holds information about data source, layers, CRS, keywords, etc. In POLYMAP all these information are already there in the Workbench project structure. So, the integration layer between POLYMAP and GeoServer just has to translate the project structure from POLYMAP into GeoServer and let GeoServer run on it.
Inside POLYMAP GeoServer runs as one OSGi bundle. All GeoServer jars are included in this bundle. In order to give the GeoServer classes access to their jars a special WebAppClassLoader is given to the servlet.
The GeoServer servlet is wrapped inside another servlet that handles class loading and integration into OSGi HTTP service. This allows to start/stop GeoServer as an OSGi service.
Multiple instances of GeoServer
As of version 2.0.2 of GeoServer, which POLYMAP3 is currently based on, all layers are provided inside one OWS instance with one base URL. This does not meet the needs of POLYMAP where we need to start/stop services for every project independently. To get this working every GeoServer instance has its own ClassLoader that separates the environments but let all instances share the same GeoTools jars.