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

com.bazaarvoice.emodb.table.db.test.InMemoryTable Maven / Gradle / Ivy

package com.bazaarvoice.emodb.table.db.test;

import com.bazaarvoice.emodb.datacenter.api.DataCenter;
import com.bazaarvoice.emodb.sor.api.TableAvailability;
import com.bazaarvoice.emodb.sor.api.TableOptions;
import com.bazaarvoice.emodb.table.db.Table;

import java.util.Collection;
import java.util.Map;

public class InMemoryTable implements Table {
    private final String _name;
    private final TableOptions _options;
    private final boolean _facade;
    private Map _attributes;

    public InMemoryTable(String name, TableOptions options, Map attributes) {
        this(name, options, attributes, false);
    }

    public InMemoryTable(String name, TableOptions options, Map attributes, boolean facade) {
        _name = name;
        _options = options;
        _attributes = attributes;
        _facade = facade;
    }

    @Override
    public boolean isInternal() {
        return _name.startsWith("__");
    }

    @Override
    public String getName() {
        return _name;
    }

    @Override
    public TableOptions getOptions() {
        return _options;
    }

    @Override
    public TableAvailability getAvailability() {
        if (!_facade) {
            return new TableAvailability(_options.getPlacement(), false);
        }
        // Facades aren't fully supported
        throw new UnsupportedOperationException();
    }

    @Override
    public Map getAttributes() {
        return _attributes;
    }

    public void setAttributes(Map attributes) {
        _attributes = attributes;
    }

    @Override
    public Collection getDataCenters() {
        throw new UnsupportedOperationException();
    }

    @Override
    public boolean isFacade() {
        return _facade;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy