This function creates, initializes and returns a new request parser.

@param   configurationKey
The configuration key used to fetch the parser class name
@param   defaultParserClassName
The default parser class name
@return  The new request parser
555735
@SuppressWarnings("unchecked")
    protected RequestParser<T> createRequestParser(String configurationKey,String defaultParserClassName)
    {
        if(configurationKey==null)
        {
            throw new FaxException("Configuration key for request parser not provided.");
        }

        //get class name
        String className=this.getConfigurationValue(configurationKey);

        //if no class name configured, use default
        if(className==null)
        {
            className=defaultParserClassName;
            
            if(className==null)
            {
                throw new FaxException("Request parser class name not found.");
            }
        }

        //create new instance
        RequestParser<T> parser=(RequestParser<T>)ReflectionHelper.createInstance(className);
            
        //initialize
        Map<String,String> configuration=this.getConfiguration();
        parser.initialize(configuration);
        
        return parser;
    }
148488
public static KieServicesConfiguration newJMSConfiguration( ConnectionFactory connectionFactory, Queue requestQueue, Queue responseQueue) {
        return new KieServicesConfigurationImpl( connectionFactory, requestQueue, responseQueue );
    }
207763
private URL loadResource(String configurationResourceName)
    {
        ClassLoader standardClassloader = ClassLoaderUtil.getStandardClassLoader();
        URL url = null;
        if (standardClassloader != null)
        {
            url = standardClassloader.getResource(configurationResourceName);
        }
        if (url == null)
        {
            url = this.getClass().getResource(configurationResourceName);
        }
        log.info("Creating EhCacheFactory from a specified resource: " + configurationResourceName
                + " Resolved to URL: " + url);

        if (url == null)
        {
            log.warn("A configurationResourceName was set to {} but the resource could not be loaded from the classpath.Ehcache will configure itself using defaults." ,configurationResourceName);
        }
        return url;
    }
660926
@SuppressWarnings("unchecked")
  public static <T> T newInstance(Class<T> theClass, Configuration conf) {
    return newInstance(theClass, conf, true);
  }
1157498
protected static boolean loadDefaultConf(String packageName) throws ParseException {

      if (packageName.endsWith(".conf")) {
         return false;
      }

      packageName = packageName.replaceAll("\\$[0-9]+$", "");


      Resource defaultConf = new ClasspathResource((packageName.replaceAll("\\.",
                                                                           "/"
                                                                          ) + "/" + DEFAULT_CONFIG_FILE_NAME).trim(),
                                                   Config.getDefaultClassLoader()
      );

      // Go through each level of the package until we find one that
      // has a default properties file or we cannot go any further.
      while (!defaultConf.exists()) {
         int idx = packageName.lastIndexOf('.');
         if (idx == -1) {
            defaultConf = new ClasspathResource(packageName + "/" + DEFAULT_CONFIG_FILE_NAME,
                                                Config.getDefaultClassLoader()
            );
            break;
         }
         packageName = packageName.substring(0, idx);
         defaultConf = new ClasspathResource(packageName.replaceAll("\\.", "/") + "/" + DEFAULT_CONFIG_FILE_NAME,
                                             Config.getDefaultClassLoader()
         );
      }

      if (defaultConf.exists()) {
         loadConfig(defaultConf);
         return true;
      }


      return false;
   }
824629
@SuppressWarnings("unchecked")
  public <T> T get(String key, Class<T> type, T defaultValue)
  {
    Objects.requireNonNull(key);
    Objects.requireNonNull(type);

    String value = _map.get(key);

    if (value == null) {
      return defaultValue;
    }

    if (type.equals(String.class)) {
      return (T) value;
    }

    T valueType = _converter.convert(type, value);

    if (valueType != null) {
      return valueType;
    }
    else {
      log.warning(L.l("Unexpected type for key={0} type={1} value={2}",
                      key, type, value));
      /*
      throw new ConfigException(L.l("Unexpected type for key={0} type={1} value={2}",
                                    key, type, value));
                                    */
      return defaultValue;
    }
  }
592250
@Override
	public Object get(final Object key) {
		final boolean useLocalPrefixes = !mixDefaultAndLocalPrefixes && hasLocalPrefixConfigurations();
		return get(key, useLocalPrefixes);
	}
