Opened 20 years ago

Closed 20 years ago

Last modified 20 years ago

#615 closed defect (fixed)

[OWS] Extend msOWSPrintMetadata to operate on multiple namespaces

Reported by: dmorissette Owned by: mapserverbugs
Priority: high Milestone: 4.2 release
Component: WMS Server Version: 4.1
Severity: normal Keywords:
Cc:

Description

Stephen Lime wrote:

> Dan: Wondering about that function. Looks real useful. However we talked about
somehow checking for both ows_ and wxs_ versions of metadata and that function
really only allows for metadata name. I did add a function to mapows.c to do a
metadata lookup based on a list so you could do:
>
>   val = msOWSGetMetadata(map->web.metadata, "wcs_keywords", "ows_keywords", NULL);
>
> Any ideas on how the two functions could be used together? It would be great
to be able to call:
>
>  msOWSPrintMetadata(stdout, map->web.metadata, "fees", OWS_NOERR, " 
<Fees>%s</Fees>\n", NULL);
>
> and have it check for wcs_fees AND ows_fees.
>

I think we need to find a way for msOWSPrintMetadata() to handle this
automatically.  I'll try to think about something and get back to you.

Change History (4)

comment:1 by dmorissette, 20 years ago

blocked: 568
Milestone: 4.2 release
Status: newassigned
I think I've found a nice and simple way to handle this accross the board.

First I have created a new 

  int msOWSLookupMetadata(hashTableObj metadata, 
                          const char *namespaces, const char *name)


It's just like msLookupHashTable() except that if namespaces is non-null then it
is used to define the namespaces to lookup, with one letter (code) in the
namespaces string for each OWS protocol. (M=wms_, F=wfs_, C=wcs_, O=ows_ and G=gml_)

E.g. to lookup "wcs_keywords" followed by "ows_keywords", you use:

  value = msOWSLookupMetadata(hashtable, "CO", "keywords");

The internal implementation uses a switch/case on a single char and does only a
minimum of string copies, so it's fairly efficient.  Finally, another benefit is
that we can just pass that namespaces parameter in all the mapows.c functions
that take metadata as arguments... including the msOWSPrintMetadata() to which I
will add the new namespaces argument to provide the flexibility that Steve needs.

I'm in the middle of implementing this and about to commit it... hopefully you
like the idea.


comment:2 by dmorissette, 20 years ago

Resolution: fixed
Status: assignedclosed
I have committed new versions of mapows.c with the new msOWSLookupMetadata() and
modified all msOWSPrint*Metadata() functions to take a namespaces argument. 

Also updated all code that calls those functions (in mapwms.c, mapcontext.c, 
mapwcs.c and mapwfs.c) to pass namespaces=NULL everywhere for now, this is to
avoid breaking something just before the 4.2 release. We'll review all those
function calls as part of bug 568 in the 4.3/4.4 release cycle to lookup the
wxs_ prefix first and then fallback on ows_ if not found.

comment:3 by sdlime, 20 years ago

Sounds like this is a replacement for the metadata lookup function
msOWSGetMetadata() I tossed in mapows.c a while back? Might as well remove it
since the new lookup function does the same thing but cleaner. I like it, thanks.

comment:4 by dmorissette, 20 years ago

Sounds good. I have removed msOWSGetMetadata() from mapows.[ch]
Note: See TracTickets for help on using tickets.