
com.hazelcast.client.config.ClientFailoverConfigRecognizer Maven / Gradle / Ivy
The newest version!
/*
* Copyright (c) 2008-2024, Hazelcast, Inc. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.hazelcast.client.config;
import com.hazelcast.client.config.impl.ClientFailoverXmlConfigRootTagRecognizer;
import com.hazelcast.client.config.impl.ClientFailoverYamlConfigRootTagRecognizer;
import com.hazelcast.config.ConfigRecognizer;
import com.hazelcast.internal.config.AbstractConfigRecognizer;
import java.util.LinkedList;
import java.util.List;
import static java.util.Arrays.asList;
/**
* {@link ConfigRecognizer} implementation that recognizes Hazelcast
* client failover declarative configurations based on an extensible set
* of built-in {@link ConfigRecognizer} implementations.
*/
public class ClientFailoverConfigRecognizer
extends AbstractConfigRecognizer {
/**
* Constructs an instance with the built-in set of
* {@link ConfigRecognizer} implementations only.
*
* @throws Exception If there is an unexpected error occur during
* instantiation.
*/
public ClientFailoverConfigRecognizer() throws Exception {
super(builtInRecognizers());
}
/**
* Constructs an instance with the built-in set of
* {@link ConfigRecognizer} implementations extended with ones
* provided in {@code customRecognizers}.
*
* @param customRecognizers The custom config recognizers to use
* besides the built-in ones.
* @throws Exception If there is an unexpected error occur during
* instantiation.
*/
public ClientFailoverConfigRecognizer(ConfigRecognizer... customRecognizers) throws Exception {
super(recognizers(customRecognizers));
}
private static List recognizers(ConfigRecognizer... customRecognizers) throws Exception {
List configRecognizers = new LinkedList<>(builtInRecognizers());
configRecognizers.addAll(asList(customRecognizers));
return configRecognizers;
}
private static List builtInRecognizers() throws Exception {
return asList(
new ClientFailoverXmlConfigRootTagRecognizer(),
new ClientFailoverYamlConfigRootTagRecognizer());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy