Skip to content

Commit

Permalink
Refactor interfaces and use property builtin to define metadata prope…
Browse files Browse the repository at this point in the history
…rties
  • Loading branch information
sgillies committed Nov 19, 2007
1 parent 70fd939 commit 973185d
Showing 1 changed file with 87 additions and 106 deletions.
193 changes: 87 additions & 106 deletions owslib/interfaces.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
# Do not import zope.interfaces

class IWebMapService:
"""Abstraction for an OGC Web Map Service (WMS).

Properties
----------
url : string
Online resource URL.
version : string
WMS protocol version.
capabilities : object
Describes the capabilities metadata of the WMS.
class IService:
"""The OGC Web Service interface.
"""

url = property("""Online resource URL (string)""")
# XXX: here or in capabilities?
version = property("""Protocol version (string)""")
capabilities = property("""Implementation of IServiceMetadata (object)""")


class IWebMapService(IService):
"""Abstraction for an OGC Web Map Service (WMS).
"""

def getcapabilities():
Expand All @@ -25,17 +27,8 @@ def getfeatureinfo(**kw):
"""Make a request to the WMS, returns data."""


class IWebFeatureService:
class IWebFeatureService(IService):
"""Abstraction for an OGC Web Feature Service (WFS).
Properties
----------
url : string
Online resource URL.
version : string
WFS protocol version.
capabilities : object
Describes the capabilities metadata of the WFS.
"""

def getcapabilities():
Expand All @@ -50,62 +43,93 @@ def describefeaturetype(**kw):
"""Make a request to the WFS, returns data."""


class IServiceIdentificationMetadata:
"""OO-interface to WMS metadata.
class IWebCoverageService(IService):
# TODO
pass

Properties
----------
service : string
"WMS", "WFS".
version : string
Version of service protocol.
title : string
Human-targeted title of service.
abstract : string
Text describing the service.
keywords : list
List of strings.
rights : list
Explanation of rights associated with service.

# Follows the 4 aspects of service metadata

class IServiceIdentificationMetadata:
"""OO-interface to service identification metadata.
"""

service = property("""Service name (string): "WMS", "WFS", or "WCS".""")
# XXX: here or in service root?
version = property("""Version of service protocol (string).""")
title = property("""Human-targeted title of service (string).""")
abstract = property("""Text describing the service (string).""")
keywords = property("""Keyword list (list).""")
rights = property("""Explanation of rights associated with service (string).""")

class IServiceProviderMetadata:
"""OO-interface to WMS metadata.

Properties
----------
provider : string
Organization name.
url : string
URL for provider web site.
contact : string
How to contact the service provider.
class IServiceProviderMetadata:
"""OO-interface to service provider metadata.
"""

provider = property("""Provider's name (string).""")
url = property("""URL for provider's web site (string).""")
contact = property("""How to contact the service provider (string).""")


class IServiceOperationsMetadata:
"""OO-interface to WMS metadata.
"""OO-interface to service operations metadata.
"""

Properties
----------
operations : list
List of operation descriptors.
exceptions : list
List of exception formats.
operations = property("""List of operation descriptors (list). These must implement IOperationMetadata (below).""")
exceptions = property("""List of exception formats (list).""")


class IServiceContentsMetadata:
"""OO-interface to service contents metadata.
"""


contents = property("""List of content descriptors (list). These must implement IServiceContent (below).""")


# IServiceMetadata aggregates the 4 aspects above

class IServiceMetadata(
IServiceIdentificationMetadata, IServiceProviderMetadata,
IServiceOperationsMetadata, IServiceContentsMetadata
):
"""OWS Metadata.
"""


# Second level metadata interfaces

class IOperationMetadata:
"""OO-interface to WMS metadata.
"""OO-interface to operation metadata.
"""

Properties
----------
name : string
"GetCapabilities", for example.
formatOptions : list
List of content types.
methods : dict
Array of method descriptors, keyed to HTTP verbs.
name = property("""Operation name (string): GetCapabilities", for example.""")
formatOptions = property("""List of content types (list).""")
methods = property("""Mapping of method descriptors, keyed to HTTP verbs. Items must implement IMethodMetadata (below).""")


class IMethodMetadata:
"""OO-interface to method metadata.
"""

url = property("""Method endpoint URL (string).""")
# TODO: constraint


class IContentMetadata:
"""OO-interface to content metadata.
"""

id = property("""Unique identifier (string).""")
title = property("""Human-targeted title (string).""")
boundingBox = property("""Four bounding values and a coordinate reference system identifier (tuple).""")
boundingBoxWGS84 = property("""Four bounding values in WGS coordinates.""")
crsOptions = property("""List of available coordinate/spatial reference systems (list).""")
styles = property("""List of style dicts (list).""")


# XXX: needed?

class IContactMetadata:
"""OO-interface to OWS metadata.
Expand All @@ -121,48 +145,5 @@ class IContactMetadata:
email : string
"""

class IMethodMetadata:
"""OO-interface to WMS metadata.
Properties
----------
url : string
Method URL.
TODO: constraint
"""

class IServiceContentsMetadata:
"""OO-interface to WMS metadata.
Properties
----------
contents : list
List of content descriptors.
"""

class IContentMetadata:
"""OO-interface to WMS metadata.
Properties
----------
id : string
Unique identifier.
title : string
Human-targeted title.
boundingBox : 5-tuple
Four bounding values and a coordinate reference system identifier.
boundingBoxWGS84 : 4-tuple
Four bounding values in WGS coordinates.
crsOptions : list
List of available coordinate/spatial reference systems.
styles : list
List of style dicts.
"""

class IServiceMetadata(IServiceIdentificationMetadata, IServiceProvideMetadata,
IServiceOperationsMetadata, IServiceContentsMetadata):
"""OWS Metadata.
"""


0 comments on commit 973185d

Please sign in to comment.