public static interface GatewayApplication.ApplicationDetails.Builder
A new instance of such a builder can be created using
DiffusionGatewayFramework.newApplicationDetailsBuilder()
.
Modifier and Type | Method and Description |
---|---|
GatewayApplication.ApplicationDetails.Builder |
addServiceType(String serviceTypeName,
ServiceMode mode,
String description,
String schema)
Add a service type.
|
GatewayApplication.ApplicationDetails.Builder |
addServiceType(String serviceTypeName,
ServiceMode mode,
String description,
String schema,
BiFunction<Integer,Map<String,Object>,Map<String,Object>> configUpgradeFunction)
Add a service type.
|
GatewayApplication.ApplicationDetails.Builder |
addSharedConfigType(String sharedConfigTypeName,
String description,
String schema)
Add a sharedConfig type.
|
GatewayApplication.ApplicationDetails.Builder |
addSharedConfigType(String sharedConfigTypeName,
String description,
String schema,
BiFunction<Integer,Map<String,Object>,Map<String,Object>> configUpgradeFunction)
Add a sharedConfig type.
|
GatewayApplication.ApplicationDetails |
build(String applicationType,
int configurationVersion)
Create an
GatewayApplication.ApplicationDetails instance with the current
settings of this builder. |
GatewayApplication.ApplicationDetails.Builder |
globalConfigUpgradeFunction(BiFunction<Integer,Map<String,Object>,Map<String,Object>> globalConfigUpgradeFunction)
Sets a
BiFunction to upgrade global application
configuration from an older version to the latest version
supported by the application. |
GatewayApplication.ApplicationDetails.Builder |
globalSchema(String schema)
Sets the schema for the global application configuration.
|
GatewayApplication.ApplicationDetails.Builder globalSchema(String schema) throws ApplicationConfigurationException
The default if not specified is an empty schema.
If no schema is specified, no validation of the global application configuration will be performed by the framework and the application would not benefit from configuration formatting in the Diffusion console. Not using a schema may be useful during development but it is strongly advised to define a schema before putting the application into production.
schema
- a JSON schema (in draft 7 format) which describes
the format of the global application configurationApplicationConfigurationException
- if the schema is
invalidGatewayApplication.ApplicationDetails.Builder addServiceType(String serviceTypeName, ServiceMode mode, String description, String schema) throws ApplicationConfigurationException
This can be used to add a service type, if the configuration schema for this service type is compatible with any older configuration version and a configuration upgrade function is not required.
If this builder method is used, by default, a bi-function which returns the same configuration parameters is used as the configuration upgrade function for this service type.
serviceTypeName
- the service type namemode
- the mode of operation of the servicedescription
- the description of the service type.
This will be displayed in Diffusion console to provide details about the service type.
ServiceMode.getDescription()
can be used as
default or part of the description for the service type.
schema
- a JSON schema (in draft 7 format) which describes
the format of the application specific configuration for
the service type.
Null may be supplied to define an empty schema in which case no configuration validation will be performed by the framework and the application would not benefit from configuration formatting in the Diffusion console. Not using a schema may be useful during development but it is strongly advised to define a schema before putting the application into production.
ApplicationConfigurationException
- if the supplied schema
is invalidif such
function is required to be set.
GatewayApplication.ApplicationDetails.Builder addServiceType(String serviceTypeName, ServiceMode mode, String description, String schema, BiFunction<Integer,Map<String,Object>,Map<String,Object>> configUpgradeFunction) throws ApplicationConfigurationException
serviceTypeName
- the service type namemode
- the mode of operation of the servicedescription
- the description of the service type.
This will be displayed in Diffusion console to provide details about the service type.
ServiceMode.getDescription()
can be used as
default or part of the description for the service type.
schema
- a JSON schema (in draft 7 format) which describes
the format of the application specific configuration for
the service type.
Null may be supplied to define an empty schema in which case no configuration validation will be performed by the framework and the application would not benefit from configuration formatting in the Diffusion console. Not using a schema may be useful during development but it is strongly advised to define a schema before putting the application into production.
configUpgradeFunction
- a BiFunction
to upgrade
configuration of the service type from older version to
the latest supported version.
The bi-function would take the version of the configuration to be converted and the older configuration params as map, performs necessary transformation to upgrade the configuration and return upgraded configuration map.
ApplicationConfigurationException
- if the supplied schema
is invalidif such
function is not required to be set.
GatewayApplication.ApplicationDetails.Builder addSharedConfigType(String sharedConfigTypeName, String description, String schema) throws ApplicationConfigurationException
This can be used to add a sharedConfig type, if the configuration schema for this sharedConfig type is compatible with any older configuration version and a configuration upgrade function is not required.
sharedConfigTypeName
- the sharedConfig type namedescription
- the description of the sharedConfig type
This will be displayed in Diffusion console to provide details about the sharedConfig type.
schema
- a JSON schema (in draft 7 format) which describes
the format of the application specific configuration for
the sharedConfig type.
Null may be supplied to define an empty schema in which case no configuration validation will be performed by the framework and the application would not benefit from configuration formatting in the Diffusion console. Not using a schema may be useful during development, but it is strongly advised to define a schema before putting the application into production.
ApplicationConfigurationException
- if the supplied schema
is invalidif such
function is required to be set.
If this builder method is used, by default, a bi-function
which returns the same configuration parameters is used as the
configuration upgrade function for this sharedConfig type.
GatewayApplication.ApplicationDetails.Builder addSharedConfigType(String sharedConfigTypeName, String description, String schema, BiFunction<Integer,Map<String,Object>,Map<String,Object>> configUpgradeFunction) throws ApplicationConfigurationException
sharedConfigTypeName
- the sharedConfig type namedescription
- the description of the sharedConfig type
This will be displayed in Diffusion console to provide details about the sharedConfig type.
schema
- a JSON schema (in draft 7 format) which describes
the format of the application specific configuration for
the sharedConfig type.
Null may be supplied to define an empty schema in which case no configuration validation will be performed by the framework and the application would not benefit from configuration formatting in the Diffusion console. Not using a schema may be useful during development, but it is strongly advised to define a schema before putting the application into production.
configUpgradeFunction
- a BiFunction
to upgrade
configuration of the sharedConfig type from an older version to
the latest supported version.
The bi-function would take the version of the configuration to be converted and the older configuration parameters as map, performs necessary transformation to upgrade the configuration and return upgraded configuration map.
ApplicationConfigurationException
- if the supplied schema
is invalidif such
function is not required to be set.
GatewayApplication.ApplicationDetails.Builder globalConfigUpgradeFunction(BiFunction<Integer,Map<String,Object>,Map<String,Object>> globalConfigUpgradeFunction)
BiFunction
to upgrade global application
configuration from an older version to the latest version
supported by the application.
The bi-function would take the version of the configuration to be converted and the older configuration parameters as a map, perform the necessary transformation to the parameters and return an upgraded configuration map.
The default if not specified is a bi-function which returns the same configuration without any changes.
If the application supports usage of global configuration for application and the schema of the configuration has changed from the previous version with breaking changes, then this function should be set, to upgrade passed global configuration of older version to the latest expected version.
If the application does not support usage of global application configuration, this bi-function does not need to be set.
globalConfigUpgradeFunction
- A bi-function which will be
used by framework to upgrade older global configuration to
the latest version.GatewayApplication.ApplicationDetails build(String applicationType, int configurationVersion)
GatewayApplication.ApplicationDetails
instance with the current
settings of this builder.applicationType
- specifies the application type. For
example, an adapter that interfaces with Kafka might
return type "Kafka".configurationVersion
- specifies the latest configuration
version of the application.
Application configuration includes global configuration, configuration of sharedConfig types and service types defined by Gateway Application.
Copyright © 2024 DiffusionData Limited. All rights reserved.