ec.tss.tsproviders.odbc.registry.IOdbcRegistryLoader Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of demetra-odbc Show documentation
Show all versions of demetra-odbc Show documentation
A TS Provider that handles ODBC datasources.
package ec.tss.tsproviders.odbc.registry;
import java.lang.Iterable;
import java.util.Optional;
import java.util.ServiceLoader;
import java.util.stream.StreamSupport;
/**
* Custom service loader for {@link ec.tss.tsproviders.odbc.registry.IOdbcRegistry}.
*
This class is thread-safe.
* Properties:
*
* - Quantifier: OPTIONAL
* - Fallback: null
* - Preprocessing: null
* - Mutability: NONE
* - Singleton: true
* - Name: null
* - Backend: null
* - Cleaner: null
* - Batch: false
* - Batch name: null
*
*/
public final class IOdbcRegistryLoader {
private static final Iterable SOURCE = ServiceLoader.load(IOdbcRegistry.class);
private static final Optional RESOURCE = doLoad();
private IOdbcRegistryLoader() {
}
private static Optional doLoad() {
return StreamSupport.stream(SOURCE.spliterator(), false)
.findFirst();
}
/**
* Gets an optional {@link ec.tss.tsproviders.odbc.registry.IOdbcRegistry} instance.
*
This method is thread-safe.
* @return the current non-null value
*/
public static Optional get() {
return RESOURCE;
}
}