OcmMetadataKey.java

  1. /* Copyright 2002-2022 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.     /** Classification of this message. */
  27.     CLASSIFICATION((token, context, container) -> token.processAsNormalizedString(container::setClassification)),

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

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

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

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

  37.     /** Programmatic Point Of Contact at originator. */
  38.     ORIGINATOR_POC((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPOC)),

  39.     /** Position of Programmatic Point Of Contact at originator. */
  40.     ORIGINATOR_POSITION((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPosition)),

  41.     /** Phone number of Programmatic Point Of Contact at originator. */
  42.     ORIGINATOR_PHONE((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPhone)),

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

  47.     /** Address of Programmatic Point Of Contact at originator. */
  48.     ORIGINATOR_ADDRESS((token, context, container) -> token.processAsNormalizedString(container::setOriginatorAddress)),

  49.     /** Creating agency or operator. */
  50.     TECH_ORG((token, context, container) -> token.processAsNormalizedString(container::setTechOrg)),

  51.     /** Technical Point Of Contact at originator. */
  52.     TECH_POC((token, context, container) -> token.processAsNormalizedString(container::setTechPOC)),

  53.     /** Position of Technical Point Of Contact at originator. */
  54.     TECH_POSITION((token, context, container) -> token.processAsNormalizedString(container::setTechPosition)),

  55.     /** Phone number of Technical Point Of Contact at originator. */
  56.     TECH_PHONE((token, context, container) -> token.processAsNormalizedString(container::setTechPhone)),

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

  61.     /** Address of Technical Point Of Contact at originator. */
  62.     TECH_ADDRESS((token, context, container) -> token.processAsNormalizedString(container::setTechAddress)),

  63.     /** Unique ID identifying previous message from a given originator. */
  64.     PREVIOUS_MESSAGE_ID((token, context, container) -> token.processAsNormalizedString(container::setPreviousMessageID)),

  65.     /** Unique ID identifying next message from a given originator. */
  66.     NEXT_MESSAGE_ID((token, context, container) -> token.processAsNormalizedString(container::setNextMessageID)),

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

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

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

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

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

  77.     /** Operator of the space object. */
  78.     OPERATOR((token, context, container) -> token.processAsNormalizedString(container::setOperator)),

  79.     /** Owner of the space object. */
  80.     OWNER((token, context, container) -> token.processAsNormalizedString(container::setOwner)),

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

  83.     /** Name of the constellation this space object belongs to. */
  84.     CONSTELLATION((token, context, container) -> token.processAsNormalizedString(container::setConstellation)),

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

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

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

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


  100.     /** List of elements of information data blocks included in this message. */
  101.     OCM_DATA_ELEMENTS((token, context, container) -> token.processAsUppercaseList(container::setOcmDataElements)),

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

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

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

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

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

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

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

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

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

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

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

  134.     /** Source and version of Earth Orientation Parameters. */
  135.     EOP_SOURCE((token, context, container) -> token.processAsNormalizedString(container::setEopSource)),

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

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

  140.     /** Processing method. */
  141.     private final TokenProcessor processor;

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

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

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

  167. }