Source:
private void initializeConnector(String connectorName, Properties connectorProperties) { LOG.info("Starting to load connector: " + connectorName); VerifiableProperties connectorProps = new VerifiableProperties(connectorProperties); String className = connectorProperties.getProperty(CONFIG_CONNECTOR_FACTORY_CLASS_NAME, ""); if (StringUtils.isBlank(className)) { String errorMessage = "Factory className is empty for connector " + connectorName; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } ConnectorFactory connectorFactoryInstance = ReflectionUtils.createInstance(className); if (connectorFactoryInstance == null) { String msg = "Invalid class name or no parameter-less constructor, class=" + className; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, msg, null); } Connector connectorInstance = connectorFactoryInstance.createConnector(connectorName, connectorProperties); String bootstrapConnector = connectorProperties.getProperty(CONFIG_CONNECTOR_BOOTSTRAP_TYPE, ""); if (!bootstrapConnector.isEmpty()) { _bootstrapConnectors.put(connectorName, bootstrapConnector); } AssignmentStrategyFactory assignmentStrategyFactoryInstance = null; String strategyFactory = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY_FACTORY, ""); if (!strategyFactory.isEmpty()) { assignmentStrategyFactoryInstance = ReflectionUtils.createInstance(strategyFactory); } if (assignmentStrategyFactoryInstance == null) { String errorMessage = "Invalid strategy factory class: " + strategyFactory; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } Properties strategyProps = connectorProps.getDomainProperties(STRATEGY_DOMAIN); AssignmentStrategy assignmentStrategy = assignmentStrategyFactoryInstance.createStrategy(strategyProps); boolean customCheckpointing = Boolean.parseBoolean(connectorProperties.getProperty(CONFIG_CONNECTOR_CUSTOM_CHECKPOINTING, "false")); _coordinator.addConnector(connectorName, connectorInstance, assignmentStrategy, customCheckpointing); String packageName = connectorInstance.getClass().getPackage().getName(); String resourceFactoryClass = connectorProperties.getProperty(CONFIG_CONNECTOR_RESTLI_RESOURCE_FACTORY, null); _resourceFactory.addResourceFactory(packageName, resourceFactoryClass); LOG.info("Connector loaded successfully. Type: " + connectorName); }

Target:
private void initializeConnector(String connectorName, Properties connectorProperties) { LOG.info("Starting to load connector: " + connectorName); VerifiableProperties connectorProps = new VerifiableProperties(connectorProperties); String className = connectorProperties.getProperty(CONFIG_CONNECTOR_FACTORY_CLASS_NAME, ""); if (StringUtils.isBlank(className)) { String errorMessage = "Factory className is empty for connector " + connectorName; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } ConnectorFactory connectorFactoryInstance = ReflectionUtils.createInstance(className); if (connectorFactoryInstance == null) { String msg = "Invalid class name or no parameter-less constructor, class=" + className; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, msg, null); } Connector connectorInstance = connectorFactoryInstance.createConnector(connectorName, connectorProperties); String bootstrapConnector = connectorProperties.getProperty(CONFIG_CONNECTOR_BOOTSTRAP_TYPE, ""); if (!bootstrapConnector.isEmpty()) { _bootstrapConnectors.put(connectorName, bootstrapConnector); } AssignmentStrategyFactory assignmentStrategyFactoryInstance = null; String strategyFactory = connectorProperties.getProperty(CONFIG_CONNECTOR_ASSIGNMENT_STRATEGY_FACTORY, ""); if (!strategyFactory.isEmpty()) { assignmentStrategyFactoryInstance = ReflectionUtils.createInstance(strategyFactory); } if (assignmentStrategyFactoryInstance == null) { String errorMessage = "Invalid strategy factory class: " + strategyFactory; ErrorLogger.logAndThrowDatastreamRuntimeException(LOG, errorMessage, null); } Properties strategyProps = connectorProps.getDomainProperties(STRATEGY_DOMAIN); AssignmentStrategy assignmentStrategy = assignmentStrategyFactoryInstance.createStrategy(strategyProps); boolean customCheckpointing = Boolean.parseBoolean(connectorProperties.getProperty(CONFIG_CONNECTOR_CUSTOM_CHECKPOINTING, "false")); _coordinator.addConnector(connectorName, connectorInstance, assignmentStrategy, customCheckpointing); _resourceFactory.addRestHandlers(connectorInstance.getRestHandlers()); LOG.info("Connector loaded successfully. Type: " + connectorName); }