All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.debezium.connector.spanner.db.DaoFactory Maven / Gradle / Ivy

There is a newer version: 3.0.0.CR1
Show newest version
/*
 * Copyright Debezium Authors.
 *
 * Licensed under the Apache Software License version 2.0, available at http://www.apache.org/licenses/LICENSE-2.0
 */
package io.debezium.connector.spanner.db;

import com.google.cloud.spanner.Options;

import io.debezium.connector.spanner.db.dao.ChangeStreamDao;
import io.debezium.connector.spanner.db.dao.SchemaDao;

/**
 * Factory for {@code ChangeStreamDao}
 */
public class DaoFactory {
    private final DatabaseClientFactory databaseClientFactory;

    private SchemaDao schemaDao;

    public DaoFactory(DatabaseClientFactory databaseClientFactory) {
        this.databaseClientFactory = databaseClientFactory;
    }

    public SchemaDao getSchemaDao() {
        if (schemaDao != null) {
            return schemaDao;
        }
        this.schemaDao = new SchemaDao(this.databaseClientFactory.getDatabaseClient());
        return schemaDao;
    }

    public ChangeStreamDao getStreamDao(String changeStreamName, Options.RpcPriority rpcPriority, String jobName) {
        return new ChangeStreamDao(changeStreamName, this.databaseClientFactory.getDatabaseClient(), rpcPriority, jobName);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy