use of org.objectweb.proactive.extensions.dataspaces.api.DataSpacesFileObject in project scheduling by ow2-proactive.
the class SchedulerSpacesSupport method registerUserSpace.
/**
* This method creates a dedicated USER space for the user which successfully connected
* This USER space is a subspace of the scheduler default USER space,
* A sub-folder named with the username is created to contain the USER space
*
* @param username the username of an identified user
*/
public void registerUserSpace(String username) {
if (this.userGlobalSpaces.get(username) == null) {
DataSpacesFileObject userSpace;
String userSpaceName = SchedulerConstants.USERSPACE_NAME + "_" + username;
if (!PASchedulerProperties.DATASPACE_DEFAULTUSER_URL.isSet()) {
logger.warn("URL of the root USER space is not set, cannot create a USER space for " + username);
return;
}
String localpath = PASchedulerProperties.DATASPACE_DEFAULTUSER_LOCALPATH.getValueAsStringOrNull();
String hostname = PASchedulerProperties.DATASPACE_DEFAULTUSER_HOSTNAME.getValueAsStringOrNull();
try {
DataSpaceServiceStarter.getDataSpaceServiceStarter().createSpaceWithUserNameSubfolder(username, SchedulerConstants.SCHEDULER_DATASPACE_APPLICATION_ID, userSpaceName, PASchedulerProperties.DATASPACE_DEFAULTUSER_URL.getValueAsString(), localpath, hostname, false, true);
// immediately retrieve the User Space
userSpace = PADataSpaces.resolveOutput(userSpaceName);
logger.info("USER space for user " + username + " is at " + userSpace.getAllRealURIs());
} catch (Exception e) {
logger.warn("", e);
return;
}
// register the user GlobalSpace to the frontend state
this.userGlobalSpaces.put(username, userSpace);
}
}
Aggregations