public enum DiffusionGatewayFramework extends Enum<DiffusionGatewayFramework>
For full details of the use of the framework see
Package Guide
.
Modifier and Type | Class and Description |
---|---|
static interface |
DiffusionGatewayFramework.Implementation
Do not use - Use static methods on
DiffusionGatewayFramework . |
Enum Constant and Description |
---|
IMPLEMENTATION
Internal type - do not use.
|
Modifier and Type | Method and Description |
---|---|
static String |
mapDiffusionTopic(String path,
String mappingFunction)
Extracts parts of the Diffusion topic branch in the supplied source path
and constructs another topic path specified by the supplied mapping
function.
|
static GatewayApplication.ApplicationDetails.Builder |
newApplicationDetailsBuilder()
Factory for an
GatewayApplication.ApplicationDetails builder. |
static SinkHandler.SinkServiceProperties.Builder |
newSinkServicePropertiesBuilder()
Factory for builders of
SinkHandler.SinkServiceProperties . |
static SourceHandler.SourceServiceProperties.Builder |
newSourceServicePropertiesBuilder()
Factory for builders of
SourceHandler.SourceServiceProperties . |
static void |
shutdown()
Shuts down the framework.
|
static GatewayFramework |
start(GatewayApplication application)
Called by an application to introduce a gateway framework application
implementation and start the framework.
|
static DiffusionGatewayFramework |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static DiffusionGatewayFramework[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final DiffusionGatewayFramework IMPLEMENTATION
public static DiffusionGatewayFramework[] values()
for (DiffusionGatewayFramework c : DiffusionGatewayFramework.values()) System.out.println(c);
public static DiffusionGatewayFramework valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is nullpublic static GatewayFramework start(GatewayApplication application) throws ApplicationInitializationException
This may only be called once per JVM.
When this is called, the framework will call back on the application to
determine its application
details
and then initialize
the
application.
Once the application is initialized, the GatewayFramework
and
the application will be started.
During the start of the framework, a connection with the Diffusion server
will be established, and service types supported by the application
will be registered.
After the connection with the Diffusion server,
start
will be called on the application.
If the connection with the server fails to establish due to a terminal error, such as an authentication error, the framework will throw the corresponding exception and shut down.
application
- the applicationApplicationConfigurationException
- if the passed configuration or
configuration obtained from the server has been found to be invalid
or incompatible with the application;DiffusionSecurityException
- if the application principal
does not have sufficient permissions to perform the operation;DiffusionClientException
- if some other exception has been returned from the
Diffusion server via the Diffusion Client API.
The cause will provide more detail.ApplicationInitializationException
- if the connection with
the Diffusion server fails for any other reason or if initialization fails
for any reason.public static void shutdown()
However, the instance of DiffusionGatewayFramework
created in the
JVM will not be removed and will be reused if the application is
restarted.
This is mostly useful in tests to explicitly clean up resources in the framework.
This method does not need to be called within the Gateway application, as shutting the application is managed by the framework.
public static GatewayApplication.ApplicationDetails.Builder newApplicationDetailsBuilder()
GatewayApplication.ApplicationDetails
builder.public static SourceHandler.SourceServiceProperties.Builder newSourceServicePropertiesBuilder()
SourceHandler.SourceServiceProperties
.public static SinkHandler.SinkServiceProperties.Builder newSinkServicePropertiesBuilder()
SinkHandler.SinkServiceProperties
.public static String mapDiffusionTopic(String path, String mappingFunction)
The supplied path will only be mapped if it is a simple Diffusion topic
path. If a Diffusion topic selector is supplied, an
IllegalArgumentException
will be thrown.
The mapping function comprises path fragments and path directives.
A path fragment is a section that is literally extracted as it is. It may contain the path separator character '/'.
A path directive is an expression of format <path
(start,length)>. It is used to select parts of the source path to
be re-used in the mapped topic path. start
is
mandatory and specifies the index of the source path to start from
and length
specifies the number of parts to include
from start
index. The length
of the
expression is optional – if it is missing, or '0', or a number
that specifies a length longer than the end of the source path,
the selection extends to the end of the source path. The
start
starts from 0, i.e., the index of the first
part of the source path is 0.
With the above definition, given a source path `a/b/c/d` and the mapping function 'prefix/<path(1, 2)>', this method constructs the final topic path `prefix/b/c`. Here, `prefix/` is a path fragment that is used as it is. `1` is the index of the part in the source path to start from, which is `b`, and `2` is the number of parts to include after the start index, which includes `c`. Thus, the final mapped path is `prefix/b/c`.
Similarly, for the above source path, the mapping function '<path(1)>'
constructs the final path `b/c/d`. Here, the length
argument
is missing in the path directive. Hence, all following parts will be
included in the final mapped path.
Similarly, for the above source path, the mapping function '<path(1,10)>'
constructs the final path `b/c/d`. Here, the length
argument
in the path directive contains a larger value that covers all
parts after start
. Hence, all following parts will be
included in the final mapped path.
The start
and length
in the path directive
should be positive numbers. If start
fails to find
the corresponding part in the source path, a
NoSuchElementException
will be thrown. For example, in the
given source path `a/b/c/d`, if the mapping function is '<path(5)>',
there is no part at index 5 in the source path, which causes a
NoSuchElementException
.
path
- the Diffusion source topic path to mapmappingFunction
- the mapping function to applyNoSuchElementException
- if either start
or
length
in the path directive
in the mapping function fails to find the
corresponding part in the source pathCopyright © 2024 DiffusionData Limited. All rights reserved.