/** * Constructs an instance of the {@link PropertiesBuilder} class initialized with the given * {@link PropertiesBuilder} providing the default {@link Properties} for this builder. * * @param builder {@link PropertiesBuilder} providing the default {@link Properties} for this builder. * @throws NullPointerException if the {@link PropertiesBuilder} reference is {@literal null}. * @see #PropertiesBuilder(Properties) */ public PropertiesBuilder(PropertiesBuilder builder) { this(builder.build()); }
/** * Constructs an instance of the {@link PropertiesBuilder} class initialized with the given * {@link PropertiesBuilder} providing the default {@link Properties} for this builder. * * @param builder {@link PropertiesBuilder} providing the default {@link Properties} for this builder. * @throws NullPointerException if the {@link PropertiesBuilder} reference is {@literal null}. * @see #PropertiesBuilder(Properties) */ public PropertiesBuilder(PropertiesBuilder builder) { this(builder.build()); }
@Override public Properties getObject() throws Exception { return build(); }
@Override public Properties getObject() throws Exception { return build(); }
/** * Null-safe method to add all the {@link Properties} from the provided {@link PropertiesBuilder} to this builder. * This operation effectively overwrites any properties already set with the same name from the source. * * @param builder source of the {@link Properties} to add to this builder. * @return a reference to this {@link PropertiesBuilder}. * @see org.springframework.data.gemfire.util.PropertiesBuilder */ public PropertiesBuilder add(PropertiesBuilder builder) { return builder != null ? add(builder.build()) : this; }
/** * Null-safe method to add all the {@link Properties} from the provided {@link PropertiesBuilder} to this builder. * This operation effectively overwrites any properties already set with the same name from the source. * * @param builder source of the {@link Properties} to add to this builder. * @return a reference to this {@link PropertiesBuilder}. * @see org.springframework.data.gemfire.util.PropertiesBuilder */ public PropertiesBuilder add(PropertiesBuilder builder) { return builder != null ? add(builder.build()) : this; }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return PropertiesBuilder.create() .setProperty("off-heap-memory-size", resolveProperty(cacheOffHeapProperty("memory-size"), (String) annotationAttributes.get("memorySize"))) .build(); }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return PropertiesBuilder.create() .setProperty("off-heap-memory-size", resolveProperty(cacheOffHeapProperty("memory-size"), (String) annotationAttributes.get("memorySize"))) .build(); }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.of(resolveProperty(locatorProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> { String host = resolveHost(resolveProperty(locatorProperty("host"), (String) annotationAttributes.get("host"))); int port = resolvePort(resolveProperty(locatorProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_LOCATOR_PORT); return PropertiesBuilder.create() .setProperty(START_LOCATOR_GEMFIRE_PROPERTY_NAME, String.format("%s[%d]", host, port)) .build(); }).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.of(resolveProperty(locatorProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> { String host = resolveHost(resolveProperty(locatorProperty("host"), (String) annotationAttributes.get("host"))); int port = resolvePort(resolveProperty(locatorProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_LOCATOR_PORT); return PropertiesBuilder.create() .setProperty(START_LOCATOR_GEMFIRE_PROPERTY_NAME, String.format("%s[%d]", host, port)) .build(); }).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.ofNullable(resolveProperty(redisServiceProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> PropertiesBuilder.create() .setProperty("redis-bind-address", resolveProperty(redisServiceProperty("bind-address"), (String) annotationAttributes.get("bindAddress"))) .setProperty("redis-port", resolvePort(resolveProperty(redisServiceProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_REDIS_PORT)) .build() ).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.ofNullable(resolveProperty(redisServiceProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> PropertiesBuilder.create() .setProperty("redis-bind-address", resolveProperty(redisServiceProperty("bind-address"), (String) annotationAttributes.get("bindAddress"))) .setProperty("redis-port", resolvePort(resolveProperty(redisServiceProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_REDIS_PORT)) .build() ).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.of(resolveProperty(memcachedServiceProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> PropertiesBuilder.create() .setProperty("memcached-port", resolvePort(resolveProperty(memcachedServiceProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_MEMCACHED_SERVER_PORT)) .setProperty("memcached-protocol", resolveProperty(memcachedServiceProperty("protocol"), EnableMemcachedServer.MemcachedProtocol.class, (EnableMemcachedServer.MemcachedProtocol) annotationAttributes.get("protocol"))) .build() ).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { return Optional.of(resolveProperty(memcachedServiceProperty("enabled"), Boolean.TRUE)) .filter(Boolean.TRUE::equals) .map(enabled -> PropertiesBuilder.create() .setProperty("memcached-port", resolvePort(resolveProperty(memcachedServiceProperty("port"), (Integer) annotationAttributes.get("port")), DEFAULT_MEMCACHED_SERVER_PORT)) .setProperty("memcached-protocol", resolveProperty(memcachedServiceProperty("protocol"), EnableMemcachedServer.MemcachedProtocol.class, (EnableMemcachedServer.MemcachedProtocol) annotationAttributes.get("protocol"))) .build() ).orElseGet(Properties::new); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.setPropertyIfNotDefault("log-disk-space-limit", resolveProperty(loggingProperty("log-disk-space-limit"), (Integer) annotationAttributes.get("logDiskSpaceLimit")), DEFAULT_LOG_DISK_SPACE_LIMIT); gemfireProperties.setProperty("log-file", resolveProperty(loggingProperty("log-file"), (String) annotationAttributes.get("logFile"))); gemfireProperties.setPropertyIfNotDefault("log-file-size-limit", resolveProperty(loggingProperty("log-file-size-limit"), (Integer) annotationAttributes.get("logFileSizeLimit")), DEFAULT_LOG_FILE_SIZE_LIMIT); gemfireProperties.setPropertyIfNotDefault("log-level", resolveProperty(loggingProperty("level"), (String) annotationAttributes.get("logLevel")), DEFAULT_LOG_LEVEL); return gemfireProperties.build(); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.setPropertyIfNotDefault("log-disk-space-limit", resolveProperty(loggingProperty("log-disk-space-limit"), (Integer) annotationAttributes.get("logDiskSpaceLimit")), DEFAULT_LOG_DISK_SPACE_LIMIT); gemfireProperties.setProperty("log-file", resolveProperty(loggingProperty("log-file"), (String) annotationAttributes.get("logFile"))); gemfireProperties.setPropertyIfNotDefault("log-file-size-limit", resolveProperty(loggingProperty("log-file-size-limit"), (Integer) annotationAttributes.get("logFileSizeLimit")), DEFAULT_LOG_FILE_SIZE_LIMIT); gemfireProperties.setPropertyIfNotDefault("log-level", resolveProperty(loggingProperty("level"), (String) annotationAttributes.get("logLevel")), DEFAULT_LOG_LEVEL); return gemfireProperties.build(); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.unsetProperty("locators"); gemfireProperties.setPropertyIfNotDefault("mcast-address", resolveProperty(propertyName("mcast.address"), (String) annotationAttributes.get("address")), DEFAULT_MCAST_ADDRESS); gemfireProperties.setPropertyIfNotDefault("mcast-flow-control", resolveProperty(propertyName("mcast.flow-control"), (String) annotationAttributes.get("flowControl")), DEFAULT_MCAST_FLOW_CONTROL); gemfireProperties.setPropertyIfNotDefault("mcast-port", resolveProperty(propertyName("mcast.port"), (Integer) annotationAttributes.get("port")), DEFAULT_MCAST_PORT); gemfireProperties.setPropertyIfNotDefault("mcast-recv-buffer-size", resolveProperty(propertyName("mcast.receive-buffer-size"), (Integer) annotationAttributes.get("receiveBufferSize")), DEFAULT_MCAST_RECEIVE_BUFFER_SIZE); gemfireProperties.setPropertyIfNotDefault("mcast-send-buffer-size", resolveProperty(propertyName("mcast.send-buffer-size"), (Integer) annotationAttributes.get("sendBufferSize")), DEFAULT_MCAST_SEND_BUFFER_SIZE); return gemfireProperties.build(); } }
@Override protected Properties toGemFireProperties(Map<String, Object> annotationAttributes) { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.unsetProperty("locators"); gemfireProperties.setPropertyIfNotDefault("mcast-address", resolveProperty(propertyName("mcast.address"), (String) annotationAttributes.get("address")), DEFAULT_MCAST_ADDRESS); gemfireProperties.setPropertyIfNotDefault("mcast-flow-control", resolveProperty(propertyName("mcast.flow-control"), (String) annotationAttributes.get("flowControl")), DEFAULT_MCAST_FLOW_CONTROL); gemfireProperties.setPropertyIfNotDefault("mcast-port", resolveProperty(propertyName("mcast.port"), (Integer) annotationAttributes.get("port")), DEFAULT_MCAST_PORT); gemfireProperties.setPropertyIfNotDefault("mcast-recv-buffer-size", resolveProperty(propertyName("mcast.receive-buffer-size"), (Integer) annotationAttributes.get("receiveBufferSize")), DEFAULT_MCAST_RECEIVE_BUFFER_SIZE); gemfireProperties.setPropertyIfNotDefault("mcast-send-buffer-size", resolveProperty(propertyName("mcast.send-buffer-size"), (Integer) annotationAttributes.get("sendBufferSize")), DEFAULT_MCAST_SEND_BUFFER_SIZE); return gemfireProperties.build(); } }
(Long) annotationAttributes.get("sampleRate")), DEFAULT_STATISTIC_SAMPLE_RATE); return gemfireProperties.build();
/** * Converts the App Starter properties into Geode native SSL properties * @param sslProperties App starter properties. * @return Returns the geode native SSL properties. */ private Properties toGeodeSslProperties(GemfireSslProperties sslProperties) { PropertiesBuilder pb = new PropertiesBuilder(); // locator - SSL communication with and between locators // server - SSL communication between clients and servers pb.setProperty("ssl-enabled-components", "server,locator"); pb.setProperty("ssl-keystore", this.resolveRemoteStore(sslProperties.getKeystoreUri(), sslProperties.getUserHomeDirectory(), GemfireSslProperties.LOCAL_KEYSTORE_FILE_NAME)); pb.setProperty("ssl-keystore-password", sslProperties.getSslKeystorePassword()); pb.setProperty("ssl-keystore-type", sslProperties.getKeystoreType()); pb.setProperty("ssl-truststore", this.resolveRemoteStore(sslProperties.getTruststoreUri(), sslProperties.getUserHomeDirectory(), GemfireSslProperties.LOCAL_TRUSTSTORE_FILE_NAME)); pb.setProperty("ssl-truststore-password", sslProperties.getSslTruststorePassword()); pb.setProperty("ssl-truststore-type", sslProperties.getTruststoreType()); pb.setProperty("ssl-ciphers", sslProperties.getCiphers()); return pb.build(); }