OcmMetadataKey.java

  1. /* Copyright 2002-2025 CS GROUP
  2.  * Licensed to CS GROUP (CS) under one or more
  3.  * contributor license agreements.  See the NOTICE file distributed with
  4.  * this work for additional information regarding copyright ownership.
  5.  * CS licenses this file to You under the Apache License, Version 2.0
  6.  * (the "License"); you may not use this file except in compliance with
  7.  * the License.  You may obtain a copy of the License at
  8.  *
  9.  *   http://www.apache.org/licenses/LICENSE-2.0
  10.  *
  11.  * Unless required by applicable law or agreed to in writing, software
  12.  * distributed under the License is distributed on an "AS IS" BASIS,
  13.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  14.  * See the License for the specific language governing permissions and
  15.  * limitations under the License.
  16.  */
  17. package org.orekit.files.ccsds.ndm.odm.ocm;

  18. import org.orekit.files.ccsds.utils.ContextBinding;
  19. import org.orekit.files.ccsds.utils.lexical.ParseToken;
  20. import org.orekit.utils.units.Unit;


  21. /** Keys for {@link OcmMetadata OCM container} entries.
  22.  * @author Luc Maisonobe
  23.  * @since 11.0
  24.  */
  25. public enum OcmMetadataKey {

  26.     /** International designator for the object as assigned by the UN Committee
  27.      * on Space Research (COSPAR) and the US National Space Science Data Center (NSSDC). */
  28.     INTERNATIONAL_DESIGNATOR((token, context, container) -> token.processAsNormalizedString(container::setInternationalDesignator)),

  29.     /** Specification of satellite catalog source. */
  30.     CATALOG_NAME((token, context, container) -> token.processAsNormalizedString(container::setCatalogName)),

  31.     /** Unique satellite identification designator for the object. */
  32.     OBJECT_DESIGNATOR((token, context, container) -> token.processAsNormalizedString(container::setObjectDesignator)),

  33.     /** Alternate names fir this space object. */
  34.     ALTERNATE_NAMES((token, context, container) -> token.processAsNormalizedList(container::setAlternateNames)),

  35.     /** Programmatic Point Of Contact at originator. */
  36.     ORIGINATOR_POC((token, context, container) -> token.processAsFreeTextString(container::setOriginatorPOC)),

  37.     /** Position of Programmatic Point Of Contact at originator. */
  38.     ORIGINATOR_POSITION((token, context, container) -> token.processAsFreeTextString(container::setOriginatorPosition)),

  39.     /** Phone number of Programmatic Point Of Contact at originator. */
  40.     ORIGINATOR_PHONE((token, context, container) -> token.processAsFreeTextString(container::setOriginatorPhone)),

  41.     /** Email address of Programmatic Point Of Contact at originator.
  42.      * @since 11.2
  43.      */
  44.     ORIGINATOR_EMAIL((token, context, container) -> token.processAsFreeTextString(container::setOriginatorEmail)),

  45.     /** Address of Programmatic Point Of Contact at originator. */
  46.     ORIGINATOR_ADDRESS((token, context, container) -> token.processAsFreeTextString(container::setOriginatorAddress)),

  47.     /** Creating agency or operator. */
  48.     TECH_ORG((token, context, container) -> token.processAsFreeTextString(container::setTechOrg)),

  49.     /** Technical Point Of Contact at originator. */
  50.     TECH_POC((token, context, container) -> token.processAsFreeTextString(container::setTechPOC)),

  51.     /** Position of Technical Point Of Contact at originator. */
  52.     TECH_POSITION((token, context, container) -> token.processAsFreeTextString(container::setTechPosition)),

  53.     /** Phone number of Technical Point Of Contact at originator. */
  54.     TECH_PHONE((token, context, container) -> token.processAsFreeTextString(container::setTechPhone)),

  55.     /** Email address of Technical Point Of Contact at originator.
  56.      * @since 11.2
  57.      */
  58.     TECH_EMAIL((token, context, container) -> token.processAsFreeTextString(container::setTechEmail)),

  59.     /** Address of Technical Point Of Contact at originator. */
  60.     TECH_ADDRESS((token, context, container) -> token.processAsFreeTextString(container::setTechAddress)),

  61.     /** Unique ID identifying previous message from a given originator. */
  62.     PREVIOUS_MESSAGE_ID((token, context, container) -> token.processAsFreeTextString(container::setPreviousMessageID)),

  63.     /** Unique ID identifying next message from a given originator. */
  64.     NEXT_MESSAGE_ID((token, context, container) -> token.processAsFreeTextString(container::setNextMessageID)),

  65.     /** Unique identifier of Attitude Data Message linked to this Orbit Data Message. */
  66.     ADM_MSG_LINK((token, context, container) -> token.processAsFreeTextString(container::setAdmMessageLink)),

  67.     /** Unique identifier of Conjunction Data Message linked to this Orbit Data Message. */
  68.     CDM_MSG_LINK((token, context, container) -> token.processAsFreeTextString(container::setCdmMessageLink)),

  69.     /** Unique identifier of Pointing Request Message linked to this Orbit Data Message. */
  70.     PRM_MSG_LINK((token, context, container) -> token.processAsFreeTextString(container::setPrmMessageLink)),

  71.     /** Unique identifier of Reentry Data Message linked to this Orbit Data Message. */
  72.     RDM_MSG_LINK((token, context, container) -> token.processAsFreeTextString(container::setRdmMessageLink)),

  73.     /** Unique identifier of Tracking Data Message linked to this Orbit Data Message. */
  74.     TDM_MSG_LINK((token, context, container) -> token.processAsFreeTextString(container::setTdmMessageLink)),

  75.     /** Operator of the space object. */
  76.     OPERATOR((token, context, container) -> token.processAsFreeTextString(container::setOperator)),

  77.     /** Owner of the space object. */
  78.     OWNER((token, context, container) -> token.processAsFreeTextString(container::setOwner)),

  79.     /** Name of the country where the space object owner is based. */
  80.     COUNTRY((token, context, container) -> token.processAsFreeTextString(container::setCountry)),

  81.     /** Name of the constellation this space object belongs to. */
  82.     CONSTELLATION((token, context, container) -> token.processAsFreeTextString(container::setConstellation)),

  83.     /** Type of object.
  84.      * @see ObjectType
  85.      */
  86.     OBJECT_TYPE((token, context, container) -> token.processAsEnum(ObjectType.class, container::setObjectType)),

  87.     /** Default epoch to which <em>all</em> relative times are referenced in data blocks,
  88.      * unless overridden by block-specific {@link #EPOCH_TZERO} values. */
  89.     EPOCH_TZERO((token, context, container) -> token.processAsDate(container::setEpochT0, context)),

  90.     /** Operational status.
  91.      * @see OpsStatus
  92.      */
  93.     OPS_STATUS((token, context, container) -> token.processAsEnum(OpsStatus.class, container::setOpsStatus)),

  94.     /** Orbit category.
  95.      * @see OrbitCategory
  96.      */
  97.     ORBIT_CATEGORY((token, context, container) -> token.processAsEnum(OrbitCategory.class, container::setOrbitCategory)),

  98.     /** List of elements of information data blocks included in this message. */
  99.     OCM_DATA_ELEMENTS((token, context, container) -> token.processAsEnumsList(OcmElements.class, container::setOcmDataElements)),

  100.     /** Spacecraft clock count at {@link #EPOCH_TZERO}. */
  101.     SCLK_OFFSET_AT_EPOCH((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  102.                                                                               container::setSclkOffsetAtEpoch)),

  103.     /** Number of clock seconds occurring during one SI second. */
  104.     SCLK_SEC_PER_SI_SEC((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  105.                                                                              container::setSclkSecPerSISec)),

  106.     /** Creation date of previous message from a given originator. */
  107.     PREVIOUS_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setPreviousMessageEpoch, context)),

  108.     /** Creation date of next message from a given originator. */
  109.     NEXT_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setNextMessageEpoch, context)),

  110.     /** Start time entry. */
  111.     START_TIME((token, context, container) -> token.processAsDate(container::setStartTime, context)),

  112.     /** Stop time entry. */
  113.     STOP_TIME((token, context, container) -> token.processAsDate(container::setStopTime, context)),

  114.     /** Span of time that the OCM covers. */
  115.     TIME_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
  116.                                                                    container::setTimeSpan)),

  117.     /** Difference (TAI – UTC) in seconds at epoch {@link #EPOCH_TZERO}. */
  118.     TAIMUTC_AT_TZERO((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  119.                                                                           container::setTaimutcT0)),

  120.     /** Epoch of next leap second.
  121.      * @since 11.2
  122.      */
  123.     NEXT_LEAP_EPOCH((token, context, container) -> token.processAsDate(container::setNextLeapEpoch, context)),

  124.     /** Difference (TAI – UTC) in seconds incorporated at {@link #NEXT_LEAP_EPOCH}.
  125.      * @since 11.2
  126.      */
  127.     NEXT_LEAP_TAIMUTC((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  128.                                                                            container::setNextLeapTaimutc)),

  129.     /** Difference (UT1 – UTC) in seconds at epoch {@link #EPOCH_TZERO}. */
  130.     UT1MUTC_AT_TZERO((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
  131.                                                                           container::setUt1mutcT0)),

  132.     /** Source and version of Earth Orientation Parameters. */
  133.     EOP_SOURCE((token, context, container) -> token.processAsFreeTextString(container::setEopSource)),

  134.     /** Interpolation method for Earth Orientation Parameters. */
  135.     INTERP_METHOD_EOP((token, context, container) -> token.processAsNormalizedString(container::setInterpMethodEOP)),

  136.     /** Source and version of celestial body (e.g. Sun/Earth/Planetary). */
  137.     CELESTIAL_SOURCE((token, context, container) -> token.processAsFreeTextString(container::setCelestialSource));

  138.     /** Processing method. */
  139.     private final transient TokenProcessor processor;

  140.     /** Simple constructor.
  141.      * @param processor processing method
  142.      */
  143.     OcmMetadataKey(final TokenProcessor processor) {
  144.         this.processor = processor;
  145.     }

  146.     /** Process an token.
  147.      * @param token token to process
  148.      * @param context context binding
  149.      * @param container container to fill
  150.      * @return true of token was accepted
  151.      */
  152.     public boolean process(final ParseToken token, final ContextBinding context, final OcmMetadata container) {
  153.         return processor.process(token, context, container);
  154.     }

  155.     /** Interface for processing one token. */
  156.     interface TokenProcessor {
  157.         /** Process one token.
  158.          * @param token token to process
  159.          * @param context context binding
  160.          * @param container container to fill
  161.          * @return true of token was accepted
  162.          */
  163.         boolean process(ParseToken token, ContextBinding context, OcmMetadata container);
  164.     }

  165. }