Search in sources :

Example 1 with LocalBodyStore

use of org.objectweb.proactive.core.body.LocalBodyStore in project scheduling by ow2-proactive.

the class RMCore method checkMethodCallPermission.

/**
 * Checks if the caller thread has permissions to call particular method name
 *
 * @return client object corresponding to the caller thread
 */
private Client checkMethodCallPermission(final String methodName, UniqueID clientId) {
    Client client = RMCore.clients.get(clientId);
    if (client == null) {
        // Check if the client id is a local body or half body
        LocalBodyStore lbs = LocalBodyStore.getInstance();
        if (lbs.getLocalBody(clientId) != null || lbs.getLocalHalfBody(clientId) != null) {
            return RMCore.localClient;
        }
        throw new NotConnectedException("Client " + clientId.shortString() + " is not connected to the resource manager");
    }
    final String fullMethodName = RMCore.class.getName() + "." + methodName;
    final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);
    client.checkPermission(methodCallPermission, client + " is not authorized to call " + fullMethodName);
    return client;
}
Also used : LocalBodyStore(org.objectweb.proactive.core.body.LocalBodyStore) MethodCallPermission(org.ow2.proactive.permissions.MethodCallPermission) NotConnectedException(org.ow2.proactive.resourcemanager.exception.NotConnectedException) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Aggregations

LocalBodyStore (org.objectweb.proactive.core.body.LocalBodyStore)1 MethodCallPermission (org.ow2.proactive.permissions.MethodCallPermission)1 Client (org.ow2.proactive.resourcemanager.authentication.Client)1 NotConnectedException (org.ow2.proactive.resourcemanager.exception.NotConnectedException)1