public interface Connector
A connector instance works as a connection to a data source. A connector is used for discovering catalogs, schemas, tables and columns from the data source. For example, an SQL database connector is used to discover the schemas and tables in this database, the columns in each table and their types, as well as the joins between those tables.
A connector instance is also used as a factory for DataSet
objects, in the same way a JDBC Connection object
is used as a factory for Statement object.
A connector is created using a ConnectorFactory
.
Modifier and Type | Method and Description |
---|---|
DataSet |
createDataSet(DataSetContext context,
DataSetSpec dsSpec)
This is the factory method used for creating
DataSet objects. |
DataSetSpec |
generateDataSetSpec(DiscoveryContext context,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table,
java.lang.String[] columns)
Generates the data set specification for the selected catalog, schema, table and columns.
|
java.util.List<CatalogDetails> |
getCatalogs(DiscoveryContext context,
java.lang.String parentCatalog)
Returns a list of catalogs under the specified parent catalog.
|
java.util.List<ColumnDetails> |
getColumns(DiscoveryContext context,
java.lang.String catalog,
java.lang.String schema,
java.lang.String table)
Returns the list of columns of the specified table.
|
java.lang.String |
getName()
Returns the name of the connector instance.
|
java.util.List<SchemaDetails> |
getSchemas(DiscoveryContext context,
java.lang.String catalog)
Returns a list of schemas under the specified parent catalog.
|
java.util.List<TableDetails> |
getTables(DiscoveryContext context,
java.lang.String catalog,
java.lang.String schema)
Returns a list of tables under the specified catalog and schema.
|
ConnectorType |
getType()
Returns the complete type (type, sub-type and version) of this connector
|
default boolean |
isPredefined()
Returns a boolean flag indicating whether or not this connector is predefined.
|
default PropertyModel |
refreshDataSetProperty(DataSetContext context,
DataSetSpec dsSpec,
PropertyModel property)
This method is used if a data set contains a DYNAMIC_LIST field.
|
default void |
shutdown()
This method is used for shutting down the connector instance when Incorta is shutting down (closing connections,
cleaning up resources, etc.).
|
boolean |
supportsCatalogs(DiscoveryContext context)
Returns a boolean flag indicating whether or not this connector supports catalogs.
|
boolean |
supportsSchemas(DiscoveryContext context)
Returns a boolean flag indicating whether or not this connector supports schemas.
|
void |
testConnection()
This method is used for testing connection to the data source.
|
DataSetTestResult |
testDataSet(DiscoveryContext context,
DataSetSpec dsSpec)
Tests the specified data set specification.
|
java.lang.String getName()
ConnectorType getType()
ConnectorType
objectdefault boolean isPredefined()
true
if this connector is predefined, false
otherwisevoid testConnection() throws ConnectorException
ConnectorException
(usually a FailedConnectionException
) when connection fails.ConnectorException
default void shutdown() throws ConnectorException
ConnectorException
boolean supportsCatalogs(DiscoveryContext context) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.true
if connector supports catalogs, false
otherwiseConnectorException
boolean supportsSchemas(DiscoveryContext context) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.true
if connector supports schemas, false
otherwiseConnectorException
java.util.List<CatalogDetails> getCatalogs(DiscoveryContext context, java.lang.String parentCatalog) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.parentCatalog
- Full path of the parent catalog (x/y/z), null for rootCatalogDetails
objectsConnectorException
java.util.List<SchemaDetails> getSchemas(DiscoveryContext context, java.lang.String catalog) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.catalog
- Full path of the parent catalog (x/y/z), null for rootSchemaDetails
objectsConnectorException
java.util.List<TableDetails> getTables(DiscoveryContext context, java.lang.String catalog, java.lang.String schema) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.catalog
- Fully qualified catalog path (x/y/z)schema
- Schema nameTableDetails
objectsConnectorException
java.util.List<ColumnDetails> getColumns(DiscoveryContext context, java.lang.String catalog, java.lang.String schema, java.lang.String table) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.catalog
- Fully qualified catalog path (x/y/z)schema
- Schema nametable
- Table nameColumnDetails
objectsConnectorException
DataSetSpec generateDataSetSpec(DiscoveryContext context, java.lang.String catalog, java.lang.String schema, java.lang.String table, java.lang.String[] columns) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.catalog
- Fully qualified catalog path (x/y/z)schema
- The selected schema nametable
- The selected table namecolumns
- The selected column namesDataSetSpec
object corresponding to the selected criteriaConnectorException
DataSetTestResult testDataSet(DiscoveryContext context, DataSetSpec dsSpec) throws ConnectorException
context
- A context object that can be used to access tenant information, etc.dsSpec
- The data set specification to be testedDataSetTestResult
object containing the test result, which may include sample dataConnectorException
DataSet createDataSet(DataSetContext context, DataSetSpec dsSpec) throws ConnectorException
DataSet
objects. This method is used during extraction.context
- A context object that can be used to access tenant information, etc.dsSpec
- The specification of the data set to be createdDataSet
instanceConnectorException
default PropertyModel refreshDataSetProperty(DataSetContext context, DataSetSpec dsSpec, PropertyModel property) throws ConnectorException
PropertyModel
object which contains the updated list items.
By default, this method returns the original property unchanged.context
- A context object that can be used to access tenant information, etc.dsSpec
- The current data set specification that the user is editingproperty
- The DYNAMIC_LIST property to be updatedPropertyModel
objectConnectorException