use of org.forgerock.audit.handlers.jdbc.TableMapping in project OpenAM by OpenRock.
the class JdbcAuditEventHandlerFactory method getTableMapping.
private TableMapping getTableMapping(String eventTopic, Map<String, Set<String>> attributes) {
TableMapping tableMapping = new TableMapping();
tableMapping.setEvent(eventTopic);
String tableName = getMapAttr(attributes, eventTopic + "EventTable");
if (isEmpty(tableName)) {
tableName = "am_audit" + eventTopic;
}
tableMapping.setTable(tableName);
Set<String> fieldToColumnSet = attributes.get(eventTopic + "EventColumns");
if (isEmpty(fieldToColumnSet)) {
fieldToColumnSet = JdbcFieldToColumnDefaultValues.getDefaultValues(eventTopic);
}
tableMapping.setFieldToColumn(MAP_VALUE_PARSER.parse(fieldToColumnSet));
return tableMapping;
}
use of org.forgerock.audit.handlers.jdbc.TableMapping 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));
}
Aggregations