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

io.hyperfoil.tools.horreum.datastore.BackendResolver Maven / Gradle / Ivy

There is a newer version: 0.15.3
Show newest version
package io.hyperfoil.tools.horreum.datastore;

import java.util.List;

import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;

import io.hyperfoil.tools.horreum.api.data.datastore.DatastoreType;
import io.quarkus.arc.All;

@ApplicationScoped
public class BackendResolver {
    @Inject
    @All
    List backendStores;

    public Datastore getBackend(DatastoreType type) {
        return backendStores.stream()
                .filter(store -> store.type().equals(type))
                .findFirst()
                .orElseThrow(() -> new IllegalStateException("Unknown datastore type: " + type));
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy