初始化方法

@param configuration 外部适配器配置信息
550144
@Override
    public void init(OuterAdapterConfig configuration, Properties envProperties) {
        this.envProperties = envProperties;
        Map<String, MappingConfig> rdbMappingTmp = ConfigLoader.load(envProperties);
        // 过滤不匹配的key的配置
        rdbMappingTmp.forEach((key, mappingConfig) -> {
            if ((mappingConfig.getOuterAdapterKey() == null && configuration.getKey() == null)
                || (mappingConfig.getOuterAdapterKey() != null
                    && mappingConfig.getOuterAdapterKey().equalsIgnoreCase(configuration.getKey()))) {
                rdbMapping.put(key, mappingConfig);
            }
        });

        if (rdbMapping.isEmpty()) {
            throw new RuntimeException("No rdb adapter found for config key: " + configuration.getKey());
        }

        for (Map.Entry<String, MappingConfig> entry : rdbMapping.entrySet()) {
            String configName = entry.getKey();
            MappingConfig mappingConfig = entry.getValue();
            if (!mappingConfig.getDbMapping().getMirrorDb()) {
                String key;
                if (envProperties != null && !"tcp".equalsIgnoreCase(envProperties.getProperty("canal.conf.mode"))) {
                    key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "-"
                          + StringUtils.trimToEmpty(mappingConfig.getGroupId()) + "_"
                          + mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
                } else {
                    key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "_"
                          + mappingConfig.getDbMapping().getDatabase() + "-" + mappingConfig.getDbMapping().getTable();
                }
                Map<String, MappingConfig> configMap = mappingConfigCache.computeIfAbsent(key,
                    k1 -> new ConcurrentHashMap<>());
                configMap.put(configName, mappingConfig);
            } else {
                // mirrorDB
                String key = StringUtils.trimToEmpty(mappingConfig.getDestination()) + "."
                             + mappingConfig.getDbMapping().getDatabase();
                mirrorDbConfigCache.put(key, MirrorDbConfig.create(configName, mappingConfig));
            }
        }

        // 初始化连接池
        Map<String, String> properties = configuration.getProperties();
        dataSource = new DruidDataSource();
        dataSource.setDriverClassName(properties.get("jdbc.driverClassName"));
        dataSource.setUrl(properties.get("jdbc.url"));
        dataSource.setUsername(properties.get("jdbc.username"));
        dataSource.setPassword(properties.get("jdbc.password"));
        dataSource.setInitialSize(1);
        dataSource.setMinIdle(1);
        dataSource.setMaxActive(30);
        dataSource.setMaxWait(60000);
        dataSource.setTimeBetweenEvictionRunsMillis(60000);
        dataSource.setMinEvictableIdleTimeMillis(300000);
        dataSource.setUseUnfairLock(true);
        // List<String> array = new ArrayList<>();
        // array.add("set names utf8mb4;");
        // dataSource.setConnectionInitSqls(array);

        try {
            dataSource.init();
        } catch (SQLException e) {
            logger.error("ERROR ## failed to initial datasource: " + properties.get("jdbc.url"), e);
        }

        String threads = properties.get("threads");
        // String commitSize = properties.get("commitSize");

        boolean skipDupException = BooleanUtils
            .toBoolean(configuration.getProperties().getOrDefault("skipDupException", "true"));
        rdbSyncService = new RdbSyncService(dataSource,
            threads != null ? Integer.valueOf(threads) : null,
            skipDupException);

        rdbMirrorDbSyncService = new RdbMirrorDbSyncService(mirrorDbConfigCache,
            dataSource,
            threads != null ? Integer.valueOf(threads) : null,
            rdbSyncService.getColumnsTypeCache(),
            skipDupException);

        rdbConfigMonitor = new RdbConfigMonitor();
        rdbConfigMonitor.init(configuration.getKey(), this, envProperties);
    }
982202
@Override
	public void configure(Configuration parameters) {
		super.configure(parameters);

		if (charsetName == null || !Charset.isSupported(charsetName)) {
			throw new RuntimeException("Unsupported charset: " + charsetName);
		}
	}
1064597
public void setConfigurations(java.util.Collection<Configuration> configurations) {
        if (configurations == null) {
            this.configurations = null;
            return;
        }

        this.configurations = new java.util.ArrayList<Configuration>(configurations);
    }
