Get template engine singleton.

@param configPath       - config path
@param configProperties - config properties
@return template engine
501051
public static Engine getEngine(String configPath, Properties configProperties) {
        if (StringUtils.isEmpty(configPath)) {
            configPath = HTTL_PROPERTIES;
        }
        VolatileReference<Engine> reference = ENGINES.get(configPath);
        if (reference == null) {
            reference = new VolatileReference<Engine>(); // quickly
            VolatileReference<Engine> old = ENGINES.putIfAbsent(configPath, reference);
            if (old != null) { // duplicate
                reference = old;
            }
        }
        assert (reference != null);
        Engine engine = reference.get();
        if (engine == null) {
            synchronized (reference) { // reference lock
                engine = reference.get();
                if (engine == null) { // double check
                    engine = BeanFactory.createBean(Engine.class, initProperties(configPath, configProperties)); // slowly
                    reference.set(engine);
                }
            }
        }
        assert (engine != null);
        return engine;
    }
1238339
@SuppressWarnings({"static-method", "checkstyle:npathcomplexity"})
	public void loadBuilderPreferences(GeneratorConfig2 generatorConfig, IProject context) {
		final IPreferenceStore preferenceStore = SARLPreferences.getSARLPreferencesFor(context);
		if (preferenceStore != null) {
			if (preferenceStore.contains(PREF_GENERATED_TEST_SOURCE_FOLDER)) {
				generatorConfig.setGeneratedTestSourceFolder(preferenceStore.getString(PREF_GENERATED_TEST_SOURCE_FOLDER));
			}
			if (preferenceStore.contains(PREF_GENERATE_INLINE)) {
				generatorConfig.setGenerateInlineAnnotation(preferenceStore.getBoolean(PREF_GENERATE_INLINE));
			}
			if (generatorConfig.isGenerateInlineAnnotation()
					&& preferenceStore.contains(PREF_USE_EXPRESSION_INTERPRETER)) {
				generatorConfig.setUseExpressionInterpreterForInlineAnnotation(preferenceStore.getBoolean(
						PREF_USE_EXPRESSION_INTERPRETER));
			}
			if (preferenceStore.contains(PREF_GENERATE_PURE)) {
				generatorConfig.setGeneratePureAnnotation(preferenceStore.getBoolean(PREF_GENERATE_PURE));
			}
			if (preferenceStore.contains(PREF_GENERATE_EQUALITY_TEST_FUNCTIONS)) {
				generatorConfig.setGenerateEqualityTestFunctions(preferenceStore.getBoolean(PREF_GENERATE_EQUALITY_TEST_FUNCTIONS));
			}
			if (preferenceStore.contains(PREF_GENERATE_TOSTRING_FUNCTIONS)) {
				generatorConfig.setGenerateToStringFunctions(preferenceStore.getBoolean(PREF_GENERATE_TOSTRING_FUNCTIONS));
			}
			if (preferenceStore.contains(PREF_GENERATE_CLONE_FUNCTIONS)) {
				generatorConfig.setGenerateCloneFunctions(preferenceStore.getBoolean(PREF_GENERATE_CLONE_FUNCTIONS));
			}
			if (preferenceStore.contains(PREF_GENERATE_SERIAL_NUMBER_FIELDS)) {
				generatorConfig.setGenerateSerialNumberFields(preferenceStore.getBoolean(PREF_GENERATE_SERIAL_NUMBER_FIELDS));
			}
		}
	}
486011
def scan_config_path(cls, project, scan_config):
        """"""
        return google.api_core.path_template.expand(
            "projects/{project}/scanConfigs/{scan_config}",
            project=project,
            scan_config=scan_config,
        )
711524
@Override
  public Collection<ConfigKeyPath> getChildren(ConfigKeyPath configKey) {
    try {
      return this.childrenMap.get(configKey, () -> this.fallback.getChildren(configKey));
    } catch (ExecutionException ee) {
      throw new RuntimeException(ee);
    }
  }
1285054
private static GroupTemplate createEngine(TemplateConfig config) {
		if (null == config) {
			config = new TemplateConfig();
		}

		switch (config.getResourceMode()) {
		case CLASSPATH:
			return createGroupTemplate(new ClasspathResourceLoader(config.getPath(), config.getCharsetStr()));
		case FILE:
			return createGroupTemplate(new FileResourceLoader(config.getPath(), config.getCharsetStr()));
		case WEB_ROOT:
			return createGroupTemplate(new WebAppResourceLoader(config.getPath(), config.getCharsetStr()));
		case STRING:
			return createGroupTemplate(new StringTemplateResourceLoader());
		case COMPOSITE:
			//TODO 需要定义复合资源加载器
			return createGroupTemplate(new CompositeResourceLoader());
		default:
			return new GroupTemplate();
		}
	}
