class JmsAuditEventHandlerFactory implements AuditEventHandlerFactory {

    @Override
    public AuditEventHandler create(AuditEventHandlerConfiguration configuration) throws AuditException {

        Map<String, Set<String>> attributes = configuration.getAttributes();

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

        handlerConfig.setBatch(getBatchPublisherConfig(attributes));
        handlerConfig.setDeliveryMode(getDeliveryModeConfig(attributes));
        handlerConfig.setJndi(getJndiConfig(attributes));
        handlerConfig.setSessionMode(getSessionModeConfig(attributes));

        try {
            return new JmsAuditEventHandler(null, handlerConfig, configuration.getEventTopicsMetaData());
        } catch (ResourceException e) {
            throw new AuditException(e);
        }
    }

}