Instantiate a new ResourceAdapter and set each <config-property> on it.

@return configured resource adapter.
@throws Exception if an error occurs during configuration and onError=FAIL
179816
@FFDCIgnore(value = { NumberFormatException.class, Throwable.class })
    private ResourceAdapter configureResourceAdapter() throws Exception {
        final boolean trace = TraceComponent.isAnyTracingEnabled();

        String resourceAdapterClassName = (String) properties.get(RESOURCE_ADAPTER_CLASS);
        if (resourceAdapterClassName == null)
            return null;
        ResourceAdapter instance = (ResourceAdapter) loadClass(resourceAdapterClassName).newInstance();

        // Assume all configured properties are invalid until we find them
        Set<String> invalidPropNames = new HashSet<String>();
        for (Enumeration<String> names = properties.keys(); names.hasMoreElements();) {
            String name = names.nextElement();
            if (!INTERNAL_PROPS.contains(name) && !Constants.OBJECTCLASS.equals(name) && name.indexOf('.') < 0 && name.indexOf('-') < 0 && !name.endsWith("Ref"))
                invalidPropNames.add(name);
        }

        Class<?> objectClass = instance.getClass();
        for (PropertyDescriptor descriptor : Introspector.getBeanInfo(objectClass).getPropertyDescriptors()) {
            String name = MetatypeGenerator.toCamelCase(descriptor.getName());
            Object value = properties.get(name);
            propertyDescriptors.put(name, descriptor);

            if (value != null)
                try {
                    invalidPropNames.remove(name);

                    boolean isProtectedString = value instanceof SerializableProtectedString;
                    if (isProtectedString)
                        value = new String(((SerializableProtectedString) value).getChars());
                    if (value instanceof String && name.toUpperCase().indexOf("PASSWORD") >= 0) {
                        value = PasswordUtil.getCryptoAlgorithm((String) value) == null ? value : PasswordUtil.decode((String) value);
                        isProtectedString = true;
                    }
                    if (trace && tc.isDebugEnabled())
                        Tr.debug(tc, "set " + name + '=' + (isProtectedString ? "***" : value));

                    Class<?> type = descriptor.getPropertyType();
                    Method writeMethod = descriptor.getWriteMethod();

                    // Some ra.xml files specify everything as String even when that's not true. If so, try to convert it:
                    if (value instanceof String) {
                        if (!type.isAssignableFrom(value.getClass()))
                            try {
                                value = Utils.convert((String) value, type);
                            } catch (NumberFormatException numFormatX) {
                                // If the property type can't be converted to what the bean info wants,
                                // then go looking for a matching method of the proper type (that isn't on the bean info).
                                try {
                                    writeMethod = objectClass.getMethod(writeMethod.getName(), String.class);
                                } catch (NoSuchMethodException x) {
                                    throw numFormatX;
                                }
                            }
                    }
                    // Allow the metatype to use primitive types instead of String, in which case we can easily convert to String:
                    else if (String.class.equals(type))
                        value = value.toString();
                    // When ibm:type="duration" is used, we always get Long. If necessary, convert to another numeric type:
                    else if (value instanceof Number && !type.isAssignableFrom(value.getClass()))
                        value = Utils.convert((Number) value, type);

                    writeMethod.invoke(instance, value);
                } catch (Throwable x) {
                    x = x instanceof InvocationTargetException ? x.getCause() : x;
                    x = Utils.ignoreWarnOrFail(tc, x, x.getClass(), "J2CA8500.config.prop.error", name, getConfigElementName(), objectClass.getName(), x);
                    if (x != null) {
                        InvalidPropertyException propX = new InvalidPropertyException(name, x);
                        propX.setInvalidPropertyDescriptors(new PropertyDescriptor[] { descriptor });
                        FFDCFilter.processException(propX, getClass().getName(), "239");
                        throw propX;
                    }
                }
        }

        // Invalid properties
        for (String name : invalidPropNames) {
            InvalidPropertyException x = Utils.ignoreWarnOrFail(tc, null, InvalidPropertyException.class, "J2CA8501.config.prop.unknown",
                                                                name, getConfigElementName(), objectClass.getName());
            if (x != null) {
                FFDCFilter.processException(x, Utils.class.getName(), "249");
                throw x;
            }
        }
        if (bvalHelper != null) {
            ResourceAdapterMetaData raMetaData = resourceAdapterSvc.getResourceAdapterMetaData();
            if (raMetaData != null) {
                bvalHelper.validateInstance(raMetaData.getModuleMetaData(), resourceAdapterSvc.getClassLoader(), instance);
            }
        }
        return instance;
    }
