Search in sources :

Example 1 with JdbcAuditEventHandler

use of org.forgerock.audit.handlers.jdbc.JdbcAuditEventHandler in project OpenAM by OpenRock.

the class JdbcAuditEventHandlerFactory method create.

@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));
}
Also used : Set(java.util.Set) JdbcAuditEventHandler(org.forgerock.audit.handlers.jdbc.JdbcAuditEventHandler) ArrayList(java.util.ArrayList) JdbcAuditEventHandlerConfiguration(org.forgerock.audit.handlers.jdbc.JdbcAuditEventHandlerConfiguration) TableMapping(org.forgerock.audit.handlers.jdbc.TableMapping)

Aggregations

ArrayList (java.util.ArrayList)1 Set (java.util.Set)1 JdbcAuditEventHandler (org.forgerock.audit.handlers.jdbc.JdbcAuditEventHandler)1 JdbcAuditEventHandlerConfiguration (org.forgerock.audit.handlers.jdbc.JdbcAuditEventHandlerConfiguration)1 TableMapping (org.forgerock.audit.handlers.jdbc.TableMapping)1