787687
public boolean setCurrentConfiguration(CmsGitConfiguration configuration) {

        if ((null != configuration) && configuration.isValid()) {
            m_currentConfiguration = configuration;
            return true;
        }
        return false;
    }
1153587
private static void validateSetting(ConfigurationSetting setting) {
        Objects.requireNonNull(setting);

        if (setting.key() == null) {
            throw new IllegalArgumentException("Parameter 'key' is required and cannot be null.");
        }
    }
444062
@SuppressWarnings( "unchecked" )
    private static synchronized void configure(InputStream in) throws ConfigurationException
    {
        if( c_factories == null )
            c_factories = new HashMap<String, StopWatchFactory>();

        try
        {
            c_config.load(in);
        }
        catch (IOException e2)
        {
            throw new ConfigurationException(e2);
        }

        for( Enumeration<String> e = (Enumeration<String>) c_config.propertyNames(); e.hasMoreElements(); )
        {
            String key = e.nextElement();

            String[] components = key.split("\\.");

            if( components.length < 2 || !components[0].equals(PROPERTY_PREFIX) ) continue;

            String logger = components[1];

            StopWatchFactory swf = c_factories.get(logger);

            if( swf == null )
            {
                swf = new StopWatchFactory( instantiateLog(logger) );
            }

            //
            //  Call the respective setXXX() methods of the logger
            //  based on the configuration.
            //
            if( components.length > 2 )
            {
                String setting = components[2];

                String method = "set"+Character.toUpperCase(setting.charAt(0))+setting.substring(1);

                try
                {
                    SetterUtil.set( swf.getLog(), method, (String)c_config.get(key) );
                }
                catch( NoSuchMethodException e1 )
                {
                    log.warn("An unknown setting {} for logger {}, wasn't able to find {}.{}.  Continuing nevertheless.",
                             new Object[] {setting, logger, logger, method} );
                }
                catch (Exception e1)
                {
                    throw new ConfigurationException(e1);
                }
            }

            c_factories.put(logger, swf);
        }
    }
1127574
public final static String process(final String input, final Configuration configuration)
    {
        try
        {
            return process(new StringReader(input), configuration);
        }
        catch (final IOException e)
        {
            // This _can never_ happen
            return null;
        }
    }
408231
private boolean isPluginConfiguration(Configuration configuration) {
		return (configuration.containsKey(ID_KEY) && getPluginId() == configuration.getInt(ID_KEY))
				// To keep backwards compatibility check also the classname
				|| getClass().getCanonicalName().equals(configuration.getString(CLASSNAME_KEY, ""));
	}
366158
public static void init(Properties configuration) {

        for (Object prop : configuration.keySet()) {
            String serverPropertyName = (String) prop;
            System.setProperty(PROPERTY_PREFIX + serverPropertyName, configuration.getProperty(serverPropertyName));
        }

        // Read system properties
        LOG.info("Using configuration provided using '-D' parameter and/or default values");
        EsigateServer.port = getProperty(PROPERTY_PREFIX, "port", PROPERTY_DEFAULT_HTTP_PORT);
        EsigateServer.controlPort = getProperty(PROPERTY_PREFIX, "controlPort", PROPERTY_DEFAULT_CONTROL_PORT);
        EsigateServer.contextPath = getProperty(PROPERTY_PREFIX, "contextPath", "/");
        EsigateServer.extraClasspath = getProperty(PROPERTY_PREFIX, "extraClasspath", null);
        EsigateServer.maxThreads = getProperty(PROPERTY_PREFIX, "maxThreads", 500);
        EsigateServer.minThreads = getProperty(PROPERTY_PREFIX, "minThreads", 40);
        EsigateServer.outputBufferSize = getProperty(PROPERTY_PREFIX, "outputBufferSize", 8 * 1024);
        EsigateServer.idleTimeout = getProperty(PROPERTY_PREFIX, "idleTimeout", 30 * 1000);
        EsigateServer.sessionCookieName = getProperty(PROPERTY_PREFIX, "sessionCookieName", null);
    }
