Class OpenMetadataRowDataSetConnectorBase

All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, ReadableTabularDataSource, VirtualConnectorExtension
Direct Known Subclasses:
BusinessCapabilitiesTabularDataSetConnector, OpenMetadataDataTypesDataSetConnector, OrganizationStructureDataSetConnectorBase, SecretsCollectionsTabularDataSetConnector, SecretsStoresTabularDataSetConnector, ServersTabularDataSetConnector, SurveyReportDataSetConnectorBase, UserAccountsTabularDataSetConnector, UserIdentitiesTabularDataSetConnector, ZoneMembershipProfileTabularDataSetConnector, ZoneMembershipTotalsTabularDataSetConnector

public abstract class OpenMetadataRowDataSetConnectorBase extends OpenMetadataDataSetConnectorBase
OpenMetadataRowDataSetConnectorBase is the base class for tabular data sets whose rows are not one element each. A row may be built from an element together with values the connector works out for itself - the survey report an annotation was published in, the team a department reports to, a measurement from an annotation's map of measurements - or from a relationship and the elements at its ends.

The subclass gathers its rows in collectRows() by calling addRow(org.odpi.openmetadata.frameworks.openmetadata.metadataelements.ElementHeader, org.odpi.openmetadata.frameworks.openmetadata.properties.OpenMetadataRootProperties, java.util.Map<java.lang.String, java.lang.String>). The whole data set is rebuilt on each refresh, which keeps the rows consistent with each other: these data sets join several queries together, so a row-by-row refresh of the kind the single-type data sets use would leave rows built from different moments in the repository's history.
  • Constructor Details

    • OpenMetadataRowDataSetConnectorBase

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

    • start

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

      public void refreshCache() throws ConnectorCheckedException
      Rebuild the rows of the data set.
      Specified by:
      refreshCache in class OpenMetadataDataSetConnectorBase
      Throws:
      ConnectorCheckedException - unable to refresh
    • collectRows

      protected abstract void collectRows() throws Exception
      Gather the rows of the data set by calling addRow for each one.
      Throws:
      Exception - any problem retrieving the metadata - it is logged and returned as a ConnectorCheckedException
    • addRow

      protected void addRow(ElementHeader elementHeader, OpenMetadataRootProperties properties, Map<String,String> suppliedValues) throws ConnectorCheckedException
      Add a row to the data set being built. Each column is filled from, in order: the supplied values (keyed by the column's display name, so a null value there is an explicit null), the element's header, the element's properties. A column that none of these can fill is null.
      Parameters:
      elementHeader - header of the element that the row describes (may be null)
      properties - properties of the element that the row describes (may be null)
      suppliedValues - values worked out by the connector, keyed by ProductDataFieldDefinition display name
      Throws:
      ConnectorCheckedException - a column that is part of the unique identifier has no value
    • addRow

      protected void addRow(OpenMetadataRootElement element, Map<String,String> suppliedValues) throws ConnectorCheckedException
      Add a row for an element.
      Parameters:
      element - element that the row describes
      suppliedValues - values worked out by the connector, keyed by ProductDataFieldDefinition display name
      Throws:
      ConnectorCheckedException - a column that is part of the unique identifier has no value
    • newValues

      protected Map<String,String> newValues()
      Start a map of supplied values.
      Returns:
      empty map
    • putValue

      protected void putValue(Map<String,String> values, ProductDataFieldDefinition field, Object value)
      Add a value to the supplied values.
      Parameters:
      values - map of values
      field - field that the value belongs to
      value - value (may be null, which forces the column to be null)
    • getAllElements

      protected List<OpenMetadataRootElement> getAllElements(String typeName, int graphQueryDepth) throws Exception
      Retrieve every element of a type (and its subtypes).
      Parameters:
      typeName - name of the type
      graphQueryDepth - how many levels of related elements to return with each element
      Returns:
      list of elements, oldest first
      Throws:
      Exception - problem retrieving the elements
    • getAllElements

      protected List<OpenMetadataRootElement> getAllElements(String typeName, int graphQueryDepth, List<String> includeOnlyRelationships) throws Exception
      Retrieve every element of a type (and its subtypes), with only the named relationships.
      Parameters:
      typeName - name of the type
      graphQueryDepth - how many levels of related elements to return with each element
      includeOnlyRelationships - relationship types to return with each element (null for all)
      Returns:
      list of elements, oldest first
      Throws:
      Exception - problem retrieving the elements
    • getAllRelationships

      protected List<MetadataRelationshipSummary> getAllRelationships(String relationshipTypeName) throws Exception
      Retrieve every relationship of a type (and its subtypes).
      Parameters:
      relationshipTypeName - name of the relationship type
      Returns:
      list of relationships, oldest first
      Throws:
      Exception - problem retrieving the relationships
    • isTypeOf

      protected boolean isTypeOf(ElementHeader elementHeader, String typeName)
      Is the element of the named type, or one of its subtypes?
      Parameters:
      elementHeader - header of the element
      typeName - type to test for
      Returns:
      boolean
    • getRecordCount

      public long getRecordCount()
      Return the record count in the data source.
      Returns:
      count
    • readRecord

      public List<String> readRecord(long rowNumber) throws ConnectorCheckedException
      Return the requested data record. The first record is record 0.
      Parameters:
      rowNumber - long
      Returns:
      list of values (as strings) where each string is the value from a column. The order is the same as the columns
      Throws:
      ConnectorCheckedException - a problem occurred accessing the data.