001/* 002 * The contents of this file are subject to the terms of the Common Development and 003 * Distribution License (the License). You may not use this file except in compliance with the 004 * License. 005 * 006 * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the 007 * specific language governing permission and limitations under the License. 008 * 009 * When distributing Covered Software, include this CDDL Header Notice in each file and include 010 * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL 011 * Header, with the fields enclosed by brackets [] replaced by your own identifying 012 * information: "Portions copyright [year] [name of copyright owner]". 013 * 014 * Copyright 2015 ForgeRock AS. 015 */ 016package org.forgerock.audit.events.handlers; 017 018import java.util.Set; 019 020import com.fasterxml.jackson.annotation.JsonPropertyDescription; 021/** 022 * Base class for audit event handler configuration. 023 */ 024public abstract class EventHandlerConfiguration { 025 026 /** Whether or not this handler is enabled. */ 027 @JsonPropertyDescription("audit.handlers.all.enabled") 028 private boolean enabled = true; 029 030 /** Name of this audit event handler. */ 031 @JsonPropertyDescription("audit.handlers.all.name") 032 private String name; 033 034 /** The set of topics that this audit event handler accepts. */ 035 @JsonPropertyDescription("audit.handlers.all.topics") 036 private Set<String> topics; 037 038 /** 039 * Checks if the audit event handler is enabled. 040 * @return 041 * True - If the audit event handler is enabled. 042 * False - If the audit event handler is disabled. 043 */ 044 public boolean isEnabled() { 045 return enabled; 046 } 047 048 /** 049 * Sets the enabled flag for an audit event handler. 050 * @param enabled 051 * True - Enable the audit event handler. 052 * False - Disable the audit event handler. 053 */ 054 public void setEnabled(final boolean enabled) { 055 this.enabled = enabled; 056 } 057 058 /** 059 * Returns the name of this handler. 060 * 061 * @return the name 062 */ 063 public String getName() { 064 return name; 065 } 066 067 /** 068 * Sets the name of this handler. 069 * 070 * @param name 071 * The name 072 */ 073 public void setName(String name) { 074 this.name = name; 075 } 076 077 /** 078 * Returns the names of the topics accepted by this handler. 079 * 080 * @return the set of topic names 081 */ 082 public Set<String> getTopics() { 083 return topics; 084 } 085 086 /** 087 * Sets the topics accepted by this handler. 088 * 089 * @param topics 090 * The names of all accepted topics 091 */ 092 public void setTopics(Set<String> topics) { 093 this.topics = topics; 094 } 095}