Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save daneshk/9f7b33ab0e2245d18edfd9447483982e to your computer and use it in GitHub Desktop.
Save daneshk/9f7b33ab0e2245d18edfd9447483982e to your computer and use it in GitHub Desktop.
package org.wso2.carbon.transport.http.netty.config;
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlElementWrapper;
import javax.xml.bind.annotation.XmlRootElement;
@Configuration(namespace = "wso2.transports.netty", description = "Netty Transport Configurations")
public class TransportsConfiguration {
//default values of an array or collection need to mention in class constructor
public TransportsConfiguration() {
ListenerConfiguration listenerConfiguration = ListenerConfiguration();
listenerConfigurations = new HashSet<>();
listenerConfigurations.add(listenerConfiguration);
SenderConfiguration senderConfiguration = SenderConfiguration();
senderConfigurations = new HashSet<>();
senderConfigurations.add(senderConfiguration);
transportProperties = new HashSet<>();
}
@Element(description = "transport properties")
private Set<TransportProperty> transportProperties = Collections.EMPTY_SET;
@Element(description = "listener configurations")
private Set<ListenerConfiguration> listenerConfigurations;
@Element(description = "sender configurations")
private Set<SenderConfiguration> senderConfigurations;
public Set<ListenerConfiguration> getListenerConfigurations() {
return Collections.unmodifiableSet(listenerConfigurations);
}
public Set<SenderConfiguration> getSenderConfigurations() {
if (senderConfigurations == null) {
return Collections.EMPTY_SET;
}
return Collections.unmodifiableSet(senderConfigurations);
}
public void setListenerConfigurations(Set<ListenerConfiguration> listenerConfigurations) {
this.listenerConfigurations = Collections.unmodifiableSet(listenerConfigurations);
}
public void setSenderConfigurations(Set<SenderConfiguration> senderConfigurations) {
this.senderConfigurations = Collections.unmodifiableSet(senderConfigurations);
}
public Set<TransportProperty> getTransportProperties() {
return transportProperties;
}
public void setTransportProperties(Set<TransportProperty> transportProperties) {
this.transportProperties = transportProperties;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment