1   /* Copyright 2002-2021 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  
19  import org.orekit.files.ccsds.utils.ContextBinding;
20  import org.orekit.files.ccsds.utils.lexical.ParseToken;
21  import org.orekit.utils.units.Unit;
22  
23  
24  /** Keys for {@link OcmMetadata OCM container} entries.
25   * @author Luc Maisonobe
26   * @since 11.0
27   */
28  public enum OcmMetadataKey {
29  
30      /** Classification of this message. */
31      CLASSIFICATION((token, context, container) -> token.processAsNormalizedString(container::setClassification)),
32  
33      /** International designator for the object as assigned by the UN Committee
34       * on Space Research (COSPAR) and the US National Space Science Data Center (NSSDC). */
35      INTERNATIONAL_DESIGNATOR((token, context, container) -> token.processAsNormalizedString(container::setInternationalDesignator)),
36  
37      /** Specification of satellite catalog source. */
38      CATALOG_NAME((token, context, container) -> token.processAsNormalizedString(container::setCatalogName)),
39  
40      /** Unique satellite identification designator for the object. */
41      OBJECT_DESIGNATOR((token, context, container) -> token.processAsNormalizedString(container::setObjectDesignator)),
42  
43      /** Alternate names fir this space object. */
44      ALTERNATE_NAMES((token, context, container) -> token.processAsNormalizedList(container::setAlternateNames)),
45  
46      /** Programmatic Point Of Contact at originator. */
47      ORIGINATOR_POC((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPOC)),
48  
49      /** Position of Programmatic Point Of Contact at originator. */
50      ORIGINATOR_POSITION((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPosition)),
51  
52      /** Phone number of Programmatic Point Of Contact at originator. */
53      ORIGINATOR_PHONE((token, context, container) -> token.processAsNormalizedString(container::setOriginatorPhone)),
54  
55      /** Address of Programmatic Point Of Contact at originator. */
56      ORIGINATOR_ADDRESS((token, context, container) -> token.processAsNormalizedString(container::setOriginatorAddress)),
57  
58      /** Creating agency or operator. */
59      TECH_ORG((token, context, container) -> token.processAsNormalizedString(container::setTechOrg)),
60  
61      /** Technical Point Of Contact at originator. */
62      TECH_POC((token, context, container) -> token.processAsNormalizedString(container::setTechPOC)),
63  
64      /** Position of Technical Point Of Contact at originator. */
65      TECH_POSITION((token, context, container) -> token.processAsNormalizedString(container::setTechPosition)),
66  
67      /** Phone number of Technical Point Of Contact at originator. */
68      TECH_PHONE((token, context, container) -> token.processAsNormalizedString(container::setTechPhone)),
69  
70      /** Address of Technical Point Of Contact at originator. */
71      TECH_ADDRESS((token, context, container) -> token.processAsNormalizedString(container::setTechAddress)),
72  
73      /** Unique ID identifying previous message from a given originator. */
74      PREVIOUS_MESSAGE_ID((token, context, container) -> token.processAsNormalizedString(container::setPreviousMessageID)),
75  
76      /** Unique ID identifying next message from a given originator. */
77      NEXT_MESSAGE_ID((token, context, container) -> token.processAsNormalizedString(container::setNextMessageID)),
78  
79      /** Unique identifier of Attitude Data Message linked to this Orbit Data Message. */
80      ADM_MESSAGE_LINK((token, context, container) -> token.processAsNormalizedString(container::setAdmMessageLink)),
81  
82      /** Unique identifier of Conjunction Data Message linked to this Orbit Data Message. */
83      CDM_MESSAGE_LINK((token, context, container) -> token.processAsNormalizedString(container::setCdmMessageLink)),
84  
85      /** Unique identifier of Pointing Request Message linked to this Orbit Data Message. */
86      PRM_MESSAGE_LINK((token, context, container) -> token.processAsNormalizedString(container::setPrmMessageLink)),
87  
88      /** Unique identifier of Reentry Data Message linked to this Orbit Data Message. */
89      RDM_MESSAGE_LINK((token, context, container) -> token.processAsNormalizedString(container::setRdmMessageLink)),
90  
91      /** Unique identifier of Tracking Data Message linked to this Orbit Data Message. */
92      TDM_MESSAGE_LINK((token, context, container) -> token.processAsNormalizedString(container::setTdmMessageLink)),
93  
94      /** Operator of the space object. */
95      OPERATOR((token, context, container) -> token.processAsNormalizedString(container::setOperator)),
96  
97      /** Owner of the space object. */
98      OWNER((token, context, container) -> token.processAsNormalizedString(container::setOwner)),
99  
100     /** Name of the country where the space object owner is based. */
101     COUNTRY((token, context, container) -> token.processAsNormalizedString(container::setCountry)),
102 
103     /** Name of the constellation this space object belongs to. */
104     CONSTELLATION((token, context, container) -> token.processAsNormalizedString(container::setConstellation)),
105 
106     /** Type of object.
107      * @see ObjectType
108      */
109     OBJECT_TYPE((token, context, container) -> token.processAsEnum(ObjectType.class, container::setObjectType)),
110 
111     /** Default epoch to which <em>all</em> relative times are referenced in data blocks,
112      * unless overridden by block-specific {@link #EPOCH_TZERO} values. */
113     EPOCH_TZERO((token, context, container) -> token.processAsDate(container::setEpochT0, context)),
114 
115     /** Operational status.
116      * @see OpsStatus
117      */
118     OPS_STATUS((token, context, container) -> token.processAsEnum(OpsStatus.class, container::setOpsStatus)),
119 
120     /** Orbit category.
121      * @see OrbitCategory
122      */
123     ORBIT_CATEGORY((token, context, container) -> token.processAsEnum(OrbitCategory.class, container::setOrbitCategory)),
124 
125 
126     /** List of elements of information data blocks included in this message. */
127     OCM_DATA_ELEMENTS((token, context, container) -> token.processAsUppercaseList(container::setOcmDataElements)),
128 
129     /** Spacecraft clock count at {@link #EPOCH_TZERO}. */
130     SCLK_OFFSET_AT_EPOCH((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
131                                                                               container::setSclkOffsetAtEpoch)),
132 
133     /** Number of clock seconds occurring during one SI second. */
134     SCLK_SEC_PER_SI_SEC((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
135                                                                              container::setSclkSecPerSISec)),
136 
137     /** Creation date of previous message from a given originator. */
138     PREVIOUS_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setPreviousMessageEpoch, context)),
139 
140     /** Creation date of next message from a given originator. */
141     NEXT_MESSAGE_EPOCH((token, context, container) -> token.processAsDate(container::setNextMessageEpoch, context)),
142 
143     /** Start time entry. */
144     START_TIME((token, context, container) -> token.processAsDate(container::setStartTime, context)),
145 
146     /** Stop time entry. */
147     STOP_TIME((token, context, container) -> token.processAsDate(container::setStopTime, context)),
148 
149     /** Span of time that the OCM covers. */
150     TIME_SPAN((token, context, container) -> token.processAsDouble(Unit.DAY, context.getParsedUnitsBehavior(),
151                                                                    container::setTimeSpan)),
152 
153     /** Difference (TAI – UTC) in seconds at epoch {@link #EPOCH_TZERO}. */
154     TAIMUTC_AT_TZERO((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
155                                                                           container::setTaimutcT0)),
156 
157     /** Difference (UT1 – UTC) in seconds at epoch {@link #EPOCH_TZERO}. */
158     UT1MUTC_AT_TZERO((token, context, container) -> token.processAsDouble(Unit.SECOND, context.getParsedUnitsBehavior(),
159                                                                           container::setUt1mutcT0)),
160 
161     /** Source and version of Earth Orientation Parameters. */
162     EOP_SOURCE((token, context, container) -> token.processAsNormalizedString(container::setEopSource)),
163 
164     /** Interpolation method for Earth Orientation Parameters. */
165     INTERP_METHOD_EOP((token, context, container) -> token.processAsNormalizedString(container::setInterpMethodEOP)),
166 
167     /** Source and version of celestial body (e.g. Sun/Earth/Planetary). */
168     CELESTIAL_SOURCE((token, context, container) -> token.processAsNormalizedString(container::setCelestialSource));
169 
170     /** Processing method. */
171     private final TokenProcessor processor;
172 
173     /** Simple constructor.
174      * @param processor processing method
175      */
176     OcmMetadataKey(final TokenProcessor processor) {
177         this.processor = processor;
178     }
179 
180     /** Process an token.
181      * @param token token to process
182      * @param context context binding
183      * @param container container to fill
184      * @return true of token was accepted
185      */
186     public boolean process(final ParseToken token, final ContextBinding context, final OcmMetadata container) {
187         return processor.process(token, context, container);
188     }
189 
190     /** Interface for processing one token. */
191     interface TokenProcessor {
192         /** Process one token.
193          * @param token token to process
194          * @param context context binding
195          * @param container container to fill
196          * @return true of token was accepted
197          */
198         boolean process(ParseToken token, ContextBinding context, OcmMetadata container);
199     }
200 
201 }