source: TI05-delivery/ows_framework/trunk/ows_common/operations_metadata.py @ 2475

Subversion URL: http://proj.badc.rl.ac.uk/svn/ndg/TI05-delivery/ows_framework/trunk/ows_common/operations_metadata.py@2475
Revision 2475, 2.1 KB checked in by spascoe, 12 years ago (diff)

renaming part 2

Line 
1# Copyright (C) 2007 STFC & NERC (Science and Technology Facilities Council).
2# This software may be distributed under the terms of the
3# Q Public License, version 1.0 or later.
4# http://ndg.nerc.ac.uk/public_docs/QPublic_license.txt
5"""
6Classes modelling the OWS Operations Metadata package v1.1.0.
7
8This module makes several simplifications to the OWS model to make it
9more pythonic and restrict the model to it's common usage.
10
11 1. Each operation can have 0..1 get and post request methods
12 2. DCP's are not modelled.  Only HTTP DCP is supported.
13 3. Operation.name becomes a key in the OperationsMetadata.operationDict
14    attribute.
15
16@author: Stephen Pascoe
17"""
18
19from ows_common.domain import Domain
20from ows_common.is19115_subset import OnlineResource
21
22class OperationsMetadata(object):
23    """
24    @note: extendedCapabilities could be implemented by subclassing.
25
26    @ivar operationDict
27    @type operationDict: dictionary mapping names to Operation objects
28    @ivar constraints
29    @type constraints: iterable of Domain objects
30    @ivar parameters
31    @ivar parameters: iterable of Domain objects
32
33    """
34    def __init__(self, operationDict, constraints=[], parameters=[]):
35        self.operationDict = operationDict
36        self.constraints = constraints
37        self.parameters = parameters
38
39    @classmethod
40    def fromOperations(klass, **kwargs):
41        """A convenient factory class method for operations.
42
43        @param kwargs: A mapping of operation name to Operation objects
44
45        """
46        return klass(operationDict=kwargs)
47
48class Operation(object):
49    """
50    @note: This class encompasses Operation, DCP and HTTP classes from OWS.
51   
52    @ivar get
53    @type get: None or RequestMethod
54    @ivar post
55    @type post: None or RequestMethod
56
57    """
58    def __init__(self, get=None, post=None):
59        self.get = get
60        self.post = post
61
62class RequestMethod(OnlineResource):
63    """
64    @ivar constraints
65    @type constraints: Iterable of Domain objects
66
67    """
68    def __init__(self, constraints=[], **kwargs):
69        super(RequestMethod, self).__init__(**kwargs)
70
71        self.constraints = constraints
72
73   
Note: See TracBrowser for help on using the repository browser.