All Implemented Interfaces:
AuditLoggingComponent, SecureConnectorExtension, VirtualConnectorExtension, OMRSMetadataCollectionManager

public class XTDBOMRSRepositoryConnector extends OMRSRepositoryConnector
Provides all connectivity and API-based interaction with a XTDB back-end.
  • Constructor Details

    • XTDBOMRSRepositoryConnector

      public XTDBOMRSRepositoryConnector()
      Default constructor used by the OCF Connector Provider.
  • Method Details

    • setMetadataCollectionId

      public void setMetadataCollectionId(String metadataCollectionId)
      Set up the unique id for this metadata collection.
      Specified by:
      setMetadataCollectionId in interface OMRSMetadataCollectionManager
      Overrides:
      setMetadataCollectionId in class OMRSRepositoryConnector
      Parameters:
      metadataCollectionId - String unique Id
    • start

      public void start() throws ConnectorCheckedException
      Indicates that the connector is completely configured and can begin processing.
      Overrides:
      start in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.
    • disconnect

      public void disconnect() throws ConnectorCheckedException
      Free up any resources held since the connector is no longer needed.
      Overrides:
      disconnect in class ConnectorBase
      Throws:
      ConnectorCheckedException - there is a problem within the connector.
    • isLuceneConfigured

      public boolean isLuceneConfigured()
      Indicates whether Lucene is configured in the connector (true) or not (false).
      Returns:
      boolean
    • expectsLuceneRegexes

      public boolean expectsLuceneRegexes()
      Indicates whether the connector expects all regular expressions to be Lucene-compatible (true) or not (false).
      Returns:
      boolean
    • logProblem

      public void logProblem(String className, String methodName, XTDBAuditCode code, Throwable cause, String... params)
      Log a problem with the connector, preferring the audit log so long as it is available and only falling back to debug-level logging if it is not.
      Parameters:
      className - where the problem occurred
      methodName - where the problem occurred
      code - describing the problem
      cause - the exception that triggered the problem (if any)
      params - providing additional details about the problem
    • isDataStoreEmpty

      public boolean isDataStoreEmpty()
      Checks whether the data store is currently empty.
      Returns:
      true of the data store is empty (has no metadata stored), otherwise false
    • validateCommit

      public void validateCommit(xtdb.api.TransactionInstant instant, String methodName) throws Exception
      Validate that the commit was persisted, or throw an exception if it failed.
      Parameters:
      instant - giving the commit point
      methodName - that made the commit
      Throws:
      Exception - on any error
    • getResultingEntity

      public EntityDetail getResultingEntity(String docId, xtdb.api.TransactionInstant instant, String methodName) throws Exception
      Validates that the commit was persisted (if synchronous), throwing an exception if it failed, and also retrieves and returns the detailed entity that resulted from the transaction. Note that if the operation is configured to be asynchronous, this will ALWAYS return null for the entity details.
      Parameters:
      docId - of the entity within XTDB itself (i.e. prefixed)
      instant - giving the commit point of the transaction
      methodName - that made the commit
      Returns:
      EntityDetail result of the committed transaction (synchronous) or null (asynchronous)
      Throws:
      Exception - on any error
    • getResultingEntitySummary

      public EntitySummary getResultingEntitySummary(String docId, xtdb.api.TransactionInstant instant, String methodName) throws Exception
      Validates that the commit was persisted (if synchronous), throwing an exception if it failed, and also retrieves and returns the summary entity that resulted from the transaction. Note that if the operation is configured to be asynchronous, this will ALWAYS return null for the entity details.
      Parameters:
      docId - of the entity within XTDB itself (i.e. prefixed)
      instant - giving the commit point of the transaction
      methodName - that made the commit
      Returns:
      EntitySummary result of the committed transaction (synchronous) or null (asynchronous)
      Throws:
      Exception - on any error
    • getResultingRelationship

      public Relationship getResultingRelationship(String docId, xtdb.api.TransactionInstant instant, String methodName) throws Exception
      Validates that the commit was persisted (if synchornous), throwing an exception if it failed, and also retrieves and returns the detailed relationship that resulted from the transaction. Note that if the operation is configured to be asynchronous, this will ALWAYS return null for the relationship detials.
      Parameters:
      docId - of the relationship within XTDB itself (i.e. prefixed)
      instant - giving the commit point of the transaction
      methodName - that made the commit
      Returns:
      Relationship result of the committed transaction (synchronous) or null (asynchronous)
      Throws:
      Exception - on any error
    • runTx

      public xtdb.api.TransactionInstant runTx(xtdb.api.tx.Transaction statements)
      Run multiple statements through XTDB as a single transaction.
      Parameters:
      statements - the transaction to submit
      Returns:
      TransactionInstant transaction details
    • getXtdbAPI

      public xtdb.api.IXtdb getXtdbAPI()
      Retrieve the XTDB API directly. NOTE: This should only be used in very exceptional circumstances where direct access to the API is needed (e.g. for testing purposes). Use any other method where possible.
      Returns:
      IXtdb
    • equals

      public boolean equals(Object o)
      Default equality comparison.
      Overrides:
      equals in class ConnectorBase
      Parameters:
      o - object to compare against
      Returns:
      boolean
    • hashCode

      public int hashCode()
      Default hash calculation.
      Overrides:
      hashCode in class ConnectorBase
      Returns:
      int