Class NameMeaning

java.lang.Object
org.apache.sis.util.Static
org.apache.sis.internal.metadata.NameMeaning

public final class NameMeaning extends Static
The meaning of some parts of URN in the "ogc" namespace. The meaning are defined by OGC Naming Authority (OGCNA) or other OGC sources.
Since:
0.5
Version:
0.8
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private static final Map<String,String>
    Naming authorities allowed to appear in "urn:ogc:def:".
    private static final Class<?>[]
    Subtypes of IdentifiedObject for which an object type is defined.
    private static final String[]
    The object types for instances of CLASSES.
  • Constructor Summary

    Constructors
    Modifier
    Constructor
    Description
    private
    Do not allow instantiation of this class.
  • Method Summary

    Modifier and Type
    Method
    Description
    private static void
    add(String authority)
    Adds the given authority to the AUTHORITIES map.
    static String
    getVersion(org.opengis.metadata.citation.Citation authority)
    Returns the version of the namespace managed by the given authority.
    static String
    Returns the "object type" part of an OGC URN for the given class, or null if unknown.
    static String
    toURN(Class<?> type, String authority, String version, String code)
    Formats the given identifier using the "ogc:urn:def:" syntax with possible heuristic changes to the given values.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • CLASSES

      private static final Class<?>[] CLASSES
      Subtypes of IdentifiedObject for which an object type is defined. For each interface at index i, the type is TYPES[i].

      For performance reasons, most frequently used types should be first.

    • TYPES

      private static final String[] TYPES
      The object types for instances of CLASSES. See DefinitionURI javadoc for a list of object types in URN.

      Types not yet listed (waiting to see if there is a use for them):

      "group" for ParameterValueGroup.class; "verticalDatumType" for VerticalDatumType.class; "pixelInCell" for PixelInCell.class; "rangeMeaning" for RangeMeaning.class; "axisDirection" for AxisDirection.class;
    • AUTHORITIES

      private static final Map<String,String> AUTHORITIES
      Naming authorities allowed to appear in "urn:ogc:def:". This map serves two purposes:
      • Tell if a given authority is one of the authorities allowed by the OGC namespace.
      • Opportunistically fix the letter case.
      Note on the case: "Name type specification — definitions" (OGC 09-048) writes authorities in upper cases, while http://www.opengis.net/def/auth/ uses lower cases. Apache SIS uses upper cases for now. The lower/upper case policy should be kept consistent with the policy used by MultiAuthoritiesFactory for its keys.
      Since:
      0.7
      See Also:
  • Constructor Details

    • NameMeaning

      private NameMeaning()
      Do not allow instantiation of this class.
  • Method Details

    • add

      private static void add(String authority)
      Adds the given authority to the AUTHORITIES map. This method shall be invoked at class initialization time only.
    • toURN

      public static String toURN(Class<?> type, String authority, String version, String code)
      Formats the given identifier using the "ogc:urn:def:" syntax with possible heuristic changes to the given values. The identifier code space, version and code are appended omitting any characters that are not valid for a Unicode identifier. If some information are missing in the given identifier, then this method returns null. This method tries to "fix" the given values using some heuristic knowledge about the meaning of URN.
      Parameters:
      type - the object type.
      authority - the authority as one of the values documented in DefinitionURI javadoc.
      version - the code version, or null. This is the only optional information.
      code - the code.
      Returns:
      an identifier using the URN syntax, or null if a mandatory information is missing.
      Since:
      0.7
    • toObjectType

      public static String toObjectType(Class<?> type)
      Returns the "object type" part of an OGC URN for the given class, or null if unknown. See DefinitionURI javadoc for a list of object types in URN.
      Parameters:
      type - the class for which to get the URN type.
      Returns:
      the URN type, or null if unknown.
    • getVersion

      public static String getVersion(org.opengis.metadata.citation.Citation authority)
      Returns the version of the namespace managed by the given authority. Current Apache SIS implementation searches this information in the Citation.getEdition() property. This approach is based on the assumption that the authority is some specification document or reference to a database, not an organization. However, this policy may be revisited in any future SIS version.
      Parameters:
      authority - the authority from which to get a version, or null.
      Returns:
      the version, or null if none.
      Since:
      0.7