[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Orekit Developers] [Orekit Users] design of the DataProviders

Hi Yannick, Luc,

On Mon, 2017-11-13 at 12:16 +0100, MAISONOBE Luc wrote:
"JEANDROZ, Yannick [FR]" <yannick.jeandroz@airbus.com> a écrit :

I have started thinking about possible refactorings of the model data management. I have a somewhat similar behaviour somewhere else in my software, and I have used a dependency inversion based on Java services to solve it. So far, it seems to work quite well (but my software is not that big yet, so it might be a bit early to tell). Maybe something like this could be implemented for orekit data management ? I would gladly share a very basic draft of my ideas if it can be of any help.
Sure! We can speak about this on the developers list (and also during the Orekit day at the end of the month!).

Yannick, I'm interested in hearing your ideas. I've run in to the same issue when trying to use different EOP data sets within the same Orekit application. My thought is to:

1. Make the DataProviderManager (DPM) instaniable.
2. Make all the static factories (TimeScaleFactory, FramesFactory, etc.) instantiable and take a DPM in the constructor.
3. Ensure that for every contructor/method in Orekit that uses one of the static factories there is an equivalent method that receives the factory or the factory-created object as a parameter instead.

The existing static factory methods could be retained to make it easier for new users or simple applications.

Loaded data would still be cached in each of the factories, but the user application would now have more control over where the data is used. For example, application could use one TimeScaleFactory for the entire application to match the current behavior, or one TimeScaleFactory per thread to match Yannik's use case, or something more complex that makes sense for the specific application.

Here is an example of what the code would look like:

DataProviderManager dataSet1 = new DataProviderManager();
dataSet1.addProvider(new DirectoryCrawler("C:/dataset1"));
DataProviderManager dataSet2 = new DataProviderManager();
dataSet2.addProvider(new DirectoryCrawler("C:/dataset2"));
TimeScaleFactory tsf1 = new TimeScaleFactory(dataSet1);
TimeScaleFactory tsf2 = new TimeScaleFactory(dataSet2);
TimeScale utc = tsf1.getUTC(); // using original data set
TimeScale utcPlusHalf = tsf2.getUTC(); // using modified data set

Comments and criticisms welcome.

I agree with Luc that this would be a good topic to discuss at the Orekit Day.

Best Regards,

best regards,

Thank you for your time. Yannick Jeandroz Yannick Jeandroz TESOA2 - Flight Dynamics T +33 (0)5 62 19 51 71 E yannick.jeandroz@airbus.com www.airbusdefenceandspace.com<http://www.airbusdefenceandspace.com/> [AirbusDS]