Hello Jody,

In DataAccessFactory, there is an extension of Parameter called Param, used by the data access factories.
In this class the key and the title are the same.
I read now that Param was created for backwards compatibility. Can it be bypassed and can we use Parameter directly in DataAccessFactory, or could that cause a Classcastexception somewhere (parameters are put in an untyped map)? I do not know. Param for example provides the lookUp parameter which is commonly used in DataAccessFactories, so isn't the idea to use Param.

The thing is, you asked me to change the titles. Again, I didn't write any of this code. I look at what has been done and I see that the title and the key are the same in the used Param class. So I think it was a fair assumption of me to think I needed to continue to use the same Param class and change the keys with the titles.

Regards,
Niels

On 05/06/14 12:15, Jody Garnett wrote:
The Param data structure has both a key (which you do not want to change) and a tile and description which is what I was asking you to fill in.

See picture here: http://docs.geotools.org/stable/userguide/library/api/parameter.html

And javadoc: http://docs.geotools.org/latest/javadocs/org/geotools/data/Parameter.html#title

(Why are our javadocs looking so bad?)

The constructor in question is:

    public Parameter(String key, Class<T> type, InternationalString title,
                     InternationalString description,
                     boolean required, int min, int max, Object sample,
                     Map<String,Object> metadata) {
        this.key = key;
        this.title = title;
        this.type = type;
        this.description = description;
        this.required = required;
        this.minOccurs = min;
        this.maxOccurs = max;
        this.sample = sample;
this.metadata = metadata == null ? Collections.EMPTY_MAP : Collections.unmodifiableMap(metadata);
    }

See how you can pass a title in? Let me try and adapt the code for MAXFEATURES so we have a good example ...

static import org.geotools.text.Text.text;

    public static final WFSFactoryParam<Integer> MAXFEATURES;

    static {
        String key = "WFSDataStoreFactory:MAXFEATURES";
        String title = "Max Features";
String description = "Positive integer used as a hard limit for the amount of Features to retrieve" + " for each FeatureType. A value of zero or not providing this parameter means no limit.";
        KVP kvp = new KVP("level","advanced");
parametersInfo[9] = MAXFEATURES = new Parameter<Integer>(key, Integer.class, text(title), text(description), false, 0, 1, 0, kvp);
    }


I am on IRC if you need a hand ...



Jody Garnett


On Thu, Jun 5, 2014 at 7:34 PM, Niels Charlier <[email protected] <mailto:[email protected]>> wrote:

    Hi Jody,

    You asked me a while ago to change the parameter names, because
    you wanted them to look nicer for humans in udig. But the key and
    the displayed name are the same. So for example, I changed
    "WFSDataStoreFactory:MAXFEATURES"
    to
    "Maximum Features"

    because of your request.

    But the keys are also used in the datastore.xml files.

    So what I am wondering if this won't cause problems with the
    switch from wfs to wfs-ng.
    Because people's existing configurations will be using the old
    parameter keys which are in the form of
    "WFSDataStoreFactory:MAXFEATURES".

    Regards
    Niels





------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to