1178213
@Override
    public void configure(Properties configuration) {
        String u = configuration.getProperty(ANDROLOG_REPORTER_POST_URL);
        if (u == null) {
            Log.e(this, "The Property " + ANDROLOG_REPORTER_POST_URL
                    + " is mandatory");
            return;
        }
        try {
            url = new URL(u);
        } catch (MalformedURLException e) {
            Log.e(this, "The Property " + ANDROLOG_REPORTER_POST_URL
                    + " is not a valid url", e);
        }
    }
1267658
@Override
    protected void updateHTTPResponseHandlerConfiguration(Map<String,String> configuration)
    {
        //get property part
        String propertyPart=this.getPropertyPart();

        //modify configuration
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.SUBMIT_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"txn_ref");
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_PATH_PROPERTY_KEY.toString(),propertyPart),"status");
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_DETECTION_VALUE_PROPERTY_KEY.toString(),propertyPart),"error_");
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.GET_STATUS_JSON_OUTPUT_PROPERTY_KEY.toString(),propertyPart),"fax_status");
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.IN_PROGRESS_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"ongoing");
        configuration.put(MessageFormat.format(JSONHTTPResponseHandlerConfigurationConstants.ERROR_STATUS_MAPPING_PROPERTY_KEY.toString(),propertyPart),"unanswered;failed;busy");
    }
1277550
private void printConfig() {
        logger.debug("-----Configuration parameters:");
        for (String paramName : m_params.keySet()) {
            Object paramValue = m_params.get(paramName);
            printParam(paramName, paramValue, "");
        }
    }
66226
def configuration(*args, **kwargs):
    """"""
    try:
        config_kwargs = {'mapping_class': kwargs.pop('mapping_class')}
    except KeyError:
        config_kwargs = {}
    cm = ConfigurationManager(*args, **kwargs)
    return cm.get_config(**config_kwargs)
941086
def __parse(self, configuration):
        
        for entry in (
            "properties",
            "environment",
            "paths",
            "bundles",
            "components",
        ):
            # Check if current values must be reset
            reset_key = "reset_{0}".format(entry)

            # Compute the name of the method
            call_name = "add" if not configuration.get(reset_key) else "set"
            method = getattr(self.__state, "{0}_{1}".format(call_name, entry))

            # Update configuration
            method(configuration.get(entry))
155526
public void init(Configuration configuration) throws Exception {
        if (configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME) != null) {
            log.debug("Configuring context timeout with value ", configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME));
            try {
                contextTimeout = Long.parseLong(configuration.getBootstrapPropertyResolver().getProperty(CONTEXT_TIMEOUT_NAME));
            } catch (NumberFormatException e) {
                log.warn("Init parameter ", CONTEXT_TIMEOUT_NAME, " is not a parsable long, timeout will be ", " instead");
                contextTimeout = DEFAULT_CONTEXT_TIMEOUT;
            }
        }
    }
1011468
public void storeState(final Configuration configuration) {
        // clear properties from vertex program
        Set<String> oldKeys = new HashSet<>();
        configuration.subset(PREFIX_SELECTED_TYPE_KEY).getKeys()
                .forEachRemaining(key -> oldKeys.add(PREFIX_SELECTED_TYPE_KEY + "." + key));
        oldKeys.forEach(configuration::clearProperty);

        // store selectedTypes
        selectedTypes.forEach(typeId ->
                configuration.addProperty(PREFIX_SELECTED_TYPE_KEY + "." + typeId, typeId));

        // store user specified properties
        persistentProperties.forEach((key, value) ->
                configuration.addProperty(PREFIX_PERSISTENT_PROPERTIES + "." + key, value));
    }
1184085
@Override
	public void configure(Configuration parameters) {
		boolean needConfigure = isFieldNullOrEmpty(this.query) || isFieldNullOrEmpty(this.dbURL);
		if (needConfigure) {
			this.driverName = parameters.getString(DRIVER_KEY, null);
			this.username = parameters.getString(USERNAME_KEY, null);
			this.password = parameters.getString(PASSWORD_KEY, null);
			this.query = parameters.getString(QUERY_KEY, null);
			this.dbURL = parameters.getString(URL_KEY, null);
		}

		try {
			prepareQueryExecution();
		} catch (SQLException e) {
			throw new IllegalArgumentException("Configure failed:\t!", e);
		}
	}