Load the static resolutions from configuration. This is required for junit
to work on testcases that simulate multiple nodes on a single physical
node.
@param conf The configuration.
190069
public static void loadStaticResolutions(Configuration conf) {
    String hostToResolved[] = conf.getStrings("hadoop.net.static.resolutions");
    if (hostToResolved != null) {
      for (String str : hostToResolved) {
        String name = str.substring(0, str.indexOf('='));
        String resolvedName = str.substring(str.indexOf('=') + 1);
        NetUtils.addStaticResolution(name, resolvedName);
      }
    }
  }
980758
public void initialise() {
        if (log.isDebugEnabled()) {
            log.debug("now initialising conf");
        }

        initDecodeUsing(decodeUsing);

        boolean rulesOk = true;
        for (int i = 0; i < rules.size(); i++) {
            final Rule rule = (Rule) rules.get(i);
            if (!rule.initialise(context)) {
                // if we failed to initialise anything set the status to bad
                rulesOk = false;
            }
        }
        for (int i = 0; i < outboundRules.size(); i++) {
            final OutboundRule outboundRule = (OutboundRule) outboundRules.get(i);
            if (!outboundRule.initialise(context)) {
                // if we failed to initialise anything set the status to bad
                rulesOk = false;
            }
        }
        for (int i = 0; i < catchElems.size(); i++) {
            final CatchElem catchElem = (CatchElem) catchElems.get(i);
            if (!catchElem.initialise(context)) {
                // if we failed to initialise anything set the status to bad
                rulesOk = false;
            }
        }
        if (rulesOk) {
            ok = true;
        }
        if (log.isDebugEnabled()) {
            log.debug("conf status " + ok);
        }
    }
142089
@Override
	public void init(Configuration configuration)
	        throws Exception
	{
	    super.init(configuration);

        if (!(getLocalizationBundleFactory() instanceof JstlLocalizationBundleFactory))
        {
            BootstrapPropertyResolver propertyResolver = configuration.getBootstrapPropertyResolver();

            errorBundleName = propertyResolver.getProperty(ERROR_BUNDLE_NAME_CONFIG);
            LOGGER.debug("errorBundleName = ", errorBundleName == null ? "null" : '"' + errorBundleName + '"');

            fieldBundleName = propertyResolver.getProperty(FIELD_BUNDLE_NAME_CONFIG);
            LOGGER.debug("fieldBundleName = ", fieldBundleName == null ? "null" : '"' + fieldBundleName + '"');
        }
	}
136698
private List<StringKeyValueBean> loadConfiguration(){
		List<StringKeyValueBean> result = new LinkedList<StringKeyValueBean>();
		Resource resource = null;
		if (primaryConfigFileLocation == null){
			return result;		// fail silently because we must be in test
		}else{
			resource = new ClassPathResource(primaryConfigFileLocation);
			if (!resource.exists()){
				if (secondaryConfigFileLocation == null){
					return result;		// fail silently because we must be in test
				}
				resource = new ClassPathResource(secondaryConfigFileLocation);
			}
		}

		Properties properties = null;
		try {
			properties = PropertiesLoaderUtils.loadProperties(resource);
			
			// sort them, make the more specific ones at the top, and "*"/".*" at the bottom
			List<StringKeyValueBean> sorted = new ArrayList<StringKeyValueBean>(properties.size());
			for (Entry<Object, Object> entry: properties.entrySet()){
				sorted.add(new StringKeyValueBean(entry.getKey().toString(), entry.getValue().toString()));
			}
			Collections.sort(sorted, new Comparator<StringKeyValueBean>(){
				@Override
				public int compare(StringKeyValueBean b0,	StringKeyValueBean b1) {
					if (b0.getKey().equals(b1.getKey())){
						return 0;
					}
					if ("*".equals(b0.getKey()) || ".*".equals(b0.getKey())){
						return 1;
					}else if ("*".equals(b1.getKey()) || ".*".equals(b1.getKey())){
						return -1;
					}
					return b1.getKey().compareTo(b0.getKey());
				}
			});
			result.addAll(sorted);
		} catch (Exception e) {
			logger.warn("Cannot load environments configuration file from class path: " + 
					(resource == null ? "<null>" : resource.getDescription()), e);
		}
		
		return result;
	}
