public class PropertyUtils
extends java.lang.Object
| Constructor and Description |
|---|
PropertyUtils() |
| Modifier and Type | Method and Description |
|---|---|
static @NonNull java.util.Properties |
addProperties(java.util.Properties dest,
@Nullable java.util.Properties propsToAdd) |
static void |
addSnapshotState(@Nullable java.util.List<Pair<java.lang.String,java.lang.Object>> state,
@NonNull java.lang.String name,
@Nullable java.util.Properties properties) |
static void |
applyProperties(java.lang.Object target,
java.util.Properties properties) |
static void |
clearReportedHostSelectionProperties()
Forgets which node-selection properties have already been reported, so the once-per-JVM warning in
removeHostSelectionProperties(java.util.Properties, software.amazon.jdbc.targetdriverdialect.TargetDriverDialect) can be exercised in isolation. |
static @NonNull java.util.Properties |
copyProperties(@Nullable java.util.Properties props) |
static @Nullable java.lang.Boolean |
getBooleanPropertyValue(@NonNull java.util.Properties props,
@NonNull AwsWrapperProperty wrapperProperty) |
static @Nullable java.lang.Integer |
getIntegerPropertyValue(@NonNull java.util.Properties props,
@NonNull AwsWrapperProperty wrapperProperty) |
static java.lang.String |
logProperties(java.util.Properties props,
java.lang.String caption) |
static @NonNull java.util.Properties |
maskProperties(java.util.Properties props) |
static void |
removeHostSelectionProperties(@NonNull java.util.Properties monitoringProps,
@Nullable TargetDriverDialect targetDriverDialect)
Strips properties that restrict which database node the target driver will accept, from properties
about to be used for an internal monitoring connection.
|
static void |
setPropertyOnTarget(java.lang.Object target,
java.lang.String propName,
@Nullable java.lang.Object propValue,
java.util.List<java.lang.reflect.Method> methods) |
public static void applyProperties(java.lang.Object target,
java.util.Properties properties)
public static void setPropertyOnTarget(java.lang.Object target,
java.lang.String propName,
@Nullable java.lang.Object propValue,
java.util.List<java.lang.reflect.Method> methods)
public static @NonNull java.util.Properties copyProperties(@Nullable java.util.Properties props)
public static @NonNull java.util.Properties addProperties(java.util.Properties dest,
@Nullable java.util.Properties propsToAdd)
public static void removeHostSelectionProperties(@NonNull java.util.Properties monitoringProps,
@Nullable TargetDriverDialect targetDriverDialect)
Monitoring connections are opened against one specific node that the wrapper has already chosen, and often against a reader or a replica deliberately. A target driver setting that makes the driver reject a node by role would make those connections fail, silently disabling whichever monitor relies on them. Which properties qualify is decided by the target driver dialect, so no driver-specific property name is needed here.
A warning is logged when something is removed, so the configuration issue is visible rather than silently corrected.
This is best-effort hygiene called while monitors are being constructed, so a missing dialect is tolerated and simply skipped. Failing to strip a property must never be the reason a monitor cannot be created.
monitoringProps - the monitoring connection properties to adjust in place.targetDriverDialect - the dialect that knows which properties restrict node selection.public static void clearReportedHostSelectionProperties()
removeHostSelectionProperties(java.util.Properties, software.amazon.jdbc.targetdriverdialect.TargetDriverDialect) can be exercised in isolation. Intended for tests.public static @NonNull java.util.Properties maskProperties(java.util.Properties props)
public static java.lang.String logProperties(java.util.Properties props,
java.lang.String caption)
public static @Nullable java.lang.Integer getIntegerPropertyValue(@NonNull java.util.Properties props,
@NonNull AwsWrapperProperty wrapperProperty)
public static @Nullable java.lang.Boolean getBooleanPropertyValue(@NonNull java.util.Properties props,
@NonNull AwsWrapperProperty wrapperProperty)
public static void addSnapshotState(@Nullable java.util.List<Pair<java.lang.String,java.lang.Object>> state, @NonNull java.lang.String name, @Nullable java.util.Properties properties)