932377
@FFDCIgnore(XMLStreamException.class)
    public boolean parseServerConfiguration(InputStream in, String docLocation, BaseConfiguration config,
                                            MergeBehavior mergeBehavior) throws ConfigParserException, ConfigValidationException {
        XMLStreamReader parser = null;
        try {
            parser = getXMLInputFactory().createXMLStreamReader(docLocation, in);
            return parseServerConfiguration(new DepthAwareXMLStreamReader(parser), docLocation, config, mergeBehavior);
        } catch (XMLStreamException e) {
            throw new ConfigParserException(e);
        } finally {
            if (parser != null) {
                try {
                    parser.close();
                } catch (XMLStreamException e) {
                    throw new ConfigParserException(e);
                }
            }
        }
    }
584824
public static <T> Key<T> keyWithDefault(String name, T defaultValue) {
    return new Key<>(name, defaultValue);
  }
120665
@Override
    public String get(final String key) {
        return retrieve(new Callable<String>() {
            @Override
            public String call() throws Exception {
                return configuration.getString(key);
            }
        }, null);
    }
869757
public java.lang.String getHttpHeadersOrDefault(
      java.lang.String key,
      java.lang.String defaultValue) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.String> map =
        internalGetHttpHeaders().getMap();
    return map.containsKey(key) ? map.get(key) : defaultValue;
  }
193083
private static synchronized KeyManager[] getDefaultKeyManager() throws KeyStoreException, NoSuchProviderException,
    IOException, CertificateException, NoSuchAlgorithmException, UnrecoverableKeyException {
    final String defaultKeyStore = System.getProperty("javax.net.ssl.keyStore", "");
    String defaultKeyStoreType = System.getProperty("javax.net.ssl.keyStoreType", KeyStore.getDefaultType());
    String defaultKeyStoreProvider = System.getProperty("javax.net.ssl.keyStoreProvider", "");

    logDebug("keyStore is : " + defaultKeyStore);
    logDebug("keyStore type is : " + defaultKeyStoreType);
    logDebug("keyStore provider is : " + defaultKeyStoreProvider);

    if (P11KEYSTORE.equals(defaultKeyStoreType) && !NONE.equals(defaultKeyStore)) {
      throw new IllegalArgumentException("if keyStoreType is " + P11KEYSTORE + ", then keyStore must be " + NONE);
    }

    KeyStore ks = null;
    String defaultKeyStorePassword = System.getProperty("javax.net.ssl.keyStorePassword", "");
    char[] passwd = defaultKeyStorePassword.isEmpty() ? null : defaultKeyStorePassword.toCharArray();

    // Try to initialize key store.
    if (!defaultKeyStoreType.isEmpty()) {
      logDebug("init keystore");
      if (defaultKeyStoreProvider.isEmpty()) {
        ks = KeyStore.getInstance(defaultKeyStoreType);
      } else {
        ks = KeyStore.getInstance(defaultKeyStoreType, defaultKeyStoreProvider);
      }
      if (!defaultKeyStore.isEmpty() && !NONE.equals(defaultKeyStore)) {
        try (FileInputStream fs = new FileInputStream(defaultKeyStore)) {
          ks.load(fs, passwd);
        }
      } else {
        ks.load(null, passwd);
      }
    }

    // Try to initialize key manager.
    logDebug("init keymanager of type " + KeyManagerFactory.getDefaultAlgorithm());
    KeyManagerFactory kmf = KeyManagerFactory.getInstance(KeyManagerFactory.getDefaultAlgorithm());

    if (P11KEYSTORE.equals(defaultKeyStoreType)) {
      // do not pass key passwd if using token
      kmf.init(ks, null);
    } else {
      kmf.init(ks, passwd);
    }

    return kmf.getKeyManagers();
  }
712060
public String getRequiredConfigAttributeWithDefaultValueAndConfigId(Map<String, Object> props, String key, String defaultValue, String configId) {
        String result = getAndTrimConfigAttribute(props, key);
        if (key != null && result == null) {
            if (defaultValue != null) {
                result = defaultValue;
            } else {
                logMessageForMissingRequiredAttribute(key, configId);
            }
        }
        return result;
    }
1145862
public MtasTokenizer create(String configuration, String defaultConfiguration) throws IOException {
    return create(TokenStream.DEFAULT_TOKEN_ATTRIBUTE_FACTORY, configuration, defaultConfiguration);
  }
1180839
public static <T> ConfigKey<T> key(String value, KeyParser<T> parser) {
        return new AutoValue_ConfigKey<>(value, parser);
    }
278775
public Json.Object getObject(String key, Json.Object default_) {
    Object o = get(key);
    return (o instanceof JsonObject) ? (JsonObject)o : default_;
  }
465872
public final synchronized void initialize(Map<String,String> configuration)
    {
        if(this.initialized)
        {
            throw new FaxException("Request parser already initialized.");
        }
        
        //set flag
        this.initialized=true;
        
        //initialize
        this.initializeImpl(configuration);
    }