Search in sources :

Example 1 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl 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)

Example 2 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontend method getJobs.

/**
 * {@inheritDoc}
 */
@Override
@ImmediateService
public Page<JobInfo> getJobs(int offset, int limit, JobFilterCriteria filterCriteria, List<SortParameter<JobSortParameter>> sortParameters) throws NotConnectedException, PermissionException {
    UserIdentificationImpl ident = frontendState.checkPermission("getJobs", "You don't have permissions to load jobs");
    boolean myJobsOnly = filterCriteria.isMyJobsOnly();
    String user;
    if (myJobsOnly) {
        user = ident.getUsername();
    } else {
        user = null;
    }
    return dbManager.getJobs(offset, limit, user, filterCriteria.isPending(), filterCriteria.isRunning(), filterCriteria.isFinished(), sortParameters);
}
Also used : UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 3 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontend method submit.

/**
 * {@inheritDoc}
 */
@Override
@ImmediateService
public JobId submit(Job userJob) throws NotConnectedException, PermissionException, SubmissionClosedException, JobCreationException {
    try {
        if (logger.isDebugEnabled()) {
            logger.debug("New job submission requested : " + userJob.getName());
        }
        // check if the scheduler is stopped
        if (!schedulingService.isSubmitPossible()) {
            String msg = "Scheduler is stopped, cannot submit job";
            logger.info(msg);
            throw new SubmissionClosedException(msg);
        }
        UserIdentificationImpl ident = frontendState.checkPermission("submit", YOU_DO_NOT_HAVE_PERMISSION_TO_SUBMIT_A_JOB);
        InternalJob job = frontendState.createJob(userJob, ident);
        schedulingService.submitJob(job);
        frontendState.jobSubmitted(job, ident);
        return job.getId();
    } catch (Exception e) {
        logger.warn("Error when submitting job.", e);
        throw e;
    }
}
Also used : InternalJob(org.ow2.proactive.scheduler.job.InternalJob) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl) KeyException(java.security.KeyException) UnknownJobException(org.ow2.proactive.scheduler.common.exception.UnknownJobException) TaskCouldNotRestartException(org.ow2.proactive.scheduler.common.exception.TaskCouldNotRestartException) JobCreationException(org.ow2.proactive.scheduler.common.exception.JobCreationException) PermissionException(org.ow2.proactive.scheduler.common.exception.PermissionException) NotConnectedException(org.ow2.proactive.scheduler.common.exception.NotConnectedException) AlreadyConnectedException(org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException) UnknownTaskException(org.ow2.proactive.scheduler.common.exception.UnknownTaskException) TaskCouldNotStartException(org.ow2.proactive.scheduler.common.exception.TaskCouldNotStartException) JobAlreadyFinishedException(org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) DatabaseManagerException(org.ow2.proactive.db.DatabaseManagerException) TaskSkippedException(org.ow2.proactive.scheduler.common.exception.TaskSkippedException) SubmissionClosedException(org.ow2.proactive.scheduler.common.exception.SubmissionClosedException) ImmediateService(org.objectweb.proactive.annotation.ImmediateService)

Example 4 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontend method removeThirdPartyCredential.

@Override
public void removeThirdPartyCredential(String key) throws NotConnectedException, PermissionException {
    UserIdentificationImpl ident = frontendState.checkPermission("removeThirdPartyCredential", YOU_DO_NOT_HAVE_PERMISSION_TO_REMOVE_THIRD_PARTY_CREDENTIALS_FROM_THE_SCHEDULER);
    dbManager.removeThirdPartyCredential(ident.getUsername(), key);
}
Also used : UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Example 5 with UserIdentificationImpl

use of org.ow2.proactive.scheduler.job.UserIdentificationImpl in project scheduling by ow2-proactive.

the class SchedulerFrontend method putThirdPartyCredential.

@Override
public void putThirdPartyCredential(String key, String value) throws NotConnectedException, PermissionException, KeyException {
    UserIdentificationImpl ident = frontendState.checkPermission("putThirdPartyCredential", YOU_DO_NOT_HAVE_PERMISSION_TO_PUT_THIRD_PARTY_CREDENTIALS_IN_THE_SCHEDULER);
    HybridEncryptionUtil.HybridEncryptedData encryptedData = HybridEncryptionUtil.encryptString(value, corePublicKey);
    dbManager.putThirdPartyCredential(ident.getUsername(), key, encryptedData);
}
Also used : HybridEncryptionUtil(org.ow2.proactive.authentication.crypto.HybridEncryptionUtil) UserIdentificationImpl(org.ow2.proactive.scheduler.job.UserIdentificationImpl)

Aggregations

UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)16 UniqueID (org.objectweb.proactive.core.UniqueID)9 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)6 JobAlreadyFinishedException (org.ow2.proactive.scheduler.common.exception.JobAlreadyFinishedException)3 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)3 IOException (java.io.IOException)2 Test (org.junit.Test)2 ImmediateService (org.objectweb.proactive.annotation.ImmediateService)2 AlreadyConnectedException (org.ow2.proactive.scheduler.common.exception.AlreadyConnectedException)2 NotConnectedException (org.ow2.proactive.scheduler.common.exception.NotConnectedException)2 SubmissionClosedException (org.ow2.proactive.scheduler.common.exception.SubmissionClosedException)2 UnknownJobException (org.ow2.proactive.scheduler.common.exception.UnknownJobException)2 UnknownTaskException (org.ow2.proactive.scheduler.common.exception.UnknownTaskException)2 IdentifiedJob (org.ow2.proactive.scheduler.job.IdentifiedJob)2 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)2 ChangePriorityPermission (org.ow2.proactive.scheduler.permissions.ChangePriorityPermission)2 KeyException (java.security.KeyException)1 ArrayList (java.util.ArrayList)1 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1