xref: /aosp_15_r20/external/cldr/tools/cldr-code/src/main/java/org/unicode/cldr/tool/ToolConfig.java (revision 912701f9769bb47905792267661f0baf2b85bed5)
1 package org.unicode.cldr.tool;
2 
3 import org.unicode.cldr.util.CLDRConfig;
4 import org.unicode.cldr.util.CLDRConfig.Environment;
5 
6 /**
7  * Shim for CLDRConfig. It shouldn't be called outside of tool (command line) usage.
8  *
9  * <p>Formerly: unittest.TestAll.TestInfo
10  */
11 public class ToolConfig {
12 
13     private static CLDRConfig INSTANCE = null;
14 
getToolInstance()15     public static final synchronized CLDRConfig getToolInstance() {
16         if (INSTANCE == null) {
17             INSTANCE = CLDRConfig.getInstance();
18             if (INSTANCE.getEnvironment()
19                     != Environment.LOCAL) { // verify we aren't in the server, unittests, etc.
20                 throw new InternalError(
21                         "Error: ToolConfig can only be used in the LOCAL environment.");
22             }
23         }
24         return INSTANCE;
25     }
26 }
27