class SyslogAuditEventHandlerFactory implements AuditEventHandlerFactory {

    @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);
        }
        //Severity Field Mappings intentionally not set.

        return new SyslogAuditEventHandler(syslogHandlerConfiguration, configuration.getEventTopicsMetaData(),
                new ProductInfoProviderImpl(), new SyslogLocalHostNameProvider());
    }

}