本文整理汇总了Java中com.hazelcast.config.properties.PropertyDefinition类的典型用法代码示例。如果您正苦于以下问题:Java PropertyDefinition类的具体用法?Java PropertyDefinition怎么用?Java PropertyDefinition使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertyDefinition类属于com.hazelcast.config.properties包,在下文中一共展示了PropertyDefinition类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: discoveryStrategyFactory
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
@Bean
public DiscoveryStrategyFactory discoveryStrategyFactory () {
return new DiscoveryStrategyFactory() {
@Override
public Class<? extends DiscoveryStrategy> getDiscoveryStrategyType () {
return EurekaDiscoveryStrategy.class;
}
@Override
public DiscoveryStrategy newDiscoveryStrategy (DiscoveryNode discoveryNode,
ILogger logger,
Map<String, Comparable> properties
) {
val eurekaDiscoveryStrategy = new EurekaDiscoveryStrategy(logger, emptyMap());
eurekaDiscoveryStrategy.setDiscoveryClient(discoveryClient);
eurekaDiscoveryStrategy.setHaselcastNodeServiceId(applicationName);
return eurekaDiscoveryStrategy;
}
@Override
public Collection<PropertyDefinition> getConfigurationProperties () {
return null;
}
};
}
示例2: getOrDefault
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
protected <T extends Comparable> T getOrDefault(Map<String, Comparable> properties, String prefix,
PropertyDefinition property, T defaultValue) {
if (property == null) {
return defaultValue;
}
Comparable value = readProperty(prefix, property);
if (value == null) {
value = properties.get(property.key());
}
if (value == null) {
return defaultValue;
}
return (T) value;
}
示例3: readProperty
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
private Comparable readProperty(String prefix, PropertyDefinition property) {
if (prefix != null) {
String p = getProperty(prefix, property);
String v = System.getProperty(p);
if (StringUtil.isNullOrEmpty(v)) {
v = System.getenv(p);
if (StringUtil.isNullOrEmpty(v)) {
v = System.getenv(cIdentifierLike(p));
}
}
if (!StringUtil.isNullOrEmpty(v)) {
return property.typeConverter().convert(v);
}
}
return null;
}
示例4: getConfigurationProperties
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
final AwsProperties[] props = AwsProperties.values();
final ArrayList<PropertyDefinition> definitions = new ArrayList<PropertyDefinition>(props.length);
for (AwsProperties prop : props) {
definitions.add(prop.getDefinition());
}
return definitions;
}
示例5: parseDiscoveryStrategyConfigPasses
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
@Test
public void parseDiscoveryStrategyConfigPasses() {
final AwsDiscoveryStrategyFactory factory = new AwsDiscoveryStrategyFactory();
final Config config = createConfig("test-aws-config.xml");
final JoinConfig joinConfig = config.getNetworkConfig().getJoin();
assertFalse(joinConfig.getAwsConfig().isEnabled());
assertFalse(joinConfig.getTcpIpConfig().isEnabled());
assertFalse(joinConfig.getMulticastConfig().isEnabled());
final DiscoveryConfig discoveryConfig = joinConfig.getDiscoveryConfig();
assertTrue(discoveryConfig.isEnabled());
assertEquals(1, discoveryConfig.getDiscoveryStrategyConfigs().size());
final DiscoveryStrategyConfig providerConfig = discoveryConfig.getDiscoveryStrategyConfigs().iterator().next();
final Map<String, Comparable> providerProperties = providerConfig.getProperties();
final Collection<PropertyDefinition> factoryConfigProperties = factory.getConfigurationProperties();
assertEquals(factory.getDiscoveryStrategyType(), AwsDiscoveryStrategy.class);
assertEquals(AwsDiscoveryStrategy.class.getName(), providerConfig.getClassName());
assertEquals(factoryConfigProperties.size(), providerProperties.size());
for (AwsProperties prop : AwsProperties.values()) {
assertTrue(factoryConfigProperties.contains(prop.getDefinition()));
}
assertEquals("test-access-key", providerProperties.get("access-key"));
assertEquals("test-secret-key", providerProperties.get("secret-key"));
assertEquals("test-region", providerProperties.get("region"));
assertEquals("test-iam-role", providerProperties.get("iam-role"));
assertEquals("ec2.test-host-header", providerProperties.get("host-header"));
assertEquals("test-security-group-name", providerProperties.get("security-group-name"));
assertEquals("test-tag-key", providerProperties.get("tag-key"));
assertEquals("test-tag-value", providerProperties.get("tag-value"));
assertEquals("10", providerProperties.get("connection-timeout-seconds"));
assertEquals("5702", providerProperties.get("hz-port"));
}
示例6: getOrDefault
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
private <T extends Comparable> T getOrDefault(PropertyDefinition property, T defaultValue) {
if (properties == null || property == null) {
return defaultValue;
}
Comparable value = properties.get(property.key());
if (value == null) {
return defaultValue;
}
return (T) value;
}
示例7: ConsulDiscoveryFactory
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
public ConsulDiscoveryFactory() {
List<PropertyDefinition> properties = new ArrayList<>();
properties.add(new SimplePropertyDefinition("host", PropertyTypeConverter.STRING));
properties.add(new SimplePropertyDefinition("port", PropertyTypeConverter.INTEGER));
properties.add(new SimplePropertyDefinition("name", PropertyTypeConverter.STRING));
this.propertyDefinitions = Collections.unmodifiableCollection(properties);
}
示例8: getProperty
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
private String getProperty(String prefix, PropertyDefinition property) {
StringBuilder sb = new StringBuilder(prefix);
if (prefix.charAt(prefix.length() - 1) != '.') {
sb.append('.');
}
return sb.append(property.key()).toString();
}
示例9: checkProperties
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
@Test
public void checkProperties() {
HazelcastKubernetesDiscoveryStrategyFactory factory = new HazelcastKubernetesDiscoveryStrategyFactory();
Collection<PropertyDefinition> propertyDefinitions = factory.getConfigurationProperties();
assertTrue(propertyDefinitions.contains(KubernetesProperties.SERVICE_DNS));
assertTrue(propertyDefinitions.contains(KubernetesProperties.SERVICE_PORT));
}
示例10: getConfigurationProperties
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
public Collection<PropertyDefinition> getConfigurationProperties() {
return PROPERTIES;
}
开发者ID:bitsofinfo,项目名称:hazelcast-docker-swarm-discovery-spi,代码行数:4,代码来源:DockerSwarmDiscoveryStrategyFactory.java
示例11: property
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter) {
return property(key, typeConverter, null);
}
示例12: getConfigurationProperties
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
public Collection<PropertyDefinition> getConfigurationProperties() {
return PROPERTY_DEFINITIONS;
}
示例13: getConfigurationProperties
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
return PROPERTY_DEFINITIONS;
}
开发者ID:noctarius,项目名称:hazelcast-discovery-spi-demonstration,代码行数:5,代码来源:SomeRestServiceDiscoveryStrategyFactory.java
示例14: property
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
private static PropertyDefinition property(String key, TypeConverter typeConverter) {
return new SimplePropertyDefinition(key, true, typeConverter);
}
示例15: HerokuDiscoveryStrategyFactory
import com.hazelcast.config.properties.PropertyDefinition; //导入依赖的package包/类
public HerokuDiscoveryStrategyFactory() {
this.propertyDefinitions = Collections.unmodifiableCollection(
new ArrayList<PropertyDefinition>()
);
}