SGF-328 - Add missing 'hostname-for-senders' attribute on the <gfe:gateway-receiver> element in the SDG XML namespace (XSD).

This commit is contained in:
John Blum
2014-09-23 17:19:14 -07:00
parent 6efb775c1e
commit 34ae38ef23
9 changed files with 166 additions and 12 deletions

View File

@@ -23,9 +23,12 @@ import org.springframework.util.StringUtils;
import org.w3c.dom.Element;
/**
* Spring BeanDefinitionParser for the &lt;gfe:gateway-receiver&gt; SDG (GFE) XML XSD namespace element.
*
* @author David Turanski
* @author John Blum
* @see org.springframework.beans.factory.xml.AbstractSimpleBeanDefinitionParser
* @see org.springframework.data.gemfire.wan.GatewayReceiverFactoryBean
*/
class GatewayReceiverParser extends AbstractSimpleBeanDefinitionParser {
@@ -43,6 +46,7 @@ class GatewayReceiverParser extends AbstractSimpleBeanDefinitionParser {
builder.setLazyInit(false);
ParsingUtils.setPropertyValue(element, builder, "bind-address");
ParsingUtils.setPropertyValue(element, builder, "hostname-for-senders");
ParsingUtils.setPropertyValue(element, builder, "start-port");
ParsingUtils.setPropertyValue(element, builder, "end-port");
ParsingUtils.setPropertyValue(element, builder, "manual-start");

View File

@@ -26,18 +26,21 @@ import com.gemstone.gemfire.cache.Cache;
import com.gemstone.gemfire.cache.wan.GatewayReceiver;
import com.gemstone.gemfire.cache.wan.GatewayReceiverFactory;
import com.gemstone.gemfire.cache.wan.GatewayTransportFilter;
import com.gemstone.gemfire.management.internal.cli.util.spring.StringUtils;
/**
* FactoryBean for creating a GemFire {@link GatewayReceiver}.
* Spring FactoryBean for creating a GemFire {@link GatewayReceiver}.
*
* @author David Turanski
* @author John Blum
* @see org.springframework.context.SmartLifecycle
* @see org.springframework.data.gemfire.wan.AbstractWANComponentFactoryBean
* @see com.gemstone.gemfire.cache.Cache
* @see com.gemstone.gemfire.cache.wan.GatewayReceiver
* @see com.gemstone.gemfire.cache.wan.GatewayReceiverFactory
* @since 1.2.2
*/
@SuppressWarnings("unused")
public class GatewayReceiverFactoryBean extends AbstractWANComponentFactoryBean<GatewayReceiver>
implements SmartLifecycle {
@@ -53,6 +56,7 @@ public class GatewayReceiverFactoryBean extends AbstractWANComponentFactoryBean<
private List<GatewayTransportFilter> transportFilters;
private String bindAddress;
private String hostnameForSenders;
/**
* Constructs an instance of the GatewayReceiverFactoryBean class for configuring an initializing
@@ -84,17 +88,22 @@ public class GatewayReceiverFactoryBean extends AbstractWANComponentFactoryBean<
}
}
if (bindAddress != null) {
if (StringUtils.hasText(bindAddress)) {
gatewayReceiverFactory.setBindAddress(bindAddress);
}
int minPort = (startPort != null ? startPort : GatewayReceiver.DEFAULT_START_PORT);
int maxPort = (endPort != null ? endPort : GatewayReceiver.DEFAULT_END_PORT);
if (StringUtils.hasText(hostnameForSenders)) {
gatewayReceiverFactory.setHostnameForSenders(hostnameForSenders);
}
Assert.isTrue(minPort <= maxPort, String.format("'startPort' must be less than or equal to %1$d.", maxPort));
int localStartPort = (startPort != null ? startPort : GatewayReceiver.DEFAULT_START_PORT);
int localEndPort = (endPort != null ? endPort : GatewayReceiver.DEFAULT_END_PORT);
gatewayReceiverFactory.setStartPort(minPort);
gatewayReceiverFactory.setEndPort(maxPort);
Assert.isTrue(localStartPort <= localEndPort, String.format("'startPort' must be less than or equal to %1$d.",
localEndPort));
gatewayReceiverFactory.setStartPort(localStartPort);
gatewayReceiverFactory.setEndPort(localEndPort);
if (maximumTimeBetweenPings != null) {
gatewayReceiverFactory.setMaximumTimeBetweenPings(maximumTimeBetweenPings);
@@ -115,6 +124,10 @@ public class GatewayReceiverFactoryBean extends AbstractWANComponentFactoryBean<
this.bindAddress = bindAddress;
}
public void setHostnameForSenders(String hostnameForSenders) {
this.hostnameForSenders = hostnameForSenders;
}
public void setStartPort(Integer startPort) {
this.startPort = startPort;
}