use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class RMRest method defineNodeSource.
@Override
@POST
@Path("nodesource")
@Produces("application/json")
public NSState defineNodeSource(@HeaderParam("sessionid") String sessionId, @FormParam("nodeSourceName") String nodeSourceName, @FormParam("infrastructureType") String infrastructureType, @FormParam("infrastructureParameters") String[] infrastructureParameters, @FormParam("infrastructureFileParameters") String[] infrastructureFileParameters, @FormParam("policyType") String policyType, @FormParam("policyParameters") String[] policyParameters, @FormParam("policyFileParameters") String[] policyFileParameters, @FormParam("nodesRecoverable") String nodesRecoverable) throws NotConnectedException {
ResourceManager rm = checkAccess(sessionId);
NSState nsState = new NSState();
Object[] infraParams = this.getAllInfrastructureParameters(infrastructureType, infrastructureParameters, infrastructureFileParameters, rm);
Object[] policyParams = this.getAllPolicyParameters(policyType, policyParameters, policyFileParameters, rm);
try {
nsState.setResult(rm.defineNodeSource(nodeSourceName, infrastructureType, infraParams, policyType, policyParams, Boolean.parseBoolean(nodesRecoverable)).getBooleanValue());
} catch (RuntimeException ex) {
nsState.setResult(false);
nsState.setErrorMessage(cleanDisplayedErrorMessage(ex.getMessage()));
nsState.setStackTrace(StringEscapeUtils.escapeJson(getStackTrace(ex)));
}
return nsState;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerStateListener method getSchedulerStatus.
public SchedulerStatus getSchedulerStatus(Scheduler scheduler) throws PermissionException, NotConnectedException {
SchedulerStatus status = state.getStatus();
if (status == null) {
status = scheduler.getStatus();
state.setStatus(status);
}
return status;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerProxyUserInterfaceTest method testChangeStartAt.
@Test
public void testChangeStartAt() throws NotConnectedException, UnknownJobException, PermissionException {
JobId jobId = JobIdImpl.makeJobId("66");
String startAt = "2017-07-07T00:00:00+01:00";
when(uischedulerMock.changeStartAt(jobId, startAt)).thenReturn(true);
assertThat(schedulerProxyUserInterface.changeStartAt(jobId, startAt), is(true));
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method checkPermissionReturningListeningUser.
synchronized ListeningUser checkPermissionReturningListeningUser(String methodName, String permissionMsg) throws NotConnectedException, PermissionException {
UniqueID id = checkAccess();
ListeningUser ident = identifications.get(id);
// renew session for this user
renewUserSession(id, ident.getUser());
final String fullMethodName = SchedulerFrontend.class.getName() + "." + methodName;
final MethodCallPermission methodCallPermission = new MethodCallPermission(fullMethodName);
try {
ident.getUser().checkPermission(methodCallPermission, permissionMsg);
} catch (PermissionException ex) {
logger.warn(permissionMsg);
throw ex;
}
return ident;
}
use of org.ow2.proactive.resourcemanager.exception.NotConnectedException in project scheduling by ow2-proactive.
the class SchedulerFrontendState method getCurrentUserData.
public UserData getCurrentUserData() throws NotConnectedException {
UniqueID id = checkAccess();
UserIdentificationImpl ident = identifications.get(id).getUser();
// renew session for this user
renewUserSession(id, ident);
UserData userData = new UserData();
userData.setUserName(ident.getUsername());
userData.setGroups(ident.getGroups());
return userData;
}
Aggregations