All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.wildfly.swarm.config.elytron.AggregatePrincipalTransformer Maven / Gradle / Ivy

The newest version!
package org.wildfly.swarm.config.elytron;

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;
import java.util.List;
import java.util.Arrays;
import java.util.stream.Collectors;

/**
 * A principal transformer aggregating more principal transformers. Original
 * principal is tried to be transformed by individual transformers until one
 * return non-null principal - that is returned.
 */
@Address("/subsystem=elytron/aggregate-principal-transformer=*")
@ResourceType("aggregate-principal-transformer")
public class AggregatePrincipalTransformer>
		implements
			org.wildfly.swarm.config.runtime.Keyed {

	private String key;
	private PropertyChangeSupport pcs;
	@AttributeDocumentation("The referenced principal transformers to aggregate.")
	private List principalTransformers;

	public AggregatePrincipalTransformer(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 referenced principal transformers to aggregate.
	 */
	@ModelNodeBinding(detypedName = "principal-transformers")
	public List principalTransformers() {
		return this.principalTransformers;
	}

	/**
	 * The referenced principal transformers to aggregate.
	 */
	@SuppressWarnings("unchecked")
	public T principalTransformers(java.util.List value) {
		Object oldValue = this.principalTransformers;
		this.principalTransformers = value;
		if (this.pcs != null)
			this.pcs.firePropertyChange("principalTransformers", oldValue,
					value);
		return (T) this;
	}

	/**
	 * The referenced principal transformers to aggregate.
	 */
	@SuppressWarnings("unchecked")
	public T principalTransformer(String value) {
		if (this.principalTransformers == null) {
			this.principalTransformers = new java.util.ArrayList<>();
		}
		this.principalTransformers.add(value);
		return (T) this;
	}

	/**
	 * The referenced principal transformers to aggregate.
	 */
	@SuppressWarnings("unchecked")
	public T principalTransformers(String... args) {
		principalTransformers(Arrays.stream(args).collect(Collectors.toList()));
		return (T) this;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy