Package org.forgerock.am.config
Class Listener
- java.lang.Object
-
- org.forgerock.am.config.Listener
-
public abstract class Listener extends Object
Builder responsible for providing fluent-like functions for building up Action instances which will respond to changes in Service configuration.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
Listener.Action
A generic listener which will respond to a configuration or schema change event.protected static class
Listener.ConfigType
static class
Listener.ServiceListenerEvent
Represents an event provided to a service listener.
-
Field Summary
Fields Modifier and Type Field Description protected com.google.common.collect.ArrayListMultimap<Listener.ConfigType,Listener.Action>
actions
protected Map<Listener.ServiceListenerEvent,Collection<Consumer<Realm>>>
realmActions
-
Constructor Summary
Constructors Constructor Description Listener()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract void
listen()
Start the listener.Listener
onGlobalChange(Listener.Action action)
Adds an action to be invoked when the global configuration changes for the service.Listener
onRealmChange(Consumer<Realm> action)
Adds an action to be invoked if the requested service changes for a realm.Listener
onRealmChange(Consumer<Realm> action, Listener.ServiceListenerEvent... events)
Adds an action to be invoked if the requested service changes for a realm.Listener
onRealmChange(Listener.Action action)
Adds an action to be invoked when the requested service's realm level configuration changes.Listener
onSchemaChange(Listener.Action action)
Adds an action to be invoked when the requested service's schema changes.
-
-
-
Field Detail
-
actions
protected final com.google.common.collect.ArrayListMultimap<Listener.ConfigType,Listener.Action> actions
-
realmActions
protected final Map<Listener.ServiceListenerEvent,Collection<Consumer<Realm>>> realmActions
-
-
Method Detail
-
onGlobalChange
public Listener onGlobalChange(Listener.Action action)
Adds an action to be invoked when the global configuration changes for the service. Applies to all event types.- Parameters:
action
- The action to perform when the change happens.- Returns:
- This builder.
-
onRealmChange
public Listener onRealmChange(Listener.Action action)
Adds an action to be invoked when the requested service's realm level configuration changes. Applies to all event types.- Parameters:
action
- The action to perform when the change happens.- Returns:
- This builder.
-
onRealmChange
public Listener onRealmChange(Consumer<Realm> action)
Adds an action to be invoked if the requested service changes for a realm. Applies to all event types.- Parameters:
action
- The consumer to invoke with the realm.- Returns:
- This builder.
-
onRealmChange
public Listener onRealmChange(Consumer<Realm> action, Listener.ServiceListenerEvent... events)
Adds an action to be invoked if the requested service changes for a realm. Applies to the specified event types.- Parameters:
action
- The consumer to invoke with the realm.events
- The events to trigger the consumer for.- Returns:
- This builder.
-
onSchemaChange
public Listener onSchemaChange(Listener.Action action)
Adds an action to be invoked when the requested service's schema changes. Applies to all event types.- Parameters:
action
- The action to perform when the change happens.- Returns:
- This builder.
-
listen
public abstract void listen()
Start the listener.
-
-