/** * Tries to create a Connector for a given connector configuration name. * * @param connectorConfigurationName the name of the connector configuration * @return the connector if it could be created and initialized without error, otherwise null */ final Connector createConnector(final String connectorConfigurationName) { Map<String, String> propertyMap = this.getPropertiesForConnectorConfigurationName(connectorConfigurationName); String type = propertyMap.get(TraceeContextLoggerConstants.SYSTEM_PROPERTY_CONTEXT_LOGGER_CONNECTOR_TYPE); // get canonical class name for well known connectors if (WELL_KNOW_CONNECTOR_MAPPINGS.containsKey(type)) { type = WELL_KNOW_CONNECTOR_MAPPINGS.get(type); } try { // try to create connector instance Connector connector = (Connector) Class.forName(type).newInstance(); // now try to call init method connector.init(propertyMap); return connector; } catch (Exception e) { LOGGER.error("An error occurred while creating connector with name '" + connectorConfigurationName + "' of type '" + type + "'", e); } return null; }