1298603
@PostConstruct
    public Object loadConfiguration(InvocationContext ic) throws Exception {

        Object target = ic.getTarget();
        Class targetClass = target.getClass();

        if (targetClassIsProxied(targetClass)) {
            targetClass = targetClass.getSuperclass();
        }

        ConfigBundle configBundleAnnotation = (ConfigBundle) targetClass.getDeclaredAnnotation(ConfigBundle.class);

        processConfigBundleBeanSetters(target, targetClass, getKeyPrefix(targetClass), new HashMap<>(),
                configBundleAnnotation.watch());

        return ic.proceed();
    }
742904
protected void loadConfigs() {
        configs = new Properties();
        // If run as a jar, find in file system classpath first, if not found, then get resource in jar.
        if (ClassPathUtil.testRunMainInJar()) {
            String[] classPathsInFileSystem = ClassPathUtil.getAllClassPathNotInJar();
            String workDir = System.getProperty("user.dir");
            String mainJarRelativePath = ClassPathUtil.getClassPathsInSystemProperty()[0];
            File mainJar = new File(workDir, mainJarRelativePath);
            File mainJarDir = mainJar.getParentFile();
            for (String classPath : classPathsInFileSystem) {
                File classPathFile = new File(classPath);
                File configFile;
                if (classPathFile.isAbsolute()) {
                    configFile = new File(classPathFile, propertiesAbsoluteClassPath);
                } else {
                    configFile = new File(new File(mainJarDir, classPath), propertiesAbsoluteClassPath);
                }
                if (configFile.exists() && configFile.isFile()) {
                    InputStream is = null;
                    try {
                        is = new FileInputStream(configFile);
                        loadConfigsFromStream(is);
                    } catch (FileNotFoundException e) {
                        LOGGER.warn("Load config file " + configFile.getPath() + " error!", e);
                    }
                    return;
                }
            }
        }
        if (propertiesFilePath == null) {
            if (propertiesAbsoluteClassPath == null) {
                return;
            }
            InputStream is = OneProperties.class.getResourceAsStream(propertiesAbsoluteClassPath);
            loadConfigsFromStream(is);
        } else {
            configs = PropertiesIO.load(propertiesFilePath);
        }
    }
479440
public void load(String file) {
		Context context = factory.enterContext();
		
		try {
			URL url = Thread.currentThread().getContextClassLoader().getResource(file);
			
			if (url == null) {
				logger.debug("Configuration [" + file + "] does not exist");
				return;
			}
			
			File f = new File(url.getPath());
			
			if (f.exists()) {
				logger.info("Loading configuration [" + file + "]");
				context.evaluateReader(scope, new FileReader(f), file.substring(file.lastIndexOf("/") + 1), 1, null);
			}
			
		} catch (Exception e) {
			logger.error("Failed to load configuration [" + file + "]", e);
			throw new UncheckedException(e);
		} finally {
			Context.exit();
		}
	}
589705
public void initialize(URI name, Configuration conf) throws IOException {
    this.conf = conf;

    Class<?> clazz = conf.getClass("fs.lookasidecache.underlyingfs.impl",
        DistributedFileSystem.class);
    if (clazz == null) {
      throw new IOException("No FileSystem for " +
                            "fs.lookasidecache.underlyingfs.impl.");
    }

    this.fs = (FileSystem)ReflectionUtils.newInstance(clazz, null);
    super.initialize(name, conf);

    // find configured cache directory
    cacheDir = conf.get("fs.lookasidecache.dir");
    if (cacheDir == null) {
      LOG.info("fs.lookasidecache.dir is not defined");
      return;
    }
    cacheDir += "/" + System.currentTimeMillis();
    cachePath = new Path(cacheDir);
    assert cachePath.isAbsolute();
    cacheURI = URI.create("file:///" + cacheDir);

    if (cacheURI == null) {
      LOG.info("fs.lookasidecache.dir is not defined");
      return;
    }
    if (LOG.isDebugEnabled()) {
      LOG.debug("CacheDir is " + cacheURI);
    }

    // create an instance of a RawLocalFileSystem to read from the cache
    cacheFs = new RawLocalFileSystem();
    cacheFs.initialize(cacheURI, conf);

    // Create the cachedir if it does not exist
    // There could be pre-exisiting files in the cachedir, do not do
    // anything to them. They will not be served by this cache, but they
    // will not be deleted by this cache either.
    cacheFs.mkdirs(cachePath);

    // create a lookaside cache
    lookasideCache = new LookasideCache(conf, this);

    // create a metrics updater object
    metrics = new LookasideMetrics();
  }
