Search in sources :

Example 1 with SyslogAuditEventHandlerConfiguration

use of org.forgerock.audit.handlers.syslog.SyslogAuditEventHandlerConfiguration in project OpenAM by OpenRock.

the class SyslogAuditEventHandlerFactory method create.

@Override
public AuditEventHandler create(AuditEventHandlerConfiguration configuration) throws AuditException {
    Map<String, Set<String>> attributes = configuration.getAttributes();
    SyslogAuditEventHandlerConfiguration syslogHandlerConfiguration = new SyslogAuditEventHandlerConfiguration();
    syslogHandlerConfiguration.setEnabled(getBooleanMapAttr(attributes, "enabled", true));
    syslogHandlerConfiguration.setName(configuration.getHandlerName());
    syslogHandlerConfiguration.setTopics(attributes.get("topics"));
    syslogHandlerConfiguration.setHost(getMapAttr(attributes, "host"));
    setPort(syslogHandlerConfiguration, attributes);
    String transportProtocol = getMapAttr(attributes, "transportProtocol");
    try {
        syslogHandlerConfiguration.setProtocol(TransportProtocol.valueOf(transportProtocol));
    } catch (IllegalArgumentException iae) {
        throw new AuditException("Attribute 'transportProtocol' is invalid: " + transportProtocol);
    }
    setConnectTimeout(syslogHandlerConfiguration, attributes);
    EventBufferingConfiguration eventBufferingConfiguration = new EventBufferingConfiguration();
    eventBufferingConfiguration.setEnabled(getBooleanMapAttr(attributes, "bufferingEnabled", true));
    syslogHandlerConfiguration.setBufferingConfiguration(eventBufferingConfiguration);
    String facility = getMapAttr(attributes, "facility");
    try {
        syslogHandlerConfiguration.setFacility(Facility.valueOf(facility));
    } catch (IllegalArgumentException iae) {
        throw new AuditException("Attribute 'facility' is invalid: " + facility);
    }
    return new SyslogAuditEventHandler(syslogHandlerConfiguration, configuration.getEventTopicsMetaData(), new ProductInfoProviderImpl(), new SyslogLocalHostNameProvider());
}
Also used : Set(java.util.Set) SyslogAuditEventHandlerConfiguration(org.forgerock.audit.handlers.syslog.SyslogAuditEventHandlerConfiguration) AuditException(org.forgerock.audit.AuditException) EventBufferingConfiguration(org.forgerock.audit.handlers.syslog.SyslogAuditEventHandlerConfiguration.EventBufferingConfiguration) SyslogAuditEventHandler(org.forgerock.audit.handlers.syslog.SyslogAuditEventHandler)

Aggregations

Set (java.util.Set)1 AuditException (org.forgerock.audit.AuditException)1 SyslogAuditEventHandler (org.forgerock.audit.handlers.syslog.SyslogAuditEventHandler)1 SyslogAuditEventHandlerConfiguration (org.forgerock.audit.handlers.syslog.SyslogAuditEventHandlerConfiguration)1 EventBufferingConfiguration (org.forgerock.audit.handlers.syslog.SyslogAuditEventHandlerConfiguration.EventBufferingConfiguration)1