Search in sources :

Example 1 with ServicesConfigModule

use of com.palantir.atlasdb.services.ServicesConfigModule in project atlasdb by palantir.

the class KvsMigrationCommand method connectToServices.

public AtlasDbServices connectToServices() throws IOException {
    AtlasDbConfig toConfig = toConfigFile != null ? AtlasDbConfigs.load(toConfigFile, configRoot, AtlasDbConfig.class) : AtlasDbConfigs.loadFromString(inlineConfig, null, AtlasDbConfig.class);
    ServicesConfigModule scm = ServicesConfigModule.create(makeOfflineIfNecessary(toConfig), AtlasDbRuntimeConfig.withSweepDisabled());
    return DaggerAtlasDbServices.builder().servicesConfigModule(scm).build();
}
Also used : ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig)

Example 2 with ServicesConfigModule

use of com.palantir.atlasdb.services.ServicesConfigModule in project atlasdb by palantir.

the class KvsMigrationCommand method connectFromServices.

public AtlasDbServices connectFromServices() throws IOException {
    AtlasDbConfig fromConfig = AtlasDbConfigs.load(fromConfigFile, configRoot, AtlasDbConfig.class);
    ServicesConfigModule scm = ServicesConfigModule.create(makeOfflineIfNecessary(fromConfig), AtlasDbRuntimeConfig.withSweepDisabled());
    return DaggerAtlasDbServices.builder().servicesConfigModule(scm).build();
}
Also used : ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule) AtlasDbConfig(com.palantir.atlasdb.config.AtlasDbConfig)

Example 3 with ServicesConfigModule

use of com.palantir.atlasdb.services.ServicesConfigModule in project atlasdb by palantir.

the class AtlasDbServicesConnector method connect.

public AtlasDbServices connect() {
    if (services != null) {
        throw new IllegalStateException("connect() has already been called");
    }
    DockerizedDatabaseUri dburi = DockerizedDatabaseUri.fromUriString(uri);
    KeyValueServiceConfig config = dburi.getKeyValueServiceInstrumentation().getKeyValueServiceConfig(dburi.getAddress());
    ImmutableAtlasDbConfig atlasDbConfig = ImmutableAtlasDbConfig.builder().keyValueService(config).build();
    ImmutableAtlasDbRuntimeConfig runtimeConfig = ImmutableAtlasDbRuntimeConfig.defaultRuntimeConfig();
    ServicesConfigModule servicesConfigModule = ServicesConfigModule.create(atlasDbConfig, runtimeConfig);
    services = DaggerAtlasDbServices.builder().servicesConfigModule(servicesConfigModule).build();
    return services;
}
Also used : KeyValueServiceConfig(com.palantir.atlasdb.spi.KeyValueServiceConfig) ImmutableAtlasDbRuntimeConfig(com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig) ImmutableAtlasDbConfig(com.palantir.atlasdb.config.ImmutableAtlasDbConfig) ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule)

Example 4 with ServicesConfigModule

use of com.palantir.atlasdb.services.ServicesConfigModule in project atlasdb by palantir.

the class TestSweepCommand method setup.

@BeforeClass
public static void setup() throws Exception {
    sweepTimestamp = new AtomicLong();
    moduleFactory = new AtlasDbServicesFactory() {

        @Override
        public TestAtlasDbServices connect(ServicesConfigModule servicesConfigModule) {
            return DaggerTestAtlasDbServices.builder().servicesConfigModule(servicesConfigModule).testSweeperModule(TestSweeperModule.create(sweepTimestamp::get)).build();
        }
    };
}
Also used : AtomicLong(java.util.concurrent.atomic.AtomicLong) AtlasDbServicesFactory(com.palantir.atlasdb.services.AtlasDbServicesFactory) ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule) DaggerTestAtlasDbServices(com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices) TestAtlasDbServices(com.palantir.atlasdb.services.test.TestAtlasDbServices) BeforeClass(org.junit.BeforeClass)

Example 5 with ServicesConfigModule

use of com.palantir.atlasdb.services.ServicesConfigModule in project atlasdb by palantir.

the class TestTimestampCommand method oneTimeSetup.

@BeforeClass
public static void oneTimeSetup() throws Exception {
    lock = StringLockDescriptor.of("lock");
    moduleFactory = new AtlasDbServicesFactory() {

        @Override
        public TestAtlasDbServices connect(ServicesConfigModule servicesConfigModule) {
            return DaggerTestAtlasDbServices.builder().servicesConfigModule(servicesConfigModule).build();
        }
    };
}
Also used : AtlasDbServicesFactory(com.palantir.atlasdb.services.AtlasDbServicesFactory) ServicesConfigModule(com.palantir.atlasdb.services.ServicesConfigModule) DaggerTestAtlasDbServices(com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices) TestAtlasDbServices(com.palantir.atlasdb.services.test.TestAtlasDbServices) BeforeClass(org.junit.BeforeClass)

Aggregations

ServicesConfigModule (com.palantir.atlasdb.services.ServicesConfigModule)5 AtlasDbConfig (com.palantir.atlasdb.config.AtlasDbConfig)2 AtlasDbServicesFactory (com.palantir.atlasdb.services.AtlasDbServicesFactory)2 DaggerTestAtlasDbServices (com.palantir.atlasdb.services.test.DaggerTestAtlasDbServices)2 TestAtlasDbServices (com.palantir.atlasdb.services.test.TestAtlasDbServices)2 BeforeClass (org.junit.BeforeClass)2 ImmutableAtlasDbConfig (com.palantir.atlasdb.config.ImmutableAtlasDbConfig)1 ImmutableAtlasDbRuntimeConfig (com.palantir.atlasdb.config.ImmutableAtlasDbRuntimeConfig)1 KeyValueServiceConfig (com.palantir.atlasdb.spi.KeyValueServiceConfig)1 AtomicLong (java.util.concurrent.atomic.AtomicLong)1