org.wildfly.swarm.config.management.access.InMemoryHandler Maven / Gradle / Ivy
package org.wildfly.swarm.config.management.access;
import org.wildfly.swarm.config.runtime.AttributeDocumentation;
import org.wildfly.swarm.config.runtime.ResourceDocumentation;
import org.wildfly.swarm.config.runtime.SingletonResource;
import org.wildfly.swarm.config.runtime.Address;
import org.wildfly.swarm.config.runtime.ResourceType;
import java.beans.PropertyChangeSupport;
import java.beans.PropertyChangeListener;
import org.wildfly.swarm.config.runtime.ModelNodeBinding;
/**
* A in-memory handler for use with the management audit logging service.
*/
@Address("/core-service=management/access=audit/in-memory-handler=*")
@ResourceType("in-memory-handler")
public class InMemoryHandler>
implements
org.wildfly.swarm.config.runtime.Keyed {
private String key;
private PropertyChangeSupport pcs;
@AttributeDocumentation("The maximum number of operation stored in history for this handler.")
private Integer maxHistory;
public InMemoryHandler(java.lang.String key) {
super();
this.key = key;
}
public String getKey() {
return this.key;
}
/**
* Adds a property change listener
*/
public void addPropertyChangeListener(PropertyChangeListener listener) {
if (null == this.pcs)
this.pcs = new PropertyChangeSupport(this);
this.pcs.addPropertyChangeListener(listener);
}
/**
* Removes a property change listener
*/
public void removePropertyChangeListener(
java.beans.PropertyChangeListener listener) {
if (this.pcs != null)
this.pcs.removePropertyChangeListener(listener);
}
/**
* The maximum number of operation stored in history for this handler.
*/
@ModelNodeBinding(detypedName = "max-history")
public Integer maxHistory() {
return this.maxHistory;
}
/**
* The maximum number of operation stored in history for this handler.
*/
@SuppressWarnings("unchecked")
public T maxHistory(java.lang.Integer value) {
Object oldValue = this.maxHistory;
this.maxHistory = value;
if (this.pcs != null)
this.pcs.firePropertyChange("maxHistory", oldValue, value);
return (T) this;
}
}