584726
public function getConfig($pPath, $pForceGlobalArray = false)
    {
        if (array_key_exists($pPath, $this->_cache)) {
            return $this->_cache[$pPath];
        }

        if ($this->_cacheEnabled and $pPath != static::CONFIG_CACHE_TYPE_KEY) {
            if ($this->_cacheInstance === NULL) {
                $this->_cacheInstance = Agl::getCache();
            }

            if ($this->_cacheInstance->has('config.' . $pPath)) {
                $this->_cache[$pPath] = $this->_cacheInstance->get('config.' . $pPath);
                return $this->_cache[$pPath];
            }
        }

        $this->_cache[$pPath] = $this->_getConfigValues($pPath, $pForceGlobalArray);

        if ($this->_cacheInstance !== NULL) {
            $this->_cacheInstance->set('config.' . $pPath, $this->_cache[$pPath]);
        }

        return $this->_cache[$pPath];
    }
1232377
@SuppressWarnings("unused")
    public Template getTemplate(String path) {
        ActContext.Base ctx = ActContext.Base.currentContext();
        if (null != ctx) {
            String curPath = ctx.templatePath();
            ctx.templateLiteral(path);
            try {
                return load(ctx);
            } finally {
                ctx.templatePath(curPath);
            }
        }
        final String templatePath = S.ensureStartsWith(path, '/');
        Template template = null;

        View defView = Act.appConfig().defaultView();

        if (null != defView) {
            template = !isTemplatePath(path) ? defView.loadInlineTemplate(path) : defView.loadTemplate(templatePath);
        }
        if (null == template && multiViews) {
            for (View view : viewList) {
                if (view == defView) continue;
                template = view.loadTemplate(templatePath);
                if (null != template) {
                    break;
                }
            }
        }
        if (null != template) {
            cache(path, template);
        }
        return template;
    }
912538
private void loadEngines(final JBakeConfiguration config, final ContentStore db) {
        try {
            ClassLoader cl = TemplateEngines.class.getClassLoader();
            Enumeration<URL> resources = cl.getResources("META-INF/org.jbake.parser.TemplateEngines.properties");
            while (resources.hasMoreElements()) {
                URL url = resources.nextElement();
                Properties props = new Properties();
                props.load(url.openStream());
                for (Map.Entry<Object, Object> entry : props.entrySet()) {
                    String className = (String) entry.getKey();
                    String[] extensions = ((String) entry.getValue()).split(",");
                    registerEngine(config, db, className, extensions);
                }
            }
        } catch (IOException e) {
            LOGGER.error("Error loading engines", e);
        }
    }
399629
function ConfigFromPath (superConfig, project, version) {
  ConfigFromPath.super_.call(this, superConfig, project, version);

  var strictNS = simpleWrapNS(this.ns);
  strictNS.env = simpleWrapNS(createNamespace(superConfig.getEnvConfig()));

  var files = superConfig._resolvePaths(project, version);
  var loaded = {};

  var generateLoad = function (f) {
    return function (otherVersion) {
      debug('load(%s) in %s', otherVersion, f);
      var dir = path.dirname(f);
      var otherFile = path.resolve(dir, otherVersion + '.js');
      if (loaded[otherFile]) {
        throw new Error('load(' + version + ') conflict in file ' + f);
      }
      try {
        require(otherFile)(strictNS, generateLoad(otherFile));
      } catch (err) {
        if (err.code === 'MODULE_NOT_FOUND') {
          throw new Error('load(' + version + ') fail in file ' + f);
        } else {
          throw err;
        }
      }
    };
  };
  files.forEach(function (f) {
    debug('load %s', f);
    var init = require(f);
    loaded[f] = true;
    if (typeof init !== 'function') {
      throw new Error('bad config file format, `module.exports` must be a function: ' + f);
    }
    init(strictNS, generateLoad(f));
  });

  var loadedFiles = Object.keys(loaded);
  if (loadedFiles.length < 1) {
    throw new Error('cannot find any config files for ' + project + '.' + version);
  } else {
    loadedFiles.forEach(function (f) {
      delete require.cache[f];
    });
  }

  this._loadFinish();
  debug('done');
}
213182
protected Config getConfig (String packagePath)
    {
        Config c = _configs.get(packagePath);
        if (c == null) {
            Properties props = new Properties();
            String propFilename = packagePath + Sounds.PROP_NAME + ".properties";
            try {
                props = ConfigUtil.loadInheritedProperties(propFilename, _rmgr.getClassLoader());
            } catch (IOException ioe) {
                log.warning("Failed to load sound properties", "filename", propFilename, ioe);
            }
            c = new Config(props);
            _configs.put(packagePath, c);
        }
        return c;
    }
