Source:
<code>private void initializeConnector(String connectorStr, Properties connectorProperties) throws DatastreamException { LOG.info("Starting to load connector: " + connectorStr); try { <START> String className = connectorProperties.getProperty(CONFIG_CONNECTOR_CLASS_NAME, ""); <END> if (StringUtils.isBlank(className)) { throw new DatastreamException("className is empty for connector " + connectorStr); } Class connectorClass = _classLoader.loadClass(className); Connector connectorInstance; try { Constructor<Connector> constructor = connectorClass.getConstructor(Properties.class); connectorInstance = constructor.newInstance(connectorProperties); } catch (NoSuchMethodException e) { LOG.warn("No consturctor found with Properties.class as parameter. Will create connector instance without config."); connectorInstance = (Connector) connectorClass.newInstance(); } String bootstrapConnector = connectorProperties.getProperty(CONFIG_CONNECTOR_BOOTSTRAP_TYPE, ""); if (!bootstrapConnector.isEmpty()) { _bootstrapConnectors.put(connectorStr, bootstrapConnector); } AssignmentStrategy assignmentStrategyInstance; String strategy = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY, ""); if (!strategy.isEmpty()) { Class assignmentStrategyClass = _classLoader.loadClass(strategy); assignmentStrategyInstance = (AssignmentStrategy) assignmentStrategyClass.newInstance(); } else { assignmentStrategyInstance = new SimpleStrategy(); } _coordinator.addConnector(connectorInstance, assignmentStrategyInstance); } catch (Exception ex) { throw new DatastreamException("Failed to instantiate connector: " + connectorStr, ex); } LOG.info("Connector loaded successfully. Type: " + connectorStr); }</code><technical_language>I need a config management, This config keys litter code. extremely hard figure out modules need config</technical_language>

Target:
private void initializeConnector(String connectorStr, Properties connectorProperties) throws DatastreamException { LOG.info("Starting to load connector: " + connectorStr); try { String className = connectorProperties.getProperty(CONFIG_CONNECTOR_CLASS_NAME, ""); if (StringUtils.isBlank(className)) { throw new DatastreamException("className is empty for connector " + connectorStr); } Class connectorClass = _classLoader.loadClass(className); Connector connectorInstance; try { Constructor<Connector> constructor = connectorClass.getConstructor(Properties.class); connectorInstance = constructor.newInstance(connectorProperties); } catch (NoSuchMethodException e) { LOG.warn("No consturctor found with Properties.class as parameter. Will create connector instance without config."); connectorInstance = (Connector) connectorClass.newInstance(); } if (!connectorInstance.getConnectorType().equals(connectorStr)) { throw new DatastreamException(String.format("Wrong connector type for %s, expected: %s actual: %s", className, connectorStr, connectorInstance.getConnectorType())); } String bootstrapConnector = connectorProperties.getProperty(CONFIG_CONNECTOR_BOOTSTRAP_TYPE, ""); if (!bootstrapConnector.isEmpty()) { _bootstrapConnectors.put(connectorStr, bootstrapConnector); } AssignmentStrategy assignmentStrategyInstance; String strategy = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY, ""); if (!strategy.isEmpty()) { Class assignmentStrategyClass = _classLoader.loadClass(strategy); assignmentStrategyInstance = (AssignmentStrategy) assignmentStrategyClass.newInstance(); } else { assignmentStrategyInstance = new SimpleStrategy(); } _coordinator.addConnector(connectorInstance, assignmentStrategyInstance); } catch (Exception ex) { throw new DatastreamException("Failed to instantiate connector: " + connectorStr, ex); } LOG.info("Connector loaded successfully. Type: " + connectorStr); }