GeoAPI

NameFactory.createNameSpace(...) need to be more extensible

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: 2.3-M1
  • Fix Version/s: 2.3-M2
  • Component/s: util
  • Labels:
    None
  • Number of attachments :
    0

Description

The GeoAPI-specific (not ISO) NameFactory interface currently defines the following method:

NameSpace createNameSpace(GenericName name,
                          String headSeparator,
                          String separator)

However the separator is unlikely to be the only property we care about. For example are names case-sensitive (like filenames in the namespace of a Unix file system) or not (like filenames in the namespace of a Windows file system)? Furthermore the "head separator" is specific to only a few namespace and something that user will not want to care about in a majority of case. A more generic approach would be to replace the String arguments by a single Map, so that user can define only the properties he care about and new properties can be added in future versions without compatibility break.

Java Naming and Directory Interface (JNDI) defines the following properties. We may want to leverage a few of them.

Key Meaning
jndi.syntax.direction Direction for parsing ("right_to_left", "left_to_right", "flat"). If unspecified, defaults to "flat", which means the namespace is flat with no hierarchical structure.
jndi.syntax.separator Separator between atomic name components. Required unless direction is "flat".
jndi.syntax.ignorecase If present, "true" means ignore the case when comparing name components. If its value is not "true", or if the property is not present, case is considered when comparing name components.
jndi.syntax.escape If present, specifies the escape string for overriding separator, escapes and quotes.
jndi.syntax.beginquote If present, specifies the string delimiting start of a quoted string.
jndi.syntax.endquote String delimiting end of quoted string. If present, specifies the string delimiting the end of a quoted string. If not present, use syntax.beginquote as end quote.
jndi.syntax.beginquote2 Alternative set of begin/end quotes.
jndi.syntax.endquote2 Alternative set of begin/end quotes.
jndi.syntax.trimblanks If present, "true" means trim any leading and trailing whitespaces in a name component for comparison purposes. If its value is not "true", or if the property is not present, blanks are significant.
jndi.syntax.separator.ava If present, specifies the string that separates attribute-value-assertions when specifying multiple attribute/value pairs. (e.g. "," in age=65,gender=male).
jndi.syntax.separator.typeval If present, specifies the string that separators attribute from value (e.g. "=" in "age=65")

Activity

Hide
Martin Desruisseaux added a comment -

Applied on trunk as of revision 1426. Library can upgrade their implementation by providing the following method in their NameFactory implementation:

public NameSpace createNameSpace(GenericName name, Map<String,?> properties) {
        return createNameSpace(name, properties.get("separator.head"), properties.get("separator"));
}

The actual implementation may vary depending how the library handles null values.

Show
Martin Desruisseaux added a comment - Applied on trunk as of revision 1426. Library can upgrade their implementation by providing the following method in their NameFactory implementation:
public NameSpace createNameSpace(GenericName name, Map<String,?> properties) {
        return createNameSpace(name, properties.get("separator.head"), properties.get("separator"));
}
The actual implementation may vary depending how the library handles null values.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: