org.wildfly.swarm.config.elytron.ProviderLoader Maven / Gradle / Ivy
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;
import java.util.Map;
/**
* A definition for a Provider loader.
*/
@Address("/subsystem=elytron/provider-loader=*")
@ResourceType("provider-loader")
public class ProviderLoader>
implements
org.wildfly.swarm.config.runtime.Keyed {
private String key;
private PropertyChangeSupport pcs;
@AttributeDocumentation("An argument to be passed into the constructor as the Provider is instantiated.")
private String argument;
@AttributeDocumentation("The fully qualified class names of the providers to load, these are loaded after the service-loader discovered providers and duplicates will be skipped.")
private List classNames;
@AttributeDocumentation("The key/value configuration to be passed to the Provider to initialise it.")
private Map configuration;
@AttributeDocumentation("The list of providers loaded by this provider loader.")
private List loadedProviders;
@AttributeDocumentation("The name of the module to load the provider from.")
private String module;
@AttributeDocumentation("The path of the file to use to initialise the providers.")
private String path;
@AttributeDocumentation("The base path of the configuration file.")
private String relativeTo;
public ProviderLoader(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);
}
/**
* An argument to be passed into the constructor as the Provider is
* instantiated.
*/
@ModelNodeBinding(detypedName = "argument")
public String argument() {
return this.argument;
}
/**
* An argument to be passed into the constructor as the Provider is
* instantiated.
*/
@SuppressWarnings("unchecked")
public T argument(java.lang.String value) {
Object oldValue = this.argument;
this.argument = value;
if (this.pcs != null)
this.pcs.firePropertyChange("argument", oldValue, value);
return (T) this;
}
/**
* The fully qualified class names of the providers to load, these are
* loaded after the service-loader discovered providers and duplicates will
* be skipped.
*/
@ModelNodeBinding(detypedName = "class-names")
public List classNames() {
return this.classNames;
}
/**
* The fully qualified class names of the providers to load, these are
* loaded after the service-loader discovered providers and duplicates will
* be skipped.
*/
@SuppressWarnings("unchecked")
public T classNames(java.util.List value) {
Object oldValue = this.classNames;
this.classNames = value;
if (this.pcs != null)
this.pcs.firePropertyChange("classNames", oldValue, value);
return (T) this;
}
/**
* The fully qualified class names of the providers to load, these are
* loaded after the service-loader discovered providers and duplicates will
* be skipped.
*/
@SuppressWarnings("unchecked")
public T className(String value) {
if (this.classNames == null) {
this.classNames = new java.util.ArrayList<>();
}
this.classNames.add(value);
return (T) this;
}
/**
* The fully qualified class names of the providers to load, these are
* loaded after the service-loader discovered providers and duplicates will
* be skipped.
*/
@SuppressWarnings("unchecked")
public T classNames(String... args) {
classNames(Arrays.stream(args).collect(Collectors.toList()));
return (T) this;
}
/**
* The key/value configuration to be passed to the Provider to initialise
* it.
*/
@ModelNodeBinding(detypedName = "configuration")
public Map configuration() {
return this.configuration;
}
/**
* The key/value configuration to be passed to the Provider to initialise
* it.
*/
@SuppressWarnings("unchecked")
public T configuration(java.util.Map value) {
Object oldValue = this.configuration;
this.configuration = value;
if (this.pcs != null)
this.pcs.firePropertyChange("configuration", oldValue, value);
return (T) this;
}
/**
* The key/value configuration to be passed to the Provider to initialise
* it.
*/
@SuppressWarnings("unchecked")
public T configuration(java.lang.String key, java.lang.Object value) {
if (this.configuration == null) {
this.configuration = new java.util.HashMap<>();
}
this.configuration.put(key, value);
return (T) this;
}
/**
* The list of providers loaded by this provider loader.
*/
@ModelNodeBinding(detypedName = "loaded-providers")
public List
© 2015 - 2025 Weber Informatics LLC | Privacy Policy