/** * Factory method to create a default {@link PropertiesBuilder} instance. * * @return an instance of the {@link PropertiesBuilder} class with not {@link Properties}. * @see #PropertiesBuilder() */ public static PropertiesBuilder create() { return new PropertiesBuilder(); }
/** * 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) { 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(); } }
PropertiesBuilder gemfireProperties = new PropertiesBuilder(); gemfireProperties.setPropertyIfNotDefault("ack-severe-alert-threshold", annotationAttributes.get("ackSevereAlertThreshold"), DEFAULT_ACK_SEVERE_ALERT_THRESHOLD); gemfireProperties.setPropertyIfNotDefault("ack-wait-threshold", annotationAttributes.get("ackWaitThreshold"), DEFAULT_ACK_WAIT_THRESHOLD); gemfireProperties.setPropertyIfNotDefault("async-distribution-timeout", annotationAttributes.get("asyncDistributionTimeout"), DEFAULT_ASYNC_DISTRIBUTION_TIMEOUT); gemfireProperties.setPropertyIfNotDefault("async-max-queue-size", annotationAttributes.get("asyncMaxQueueSize"), DEFAULT_ASYNC_MAX_QUEUE_SIZE); gemfireProperties.setPropertyIfNotDefault("async-queue-timeout", annotationAttributes.get("asyncQueueTimeout"), DEFAULT_ASYNC_QUEUE_TIMEOUT); gemfireProperties.setProperty("bind-address", annotationAttributes.get("bindAddress")); gemfireProperties.setProperty("cache-xml-file", annotationAttributes.get("cacheXmlFile")); gemfireProperties.setProperty("cluster-configuration-dir", annotationAttributes.get("clusterConfigurationDirectory")); gemfireProperties.setPropertyIfNotDefault("conflate-events", annotationAttributes.get("conflateEvents"), DEFAULT_CONFLATE_EVENTS); gemfireProperties.setPropertyIfNotDefault("conserve-sockets", annotationAttributes.get("conserveSockets"), DEFAULT_CONSERVE_SOCKETS);
protected Properties gemfireProperties() { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.setProperty("name", name()); gemfireProperties.setProperty("mcast-port", mcastPort()); gemfireProperties.setProperty("log-level", logLevel()); gemfireProperties.setProperty("locators", locators()); gemfireProperties.setProperty("start-locator", startLocator()); gemfireProperties.add(this.customGemFireProperties); 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(); } }
/** * 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(); }
@Bean public ClientCacheFactoryBean clientCache(GemfireSecurityProperties securityProperties, GemfireSslProperties sslProperties) { ClientCacheFactoryBean clientCacheFactoryBean = new ClientCacheFactoryBean(); clientCacheFactoryBean.setUseBeanFactoryLocator(false); clientCacheFactoryBean.setPoolName("gemfirePool"); if (StringUtils.hasText(securityProperties.getUsername()) && StringUtils .hasText(securityProperties.getPassword())) { Properties properties = new Properties(); properties .setProperty(SECURITY_CLIENT, GemfireSecurityProperties.UserAuthInitialize.class.getName() + ".create"); properties.setProperty(SECURITY_USERNAME, securityProperties.getUsername()); properties.setProperty(SECURITY_PASSWORD, securityProperties.getPassword()); clientCacheFactoryBean.setProperties(properties); } if (sslProperties.isSslEnabled()) { PropertiesBuilder pb = new PropertiesBuilder(); pb.add(clientCacheFactoryBean.getProperties()); pb.add(this.toGeodeSslProperties(sslProperties)); clientCacheFactoryBean.setProperties(pb.build()); } clientCacheFactoryBean.setReadyForEvents(true); return clientCacheFactoryBean; }
/** * Sets a property with given name to the specified value. The property is only set if the value is not null. * * @param name the name of the property to set. * @param value the value to set the property to. * @return a reference to this {@link PropertiesBuilder}. * @see #setProperty(String, String) */ public PropertiesBuilder setProperty(String name, Object value) { return value != null ? setProperty(name, value.toString()) : this; }
/** * 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()); }
public void add(Properties gemfireProperties) { customGemFireProperties.add(gemfireProperties); }
/** * Sets a property with the given name to the specified {@link String} value. The property is only set * if the value is not {@literal null}, an empty {@link String} or not equal to the {@link String} literal * {@literal null}, ignoring case. * * @param name the name of the property to set. * @param value the value to set the property to. * @return a reference to this {@link PropertiesBuilder}. * @throws IllegalArgumentException if the property name is not specified. * @see java.util.Properties#setProperty(String, String) */ public PropertiesBuilder setProperty(String name, String value) { Assert.hasText(name, String.format("Name [%s] must be specified", name)); if (isValuable(value)) { this.properties.setProperty(name, value); } return this; }
@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(); } }
PropertiesBuilder gemfireProperties = new PropertiesBuilder(); gemfireProperties.setPropertyIfNotDefault("ack-severe-alert-threshold", annotationAttributes.get("ackSevereAlertThreshold"), DEFAULT_ACK_SEVERE_ALERT_THRESHOLD); gemfireProperties.setPropertyIfNotDefault("ack-wait-threshold", annotationAttributes.get("ackWaitThreshold"), DEFAULT_ACK_WAIT_THRESHOLD); gemfireProperties.setPropertyIfNotDefault("async-distribution-timeout", annotationAttributes.get("asyncDistributionTimeout"), DEFAULT_ASYNC_DISTRIBUTION_TIMEOUT); gemfireProperties.setPropertyIfNotDefault("async-max-queue-size", annotationAttributes.get("asyncMaxQueueSize"), DEFAULT_ASYNC_MAX_QUEUE_SIZE); gemfireProperties.setPropertyIfNotDefault("async-queue-timeout", annotationAttributes.get("asyncQueueTimeout"), DEFAULT_ASYNC_QUEUE_TIMEOUT); gemfireProperties.setProperty("bind-address", annotationAttributes.get("bindAddress")); gemfireProperties.setProperty("cache-xml-file", annotationAttributes.get("cacheXmlFile")); gemfireProperties.setProperty("cluster-configuration-dir", annotationAttributes.get("clusterConfigurationDirectory")); gemfireProperties.setPropertyIfNotDefault("conflate-events", annotationAttributes.get("conflateEvents"), DEFAULT_CONFLATE_EVENTS); gemfireProperties.setPropertyIfNotDefault("conserve-sockets", annotationAttributes.get("conserveSockets"), DEFAULT_CONSERVE_SOCKETS);
protected Properties gemfireProperties() { PropertiesBuilder gemfireProperties = PropertiesBuilder.create(); gemfireProperties.setProperty("name", name()); gemfireProperties.setProperty("mcast-port", mcastPort()); gemfireProperties.setProperty("log-level", logLevel()); gemfireProperties.setProperty("locators", locators()); gemfireProperties.setProperty("start-locator", startLocator()); gemfireProperties.add(this.customGemFireProperties); 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(); } }
/** * Sets a property with given name to the specified value. The property is only set if the value is not null. * * @param name the name of the property to set. * @param value the value to set the property to. * @return a reference to this {@link PropertiesBuilder}. * @see #setProperty(String, String) */ public PropertiesBuilder setProperty(String name, Object value) { return value != null ? setProperty(name, value.toString()) : this; }
/** * 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()); }
public void add(Properties gemfireProperties) { customGemFireProperties.add(gemfireProperties); }