use of org.ow2.proactive.resourcemanager.exception.RMActiveObjectCreationException in project scheduling by ow2-proactive.
the class RMRest method loginWithCredential.
/*
* (non-Javadoc)
*
* @see org.ow2.proactive_grid_cloud_portal.SchedulerRestInterface#loginWithCredential(org.ow2.
* proactive_grid_cloud_portal.LoginForm)
*/
@Override
public String loginWithCredential(@MultipartForm LoginForm multipart) throws RMActiveObjectCreationException, RMNodeException, KeyException, IOException, LoginException, RMException {
Session session;
try {
if (multipart.getCredential() != null) {
session = sessionStore.createUnnamedSession();
Credentials credentials = Credentials.getCredentials(multipart.getCredential());
session.connectToRM(credentials);
} else {
session = sessionStore.create(multipart.getUsername());
CredData credData = new CredData(CredData.parseLogin(multipart.getUsername()), CredData.parseDomain(multipart.getUsername()), multipart.getPassword(), multipart.getSshKey());
session.connectToRM(credData);
}
} catch (ActiveObjectCreationException e) {
throw new RMActiveObjectCreationException(e);
} catch (NodeException e) {
throw new RMNodeException(e);
}
return session.getSessionId();
}
Aggregations