Search in sources :

Example 1 with RMNodeException

use of org.ow2.proactive.resourcemanager.exception.RMNodeException 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();
}
Also used : RMNodeException(org.ow2.proactive.resourcemanager.exception.RMNodeException) RMActiveObjectCreationException(org.ow2.proactive.resourcemanager.exception.RMActiveObjectCreationException) CredData(org.ow2.proactive.authentication.crypto.CredData) NodeException(org.objectweb.proactive.core.node.NodeException) RMNodeException(org.ow2.proactive.resourcemanager.exception.RMNodeException) Credentials(org.ow2.proactive.authentication.crypto.Credentials) ActiveObjectCreationException(org.objectweb.proactive.ActiveObjectCreationException) RMActiveObjectCreationException(org.ow2.proactive.resourcemanager.exception.RMActiveObjectCreationException)

Example 2 with RMNodeException

use of org.ow2.proactive.resourcemanager.exception.RMNodeException in project scheduling by ow2-proactive.

the class RMRest method releaseNode.

@Override
public boolean releaseNode(String sessionId, String url) throws RMNodeException, NotConnectedException, PermissionRestException {
    ResourceManager rm = checkAccess(sessionId);
    Node n;
    try {
        n = NodeFactory.getNode(url);
    } catch (NodeException e) {
        throw new RMNodeException(e);
    }
    return orThrowRpe(rm.releaseNode(n).getBooleanValue());
}
Also used : RMNodeException(org.ow2.proactive.resourcemanager.exception.RMNodeException) Node(org.objectweb.proactive.core.node.Node) NodeException(org.objectweb.proactive.core.node.NodeException) RMNodeException(org.ow2.proactive.resourcemanager.exception.RMNodeException) ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager)

Aggregations

NodeException (org.objectweb.proactive.core.node.NodeException)2 RMNodeException (org.ow2.proactive.resourcemanager.exception.RMNodeException)2 ActiveObjectCreationException (org.objectweb.proactive.ActiveObjectCreationException)1 Node (org.objectweb.proactive.core.node.Node)1 CredData (org.ow2.proactive.authentication.crypto.CredData)1 Credentials (org.ow2.proactive.authentication.crypto.Credentials)1 RMActiveObjectCreationException (org.ow2.proactive.resourcemanager.exception.RMActiveObjectCreationException)1 ResourceManager (org.ow2.proactive.resourcemanager.frontend.ResourceManager)1