Class OpenMetadataDataSetConnectorBase

java.lang.Object
org.odpi.openmetadata.frameworks.connectors.Connector
org.odpi.openmetadata.frameworks.connectors.ConnectorBase
org.odpi.openmetadata.adapters.connectors.jacquard.tabulardatasets.OpenMetadataDataSetConnectorBase
All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, ReadableTabularDataSource, VirtualConnectorExtension
Direct Known Subclasses:
OpenMetadataRootDataSetConnectorBase, OpenMetadataTypesDataSetConnector, ValidMetadataValueSetListConnector

public abstract class OpenMetadataDataSetConnectorBase extends ConnectorBase implements AuditLoggingComponent, ReadableTabularDataSource
ReferenceDataSetConnectorBase enables interaction with a valid value set as if it is a tabular data set.
  • Field Details

  • Constructor Details

    • OpenMetadataDataSetConnectorBase

      public OpenMetadataDataSetConnectorBase(String connectorName)
      Constructor used to set up the name of this connector (supplied by the subclasses).
      Parameters:
      connectorName - name of the connector
    • OpenMetadataDataSetConnectorBase

      public OpenMetadataDataSetConnectorBase(String connectorName, ProductDefinition productDefinition)
      Constructor used to set up the name of this connector (supplied by the subclasses).
      Parameters:
      connectorName - name of the connector
  • Method Details

    • setAuditLog

      public void setAuditLog(AuditLog auditLog)
      Receive an audit log object that can be used to record audit log messages. The caller has initialized it with the correct component description and log destinations.
      Specified by:
      setAuditLog in interface AuditLoggingComponent
      Parameters:
      auditLog - audit log object
    • getConnectorComponentDescription

      public ComponentDescription getConnectorComponentDescription()
      Return the component description used by this connector in the audit log.
      Specified by:
      getConnectorComponentDescription in interface AuditLoggingComponent
      Returns:
      id, name, description, wiki page URL.
    • setLocalEnvironment

      public void setLocalEnvironment(String clientUserId, String localServerName, String localServiceName)
      Set up caller's environment details. Needs to be done before start is called.
      Parameters:
      clientUserId - caller's userId
      localServerName - caller's server
      localServiceName - caller's service
    • start

      Indicates that the connector is completely configured and can begin processing.
      Overrides:
      start in class ConnectorBase
      Throws:
      ConnectorCheckedException - the connector detected a problem.
      UserNotAuthorizedException - the connector was disconnected before/during start
    • refreshCache

      public abstract void refreshCache() throws ConnectorCheckedException
      Refresh any cached values.
      Throws:
      ConnectorCheckedException - unable to refresh
    • getTabularColumnDescription

      protected TabularColumnDescription getTabularColumnDescription(ProductDataFieldDefinition productDataFieldDefinition, boolean isNullable, boolean isIdentifier)
      Convert an open metadata property enum into a tabular column description.
      Parameters:
      productDataFieldDefinition - property enum
      isNullable - is the field nullable?
      isIdentifier - is the filed all or part of the unique identifier for a row/record
      Returns:
      tabular column description
    • getColumnDescriptions

      protected List<TabularColumnDescription> getColumnDescriptions(ProductDefinition productDefinition) throws ConnectorCheckedException
      Return the list of column descriptions associated with this data source. The information should be sufficient to define the schema in a target data store.
      Returns:
      a list of column descriptions or null if not available.
      Throws:
      ConnectorCheckedException - data access problem
    • getTableName

      public String getTableName() throws ConnectorCheckedException
      Return the table name for this data source. This is in canonical name format where each word in the name should be capitalized, with spaces between the words. This format allows easy translation between different naming conventions.
      Specified by:
      getTableName in interface ReadableTabularDataSource
      Returns:
      string
      Throws:
      ConnectorCheckedException - no product definition
    • getTableDescription

      public String getTableDescription() throws ConnectorCheckedException
      Return the description for this data source.
      Specified by:
      getTableDescription in interface ReadableTabularDataSource
      Returns:
      string
      Throws:
      ConnectorCheckedException - no product definition
    • getColumnDescriptions

      public List<TabularColumnDescription> getColumnDescriptions() throws ConnectorCheckedException
      Return the list of column descriptions associated with this data source. The information should be sufficient to define the schema in a target data store.
      Specified by:
      getColumnDescriptions in interface ReadableTabularDataSource
      Returns:
      a list of column descriptions or null if not available.
      Throws:
      ConnectorCheckedException - no product definition
    • getColumnNumber

      public int getColumnNumber(String columnName) throws ConnectorCheckedException
      Locate the named column. A negative number means the column is not present.
      Specified by:
      getColumnNumber in interface ReadableTabularDataSource
      Parameters:
      columnName - name of the column to return
      Returns:
      column
      Throws:
      ConnectorCheckedException - problem extracting the column descriptions
    • setColumnDescriptions

      public void setColumnDescriptions(List<TabularColumnDescription> columnDescriptions) throws ConnectorCheckedException
      Set up the columns associated with this tabular data source. These are stored in the first record of the file. The rest of the file is cleared.
      Parameters:
      columnDescriptions - a list of column descriptions
      Throws:
      ConnectorCheckedException - data access problem
    • getElementHeaderRecordValue

      protected boolean getElementHeaderRecordValue(ElementHeader elementHeader, String columnName, List<String> recordValues)
      Extracts the record values from the element header based on the specified column name.
      Parameters:
      elementHeader - element header containing the record values
      columnName - name of the column to extract the value for
      recordValues - list to store the extracted record values
      Returns:
      true if the value was successfully extracted, false otherwise
    • getElementRecordValue

      protected boolean getElementRecordValue(OpenMetadataRootProperties openMetadataRootProperties, String columnName, List<String> recordValues)
      Extracts the record values from the element properties based on the specified column name.
      Parameters:
      openMetadataRootProperties - properties object
      columnName - name of column to extract
      recordValues - array of values to append to
      Returns:
      true if the value was successfully extracted, false otherwise
    • getRecordValues

      protected List<String> getRecordValues(OpenMetadataRootElement rootElement) throws ConnectorCheckedException
      Convert the root element to a list of column values based on the data spec.
      Parameters:
      rootElement - valid value that is a member of the valid value set.
      Returns:
      list of column value
      Throws:
      ConnectorCheckedException - an unexpected exception has occurred
    • disconnect

      public void disconnect()
      Close the connector
      Overrides:
      disconnect in class ConnectorBase