Skip to content

GSIP 127

Jody Garnett edited this page Jan 27, 2015 · 17 revisions

GSIP 1234 - Adapt Catalog Names

Overview

Propose the creation of a Naming class to capture the naming restrictions our different protocols operate under. This utility class can be used to translate from our internal "catalog names" into a string suitable for use with each protocol.

Proposed By

Jody

Assigned to Release

This proposal is for GeoServer 2.7.x and back ported to 2.6.x as a bug fix.

State

  • Under Discussion
  • In Progress
  • Completed
  • Rejected

Deferred

Motivation

This proposal comes out of issues reported again 2.7-beta:

  • users have created "styles" that do not match our filename restrictions
  • WCS coverages are commonly start with a number, this is different from WFS where featureTypes are restricted to be XML safe
  • The REST API, and user interface should use the same validation restrictions when creating and editing
  • Updating: When introducing a new naming restriction GeoServer should be in position to migrate configuration. Clients written against the previous naming restrictions should continue to function (although perhaps with warnings).

Proposal

Introduction of a Naming utility class:

public class Naming {
   enum Context {
      STYLE, WORKSPACE, WMS_LAYER, WCS_COVERAGE, WFS_FEATURE_TYPE;
   }
   /** Name safe for use in the provided context. */
   Name safe( String name, Context);

   /** List of alternatives to use for catalog lookup */
   List<Name> alternatives( String name, Context context);
   
   /**
    * List of warnings, if any, for using the provided name.
    * @throws IllegalArgumentException if the name cannot be used, even in safe form
    */
   List<String> validate( String name, Context context ) throws IllegalArgumentException;
}

As an example Naming.alternatives( "foo::bar", Context.STYLE ) returns a list of:

  • Name("foo","bar"): the preferred representation where the workspace "foo" is explicitly represented.
  • Name("foo__bar"): reference to the global style with the "safe" version of the "foo::bar" name
  • Name("foo::bar"): reference to the global style with the previously supported "foo::bar" name

Where Naming.safe( "foo::bar", Context.STYLE ) returns "foo__bar". Validating "foo::bar" provides the warning that "The use of : is used by WMS GET to refer to a workspace style. This name will be represented as foo__bar during

In a similar fashion:

  • Naming.safe( "1234", Context. WFS_FEATURE_TYPE) returns "_1234"
  • Naming.safe( "1234", Context. WCS_COVERAGE) returns "1234" as coverages can start with a number

The bulk of the work will be introducing the use of this class where names are used.

Feedback

Backwards Compatibility

Voting

Project Steering Committee:

  • Alessio Fabiani
  • Andrea Aime
  • Ben Caradoc-Davies
  • Christian Mueller
  • Gabriel Roldán
  • Jody Garnett
  • Jukka Rahkonen
  • Justin Deoliveira
  • Phil Scadden
  • Simone Giannecchini

Committers:

Links

Clone this wiki locally