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.
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();
PROPERTIES.load(OrekitProperties.class.getClassLoader().getResourcesAsStream(FILENAME));
}
PROPERTIES.get(property)
} 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
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.
<build>
<!-- File subset of resources to place version number in a properties file -->
<resources>
<resource>
<directory>${basedir}/src/main/resources</directory>
<filtering>false</filtering>
</resource>
<resource>
<directory>${basedir}/src/main/resources/...</directory>
<targetPath>${project.build.outputDirectory}/...</targetPath>
<filtering>true</filtering>
</resource>
</resources>
<plugins>
<!-- add version information -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>buildnumber-maven-plugin</artifactId>
<!-- 1.4 does not work with git repositories. -->
<version>3.0.0</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>create</goal>
</goals>
</execution>
</executions>
</plugin