Class NativeFileSystemFactory
- java.lang.Object
-
- org.apache.sshd.common.util.logging.AbstractLoggingBean
-
- org.apache.sshd.common.file.nativefs.NativeFileSystemFactory
-
- All Implemented Interfaces:
FileSystemFactory
public class NativeFileSystemFactory extends AbstractLoggingBean implements FileSystemFactory
Native file system factory. It uses the OS file system.
-
-
Field Summary
Fields Modifier and Type Field Description private booleancreateHomestatic java.lang.StringDEFAULT_USERS_HOMEstatic NativeFileSystemFactoryINSTANCEprivate java.lang.StringusersHomeDir-
Fields inherited from class org.apache.sshd.common.util.logging.AbstractLoggingBean
log
-
-
Constructor Summary
Constructors Constructor Description NativeFileSystemFactory()NativeFileSystemFactory(boolean createHome)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.file.FileSystemcreateFileSystem(SessionContext session)Create user specific file system.java.nio.file.PathgetUserHomeDir(SessionContext session)java.lang.StringgetUsersHomeDir()booleanisCreateHome()Should the home directories be created automaticallyvoidsetCreateHome(boolean createHome)Set if the home directories be created automaticallyvoidsetUsersHomeDir(java.lang.String usersHomeDir)Set the root location where users home is to be created
-
-
-
Field Detail
-
DEFAULT_USERS_HOME
public static final java.lang.String DEFAULT_USERS_HOME
-
INSTANCE
public static final NativeFileSystemFactory INSTANCE
-
createHome
private boolean createHome
-
usersHomeDir
private java.lang.String usersHomeDir
-
-
Method Detail
-
getUsersHomeDir
public java.lang.String getUsersHomeDir()
- Returns:
- The root location where users home is to be created - never
null/empty.
-
setUsersHomeDir
public void setUsersHomeDir(java.lang.String usersHomeDir)
Set the root location where users home is to be created- Parameters:
usersHomeDir- The root location where users home is to be created - nevernull/empty.- See Also:
isCreateHome()
-
isCreateHome
public boolean isCreateHome()
Should the home directories be created automatically- Returns:
trueif the file system will create the home directory if not available
-
setCreateHome
public void setCreateHome(boolean createHome)
Set if the home directories be created automatically- Parameters:
createHome-trueif the file system should create the home directory automatically if not available- See Also:
getUsersHomeDir()
-
getUserHomeDir
public java.nio.file.Path getUserHomeDir(SessionContext session) throws java.io.IOException
- Specified by:
getUserHomeDirin interfaceFileSystemFactory- Parameters:
session- The session created for the user- Returns:
- The recommended user home directory -
nullif none - Throws:
java.io.IOException- If failed to resolve user's home directory
-
createFileSystem
public java.nio.file.FileSystem createFileSystem(SessionContext session) throws java.io.IOException
Description copied from interface:FileSystemFactoryCreate user specific file system.- Specified by:
createFileSystemin interfaceFileSystemFactory- Parameters:
session- The session created for the user- Returns:
- The current
FileSystemfor the provided session - Throws:
java.io.IOException- if the file system can not be created
-
-