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

com.obera.jasdb.android.DataOperationFactory Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package com.obera.jasdb.android;

import com.google.inject.Inject;
import com.google.inject.Provider;
import nl.renarj.jasdb.api.model.IndexManagerFactory;
import nl.renarj.jasdb.service.operations.BagInsertOperation;
import nl.renarj.jasdb.service.operations.BagRemoveOperation;
import nl.renarj.jasdb.service.operations.BagUpdateOperation;
import nl.renarj.jasdb.storage.RecordWriterFactoryLoader;

/**
 * @author renarj
 */
public class DataOperationFactory {

    private Provider indexManagerFactoryProvider;
    private Provider recordWriterFactoryLoaderProvider;

    @Inject
    public DataOperationFactory(Provider indexManagerFactoryProvider,
                                Provider recordWriterFactoryLoaderProvider) {
        this.indexManagerFactoryProvider = indexManagerFactoryProvider;
        this.recordWriterFactoryLoaderProvider = recordWriterFactoryLoaderProvider;
    }

    public BagInsertOperation getInsertOperation() {
        BagInsertOperation insertOperation = new BagInsertOperation();
        insertOperation.setIndexManagerFactory(indexManagerFactoryProvider.get());
        insertOperation.setRecordWriterFactory(recordWriterFactoryLoaderProvider.get());
        return insertOperation;
    }

    public BagRemoveOperation getRemoveOperation() {
        BagRemoveOperation removeOperation = new BagRemoveOperation();
        removeOperation.setIndexManagerFactory(indexManagerFactoryProvider.get());
        removeOperation.setRecordWriterFactoryLoader(recordWriterFactoryLoaderProvider.get());
        return removeOperation;
    }

    public BagUpdateOperation getUpdateOperation() {
        BagUpdateOperation updateOperation = new BagUpdateOperation();
        updateOperation.setRecordWriterFactoryLoader(recordWriterFactoryLoaderProvider.get());
        updateOperation.setIndexManagerFactory(indexManagerFactoryProvider.get());
        return updateOperation;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy