Java 类com.hazelcast.config.properties.PropertyDefinition 实例源码

项目:hazelcast_eureka    文件:HazelcastMemberConfiguration.java   
@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;
        }
    };
}
项目:hazelcast-kubernetes    文件:HazelcastKubernetesDiscoveryStrategy.java   
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;
}
项目:hazelcast-kubernetes    文件:HazelcastKubernetesDiscoveryStrategy.java   
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;
}
项目:hazelcast-aws    文件:AwsDiscoveryStrategyFactory.java   
@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;
}
项目:hazelcast-aws    文件:AwsDiscoveryStrategyFactoryTest.java   
@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"));
}
项目:hazelcast-jclouds    文件:ComputeServiceBuilder.java   
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;
}
项目:hazelcast-consul-spi    文件:ConsulDiscoveryFactory.java   
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);
}
项目:hazelcast-consul-discovery    文件:ConsulDiscoveryFactory.java   
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);
}
项目:hazelcast-kubernetes    文件:HazelcastKubernetesDiscoveryStrategy.java   
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();
}
项目:hazelcast-kubernetes    文件:KubernetesDiscoveryStrategyFactoryTest.java   
@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));
}
项目:hazelcast-docker-swarm-discovery-spi    文件:DockerSwarmDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTIES;
}
项目:hazelcast-zookeeper    文件:ZookeeperDiscoveryProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter) {
    return property(key, typeConverter, null);
}
项目:hazelcast-zookeeper    文件:ZookeeperDiscoveryProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter,
                                           ValueValidator valueValidator) {
    return new SimplePropertyDefinition(key, true, typeConverter, valueValidator);
}
项目:hazelcast-zookeeper    文件:ZookeeperDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-discovery-spi-demonstration    文件:SomeRestServiceDiscoveryStrategyFactory.java   
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-eureka    文件:EurekaOneProperties.java   
private static PropertyDefinition property(String key, TypeConverter typeConverter) {
    return new SimplePropertyDefinition(key, true, typeConverter);
}
项目:hazelcast-eureka    文件:EurekaOneDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-heroku-discovery    文件:HerokuDiscoveryStrategyFactory.java   
public HerokuDiscoveryStrategyFactory() {
  this.propertyDefinitions = Collections.unmodifiableCollection(
      new ArrayList<PropertyDefinition>()
  );
}
项目:hazelcast-heroku-discovery    文件:HerokuDiscoveryStrategyFactory.java   
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
  return propertyDefinitions;
}
项目:hazelcast-jclouds    文件:JCloudsDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-jclouds    文件:JCloudsProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter) {
    return property(key, typeConverter, null);
}
项目:hazelcast-jclouds    文件:JCloudsProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter,
                                           ValueValidator valueValidator) {
    return new SimplePropertyDefinition(key, true, typeConverter, valueValidator);
}
项目:hazelcast-jclouds    文件:ComputeServiceBuilder.java   
private <T extends Comparable> T getOrNull(PropertyDefinition property) {
    return getOrDefault(property, null);
}
项目:hazelcast-consul-discovery-spi    文件:ConsulDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTIES;
}
项目:hazelcast-consul-spi    文件:ConsulDiscoveryFactory.java   
@Override
public Collection<PropertyDefinition> configurationProperties() {
    return propertyDefinitions;
}
项目:hazelcast-consul-discovery    文件:ConsulDiscoveryFactory.java   
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
    return propertyDefinitions;
}
项目:hzkeeper    文件:ZookeeperDiscoveryProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter) {
    return property(key, typeConverter, null);
}
项目:hzkeeper    文件:ZookeeperDiscoveryProperties.java   
private static PropertyDefinition property(String key, PropertyTypeConverter typeConverter,
                                           ValueValidator valueValidator) {
    return new SimplePropertyDefinition(key, true, typeConverter, valueValidator);
}
项目:hzkeeper    文件:ZookeeperDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-etcd-discovery-spi    文件:EtcdDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTIES;
}
项目:hazelcast-kubernetes    文件:KubernetesProperties.java   
private static PropertyDefinition property(String key, TypeConverter typeConverter) {
    return new SimplePropertyDefinition(key, true, typeConverter);
}
项目:hazelcast-kubernetes    文件:HazelcastKubernetesDiscoveryStrategyFactory.java   
public Collection<PropertyDefinition> getConfigurationProperties() {
    return PROPERTY_DEFINITIONS;
}
项目:hazelcast-kubernetes    文件:HazelcastKubernetesDiscoveryStrategy.java   
protected <T extends Comparable> T getOrNull(Map<String, Comparable> properties, String prefix, PropertyDefinition property) {
    return getOrDefault(properties, prefix, property, null);
}
项目:cattle    文件:DBDiscoveryFactory.java   
@Override
public Collection<PropertyDefinition> getConfigurationProperties() {
    return Collections.emptySet();
}