-
Notifications
You must be signed in to change notification settings - Fork 2
Workspace
This page is the central entry point for documentation about the deegree workspace concept and implementation.
The old workspace concept had a couple of shortcomings, which I'll describe here to give an understanding why a new implementation has been started.
The workspace has a concept of dependencies, but dependencies are only possible on a resource type level. At first glance, this is sufficient in most cases, but not all.
The first resource we came across where this was not sufficient any more was the caching tile store, which naturally depends on another tile store.
Thinking about it, a tile store implementation that automatically tiles a layer resource on the fly/whatever would be a natural thing. But since there's also a tile layer implementation, the layer subsystem already depends on the tile subsystem, introducing a dependency the other way round would introduce a cycle.
Restarting a single resource is possible, but often has unknown/bad side effects on other resources. So if you restart your feature store (possibly changing the configuration) affects eg. the WFS, some feature layer, the WMS...
The only workable solution has been to just restart the whole workspace. While that's sufficient in many cases, it can be slow and time consuming, especially if many resources are configured.
If the exact dependency chains between resources were known, only affected resources could be restarted.
Some resource managers do things in a static context. While this is often sufficient in a webapp (where only a single workspace is active anyway), it's still bad practice and should be avoided. Looking at the infamous ConnectionManager, a rewrite is badly needed.
The workspace is tightly bound to the XML formats which are used to configure resources. While this is not necessarily a bad thing, other scenarios still seem useful, where configurations are created by some other means (such as reading the config from a database). This is just not possible to do with the current workspace concepts.
So, let's have a look at the basics. The workspace revolves around resources. A resource is an instance of a specific class of object deegree works with. Example: a feature store is a resource, a WFS is a resource, a layer is a resource, a JDBC connection is a resource.
Resources are grouped together by their type. So all feature stores are in a group, all services are in a group, all layers, all JDBC connections etc. The workspace is responsible to manage these resources, and provide access to them.
The workspace manages resources, and provides access to them. That means that the lifecycle of resources is controlled by the workspace.
Typically your interaction with the workspace will be to initialize it, and to access resources contained within.
Resources are identified by ResourceIdentifier objects. This is a two part or qualified identifier, consisting of a string ID (usually the basename of the .xml configuration file) and a provider class.
We'll have a look at the provider classes later.
In order to understand how the workspace works internally, you'll need to understand the lifecycle a resource goes through. We've got a couple of phases:
- scanning
- preparing
- building
- initializing
In the scanning phase, the workspace finds resources. This results in a bunch of ResourceMetadata objects. These metadata objects are uninitialized.
In the preparing phase, which operates on ResourceMetadata objects, the resources determine what they need to be built. This includes finding out what other resources they depend on. This results in the ResourceMetadata to be initialized, and a bunch of ResourceBuilder objects. After this phase the ResourceMetadata can be sorted, taking into account their dependencies.
In the building phase, the ResourceBuilder objects are used actually build Resource objects, the result is a bunch of uninitialized Resource objects.
In the initialization phase, the Resource objects are being initialized. After this, they can be properly used.