Skip to content

Commit

Permalink
Merge pull request #2 from PDOK/resp_describefeaturertype
Browse files Browse the repository at this point in the history
fix request Validation() interface
  • Loading branch information
WouterVisscher authored Jul 21, 2020
2 parents a52e379 + 3b2f347 commit 072479f
Show file tree
Hide file tree
Showing 14 changed files with 118 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*.dll
*.so
*.dylib
*.prof

# Test binary, built with `go test -c`
*.test
Expand Down
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ And for benchmarks:
go test -bench=. ./...
```

And generate CPU & MEM profiles:

```go
go test -cpuprofile cpu.prof -memprofile mem.prof -bench=. ./...
```

For visualisation use [pprof](https://github.com/google/pprof)

## Usage

- [Simple BBOX](./examples/simple-bbox/main.go)
Expand Down
7 changes: 6 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,9 @@ module github.com/pdok/ogc-specifications

go 1.13

require gopkg.in/yaml.v2 v2.3.0
require (
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99 // indirect
github.com/ianlancetaylor/demangle v0.0.0-20200715173712-053cf528c12f // indirect
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae // indirect
gopkg.in/yaml.v2 v2.3.0
)
14 changes: 14 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e h1:fY5BOSpyZCqRo5OhCuC+XN+r/bBCmeuuJtjz+bCNIf8=
github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI=
github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99 h1:Ak8CrdlwwXwAZxzS66vgPt4U8yUZX7JwLvVR58FN5jM=
github.com/google/pprof v0.0.0-20200708004538-1a94d8640e99/go.mod h1:ZgVRPoUq/hfqzAqh7sHMqb3I9Rq5C59dIz2SbBwJ4eM=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
github.com/ianlancetaylor/demangle v0.0.0-20200715173712-053cf528c12f h1:nTaA/z8mev5oJv1dNSbu8Pwvu5CJyBZKwDvHpr9FZ4I=
github.com/ianlancetaylor/demangle v0.0.0-20200715173712-053cf528c12f/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e h1:9vRrk9YW2BTzLP0VCB9ZDjU4cPqkg+IDWL7XgxA1yxQ=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae h1:Ih9Yo4hSPImZOpfGuA4bR/ORKTAbhZo2AbWNRCnevdo=
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
Expand Down
2 changes: 1 addition & 1 deletion pkg/ows/operationrequest.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "net/url"
// OperationRequest interface
type OperationRequest interface {
Type() string
Validate() bool
Validate() Exception

ParseXML([]byte) Exception
ParseKVP(url.Values) Exception
Expand Down
5 changes: 5 additions & 0 deletions pkg/wcs201/request/getcapabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (gc *GetCapabilities) Type() string {
return getcapabilities
}

// Validate returns GetCapabilities
func (gc *GetCapabilities) Validate() ows.Exception {
return nil
}

// ParseXML builds a GetCapabilities object based on a XML document
func (gc *GetCapabilities) ParseXML(body []byte) ows.Exception {
var xmlattributes ows.XMLAttribute
Expand Down
5 changes: 5 additions & 0 deletions pkg/wfs200/request/describefeaturetype.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ func (dft *DescribeFeatureType) Type() string {
return describefeaturetype
}

// Validate returns GetCapabilities
func (dft *DescribeFeatureType) Validate() ows.Exception {
return nil
}

// ParseXML builds a DescribeFeatureType object based on a XML document
func (dft *DescribeFeatureType) ParseXML(doc []byte) ows.Exception {
var xmlattributes ows.XMLAttribute
Expand Down
5 changes: 5 additions & 0 deletions pkg/wfs200/request/getcapabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@ func (gc *GetCapabilities) Type() string {
return getcapabilities
}

// Validate returns GetCapabilities
func (gc *GetCapabilities) Validate() ows.Exception {
return nil
}

// ParseXML builds a GetCapabilities object based on a XML document
func (gc *GetCapabilities) ParseXML(doc []byte) ows.Exception {
var xmlattributes ows.XMLAttribute
Expand Down
5 changes: 5 additions & 0 deletions pkg/wfs200/request/getfeature.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,11 @@ func (gf *GetFeature) Type() string {
return getfeature
}

// Validate returns GetFeature
func (gf *GetFeature) Validate() ows.Exception {
return nil
}

// WFS tables as map[string]bool, where the key (string) is the TOKEN and the bool if its a mandatory (true) or optional (false) attribute
var table5 = map[string]bool{STARTINDEX: false, COUNT: false, OUTPUTFORMAT: false, RESULTTYPE: false}

Expand Down
47 changes: 47 additions & 0 deletions pkg/wfs200/response/describefeaturetype.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
package response

import "encoding/xml"

type Schema struct {
XMLName xml.Name `xml:"schema"`
Text string `xml:",chardata"`
Xsd string `xml:"xsd,attr"`
Digitaaltopografischbestand string `xml:"digitaaltopografischbestand,attr"`
Gml string `xml:"gml,attr"`
Wfs string `xml:"wfs,attr"`
ElementFormDefault string `xml:"elementFormDefault,attr"`
TargetNamespace string `xml:"targetNamespace,attr"`
Import struct {
Text string `xml:",chardata"`
Namespace string `xml:"namespace,attr"`
SchemaLocation string `xml:"schemaLocation,attr"`
} `xml:"import"`
ComplexType []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
ComplexContent struct {
Text string `xml:",chardata"`
Extension struct {
Text string `xml:",chardata"`
Base string `xml:"base,attr"`
Sequence struct {
Text string `xml:",chardata"`
Element []struct {
Text string `xml:",chardata"`
MaxOccurs string `xml:"maxOccurs,attr"`
MinOccurs string `xml:"minOccurs,attr"`
Name string `xml:"name,attr"`
Nillable string `xml:"nillable,attr"`
Type string `xml:"type,attr"`
} `xml:"element"`
} `xml:"sequence"`
} `xml:"extension"`
} `xml:"complexContent"`
} `xml:"complexType"`
Element []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
SubstitutionGroup string `xml:"substitutionGroup,attr"`
Type string `xml:"type,attr"`
} `xml:"element"`
}
5 changes: 5 additions & 0 deletions pkg/wms130/request/getcapabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ func (gc *GetCapabilities) Type() string {
return getcapabilities
}

// Validate returns GetCapabilities
func (gc *GetCapabilities) Validate() ows.Exception {
return nil
}

// ParseXML builds a GetCapabilities object based on a XML document
func (gc *GetCapabilities) ParseXML(body []byte) ows.Exception {
var xmlattributes ows.XMLAttribute
Expand Down
5 changes: 5 additions & 0 deletions pkg/wms130/request/getfeatureinfo.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ func (gfi *GetFeatureInfo) Type() string {
return getfeatureinfo
}

// Validate returns GetFeatureInfo
func (gfi *GetFeatureInfo) Validate() ows.Exception {
return nil
}

// ParseXML builds a GetFeatureInfo object based on a XML document
// Note: the XML GetFeatureInfo body that is consumed is a interpretation.
// So we use the GetMap, that is a large part of this request, as a base
Expand Down
7 changes: 6 additions & 1 deletion pkg/wms130/request/getmap.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (gm *GetMap) Type() string {
return getmap
}

// Validate returns GetMap
func (gm *GetMap) Validate() ows.Exception {
return nil
}

//GetMapKVP struct
type GetMapKVP struct {
// Table 8 - The Parameters of a GetMap request
Expand Down Expand Up @@ -201,7 +206,7 @@ func (gm *GetMap) ParseGetMapKVP(gmkvp GetMapKVP) ows.Exception {
// ParseKVP builds a GetMap object based on the available query parameters
func (gm *GetMap) ParseKVP(query url.Values) ows.Exception {
if len(query) == 0 {
// When there are no query value we know that at least
// When there are no query values we know that at least
// the manadorty VERSION parameter is missing.
return ows.MissingParameterValue(VERSION)
}
Expand Down
5 changes: 5 additions & 0 deletions pkg/wmts100/request/getcapabilities.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ func (gc *GetCapabilities) Type() string {
return getcapabilities
}

// Validate returns GetCapabilities
func (gc *GetCapabilities) Validate() ows.Exception {
return nil
}

// ParseXML builds a GetCapabilities object based on a XML document
func (gc *GetCapabilities) ParseXML(body []byte) ows.Exception {
var xmlattributes ows.XMLAttribute
Expand Down

0 comments on commit 072479f

Please sign in to comment.