private CacheConfig.GatewayReceiver buildConfiguration(Boolean manualStart, Integer startPort, Integer endPort, String bindAddress, Integer maximumTimeBetweenPings, Integer socketBufferSize, String[] gatewayTransportFilters, String hostnameForSenders) { CacheConfig.GatewayReceiver configuration = new CacheConfig.GatewayReceiver(); if (gatewayTransportFilters != null) { List<DeclarableType> filters = Arrays.stream(gatewayTransportFilters).map(fullyQualifiedClassName -> { DeclarableType thisFilter = new DeclarableType(); thisFilter.setClassName(fullyQualifiedClassName); return thisFilter; }).collect(Collectors.toList()); configuration.getGatewayTransportFilters().addAll(filters); } if (startPort != null) { configuration.setStartPort(String.valueOf(startPort)); } if (endPort != null) { configuration.setEndPort(String.valueOf(endPort)); } configuration.setBindAddress(bindAddress); if (maximumTimeBetweenPings != null) { configuration.setMaximumTimeBetweenPings(String.valueOf(maximumTimeBetweenPings)); } if (socketBufferSize != null) { configuration.setSocketBufferSize(String.valueOf(socketBufferSize)); } configuration.setHostnameForSenders(hostnameForSenders); configuration.setManualStart(manualStart); return configuration; }
public static void setBasicValues(CacheConfig cache) { cache.setCopyOnRead(true); CacheConfig.GatewayReceiver receiver = new CacheConfig.GatewayReceiver(); receiver.setBindAddress("localhost"); receiver.setEndPort("8080"); receiver.setManualStart(false); receiver.setStartPort("6000"); cache.setGatewayReceiver(receiver); cache.setVersion("1.0"); RegionConfig region = new RegionConfig(); region.setName("testRegion"); region.setType("REPLICATE"); cache.getRegions().add(region); }