source: cows/trunk/cows/service/wxs_iface.py @ 4785

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/cows/trunk/cows/service/wxs_iface.py@4809
Revision 4785, 2.1 KB checked in by spascoe, 11 years ago (diff)

Various comments on code structure. Grep for !TODO and !FIXME or see the diff.

Also an incomplete module for testing (iface_test_lib.py).

Line 
1"""
2The classes in this module define the base interface between the OWS Pylons
3server and components that provide Web X Server layers.  The
4intention is that a WXS can be created for a given datatype and
5rendering engine by creating classes that implement these base interfaces
6and implement service specific interfaces as defined in:
7wms_iface.py
8wfs_iface.py
9wcs_iface.py
10etc.
11
12-- there is no need to mess around with Pylons controllers or the
13cows metadata model.
14
15The main entry point for the OWS Pylons server is the ILayerMapper
16interface.  This provides a mechanism for serving multiple WxS
17endpoints through a single server.  Keywords deduced from the pylons
18routes mapper are passed to the ILayerMapper instance to return a
19dictionary of ILayer instances.  These are the layers available to the
20WxS on this route.
21
22It is expected that implementing classes will inherit from these
23interface classes, using them as abstract base classes.  However, in
24the future zope.Interface might be used to associate interfaces with
25implementations.
26
27
28"""
29
30class ILayerMapper(object):
31    """
32    Maps keyword arguments to a collection of layers.
33
34    ILayerMapper supports the retrieval of sets of layers according to arbitary
35    keyword/value pairs.
36
37    """
38    def map(self, **kwargs):
39        """
40        Given arbitary keywords/value pairs list the names of
41        all layers available.
42
43        @return: A mapping of layer names to ILayer implementations.
44        @raise ValueError: If no layers are available for these keywords.
45
46        """
47        raise NotImplementedError
48
49class ILayer(object):
50    """
51    An base interface representing a WxS contents "layer" (e.g. coverage, layer, feature).
52
53    @ivar title: The layer title.  As seen in the Capabilities document.
54    @ivar abstract:  Abstract as seen in the Capabilities document.
55
56    """
57    title = abstract = NotImplemented
58    featureInfoFormats = NotImplemented
59
60    def getBBox(self, crs):
61        """
62        @return: the bounding box (llx, lly, urx, ury) of the data in the given
63            coordinate reference system.
64
65        """
66        raise NotImplementedError
67
Note: See TracBrowser for help on using the repository browser.