class JdbcAuditEventHandlerFactory implements AuditEventHandlerFactory {

    @Override
    public AuditEventHandler create(AuditEventHandlerConfiguration configuration) throws AuditException {
        Map<String, Set<String>> attributes = configuration.getAttributes();

        JdbcAuditEventHandlerConfiguration handlerConfig = new JdbcAuditEventHandlerConfiguration();
        handlerConfig.setTopics(attributes.get("topics"));
        handlerConfig.setName(configuration.getHandlerName());
        handlerConfig.setEnabled(getBooleanMapAttr(attributes, "enabled", false));
        handlerConfig.setDatabaseType(getMapAttr(attributes, "databaseType"));

        List<TableMapping> tableMappings = new ArrayList<>();
        tableMappings.add(getTableMapping(AUTHENTICATION_TOPIC, attributes));
        tableMappings.add(getTableMapping(ACTIVITY_TOPIC, attributes));
        tableMappings.add(getTableMapping(ACCESS_TOPIC, attributes));
        tableMappings.add(getTableMapping(CONFIG_TOPIC, attributes));
        handlerConfig.setTableMappings(tableMappings);

        handlerConfig.setBufferingConfiguration(getBufferingConfiguration(attributes));

        return new JdbcAuditEventHandler(handlerConfig, configuration.getEventTopicsMetaData(),
                getDataSource(attributes));
    }

}