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.attitudes.InertialProvider;
20 import org.orekit.bodies.LazyLoadedCelestialBodies;
21 import org.orekit.errors.OrekitException;
22 import org.orekit.errors.OrekitMessages;
23 import org.orekit.forces.gravity.potential.LazyLoadedGravityFields;
24 import org.orekit.frames.LazyLoadedFrames;
25 import org.orekit.models.earth.LazyLoadedGeoMagneticFields;
26 import org.orekit.time.AbsoluteDate;
27 import org.orekit.time.LazyLoadedTimeScales;
28
29 /**
30 * A data context that always throws a runtime exception when it's methods are used. Can
31 * be useful for determining if the default data context is used. E.g. {@code
32 * DataContext.setDefault(new ExceptionalDataContext());}. The following classes have
33 * static fields that are initialized using the default data context:
34 *
35 * <ul>
36 * <li>{@link AbsoluteDate}
37 * <li>{@link InertialProvider}
38 * </ul>
39 *
40 * @author Evan Ward
41 * @see DataContext#setDefault(LazyLoadedDataContext)
42 * @since 10.1
43 */
44 public class ExceptionalDataContext extends LazyLoadedDataContext implements DataContext {
45
46 @Override
47 public LazyLoadedTimeScales getTimeScales() {
48 throw new OrekitException(OrekitMessages.EXCEPTIONAL_DATA_CONTEXT);
49 }
50
51 @Override
52 public LazyLoadedFrames getFrames() {
53 throw new OrekitException(OrekitMessages.EXCEPTIONAL_DATA_CONTEXT);
54 }
55
56 @Override
57 public LazyLoadedCelestialBodies getCelestialBodies() {
58 throw new OrekitException(OrekitMessages.EXCEPTIONAL_DATA_CONTEXT);
59 }
60
61 @Override
62 public LazyLoadedGravityFields getGravityFields() {
63 throw new OrekitException(OrekitMessages.EXCEPTIONAL_DATA_CONTEXT);
64 }
65
66 @Override
67 public LazyLoadedGeoMagneticFields getGeoMagneticFields() {
68 throw new OrekitException(OrekitMessages.EXCEPTIONAL_DATA_CONTEXT);
69 }
70
71 }