40739
@Override
    public T setResourceAdapterXML(String resourceName) throws IllegalArgumentException {
        Validate.notNull(resourceName, "ResourceName must be specified");
        return setResourceAdapterXML(new ClassLoaderAsset(resourceName));

    }
698296
private Object getDefaultJavaCompObjectInstance(NamingConstants.JavaColonNamespace namespace,
                                                    String bindingName,
                                                    ResourceInfo resourceRefInfo) throws Exception {
        String name = namespace.unprefix(bindingName);
        // Use a filter that ignores an extra service for the supertype that config processing code creates
        // with the properties of the subtype (currently the extra service is required to support ibm:extends)
        StringBuilder filter = new StringBuilder("(&")
                        .append(FilterUtils.createPropertyFilter(com.ibm.ws.resource.ResourceFactory.JAVA_COMP_DEFAULT_NAME, name))
                        .append("(!(ibm.extends.source.factoryPid=*))")
                        .append(')');
        return createResourceWithFilter(filter.toString(), resourceRefInfo);
    }
291251
protected org.apache.commons.configuration.Configuration getConfiguration() {
        try {
            return ApplicationProperties.get();
        } catch (AtlasException e) {
            throw new RuntimeException("Unable to load configuration: " + ApplicationProperties.APPLICATION_PROPERTIES);
        }
    }
321842
private void registerModelAdapter() {
        Dictionary<String, Object> properties = createResourceToModelAdapterProperties();
        String serviceClassName = AdapterFactory.class.getName();
        this.resourceToModelAdapterRegistration = this.context.registerService(serviceClassName, this.adapter, properties);
    }
1035833
public void init(Configuration configuration)
			throws Exception
	{
		LOGGER.debug("Initializing AbstractBundleInterceptor");

		localizationBundleFactory = configuration.getLocalizationBundleFactory();

		findResourceBundleFactory(configuration);
	}
1197167
@CheckResult
    @NonNull
    public static PowerAdapter asAdapter(@NonNull @LayoutRes int... resources) {
        return new ItemAdapter(toItems(checkNotNull(resources, "resources")));
    }
107687
public function getAdapter($name = null)
    {
        if (null === $name) {
            $name = $this->getDefaultDatasource();
        }
        if (!isset($this->adapters[$name])) {
            if (!isset($this->adapterClasses[$name])) {
                throw new AdapterException(sprintf('No adapter class defined for datasource "%s"', $name));
            }
            $this->adapters[$name] = AdapterFactory::create($this->adapterClasses[$name]);
        }

        return $this->adapters[$name];
    }
760892
public Config createAdaptorRuntime(SchedulerStateManagerAdaptor adaptor) {
    return Config.newBuilder()
        .put(Key.SCHEDULER_STATE_MANAGER_ADAPTOR, adaptor).build();
  }
46995
public void init(Configuration configuration)
			throws Exception
	{
		String baseName = configuration.getBootstrapPropertyResolver().getProperty("ResourceBundleFactory.Bundle");
		if (baseName != null)
		{
			this.baseName = baseName;
		}
	}
830846
private function createAdapter()
    {
        if (null === $this->adapter) {
            if (isset(static::$adaptersAvailable[$this->config['engine']])) {
                $rendererClassName = static::$adaptersAvailable[$this->config['engine']];
                $this->adapter = new $rendererClassName($this);
            } else {
                throw new ComponentConfigException([
                    ComponentConfigException::INVALID_PARAMETER_VALUE,
                    $this, 'engine', $this->config['engine']
                ]);
            }
        }
    }
1116742
@PostConstruct
    public void init() throws Exception {

        if (hosts == null) {
            throw new IllegalArgumentException("Hosts property not set ");
        }

        determineHostsAsProperty();

        /**
         * quick fix for integration tests. if hosts property set to "embedded" then a local node is start.
         * maven dependencies need to be defined correctly for this to work
         */

        if (hosts.startsWith("embedded")) {
            synchronized (SYNC) {
                if (node == null) {
                    node = new ElasticsearchEmbeddedNode();
                }
            }
            client = node.getClient();
        } else {
            String[] hostsArray = hosts.split(",");
            Settings settings = ImmutableSettings.settingsBuilder().put("cluster.name", cluster).build();
            client = new TransportClient(settings);

            for (String aHostsArray : hostsArray) {
                String s = aHostsArray.trim();
                String[] host = s.split(":");

                if (log.isLoggable(Level.FINE)) {
                    log.fine(" Connecting to elasticsearch host. [" + host[0] + ":" + host[1] + "]");
                }

                client = ((TransportClient)client).addTransportAddress(new InetSocketTransportAddress(host[0],
                        new Integer(host[1])));
            }
        }
    }
