Search in sources :

Example 1 with UniqueID

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

the class RMCore method configureDeployedNodeSource.

private void configureDeployedNodeSource(String nodeSourceName, NodeSourceDescriptor nodeSourceDescriptor, NodeSource nodeSourceStub, NodeSourcePolicy nodeSourcePolicyStub) {
    // Adding access to the core for node source and policy.
    // In order to do it node source and policy active objects are added to the clients list.
    // They will be removed from this list when node source is unregistered.
    UniqueID nsId = Client.getId(nodeSourceStub);
    UniqueID policyId = Client.getId(nodeSourcePolicyStub);
    if (nsId == null || policyId == null) {
        throw new IllegalStateException("Cannot register the node source");
    }
    BooleanWrapper result = nodeSourceStub.activate();
    if (!result.getBooleanValue()) {
        logger.error(NODE_SOURCE_STRING + nodeSourceName + " cannot be activated");
    }
    Client provider = nodeSourceDescriptor.getProvider();
    Client nsService = new Client(provider.getSubject(), false);
    Client policyService = new Client(provider.getSubject(), false);
    nsService.setId(nsId);
    policyService.setId(policyId);
    RMCore.clients.put(nsId, nsService);
    RMCore.clients.put(policyId, policyService);
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) BooleanWrapper(org.objectweb.proactive.core.util.wrapper.BooleanWrapper) Client(org.ow2.proactive.resourcemanager.authentication.Client)

Example 2 with UniqueID

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

the class RMMonitoringImpl method removeRMEventListener.

/**
 * Removes a listener from RMMonitoring. Only listener itself must call this method
 */
public void removeRMEventListener() throws RMException {
    UniqueID id = PAActiveObject.getContext().getCurrentRequest().getSourceBodyID();
    String shortId = id.shortString();
    if (removeRMEventListener(id)) {
        logger.debug("Removing the RM listener for " + shortId);
    } else {
        throw new RMException("Unknown listener found: " + shortId);
    }
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID) RMException(org.ow2.proactive.resourcemanager.exception.RMException)

Example 3 with UniqueID

use of org.objectweb.proactive.core.UniqueID 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 4 with UniqueID

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

the class SchedulerFrontendState method disconnect.

synchronized void disconnect() throws NotConnectedException, PermissionException {
    UniqueID id = checkAccess();
    disconnect(id);
}
Also used : UniqueID(org.objectweb.proactive.core.UniqueID)

Example 5 with UniqueID

use of org.objectweb.proactive.core.UniqueID 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

UniqueID (org.objectweb.proactive.core.UniqueID)17 UserIdentificationImpl (org.ow2.proactive.scheduler.job.UserIdentificationImpl)8 PermissionException (org.ow2.proactive.scheduler.common.exception.PermissionException)4 Test (org.junit.Test)2 Client (org.ow2.proactive.resourcemanager.authentication.Client)2 ExecutionException (java.util.concurrent.ExecutionException)1 ExecutorService (java.util.concurrent.ExecutorService)1 TimeoutException (java.util.concurrent.TimeoutException)1 BooleanWrapper (org.objectweb.proactive.core.util.wrapper.BooleanWrapper)1 UserData (org.ow2.proactive.authentication.UserData)1 MethodCallPermission (org.ow2.proactive.permissions.MethodCallPermission)1 RMException (org.ow2.proactive.resourcemanager.exception.RMException)1 SchedulerState (org.ow2.proactive.scheduler.common.SchedulerState)1 JobCreationException (org.ow2.proactive.scheduler.common.exception.JobCreationException)1 SchedulerJMXHelper (org.ow2.proactive.scheduler.core.jmx.SchedulerJMXHelper)1 RuntimeDataMBeanImpl (org.ow2.proactive.scheduler.core.jmx.mbean.RuntimeDataMBeanImpl)1 ClientJobState (org.ow2.proactive.scheduler.job.ClientJobState)1 InternalJob (org.ow2.proactive.scheduler.job.InternalJob)1 ChangePolicyPermission (org.ow2.proactive.scheduler.permissions.ChangePolicyPermission)1 ChangePriorityPermission (org.ow2.proactive.scheduler.permissions.ChangePriorityPermission)1