Class BaseMongoDAO

java.lang.Object
com.smeup.kokos.sdk.dao.BaseMongoDAO
Direct Known Subclasses:
BatchTrackingDAO

public abstract class BaseMongoDAO extends Object
Base class for MongoDB tracking operations. Provides common functionality for MongoDB connections and operations.
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected static final long
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    createTTLIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection)
    Creates a TTL index on the lastUpdated field if it doesn't exist.
    protected static com.mongodb.client.MongoDatabase
    getDbInstance(String connectionString, String databaseName)
    Gets or initializes a MongoDB database instance.
    protected boolean
    probe(ExecutionContext context, String collectionName)
    Probes the MongoDB connection to ensure connectivity.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • BaseMongoDAO

      public BaseMongoDAO()
  • Method Details

    • getDbInstance

      protected static com.mongodb.client.MongoDatabase getDbInstance(String connectionString, String databaseName)
      Gets or initializes a MongoDB database instance.
      Parameters:
      connectionString - MongoDB connection string
      databaseName - Database name
      Returns:
      MongoDatabase instance
    • createTTLIndex

      protected void createTTLIndex(com.mongodb.client.MongoCollection<org.bson.Document> collection)
      Creates a TTL index on the lastUpdated field if it doesn't exist.
      Parameters:
      collection - MongoDB collection
    • probe

      protected boolean probe(ExecutionContext context, String collectionName)
      Probes the MongoDB connection to ensure connectivity.
      Parameters:
      context - Execution context
      collectionName - Name of the collection to probe
      Returns:
      true if connection is successful, false otherwise