421872
public void init() throws Exception {
        userDir = new File(System.getProperty("user.dir")).getAbsolutePath();
        System.setProperty("user.dir", options.getExecutionDirectory().getAbsolutePath());

        if (!cfg.exists()) {

            ConfigurationManager manager = new ConfigurationManager(cfg, false, locateConfigurationProvider());

            try {

                manager.runProjectConfigurationInitializers();

                if (options.isVerbose()) {
                    log.info("CONFIGURATION FILE [" + cfg.getAbsolutePath() + "] CREATION COMPLETE");
                }

            } catch (IOException aux) {
                if (options.isVerbose()) {
                    log.error("The system can't create the file [ " + cfg.getAbsolutePath() + "]");
                }
                if (options.isThrowException()) {
                    System.setProperty("user.dir", userDir);
                    throw aux;
                }
            }

        } else {
            if (options.isVerbose()) {
                log.error("The configuration file [" + cfg.getAbsolutePath() + "] already exists");
            }
        }
        System.setProperty("user.dir", userDir);
    }
995073
private static <E extends PreferenceTypeAdapter<?, ?>> E generateAdapter(Class<E> clazz) {
		E adapter;
		try {
			lock.lock();
			adapter = clazz.newInstance();
			cache.put(clazz, adapter);
		} catch (Throwable e) {
			throw (new KriptonRuntimeException(e));
		} finally {
			lock.unlock();
		}
		return adapter;
	}
1113844
private Object createDefaultResource(String className, ResourceInfo resourceRefInfo) throws Exception {
        if (className != null) {
            String javaCompDefaultFilter = "(" + com.ibm.ws.resource.ResourceFactory.JAVA_COMP_DEFAULT_NAME + "=*)";
            String createsFilter = FilterUtils.createPropertyFilter(ResourceFactory.CREATES_OBJECT_CLASS, className);
            String filter = "(&" + javaCompDefaultFilter + createsFilter + ")";
            return createResourceWithFilter(filter, resourceRefInfo);
        }
        return null;
    }
468642
public static synchronized Properties getConfig() {
        if (config == null) {
            try {
                String rpcConfig = "config/rpc-config.properties";
                InputStream ins = SofaConfigs.class.getClassLoader().getResourceAsStream(rpcConfig);
                if (ins == null) {
                    ins = Thread.currentThread().getContextClassLoader()
                        .getResourceAsStream(rpcConfig);
                }

                config = new Properties();
                config.load(ins);
            } catch (Exception e) {
                config = new Properties();
                if (LOGGER.isDebugEnabled()) {
                    LOGGER.debug(LogCodes.getLog(LogCodes.ERROR_RPC_CONFIG_LOAD));
                }
            }
        }

        return config;
    }
355281
@Override
  public final synchronized void init() throws Exception {
    FactoryBldAccServices<ResultSet> factoryBldAccServices =
      new FactoryBldAccServices<ResultSet>();
    factoryBldAccServices.setFactoryAppBeans(this);
    setFactoryBldServices(factoryBldAccServices);
    FactoryAccServices<ResultSet> factoryAccServices =
      new FactoryAccServices<ResultSet>();
    factoryAccServices.setFactoryAppBeans(this);
    factoryAccServices.setFactoryBldAccServices(factoryBldAccServices);
    factoryBldAccServices.setFactoryAccServices(factoryAccServices);
    setFactoryOverBeans(factoryAccServices);
    FactoryAccReplicatorXmlHttps<ResultSet> factoryReplicatorXmlHttps =
      new FactoryAccReplicatorXmlHttps<ResultSet>();
    factoryReplicatorXmlHttps.setFactoryAppBeans(this);
    setFactoryReplicatorXmlHttps(factoryReplicatorXmlHttps);
    FactoryAccDatabaseWriterXml<ResultSet> factoryDatabaseWriterXml =
      new FactoryAccDatabaseWriterXml<ResultSet>();
    factoryDatabaseWriterXml.setFactoryAppBeans(this);
    setFactoryDatabaseWriterXml(factoryDatabaseWriterXml);
  }