org.wildfly.swarm.config.remoting.LocalOutboundConnection Maven / Gradle / Ivy
package org.wildfly.swarm.config.remoting;
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 java.util.List;
import org.wildfly.swarm.config.runtime.Subresource;
import org.wildfly.swarm.config.remoting.PropertyConsumer;
import org.wildfly.swarm.config.remoting.PropertySupplier;
import org.wildfly.swarm.config.remoting.Property;
import org.wildfly.swarm.config.runtime.SubresourceInfo;
import org.wildfly.swarm.config.runtime.ModelNodeBinding;
/**
* Remoting outbound connection with an implicit local:// URI scheme.
*/
@Address("/subsystem=remoting/local-outbound-connection=*")
@ResourceType("local-outbound-connection")
public class LocalOutboundConnection>
implements
org.wildfly.swarm.config.runtime.Keyed {
private String key;
private PropertyChangeSupport pcs;
private LocalOutboundConnectionResources subresources = new LocalOutboundConnectionResources();
@AttributeDocumentation("Name of the outbound-socket-binding which will be used to determine the destination address and port for the connection.")
private String outboundSocketBindingRef;
public LocalOutboundConnection(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);
}
public LocalOutboundConnectionResources subresources() {
return this.subresources;
}
/**
* Add all Property objects to this subresource
*
* @return this
* @param value
* List of Property objects.
*/
@SuppressWarnings("unchecked")
public T properties(java.util.List value) {
this.subresources.properties = value;
return (T) this;
}
/**
* Add the Property object to the list of subresources
*
* @param value
* The Property to add
* @return this
*/
@SuppressWarnings("unchecked")
public T property(Property value) {
this.subresources.properties.add(value);
return (T) this;
}
/**
* Create and configure a Property object to the list of subresources
*
* @param key
* The key for the Property resource
* @param config
* The PropertyConsumer to use
* @return this
*/
@SuppressWarnings("unchecked")
public T property(java.lang.String childKey, PropertyConsumer consumer) {
Property extends Property> child = new Property<>(childKey);
if (consumer != null) {
consumer.accept(child);
}
property(child);
return (T) this;
}
/**
* Create and configure a Property object to the list of subresources
*
* @param key
* The key for the Property resource
* @return this
*/
@SuppressWarnings("unchecked")
public T property(java.lang.String childKey) {
property(childKey, null);
return (T) this;
}
/**
* Install a supplied Property object to the list of subresources
*/
@SuppressWarnings("unchecked")
public T property(PropertySupplier supplier) {
property(supplier.get());
return (T) this;
}
/**
* Child mutators for LocalOutboundConnection
*/
public static class LocalOutboundConnectionResources {
/**
* Properties supported by the underlying provider. The property name is
* inferred from the last element of the properties address.
*/
@ResourceDocumentation("Properties supported by the underlying provider. The property name is inferred from the last element of the properties address.")
@SubresourceInfo("property")
private List properties = new java.util.ArrayList<>();
/**
* Get the list of Property resources
*
* @return the list of resources
*/
@Subresource
public List properties() {
return this.properties;
}
public Property property(java.lang.String key) {
return this.properties.stream().filter(e -> e.getKey().equals(key))
.findFirst().orElse(null);
}
}
/**
* Name of the outbound-socket-binding which will be used to determine the
* destination address and port for the connection.
*/
@ModelNodeBinding(detypedName = "outbound-socket-binding-ref")
public String outboundSocketBindingRef() {
return this.outboundSocketBindingRef;
}
/**
* Name of the outbound-socket-binding which will be used to determine the
* destination address and port for the connection.
*/
@SuppressWarnings("unchecked")
public T outboundSocketBindingRef(java.lang.String value) {
Object oldValue = this.outboundSocketBindingRef;
this.outboundSocketBindingRef = value;
if (this.pcs != null)
this.pcs.firePropertyChange("outboundSocketBindingRef", oldValue,
value);
return (T) this;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy