1   /* Contributed in the public domain.
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.data;
18  
19  import org.orekit.annotation.DefaultDataContext;
20  import org.orekit.bodies.CelestialBodies;
21  import org.orekit.forces.gravity.potential.GravityFields;
22  import org.orekit.frames.Frames;
23  import org.orekit.frames.FramesFactory;
24  import org.orekit.models.earth.GeoMagneticFields;
25  import org.orekit.models.earth.ionosphere.KlobucharIonoCoefficientsLoader;
26  import org.orekit.time.TimeScales;
27  import org.orekit.time.TimeScalesFactory;
28  
29  /**
30   * Provides auxiliary data for portions of the application.
31   *
32   * @author Evan Ward
33   * @since 10.1
34   */
35  public interface DataContext {
36  
37      /**
38       * Get the default data context that is used to implement the static factories ({@link
39       * TimeScalesFactory}, {@link FramesFactory}, etc) and loaders that feed themselves
40       * (e.g. {@link KlobucharIonoCoefficientsLoader}). It is used to maintain
41       * compatibility with auxiliary data loading in Orekit 10.0.
42       *
43       * @return Orekit's default data context.
44       */
45      @DefaultDataContext
46      static LazyLoadedDataContext getDefault() {
47          return DefaultDataContextHolder.getInstance();
48      }
49  
50      /**
51       * Set the default data context that is used to implement Orekit's static factories.
52       *
53       * <p> Calling this method will not modify any instances already retrieved from
54       * Orekit's static factories. In general this method should only be called at
55       * application start up before any of the static factories are used.
56       *
57       * @param context the new data context.
58       * @see #getDefault()
59       */
60      static void setDefault(final LazyLoadedDataContext context) {
61          DefaultDataContextHolder.setInstance(context);
62      }
63  
64      /**
65       * Get a factory for constructing {@link org.orekit.time.TimeScale}s based on the auxiliary data in
66       * this context.
67       *
68       * @return the set of common time scales using this data context.
69       */
70      TimeScales getTimeScales();
71  
72      /**
73       * Get a factory constructing {@link org.orekit.frames.Frame}s based on the auxiliary data in this
74       * context.
75       *
76       * @return the set of common reference frames using this data context.
77       */
78      Frames getFrames();
79  
80      /**
81       * Get a factory constructing {@link org.orekit.bodies.CelestialBody}s based on the auxiliary data in
82       * this context.
83       *
84       * @return the set of common celestial bodies using this data context.
85       */
86      CelestialBodies getCelestialBodies();
87  
88      /**
89       * Get a factory constructing gravity fields based on the auxiliary data in this
90       * context.
91       *
92       * @return the gravity fields using this data context.
93       */
94      GravityFields getGravityFields();
95  
96      /**
97       * Get a factory constructing {@link org.orekit.models.earth.GeoMagneticField}s based on the auxiliary
98       * data in this context.
99       *
100      * @return the geomagnetic fields using this data context.
101      */
102     GeoMagneticFields getGeoMagneticFields();
103 
104 }