To build a valid connector configuration, you must:
-
Define an interface.
-
Extend
ConnectorConfig
. -
Apply a few annotations.
-
Define connector methods and annotations.
All methods that are annotated with @Property
are considered to be configuration properties.
For example, @Property() String name();
results in a String property called name
.
This property would then be present in the generated schema.
Here is an example of the most basic configuration, along with required annotations:
@RootSchema(
title = "My Connector",
description = "My Connector description",
category = "My Category"
)
public interface MyConfig extends ConnectorConfig<MyConfig.Properties> {
@Property(
title = "Properties",
required = true
)
public Properties properties();
/**
* Connector specific settings
*/
interface Properties extends FetcherProperties {
@Property(
title = "My custom property",
description = "My custom property description"
)
public Integer myCustomProperty();
}
}
The metadata defined by @RootSchema
is used by Fusion when showing the list of available connectors.
The ConnectorConfig
base interface represents common, top-level settings required by all connectors.
The type
parameter of the ConnectorConfig
class indicates the interface to use for custom properties.
Once a connector configuration has been defined, it can be associated with the ConnectorPlugin
class.
From that point, the framework takes care of providing the configuration instances to your connector.
It also generates the schema, and sends it along to Fusion when it connects to Fusion.
Schema metadata can be applied to properties using additional annotations. For example, applying limits to the min/max length of a string, or describing the types of items in an array.
Nested schema metadata can also be applied to a single field by using "stacked" schema based annotations:
interface MySetConfig extends Model {
@SchemaAnnotations.Property(title = "My Set")
@SchemaAnnotations.ArraySchema(defaultValue = "[\"a\"]")
@SchemaAnnotations.StringSchema(defaultValue = "some-set-value", minLength = 1, maxLength = 1)
Set<String> mySet();
}