140224
@Singleton
    public TemplateEngine templateEngine(ITemplateResolver templateResolver,
            IEngineContextFactory engineContextFactory, ILinkBuilder linkBuilder) {
        TemplateEngine engine = new TemplateEngine();
        engine.setEngineContextFactory(engineContextFactory);
        engine.setLinkBuilder(linkBuilder);
        engine.setTemplateResolver(templateResolver);
        return engine;
    }
590875
public static ApplicationTemplateDescriptor load( Properties properties ) {

		ApplicationTemplateDescriptor result = new ApplicationTemplateDescriptor();

		// Properties with legacy
		result.name = getLegacyProperty( properties, APPLICATION_NAME, null );
		result.description = getLegacyProperty( properties, APPLICATION_DESCRIPTION, null );
		result.version = getLegacyProperty( properties, APPLICATION_VERSION, null );
		result.dslId = getLegacyProperty( properties, APPLICATION_DSL_ID, null );

		// Unchanged properties
		result.graphEntryPoint = properties.getProperty( APPLICATION_GRAPH_EP, null );
		result.instanceEntryPoint = properties.getProperty( APPLICATION_INSTANCES_EP, null );
		result.externalExportsPrefix = properties.getProperty( APPLICATION_EXTERNAL_EXPORTS_PREFIX, null );

		// Exports
		final Pattern pattern = Pattern.compile(
				"([^=\\s]+)\\s+" + APPLICATION_EXTERNAL_EXPORTS_AS + "\\s+([^=\\s]+)",
				Pattern.CASE_INSENSITIVE );

		String rawExports = properties.getProperty( APPLICATION_EXTERNAL_EXPORTS, "" );
		for( String rawExport : Utils.splitNicely( rawExports, "," )) {
			Matcher m = pattern.matcher( rawExport );
			if( m.matches())
				result.externalExports.put( m.group( 1 ), m.group( 2 ));
			else
				result.invalidExternalExports.add( rawExport );
		}

		// Tags
		String rawTags = properties.getProperty( APPLICATION_TAGS, "" );
		result.tags.addAll( Utils.splitNicely( rawTags, "," ));

		return result;
	}
339455
private static Properties load(String configFilePath)
	{
		Properties props = new Properties();
		BufferedInputStream fis = null;
		try {
			File configFile = new File(configFilePath);
	        fis = new BufferedInputStream(new FileInputStream(configFile));
	        props.load(fis);
        }
        catch(IOException e){
        	System.err.println("Could not load configuration file "+configFilePath);
        }
        finally{
			if(fis!=null){
			    try {
					fis.close();
				}
				catch (IOException e) {
		        	System.err.println("Error closing file stream of configuration file "+configFilePath);
				}
			}
        }
        return props;
	}
1215269
protected function getTypoScriptConfigurationInstance(array $configurationArray = null, $contextPageId = null)
    {
        return GeneralUtility::makeInstance(
            TypoScriptConfiguration::class,
            /** @scrutinizer ignore-type */ $configurationArray,
            /** @scrutinizer ignore-type */ $contextPageId
        );
    }
687165
@Override
  public Config getOwnConfig(final ConfigKeyPath configKey) {
    try {
      return this.ownConfigCache.get(configKey, new Callable<Config>() {
        @Override
        public Config call()  {
          return InMemoryValueInspector.this.valueFallback.getOwnConfig(configKey);
        }
      });
    } catch (ExecutionException e) {
      // should NOT come here
      throw new RuntimeException("Can not getOwnConfig for " + configKey);
    }
  }
588722
@Override
   public Map<String, String> getConfigProperties()
   {
      return configProperties == null ? null : Collections.unmodifiableMap(configProperties);
   }
1023811
function getConfig(configPath, searchPath = process.cwd(), stopDir = homedir()) {
  const useCustomPath = !!configPath
  const explorer = cosmiconfig('cca', { sync: true, stopDir })

  try {
    const searchPathAbsolute = !useCustomPath && searchPath
    const configPathAbsolute = useCustomPath && path.join(process.cwd(), configPath)
    // search from the root of the process if the user didnt specify a config file,
    // or use the custom path if a file is passed.
    const result = explorer.load(searchPathAbsolute, configPathAbsolute)

    // dont throw if the explorer didnt find a configfile,
    // instead use default config
    const config = result ? result.config : {}
    const filepath = result ? result.filepath : {}
    if (!result) Logger.log('No config file detected, using defaults.')

    return { ...config, filepath }
  } catch (error) {
    Logger.error('An error occured while parsing your config file. Using defaults...\n\n', error.message)
  }
  return {}
}