Class CodeListUID

java.lang.Object
org.apache.sis.internal.jaxb.cat.CodeListUID

public final class CodeListUID extends Object
Stores information about CodeList in order to marshal in the way defined by ISO 19115-3. This class provides the codeList and codeListValue attributes to be marshalled. Those attributes should be unique for each code.
"UID" in the class name stands for "Unique Identifier".
This object is wrapped by CodeListAdapter or, in the special case of Locale type, by LanguageCode or Country.

Base URLs

This class defines constants for URL to schema directories or definition files used in code list elements. SIS does not use those URL directly for downloading files (downloading an XML schema from ISO servers require "https" protocol, but the URLs in this class use "http" for historical reasons). Example:

Constants in this class are organized in three groups:

  • Constants with the _ROOT suffix are "http://" URL to a root directory.
  • Constants with the _PATH suffix are relative paths to concatenate to a _ROOT constant in order to get the full path to a file.
  • Constants with the _XSD suffix are "http://" URL to a the XSD definition file.

Note on multi-lingual files

Some files are available in two variants: with and without "ML_" prefix, which stands for "Multi Lingual". Some examples are "[ML_]gmxCodelists.xml" and "[ML_]gmxUom.xml". The following assumptions hold:
  • All code lists defined in a ML_foo.xml file exist also in foo.xml.
  • The converse of above point is not necessarily true: the ML_foo.xml file may contain only a subset of foo.xml.
  • All English descriptions in ML_foo.xml file are strictly identical to the ones in foo.xml.
  • Descriptions in other languages than English exist only in ML_foo.xml.
Since:
0.3
Version:
1.1
See Also:
  • Field Details

    • METADATA_ROOT

      public static final String METADATA_ROOT
      The namespace root of ISO 19115 objects. This is the namespace used by default in Apache SIS.

      Historical note

      The XSD files can be downloaded from that URL as well, but we sometimes experiment unexpected end of file. The same files can be downloaded from ISO/TC 211 repository, which seems more stable. The TC 211 repository is used for downloads, while the standard ISO URL is sill used for namespaces.
      See Also:
    • METADATA_ROOT_LEGACY

      public static final String METADATA_ROOT_LEGACY
      The root directory of OGC metadata schemas. This is the schema used by default in Apache SIS. Some alternatives to this URL are:
      • http://schemas.opengis.net/iso/19139/20070417/
      • http://standards.iso.org/ittf/PubliclyAvailableStandards/ISO_19139_Schemas/
      See Also:
    • CODELISTS_PATH

      public static final String CODELISTS_PATH
      The string to append to METADATA_ROOT for obtaining the path to the definitions of code lists.
      See Also:
    • CODELISTS_PATH_LEGACY

      public static final String CODELISTS_PATH_LEGACY
      The string to append to METADATA_ROOT_LEGACY or one of its alternative for obtaining the path to the definitions of code lists.

      A localized version of this file exists also with the "ML_gmxCodelists.xml" filename instead of "gmxCodelists.xml"

      See Also:
    • UOM_PATH

      public static final String UOM_PATH
      The string to append to METADATA_ROOT or one of its alternative for obtaining the path to the definitions of units of measurement.

      A localized version of this file exists also with the "ML_gmxUom.xml" filename instead of "gmxUom.xml"

      See Also:
    • codeList

      public String codeList
      The codeList attribute in the XML element.
    • codeListValue

      public String codeListValue
      The codeListValue attribute in the XML element.
    • codeSpace

      public String codeSpace
      The optional codeSpace attribute in the XML element. The default value is null. If a value is provided in this field, then value should be set as well.

      This attribute is set to the 3-letters language code of the value, as returned by Locale.getISO3Language().

    • value

      public String value
      The optional value to write in the XML element. The default value is null. If a value is provided in this field, then codeSpace is the language code of this field or null for English.
  • Constructor Details

    • CodeListUID

      public CodeListUID()
      Default empty constructor for JAXB.
    • CodeListUID

      public CodeListUID(Context context, String codeList, String codeListValue, String codeSpace, String value)
      Builds a code list with the given attributes.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      codeList - the codeList attribute, to be concatenated after the "#" symbol.
      codeListValue - the codeListValue attribute, to be declared in the XML element.
      codeSpace - the 3-letters language code of the value attribute, or null if none.
      value - the value in the language specified by the codeSpace attribute, or null if none.
    • CodeListUID

      public CodeListUID(Context context, org.opengis.util.CodeList<?> code)
      Builds a value for CodeListAdapter elements. This constructors stores the values that will be used for marshalling.
      Parameters:
      context - the current (un)marshalling context, or null if none.
      code - the code list to wrap.
  • Method Details

    • schema

      private static String schema(Context context, String identifier)
      Returns the URL to a given code list in the given XML file. This method concatenates the base schema URL with the given identifier. Some examples of strings returned by this method are:
      • "http://standards.iso.org/iso/19115/resources/Codelist/cat/codelists.xml#LanguageCode"
      • "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#LanguageCode"
      • "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#MD_CharacterSetCode"
      • "http://www.isotc211.org/2005/resources/Codelist/gmxCodelists.xml#CI_OnLineFunctionCode"
      Parameters:
      context - the current (un)marshalling context, or null if none.
      identifier - the UML identifier of the code list.
      Returns:
      the URL to the given code list in the given schema.
      See Also:
    • toString

      public String toString()
      Returns the identifier to use for fetching a CodeList instance. This is normally the codeListValue attribute. However if the code list is actually used as an enumeration, then the above attribute is null and we have to use directly the value instead.
      Overrides:
      toString in class Object
      Returns:
      the identifier to be given to the CodeList.valueOf(…) method.