Class UnderFileSystemFactoryRegistry
- java.lang.Object
-
- alluxio.underfs.UnderFileSystemFactoryRegistry
-
@NotThreadSafe public final class UnderFileSystemFactoryRegistry extends java.lang.Object
Central registry of available
UnderFileSystemFactory
instances that uses theServiceLoader
mechanism to automatically discover available factories and provides a central place for obtaining actualUnderFileSystem
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.- See Also:
ExtensionFactoryRegistry
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static java.util.List<UnderFileSystemFactory>
available()
Returns a read-only view of the available base factories.static UnderFileSystemFactory
find(java.lang.String path, AlluxioConfiguration alluxioConf)
Finds the first Under File System factory that supports the given path.static UnderFileSystemFactory
find(java.lang.String path, UnderFileSystemConfiguration ufsConf)
Finds the first Under File System factory that supports the given path.static java.util.List<UnderFileSystemFactory>
findAllWithRecorder(java.lang.String path, UnderFileSystemConfiguration ufsConf, Recorder recorder)
Finds all the Under File System factories that support the given path and record the execution process.static java.util.List<java.lang.String>
getSupportedVersions(java.lang.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 statestatic void
unregister(UnderFileSystemFactory factory)
Unregisters an existing factory.
-
-
-
Method Detail
-
available
public static java.util.List<UnderFileSystemFactory> available()
Returns a read-only view of the available base factories.- Returns:
- Read-only view of the available base factories
-
find
@Nullable public static UnderFileSystemFactory find(java.lang.String path, AlluxioConfiguration alluxioConf)
Finds the first Under File System factory that supports the given path.- Parameters:
path
- pathalluxioConf
- Alluxio configuration- Returns:
- factory if available, null otherwise
-
find
@Nullable public static UnderFileSystemFactory find(java.lang.String path, UnderFileSystemConfiguration ufsConf)
Finds the first Under File System factory that supports the given path.- Parameters:
path
- pathufsConf
- configuration object for the UFS- Returns:
- factory if available, null otherwise
-
findAllWithRecorder
public static java.util.List<UnderFileSystemFactory> findAllWithRecorder(java.lang.String path, UnderFileSystemConfiguration ufsConf, Recorder recorder)
Finds all the Under File System factories that support the given path and record the execution process.- Parameters:
path
- pathufsConf
- configuration of the UFSrecorder
- recorder used to record the detailed execution process- Returns:
- list of factories that support the given path which may be an empty list
-
getSupportedVersions
public static java.util.List<java.lang.String> getSupportedVersions(java.lang.String path, AlluxioConfiguration ufsConf)
Get a list of supported versions for a particular UFS path.- Parameters:
path
- the UFS URI to testufsConf
- the UFS configuration for the mount- Returns:
- a list of supported versions. The list will be empty if the particular UFS type does not support setting a version on the mount.
-
register
public static void register(UnderFileSystemFactory factory)
Registers a new 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.- Parameters:
factory
- factory to register
-
reset
public static void reset()
Resets the registry to its default stateThis clears the registry as it stands and rediscovers the available factories.
-
unregister
public static void unregister(UnderFileSystemFactory factory)
Unregisters an existing factory.- Parameters:
factory
- factory to unregister
-
-