@Beta public class ServiceOperatorDataFileSystemStructureParsingStrategy extends Object
FileSystemServiceBindingLoader.ParsingStrategy
interface that is capable of
transforming the default file system structure into service bindings based on properties (individual files) that have
been created by the ServiceOperator (e.g. in a K8s cluster), using the default ("Data") behavior. Modifier and Type | Class and Description |
---|---|
static interface |
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
Represents a utility class to set a service binding property, based on the property name.
|
static class |
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceOperatorDataFileSystemStructureParsingStrategyBuilder |
Modifier | Constructor and Description |
---|---|
protected |
ServiceOperatorDataFileSystemStructureParsingStrategy(Map<String,ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter> propertiesMapping,
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter backupPropertySetter,
Charset charset)
Constructs a new instance of the
ServiceOperatorDataFileSystemStructureParsingStrategy class. |
Modifier and Type | Method and Description |
---|---|
static ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceOperatorDataFileSystemStructureParsingStrategyBuilder |
builder() |
static ServiceOperatorDataFileSystemStructureParsingStrategy |
getDefaultInstance() |
protected com.google.gson.JsonObject |
loadServiceBinding(Path serviceBindingRoot)
Transforms the content of the given
serviceBindingRoot into a JsonObject that represents a
service binding. |
Map<String,com.google.gson.JsonArray> |
parse(Path rootLocation)
Parses the given
rootLocation and returns all contained service bindings. |
protected static io.vavr.control.Option<com.google.gson.JsonObject> |
toJsonObject(String rawJsonObject)
Utility method to convert a given string into a
JsonObject . |
@Nonnull public static final ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter TO_CREDENTIALS
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
that adds the given property to the (nested)
"credentials" object of the given serviceBindingObject
. JsonObject
"credentials", it is created.@Nonnull public static final ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter TO_ROOT
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
that adds the given property to the root
level of the given service binding.@Nonnull public static final ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter AS_JSON_ARRAY_TO_ROOT
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
that converts the given property content into
a JsonArray
and adds it to the root level of the given service binding.@Nonnull public static final Map<String,ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter> DEFAULT_PROPERTIES_MAPPING
@Nonnull public static final ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter DEFAULT_BACKUP_PROPERTY_SETTER
ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
to use if no other setter has been defined for a specific
property.protected ServiceOperatorDataFileSystemStructureParsingStrategy(@Nullable Map<String,ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter> propertiesMapping, @Nullable ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter backupPropertySetter, @Nullable Charset charset)
ServiceOperatorDataFileSystemStructureParsingStrategy
class.propertiesMapping
- A Map
of property names (keys) to the ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
to use for that
specific property. null
, the DEFAULT_PROPERTIES_MAPPING
is used.backupPropertySetter
- The ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceBindingPropertySetter
to use if none of the properties defined in
propertiesMapping
matches the current property. null
, the DEFAULT_BACKUP_PROPERTY_SETTER
is used.charset
- The charset to decode individual files. null
, the FileSystemServiceBindingLoader.DEFAULT_CHARSET
is used.@Nullable protected com.google.gson.JsonObject loadServiceBinding(@Nonnull Path serviceBindingRoot)
serviceBindingRoot
into a JsonObject
that represents a
service binding. Exception
.serviceBindingRoot
- The Path
that points to the service binding's location.Option
that contains an instance of JsonObject
if the given serviceBindingRoot
contained a valid service binding, otherwise Option.none()
.@Nonnull public static ServiceOperatorDataFileSystemStructureParsingStrategy.ServiceOperatorDataFileSystemStructureParsingStrategyBuilder builder()
@Nonnull public static ServiceOperatorDataFileSystemStructureParsingStrategy getDefaultInstance()
@Nonnull public Map<String,com.google.gson.JsonArray> parse(@Nonnull Path rootLocation)
FileSystemServiceBindingLoader.ParsingStrategy
rootLocation
and returns all contained service bindings. Exception
.parse
in interface FileSystemServiceBindingLoader.ParsingStrategy
rootLocation
- The Path
to start the parsing from.@Nonnull protected static io.vavr.control.Option<com.google.gson.JsonObject> toJsonObject(@Nonnull String rawJsonObject)
JsonObject
.rawJsonObject
- The string to parse.Option
that contains an instance of JsonObject
if the given rawJsonObject
was
parsed successfully, otherwise Option.none()
.Copyright © 2021 SAP SE. All rights reserved.