Header.java

  1. /* Copyright 2002-2024 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.section;

  18. import org.orekit.time.AbsoluteDate;

  19. /**
  20.  * Header of a CCSDS Navigation Data Message.
  21.  * @author Bryan Cazabonne
  22.  * @since 10.2
  23.  */
  24. public class Header extends CommentsContainer {

  25.     /** CCSDS Format version. */
  26.     private double formatVersion;

  27.     /** Classification. */
  28.     private String classification;

  29.     /** Message creation date and time in UTC. */
  30.     private AbsoluteDate creationDate;

  31.     /** Creating agency or operator. */
  32.     private String originator;

  33.     /** ID that uniquely identifies a message from a given originator. */
  34.     private String messageId;

  35.     /** Minimum version for {@link HeaderKey#MESSAGE_ID}. */
  36.     private final double minVersionMessageId;

  37.     /** Minimum version for {@link HeaderKey#CLASSIFICATION}. */
  38.     private final double minVersionClassification;

  39.     /**
  40.      * Constructor.
  41.      * @param minVersionMessageId minimum version for {@link HeaderKey#MESSAGE_ID}
  42.      * @param minVersionClassification minimum version for {@link HeaderKey#CLASSIFICATION}
  43.      */
  44.     public Header(final double minVersionMessageId,
  45.                   final double minVersionClassification) {
  46.         this.formatVersion            = Double.NaN;
  47.         this.minVersionMessageId      = minVersionMessageId;
  48.         this.minVersionClassification = minVersionClassification;
  49.     }

  50.     /** {@inheritDoc} */
  51.     @Override
  52.     public void validate(final double version) {
  53.         super.validate(version);
  54.         checkNotNull(creationDate, HeaderKey.CREATION_DATE.name());
  55.         checkNotNull(originator,   HeaderKey.ORIGINATOR.name());
  56.         checkAllowed(version, messageId,      HeaderKey.MESSAGE_ID.name(),
  57.                      minVersionMessageId, Double.POSITIVE_INFINITY);
  58.         checkAllowed(version, classification, HeaderKey.CLASSIFICATION.name(),
  59.                      minVersionClassification, Double.POSITIVE_INFINITY);
  60.     }

  61.     /**
  62.      * Get the CCSDS NDM (ADM, ODM or TDM) format version.
  63.      * @return format version
  64.      */
  65.     public double getFormatVersion() {
  66.         return formatVersion;
  67.     }

  68.     /**
  69.      * Set the CCSDS NDM (ADM, ODM or TDM) format version.
  70.      * @param formatVersion the format version to be set
  71.      */
  72.     public void setFormatVersion(final double formatVersion) {
  73.         this.formatVersion = formatVersion;
  74.     }

  75.     /**
  76.      * Get the classification/caveats.
  77.      * @return classification/caveats.
  78.      */
  79.     public String getClassification() {
  80.         return classification;
  81.     }

  82.     /**
  83.      * Set the classification/caveats.
  84.      * @param classification classification/caveats to be set
  85.      */
  86.     public void setClassification(final String classification) {
  87.         refuseFurtherComments();
  88.         this.classification = classification;
  89.     }

  90.     /**
  91.      * Get the message creation date and time in UTC.
  92.      * @return the message creation date and time in UTC.
  93.      */
  94.     public AbsoluteDate getCreationDate() {
  95.         return creationDate;
  96.     }

  97.     /**
  98.      * Set the message creation date and time in UTC.
  99.      * @param creationDate the creation date to be set
  100.      */
  101.     public void setCreationDate(final AbsoluteDate creationDate) {
  102.         refuseFurtherComments();
  103.         this.creationDate = creationDate;
  104.     }

  105.     /**
  106.      * Get the message originator.
  107.      * @return originator the message originator.
  108.      */
  109.     public String getOriginator() {
  110.         return originator;
  111.     }

  112.     /**
  113.      * Set the message originator.
  114.      * @param originator the originator to be set
  115.      */
  116.     public void setOriginator(final String originator) {
  117.         refuseFurtherComments();
  118.         this.originator = originator;
  119.     }

  120.     /**
  121.      * Get the ID that uniquely identifies a message from a given originator.
  122.      * @return ID that uniquely identifies a message from a given originator
  123.      */
  124.     public String getMessageId() {
  125.         return messageId;
  126.     }

  127.     /**
  128.      * Set the ID that uniquely identifies a message from a given originator.
  129.      * @param messageId ID that uniquely identifies a message from a given originator
  130.      */
  131.     public void setMessageId(final String messageId) {
  132.         this.messageId = messageId;
  133.     }

  134. }