578509
private void initialize(Configuration configuration) {
    String[] codecClassNames = configuration.getTrimmedStrings(TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES);
    List<Class> codecClasses = Lists.newArrayList();
    if (codecClassNames != null) {
      for (String clsName : codecClassNames) {
        try {
          codecClasses.add(Class.forName(clsName));
        } catch (ClassNotFoundException cnfe) {
          LOG.warn("Unable to load class configured for " + TxConstants.Persist.CFG_TX_SNAPHOT_CODEC_CLASSES
              + ": " + clsName, cnfe);
        }
      }
    }

    if (codecClasses.size() == 0) {
      codecClasses.addAll(Arrays.asList(TxConstants.Persist.DEFAULT_TX_SNAPHOT_CODEC_CLASSES));
    }
    for (Class<?> codecClass : codecClasses) {
      try {
        SnapshotCodec codec = (SnapshotCodec) (codecClass.newInstance());
        codecs.put(codec.getVersion(), codec);
        LOG.debug("Using snapshot codec {} for snapshots of version {}", codecClass.getName(), codec.getVersion());
      } catch (Exception e) {
        LOG.warn("Error instantiating snapshot codec {}. Skipping.", codecClass.getName(), e);
      }
    }
  }
818086
def load_conf(cnf) # :nodoc:

      if cnf.nil? or cnf.empty? 
        raise RepoAccessError, 'No config file provided!'
      elsif cnf and cnf.class == String and File.exists? cnf
        @svn_repo_config_file = cnf
        cnf = IO.read(cnf)
      end

      begin
        YAML::load(cnf)
       rescue Exception => e
        raise RepoAccessError, e.message
      end
    end
704782
private Configuration loadConfigurationFromMetadataBuffer(Buffer buffer) {
    if (buffer.position(12).readByte() == 1) {
      return new Configuration(
        buffer.readLong(),
        buffer.readLong(),
        buffer.readLong(),
        serializer.readObject(buffer)
      );
    }
    return null;
  }
96038
public synchronized static void initConfig(ITestContext context) {
        SeLionLogger.getLogger().entering(context);
        Map<ConfigProperty, String> initialValues = new HashMap<>();
        Map<String, String> testParams = context.getCurrentXmlTest().getLocalParameters();
        if (!testParams.isEmpty()) {
            for (ConfigProperty prop : ConfigProperty.values()) {
                // Check if a selionConfig param resides in the <test>
                String newValue = testParams.get(prop.getName());
                // accept param values that are empty in initialValues.
                if (newValue != null) {
                    initialValues.put(prop, newValue);
                }
            }
        }

        ConfigManager.addConfig(context.getCurrentXmlTest().getName(), new LocalConfig(initialValues));
        SeLionLogger.getLogger().exiting();
    }
839293
public final void loadConfiguration(final String pDirName,
    final String pFileName) throws Exception {
    this.mngSettings.loadConfiguration(pDirName, pFileName);
    loadPropertiesBase(pDirName);
    loadSqlTables();
  }
37772
public static void enableProtoStuffSerialization(Configuration conf) {
		String ser = conf.get("io.serializations").trim();
		if(ser.length() != 0) {
			ser += ",";
		}
		// Adding the ProtoStuff serialization
		ser += ProtoStuffSerialization.class.getName();
		conf.set("io.serializations", ser);
	}
311624
void initResolution(Resolution source)
    {
        Check.notNull(source);

        setSystemCursorVisible(cursorVisibility.booleanValue());
        this.source = source;
        screen.onSourceChanged(source);
        final int width = source.getWidth();
        final int height = source.getHeight();

        // Standard rendering
        final Resolution output = config.getOutput();
        if (FilterNone.INSTANCE.equals(filter) && width == output.getWidth() && height == output.getHeight())
        {
            buf = null;
            transform = null;
        }
        // Scaled rendering
        else
        {
            buf = Graphics.createImageBuffer(width, height);
            transform = getTransform();
            final Graphic gbuf = buf.createGraphic();
            graphic.setGraphic(gbuf.getGraphic());
        }
    }
1112888
public static void setSerializations(Configuration conf) {
		String serializations = conf.get(HADOOP_IO_SERIALIZATIONS);

		LinkedList<String> list = new LinkedList<String>();

		if(serializations != null && !serializations.isEmpty())
			Collections.addAll(list, serializations.split(","));

		// required by MultiInputSplit
		String writable = WritableSerialization.class.getName();
		String tuple = TupleSerialization.class.getName();

		list.remove(writable);
		list.remove(tuple);

		list.addFirst(writable);
		list.addFirst(tuple);

		// make writable last
		conf.set(HADOOP_IO_SERIALIZATIONS, Util.join(list, ","));
	}
1019539
public void initialize(URI name, Configuration conf) throws IOException {
    fs.initialize(name, conf);
  }