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;
}
Aggregations