Class ZooKeeperClientConfig
java.lang.Object
org.apache.nifi.framework.cluster.zookeeper.ZooKeeperClientConfig
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Stringprivate final Stringprivate final booleanprivate final intprivate final Stringprivate final intprivate final Stringprivate final Stringprivate final Stringprivate static final org.slf4j.Loggerstatic final Stringstatic final Stringprivate static final Patternprivate final Stringprivate final Stringprivate final Stringprivate final intprivate final Stringprivate final Stringprivate final Stringprivate final boolean -
Constructor Summary
ConstructorsModifierConstructorDescriptionprivateZooKeeperClientConfig(String connectString, int sessionTimeoutMillis, int connectionTimeoutMillis, String rootPath, String authType, String authPrincipal, String removeHostFromPrincipal, String removeRealmFromPrincipal, boolean clientSecure, String keyStore, String keyStoreType, String keyStorePassword, String trustStore, String trustStoreType, String trustStorePassword, int juteMaxbuffer, boolean withEnsembleTracker) -
Method Summary
Modifier and TypeMethodDescriptionstatic StringcleanConnectString(String connectString) Takes a given connect string and splits it by ',' character.static ZooKeeperClientConfigcreateConfig(NiFiProperties nifiProperties) intintstatic StringgetPreferredProperty(NiFiProperties properties, String preferredPropertyName, String defaultPropertyName) Retrieves the preferred property value if it's set, otherwise retrieves the default property.intprivate static intgetTimePeriod(NiFiProperties nifiProperties, String propertyName, String defaultValue) booleanbooleanresolvePath(String path)
-
Field Details
-
NETTY_CLIENT_CNXN_SOCKET
-
NIO_CLIENT_CNXN_SOCKET
-
logger
private static final org.slf4j.Logger logger -
PORT_PATTERN
-
connectString
-
sessionTimeoutMillis
private final int sessionTimeoutMillis -
connectionTimeoutMillis
private final int connectionTimeoutMillis -
rootPath
-
clientSecure
private final boolean clientSecure -
withEnsembleTracker
private final boolean withEnsembleTracker -
keyStore
-
keyStoreType
-
keyStorePassword
-
trustStore
-
trustStoreType
-
trustStorePassword
-
authType
-
authPrincipal
-
removeHostFromPrincipal
-
removeRealmFromPrincipal
-
juteMaxbuffer
private final int juteMaxbuffer
-
-
Constructor Details
-
ZooKeeperClientConfig
private ZooKeeperClientConfig(String connectString, int sessionTimeoutMillis, int connectionTimeoutMillis, String rootPath, String authType, String authPrincipal, String removeHostFromPrincipal, String removeRealmFromPrincipal, boolean clientSecure, String keyStore, String keyStoreType, String keyStorePassword, String trustStore, String trustStoreType, String trustStorePassword, int juteMaxbuffer, boolean withEnsembleTracker)
-
-
Method Details
-
getConnectString
-
getSessionTimeoutMillis
public int getSessionTimeoutMillis() -
getConnectionTimeoutMillis
public int getConnectionTimeoutMillis() -
getRootPath
-
isClientSecure
public boolean isClientSecure() -
isWithEnsembleTracker
public boolean isWithEnsembleTracker() -
getConnectionSocket
-
getKeyStore
-
getKeyStoreType
-
getKeyStorePassword
-
getTrustStore
-
getTrustStoreType
-
getTrustStorePassword
-
getAuthType
-
getAuthPrincipal
-
getRemoveHostFromPrincipal
-
getRemoveRealmFromPrincipal
-
getJuteMaxbuffer
public int getJuteMaxbuffer() -
resolvePath
-
createConfig
-
getTimePeriod
private static int getTimePeriod(NiFiProperties nifiProperties, String propertyName, String defaultValue) -
getPreferredProperty
public static String getPreferredProperty(NiFiProperties properties, String preferredPropertyName, String defaultPropertyName) Retrieves the preferred property value if it's set, otherwise retrieves the default property. If neither are set, returns null.- Parameters:
properties- The NiFi properties configuration.preferredPropertyName- The preferred property to get from NiFi properties.defaultPropertyName- The backup property to get from NiFi properties if the preferred property is not present.- Returns:
- Returns the property in order of preference.
-
cleanConnectString
Takes a given connect string and splits it by ',' character. For each split result trims whitespace then splits by ':' character. For each secondary split if a single value is returned it is trimmed and then the default zookeeper 2181 is append by adding ":2181". If two values are returned then the second value is evaluated to ensure it contains only digits and if not then the entry is in error and exception is raised. If more than two values are returned the entry is in error and an exception is raised. Each entry is trimmed and if empty the entry is skipped. After all splits are cleaned then they are all appended back together demarcated by "," and the full string is returned.- Parameters:
connectString- the string to clean- Returns:
- cleaned connect string guaranteed to be non null but could be empty
- Throws:
IllegalStateException- if any portions could not be cleaned/parsed
-