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.     /** Address of Programmatic Point Of Contact at originator. */
  44.     ORIGINATOR_ADDRESS((token, context, container) -> token.processAsNormalizedString(container::setOriginatorAddress)),

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  77.     /** Type of object.
  78.      * @see ObjectType
  79.      */
  80.     OBJECT_TYPE((token, context, container) -> token.processAsEnum(ObjectType.class, container::setObjectType)),

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

  84.     /** Operational status.
  85.      * @see OpsStatus
  86.      */
  87.     OPS_STATUS((token, context, container) -> token.processAsEnum(OpsStatus.class, container::setOpsStatus)),

  88.     /** Orbit category.
  89.      * @see OrbitCategory
  90.      */
  91.     ORBIT_CATEGORY((token, context, container) -> token.processAsEnum(OrbitCategory.class, container::setOrbitCategory)),


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

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

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

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

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

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

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

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

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

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

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

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

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

  123.     /** Processing method. */
  124.     private final TokenProcessor processor;

  125.     /** Simple constructor.
  126.      * @param processor processing method
  127.      */
  128.     OcmMetadataKey(final TokenProcessor processor) {
  129.         this.processor = processor;
  130.     }

  131.     /** Process an token.
  132.      * @param token token to process
  133.      * @param context context binding
  134.      * @param container container to fill
  135.      * @return true of token was accepted
  136.      */
  137.     public boolean process(final ParseToken token, final ContextBinding context, final OcmMetadata container) {
  138.         return processor.process(token, context, container);
  139.     }

  140.     /** Interface for processing one token. */
  141.     interface TokenProcessor {
  142.         /** Process one token.
  143.          * @param token token to process
  144.          * @param context context binding
  145.          * @param container container to fill
  146.          * @return true of token was accepted
  147.          */
  148.         boolean process(ParseToken token, ContextBinding context, OcmMetadata container);
  149.     }

  150. }