Search in sources :

Example 41 with NotConnectedException

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;
}
Also used : ResourceManager(org.ow2.proactive.resourcemanager.frontend.ResourceManager) NSState(org.ow2.proactive.resourcemanager.common.NSState) Path(javax.ws.rs.Path) POST(javax.ws.rs.POST) Produces(javax.ws.rs.Produces)

Example 42 with NotConnectedException

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;
}
Also used : SchedulerStatus(org.ow2.proactive.scheduler.common.SchedulerStatus)

Example 43 with NotConnectedException

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));
}
Also used : JobId(org.ow2.proactive.scheduler.common.job.JobId) Test(org.junit.Test)

Example 44 with NotConnectedException

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;
}
Also used : PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) UniqueID(org.objectweb.proactive.core.UniqueID) MethodCallPermission(org.ow2.proactive.permissions.MethodCallPermission)

Example 45 with NotConnectedException

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;
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) UserData(org.ow2.proactive.authentication.UserData) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)68 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)64 NotConnectedRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.NotConnectedRestException)51 PermissionRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.PermissionRestException)48 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)46 Scheduler (org.ow2.proactive.scheduler.common.Scheduler)40 Path (javax.ws.rs.Path)39 Produces (javax.ws.rs.Produces)37 UnknownJobRestException (org.ow2.proactive_grid_cloud_portal.scheduler.exception.UnknownJobRestException)36 GET (javax.ws.rs.GET)28 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)27 JobState (org.ow2.proactive.scheduler.common.job.JobState)21 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)19 GZIP (org.jboss.resteasy.annotations.GZIP)18 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)18 IOException (java.io.IOException)17 ArrayList (java.util.ArrayList)17 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)17 TaskResult (org.ow2.proactive.scheduler.common.task.TaskResult)16 TaskState (org.ow2.proactive.scheduler.common.task.TaskState)16