Source:
private void initializeConnector(String connectorStr, Properties connectorProperties) throws DatastreamException { LOG.info("Starting to load connector: " + connectorStr); try { String className = connectorProperties.getProperty(CONFIG_CONNECTOR_FACTORY_CLASS_NAME, ""); if (StringUtils.isBlank(className)) { throw new DatastreamException("Factory className is empty for connector " + connectorStr); } ConnectorFactory connectorFactoryInstance = ReflectionUtils.createInstance(className); if (connectorFactoryInstance == null) { String msg = "Invalid class name or no parameter-less constructor, class=" + className; LOG.error(msg); throw new DatastreamException(msg); } Connector connectorInstance = connectorFactoryInstance.createConnector(connectorProperties); 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 = null; String strategy = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY, ""); if (!strategy.isEmpty()) { assignmentStrategyInstance = ReflectionUtils.createInstance(strategy); LOG.warn("Invalid strategy class: " + strategy); } if (assignmentStrategyInstance == null) { assignmentStrategyInstance = new SimpleStrategy(); } _coordinator.addConnector(connectorInstance, assignmentStrategyInstance); } catch (Exception ex) { LOG.error(String.format("Instantiating connector %s failed with exception", connectorStr, ex)); throw new DatastreamException("Failed to instantiate connector: " + connectorStr, ex); } LOG.info("Connector loaded successfully. Type: " + connectorStr); }

Target:
private void initializeConnector(String connectorStr, Properties connectorProperties) throws DatastreamException { LOG.info("Starting to load connector: " + connectorStr); try { String className = connectorProperties.getProperty(CONFIG_CONNECTOR_FACTORY_CLASS_NAME, ""); if (StringUtils.isBlank(className)) { throw new DatastreamException("Factory className is empty for connector " + connectorStr); } ConnectorFactory connectorFactoryInstance = ReflectionUtils.createInstance(className); if (connectorFactoryInstance == null) { String msg = "Invalid class name or no parameter-less constructor, class=" + className; LOG.error(msg); throw new DatastreamException(msg); } Connector connectorInstance = connectorFactoryInstance.createConnector(connectorProperties); 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 = null; String strategy = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY, ""); if (!strategy.isEmpty()) { assignmentStrategyInstance = ReflectionUtils.createInstance(strategy); if (assignmentStrategyInstance == null) { LOG.warn("Invalid strategy class: " + strategy); } } if (assignmentStrategyInstance == null) { assignmentStrategyInstance = new SimpleStrategy(); } _coordinator.addConnector(connectorInstance, assignmentStrategyInstance); } catch (Exception ex) { LOG.error(String.format("Instantiating connector %s failed with exception", connectorStr, ex)); throw new DatastreamException("Failed to instantiate connector: " + connectorStr, ex); } LOG.info("Connector loaded successfully. Type: " + connectorStr); }