@NotThreadSafe public final class UnderFileSystemFactoryRegistry extends Object
Central registry of available UnderFileSystemFactory
instances that uses the
ServiceLoader
mechanism to automatically discover available factories and provides a
central place for obtaining actual UnderFileSystem
instances.
Note that if you are bundling Alluxio plus your code in a shaded JAR using Maven, make sure to
use the ServicesResourceTransformer
as otherwise your services file will override the
core provided services file and leave the standard factories and under file system
implementations unavailable.
ExtensionFactoryRegistry
Modifier and Type | Method and Description |
---|---|
static List<UnderFileSystemFactory> |
available()
Returns a read-only view of the available base factories.
|
static UnderFileSystemFactory |
find(String path,
AlluxioConfiguration alluxioConf)
Finds the first Under File System factory that supports the given path.
|
static UnderFileSystemFactory |
find(String path,
UnderFileSystemConfiguration ufsConf)
Finds the first Under File System factory that supports the given path.
|
static List<UnderFileSystemFactory> |
findAllWithRecorder(String path,
UnderFileSystemConfiguration ufsConf,
Recorder recorder)
Finds all the Under File System factories that support the given path
and record the execution process.
|
static List<String> |
getSupportedVersions(String path,
AlluxioConfiguration ufsConf)
Get a list of supported versions for a particular UFS path.
|
static void |
register(UnderFileSystemFactory factory)
Registers a new factory.
|
static void |
reset()
Resets the registry to its default state
|
static void |
unregister(UnderFileSystemFactory factory)
Unregisters an existing factory.
|
public static List<UnderFileSystemFactory> available()
@Nullable public static UnderFileSystemFactory find(String path, AlluxioConfiguration alluxioConf)
path
- pathalluxioConf
- Alluxio configuration@Nullable public static UnderFileSystemFactory find(String path, UnderFileSystemConfiguration ufsConf)
path
- pathufsConf
- configuration object for the UFSpublic static List<UnderFileSystemFactory> findAllWithRecorder(String path, UnderFileSystemConfiguration ufsConf, Recorder recorder)
path
- pathufsConf
- configuration of the UFSrecorder
- recorder used to record the detailed execution processpublic static List<String> getSupportedVersions(String path, AlluxioConfiguration ufsConf)
path
- the UFS URI to testufsConf
- the UFS configuration for the mountpublic static void register(UnderFileSystemFactory factory)
Factories are registered at the start of the factories list so they can override the existing
automatically discovered factories. Generally if you use the ServiceLoader
mechanism
properly it should be unnecessary to call this, however since ServiceLoader discovery order
may be susceptible to class loader behavioral differences there may be rare cases when you
need to manually register the desired factory.
factory
- factory to registerpublic static void reset()
This clears the registry as it stands and rediscovers the available factories.
public static void unregister(UnderFileSystemFactory factory)
factory
- factory to unregisterCopyright © 2023. All Rights Reserved.