Package com.kheops.jmap.server
Class WorkSpaceManager
java.lang.Object
com.kheops.jmap.server.WorkSpaceManager
This class is used to manage user workspaces.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
deleteUserWS
(String username) Deletes the workspace of the specified user.boolean
emptyUserWS
(String username) This method empties the workspace of the specified user.Returns the workspaces root path.getUserParameter
(String userName, int projectId, String parameterKey) Returns the UserParameter associated with the userName / projectId / parameterKey.getUserWSDirectory
(String username) This method returns the workspace path of the specified user.loadUserParameter
(String userName, int projectId) Loads user parameters from user workspace / projectID.boolean
saveUserParameter
(List<UserParameter> userParameters, String userName, int projectId) Saves user parameters to user_workspace / projectID / USER_PARAMETER_FILE.void
setUserParameter
(String userName, int projectId, UserParameter userParameter) Saves a UserParameter
-
Constructor Details
-
WorkSpaceManager
Creates a new workspace manager. The specified path is the root of the workspaces. It is created if it does not exist.- Parameters:
rootPath
- the workspaces root path.- Throws:
IOException
- if the path cannot be created
-
-
Method Details
-
getRootPath
Returns the workspaces root path.- Returns:
- the workspaces root path.
-
getUserWSDirectory
This method returns the workspace path of the specified user. It is created if it does not exist.- Parameters:
username
- , the user name- Returns:
- the workspace path of the specified user
-
emptyUserWS
This method empties the workspace of the specified user. All files and directories are deleted.- Parameters:
username
- , the user name- Returns:
- true if and only if the workspace is successfully emptied, false otherwise
-
deleteUserWS
Deletes the workspace of the specified user. All files and directories are deleted. The workspace directory for the user is also deleted.- Parameters:
username
- , the user name- Returns:
- true if and only if the workspace is successfully deleted, false otherwise
-
getUserParameter
Returns the UserParameter associated with the userName / projectId / parameterKey.null
if not found.- Parameters:
userName
- the user nameprojectId
- the project id or JMapServerRequest.SaveUserParameters.GLOBAL_PARAMETERSparameterKey
- the parameter key to search
-
setUserParameter
Saves a UserParameter- Parameters:
userName
- the user nameprojectId
- the project id or JMapServerRequest.SaveUserParameters.GLOBAL_PARAMETERSuserParameter
- user parameter to save
-
saveUserParameter
public boolean saveUserParameter(List<UserParameter> userParameters, String userName, int projectId) Saves user parameters to user_workspace / projectID / USER_PARAMETER_FILE.- Parameters:
userParameters
- list of UserParameter to be saved.userName
- user name used to get the directory where the user parameter file will be saved.projectId
- project ID used to get the directory where the user parameter file will be saved.- Returns:
- whether the parameter list was saved..
-
loadUserParameter
Loads user parameters from user workspace / projectID.- Parameters:
userName
- user name used to get the directory where the user parameter file will be saved.projectId
- project ID used to get the directory where the user parameter file will be saved.- Returns:
- a list of user parameter.
-