API for Orekit version number?

Hi all,

While looking at NtripClient class (answering to NTRIP client authentication thread), I stumbled upon a hard-coded constant:

    /** User-agent header value. */
    private static final String USER_AGENT_HEADER_VALUE = "NTRIP orekit/11.0";

This constant is recommended in the RTCM/NTRIP protocol and must have the pattern with NTRIP, software name and software version (plus possible additional text, we don’t set anything here).

I was wondering if we should not add somewhere an API for getting the current Orekit version and build this header value using this API.

Where should such a method go? I was thinking of OrekitConfiguration but it seems weird to me.

Good idea!

Maybe inside an application.properties file in the src/main/resources?

Something like


Excellent idea!

Would however such a property be available for users?

I think we shall add a new class: OrekitProperties. Something like:

public final class OrekitProperties {
   private static final String FILE_NAME = "product.properties";
   private static final Properties PROPERTIES;

   /** Private constructor for final class. */
   private OrekitProperties() {
      // nothing to do

   /** Get the value corresponding to the given property.
     * @param property to find
     * @return the value of the property
   public static String get(final String property) {
      try {
         if (PROPERTIES == null) {
             PROPERTIES = new Properties();
      } catch (Exception e) {
            throw new OrekitException(OrekitMessage.NOT_EXISTING_PROPERTY, property):

Note that I wrote the code directly in the forum. Maybe some adjustments are needed

1 Like

We could also add the following method inside OrekitProperties:

/** Get the current version of the project.
  * @return the current version of the project
public static String getProjectVersion() {
   return get("project.version");

That’s OK if we only have a small number of properties (which will be the case for Orekit).

Could also integrate it with maven so we don’t forget to update it. E.g.

    <!-- File subset of resources to place version number in a properties file -->

      <!-- add version information -->
        <!-- 1.4 does not work with git repositories. -->

In a properties file: